diff mbox

mmc: core: Fix init_card in 52Mhz

Message ID 1444286462-23571-1-git-send-email-chaotian.jing@mediatek.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chaotian Jing Oct. 8, 2015, 6:41 a.m. UTC
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, and move it to mmc_test code.

Signed-off-by: Chaotian Jing <chaotian.jing@mediatek.com>
Suggested-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/mmc/card/mmc_test.c | 10 ++++++++++
 drivers/mmc/core/mmc.c      |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

Comments

kernel test robot Oct. 8, 2015, 6:51 a.m. UTC | #1
Hi Chaotian,

[auto build test ERROR on v4.3-rc4 -- if it's inappropriate base, please ignore]

config: i386-randconfig-i1-201540 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/mmc/card/mmc_test.c: In function 'mmc_test_hw_reset':
>> drivers/mmc/card/mmc_test.c:2275:8: error: implicit declaration of function 'mmc_send_status' [-Werror=implicit-function-declaration]
     err = mmc_send_status(card, NULL);
           ^
   cc1: some warnings being treated as errors

vim +/mmc_send_status +2275 drivers/mmc/card/mmc_test.c

  2269		struct mmc_host *host = card->host;
  2270		int err;
  2271	
  2272		if (!mmc_card_mmc(card) || !mmc_can_reset(card))
  2273			return RESULT_UNSUP_CARD;
  2274	
> 2275		err = mmc_send_status(card, NULL);
  2276		if (err)
  2277			return err;
  2278	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index b78cf5d..7b105b9 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -2272,6 +2272,16 @@  static int mmc_test_hw_reset(struct mmc_test_card *test)
 	if (!mmc_card_mmc(card) || !mmc_can_reset(card))
 		return RESULT_UNSUP_CARD;
 
+	err = mmc_send_status(card, NULL);
+	if (err)
+		return err;
+
+	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)) {
 		mmc_host_clk_release(host);
 		return -ENOSYS;
 	}