Skip to contentSkip to conversation

mmc: avoid getting CID on SDIO-only cards

PATCH In review [email protected] 1 participant 2 messages Aug 19, 2010 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 13/20 mmc: avoid getting CID on SDIO-only cards

From: David Vrabel <[email protected]>

The introduction of support for SD combo cards breaks the initialization of all CSR SDIO chips. The GO_IDLE (CMD0) in mmc_sd_get_cid() causes CSR chips to be reset (this is non-standard behavior).

When initializing an SDIO card check for a combo card by using the memory present bit in the R4 response to IO_SEND_OP_COND (CMD5). This avoids the call to mmc_sd_get_cid() on an SDIO-only card.

---

 drivers/mmc/core/sdio.c  |    8 +++++---
 include/linux/mmc/sdio.h |    2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/mmc/core/sdio.c renamed from drivers/mmc/core/sdio.c~mmc-avoid-getting-cid-on-sdio-only-cards +5 -3
diff -puN drivers/mmc/core/sdio.c~mmc-avoid-getting-cid-on-sdio-only-cards drivers/mmc/core/sdio.c
@@ -362,11 +362,13 @@ static int mmc_sdio_init_card(struct mmc
 		goto err;
 	}
 
-	err = mmc_sd_get_cid(host, host->ocr & ocr, card->raw_cid);
-
-	if (!err) {
+	if (ocr & R4_MEMORY_PRESENT) {
 		card->type = MMC_TYPE_SD_COMBO;
 
+		err = mmc_sd_get_cid(host, host->ocr & ocr, card->raw_cid);
+		if (err)
+			goto remove;
+
 		if (oldcard && (oldcard->type != MMC_TYPE_SD_COMBO ||
 		    memcmp(card->raw_cid, oldcard->raw_cid, sizeof(card->raw_cid)) != 0)) {
 			mmc_remove_card(card);
include/linux/mmc/sdio.h renamed from include/linux/mmc/sdio.h~mmc-avoid-getting-cid-on-sdio-only-cards +2 -0
diff -puN include/linux/mmc/sdio.h~mmc-avoid-getting-cid-on-sdio-only-cards include/linux/mmc/sdio.h
@@ -38,6 +38,8 @@
  *      [8:0] Byte/block count
  */
 
+#define R4_MEMORY_PRESENT (1 << 27)
+
 /*
   SDIO status in R5
   Type

_

#1 lore raw
Quoted 10 lines · On Thu, 19 Aug 2010 14:13:36 -0700 [email protected] wrote:

From: David Vrabel <[email protected]>

The introduction of support for SD combo cards breaks the initialization of all CSR SDIO chips. The GO_IDLE (CMD0) in mmc_sd_get_cid() causes CSR chips to be reset (this is non-standard behavior).

When initializing an SDIO card check for a combo card by using the memory present bit in the R4 response to IO_SEND_OP_COND (CMD5). This avoids the call to mmc_sd_get_cid() on an SDIO-only card.

argh, crap, sorry, please drop this one - Michal found a bug in it.