Skip to contentSkip to conversation

mmc: rtsx_usb_sdmmc: allow legacy SD init after CMD8 timeout

PATCH In review Sean Rhodes 2 participants 2 messages Nov 20 – Nov 30

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: rtsx_usb_sdmmc: allow legacy SD init after CMD8 timeout

According to the rts5139 staging driver, SD 1.x cards do not respond to SD_SEND_IF_COND. On an RTS5129, a preinserted 2 GB SD card times out on that command and the driver then rejects CMD55 and subsequent initialization requests with -ENOMEDIUM. This prevents MMC core from trying the legacy SD path.

Do not suppress card detection on a timeout from a no-data CMD8. MMC SEND_EXT_CSD uses the same opcode with a data transfer, so retain the existing timeout handling for that command. Keep refreshing the physical card state and retain suppression on other discovery timeouts to stop repeated probes of an empty tray.

Fixes 7185b6d33b17 ("mmc: rtsx_usb_sdmmc: suppress false CD after init timeout")
---
 drivers/mmc/host/rtsx_usb_sdmmc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/mmc/host/rtsx_usb_sdmmc.c +5 -3
index bf37fab233cf..55fb83f29328 100644
@@ -879,10 +879,12 @@ static void sdmmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
 finish_detect_card:
 	if (cmd->error) {
 		/*
-		 * detect card when fail to update card existence state and
-		 * speed up card removal when retry
+		 * SD 1.x cards can time out on SEND_IF_COND. Leave card
+		 * detection enabled for the legacy initialization sequence.
+		 * MMC SEND_EXT_CSD shares the opcode but carries data.
 		 */
-		if (!mmc->card && cmd->error == -ETIMEDOUT)
+		if (!mmc->card && cmd->error == -ETIMEDOUT &&
+		    (cmd->opcode != SD_SEND_IF_COND || data))
 			WRITE_ONCE(host->suppress_cd, true);
 		sdmmc_get_cd(mmc);
 		dev_dbg(sdmmc_dev(host), "cmd->error = %d\n", cmd->error);
Signature · 1 line
2.53.0
#1 lore raw
Quoted 13 lines · Sean Rhodes

According to the rts5139 staging driver, SD 1.x cards do not respond to SD_SEND_IF_COND. On an RTS5129, a preinserted 2 GB SD card times out on that command and the driver then rejects CMD55 and subsequent initialization requests with -ENOMEDIUM. This prevents MMC core from trying the legacy SD path.

Do not suppress card detection on a timeout from a no-data CMD8. MMC SEND_EXT_CSD uses the same opcode with a data transfer, so retain the existing timeout handling for that command. Keep refreshing the physical card state and retain suppression on other discovery timeouts to stop repeated probes of an empty tray.

Quoted 5 lines
Fixes 7185b6d33b17 ("mmc: rtsx_usb_sdmmc: suppress false CD after init timeout")

Applied fixes and by adding a stable tag, thanks!

Kind regards
Uffe

Quoted 27 lines
---
 drivers/mmc/host/rtsx_usb_sdmmc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/mmc/host/rtsx_usb_sdmmc.c +5 -4
index bf37fab233cf..55fb83f29328 100644
@@ -879,10 +879,12 @@ static void sdmmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
 finish_detect_card:
        if (cmd->error) {
                /*
-                * detect card when fail to update card existence state and
-                * speed up card removal when retry
+                * SD 1.x cards can time out on SEND_IF_COND. Leave card
+                * detection enabled for the legacy initialization sequence.
+                * MMC SEND_EXT_CSD shares the opcode but carries data.
                 */
-               if (!mmc->card && cmd->error == -ETIMEDOUT)
+               if (!mmc->card && cmd->error == -ETIMEDOUT &&
+                   (cmd->opcode != SD_SEND_IF_COND || data))
                        WRITE_ONCE(host->suppress_cd, true);
                sdmmc_get_cd(mmc);
                dev_dbg(sdmmc_dev(host), "cmd->error = %d\n", cmd->error);
--

2.53.0