From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757270AbbJHNGe (ORCPT ); Thu, 8 Oct 2015 09:06:34 -0400 Received: from mga02.intel.com ([134.134.136.20]:32841 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751014AbbJHNGc (ORCPT ); Thu, 8 Oct 2015 09:06:32 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,654,1437462000"; d="scan'208";a="822281898" Subject: Re: [PATCH v2] mmc: core: Fix init_card in 52Mhz To: Ulf Hansson , Chaotian Jing References: <1444288147-24013-1-git-send-email-chaotian.jing@mediatek.com> Cc: Matthias Brugger , Jaehoon Chung , Fabio Estevam , Johan Rudholm , Gwendal Grignou , linux-mmc , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , linux-mediatek@lists.infradead.org, srv_heupstream , Sascha Hauer From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <56166988.20900@intel.com> Date: Thu, 8 Oct 2015 16:03:04 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/10/15 13:59, Ulf Hansson wrote: > On 8 October 2015 at 09:09, Chaotian Jing wrote: >> Suppose that we got a data crc error, and it triggers the mmc_reset. >> mmc_reset will call mmc_send_status to see if HW reset was supported. >> before issue CMD13, it will do retune, and if EMMC was in HS400 mode, >> it will reduce frequency to 52Mhz firstly, then results in card init >> was doing at 52Mhz. >> The mmc_send_status was originally only done for mmc_test, so if retune >> needed, do not call mmc_send_status. >> >> Signed-off-by: Chaotian Jing >> Suggested-by: Adrian Hunter >> --- >> drivers/mmc/card/mmc_test.c | 6 ++++++ >> drivers/mmc/core/mmc.c | 2 +- >> 2 files changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c >> index b78cf5d..2f78bfb 100644 >> --- a/drivers/mmc/card/mmc_test.c >> +++ b/drivers/mmc/card/mmc_test.c >> @@ -2272,6 +2272,12 @@ static int mmc_test_hw_reset(struct mmc_test_card *test) >> if (!mmc_card_mmc(card) || !mmc_can_reset(card)) >> return RESULT_UNSUP_CARD; >> >> + if (host->need_retune) { >> + pr_info("%s: cannot test hw reset because retune needed\n", >> + mmc_hostname(test->card->host)); >> + return RESULT_FAIL; >> + } >> + >> err = mmc_hw_reset(host); >> if (!err) >> return RESULT_OK; >> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c >> index e726903..647c96d 100644 >> --- a/drivers/mmc/core/mmc.c >> +++ b/drivers/mmc/core/mmc.c >> @@ -1938,7 +1938,7 @@ static int mmc_reset(struct mmc_host *host) >> host->ops->hw_reset(host); >> >> /* If the reset has happened, then a status command will fail */ >> - if (!mmc_send_status(card, &status)) { >> + if (!host->need_retune && !mmc_send_status(card, &status)) { > > No, this seem like the wrong solution! The main purpose of mmc_reset() > is to try to reset and re-initiate the card, to make it operational > again. > > I can't find a good reason to why we want to do a mmc_send_status() at > this point, as even if it succeeds it will only tell us that the card > has not been "hw-reset". No matter what, we should still try to make > it fully operational again and thus give mmc_init_card() a try. > >>>From this reasoning, I suggest we remove the call to mmc_send_status() > from this path, as that will also address your issue with CRC errors > in combination with re-tune. Then you need to remove the hw_reset test from mmc_test. Refer: http://marc.info/?l=linux-mmc&m=144360165906544&w=2