Skip to contentSkip to conversation

mmc: core: Add check for card type before mmc_hw_reset_for_init

PATCH Prasanna NAVARATNA 2 participants 3 messages Aug 12, 2013 – Aug 23, 2013 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

Almost all the places, before calling hw_reset ops, the card type is checked to make sure it is eMMC but missed during mmc_rescan_try_freq. The below patch adds the check for card type before calling hardware reset for init as double safety measure.

Quoted 1 line

From e7941c5b3b4999318feb59fa83b78c15c13493b3 Mon Sep 17 00:00:00 2001

From: Prasanna NAVARATNA <[email protected]>
Date: Mon, 12 Aug 2013 12:26:57 +0530
Subject: [PATCH] mmc: core: add check for card type before
mmc_hw_reset_for_init

During mmc_hw_reset_for_init, the card type is not checked before calling hw_reset ops.
Add check for the card type as emmc before issuing hw_reset during init.

---
 drivers/mmc/core/core.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/mmc/core/core.c +2 -1
index 49a5bca..2dad69a 100644
@@ -2196,7 +2196,8 @@ EXPORT_SYMBOL(mmc_set_blockcount);
 
 static void mmc_hw_reset_for_init(struct mmc_host *host)
 {
-	if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset)
+	if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset ||
+			!mmc_card_mmc(host->card))
 		return;
 	mmc_host_clk_hold(host);
 	host->ops->hw_reset(host);
Signature · 1 line
1.7.6
#1 lore raw
Quoted 25 lines · Prasanna NAVARATNA

Almost all the places, before calling hw_reset ops, the card type is checked to make sure it is eMMC but missed during mmc_rescan_try_freq. The below patch adds the check for card type before calling hardware reset for init as double safety measure.

From e7941c5b3b4999318feb59fa83b78c15c13493b3 Mon Sep 17 00:00:00 2001
From: Prasanna NAVARATNA <[email protected]>
Date: Mon, 12 Aug 2013 12:26:57 +0530
Subject: [PATCH] mmc: core: add check for card type before
mmc_hw_reset_for_init

During mmc_hw_reset_for_init, the card type is not checked before calling hw_reset ops.
Add check for the card type as emmc before issuing hw_reset during init.

---
 drivers/mmc/core/core.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/mmc/core/core.c +0 -0
index 49a5bca..2dad69a 100644

drivers/mmc/core/core.c EXPORT_SYMBOL(mmc_set_blockcount); · line 2200

Quoted 6 lines
drivers/mmc/core/core.c +2 -1
@@ -2196,7 +2196,8 @@ EXPORT_SYMBOL(mmc_set_blockcount);
 
 static void mmc_hw_reset_for_init(struct mmc_host *host)
 {
-       if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset)
+       if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset ||
+                       !mmc_card_mmc(host->card))

No, this does not work.

At this point we don't know the card type yet since we have not initialized it. We can only trust the host->ops is performing what we expect.

Kind regards
Ulf Hansson

Quoted 13 lines
drivers/mmc/core/core.c +0 -1
                return;
        mmc_host_clk_hold(host);
        host->ops->hw_reset(host);
--

1.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html