Skip to contentSkip to conversation

mmc: Do not send status of send_status is false

PATCH In review Marek Vasut 4 participants 5 messages Jul 14, 2022 – Aug 10, 2022 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: Do not send status of send_status is false

Commit 44645f87de5 ("mmc: Fix mmc_switch excessive timeout") introduced a side effect where CMD13 SEND_STATUS is issued in case mmc_wait_dat0() does not return -ENOSYS and $send_status is not set. This happens on all hardware which does implement .mmc_wait_dat0 callback, e.g. i.MX8M .

This leads to lengthy timeout before booting OS in case of eMMC in one of the HS200/HS400 modes, since the card cannot respond to CMD13 while downgrading from HS200/HS400 to regular HS mode.

Fix this by adding the missing conditional.

Fixes 44645f87de5 ("mmc: Fix mmc_switch excessive timeout")
Cc Jaehoon Chung <[email protected]>
Cc Kirill Kapranov <[email protected]>
Cc Marek Behún <[email protected]>
Cc Pantelis Antoniou <[email protected]>
---
 drivers/mmc/mmc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mmc/mmc.c +3 -0
index 12d29da528a..b62baca8457 100644
@@ -831,6 +831,9 @@ static int __mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value,
 		return 0;
 	}
 
+	if (!send_status)
+		return 0;
+
 	/* Finally wait until the card is ready or indicates a failure
 	 * to switch. It doesn't hurt to use CMD13 here even if send_status
 	 * is false, because by now (after 'timeout_ms' ms) the bus should be
Signature · 1 line
2.35.1
#1 lore raw
Quoted 11 lines · On Fri, 15 Jul 2022 01:58:24 +0200 Marek Vasut <[email protected]> wrote:

Commit 44645f87de5 ("mmc: Fix mmc_switch excessive timeout") introduced a side effect where CMD13 SEND_STATUS is issued in case mmc_wait_dat0() does not return -ENOSYS and $send_status is not set. This happens on all hardware which does implement .mmc_wait_dat0 callback, e.g. i.MX8M .

This leads to lengthy timeout before booting OS in case of eMMC in one of the HS200/HS400 modes, since the card cannot respond to CMD13 while downgrading from HS200/HS400 to regular HS mode.

Fix this by adding the missing conditional.

Quoted 7 lines
Fixes 44645f87de5 ("mmc: Fix mmc_switch excessive timeout")
Cc Jaehoon Chung <[email protected]>
Cc Kirill Kapranov <[email protected]>
Cc Marek Behún <[email protected]>
Cc Pantelis Antoniou <[email protected]>

Does the lenghty timeout occur even on xenon with the patch
https://source.denx.de/u-boot/u-boot/-/commit/0f3466f52fbacce67e147b9234e6323edff26a6d
?

Marek

#2 lore raw
Quoted 22 lines · Marek Behún
Quoted 11 lines · On Fri, 15 Jul 2022 01:58:24 +0200 Marek Vasut <[email protected]> wrote:

Commit 44645f87de5 ("mmc: Fix mmc_switch excessive timeout") introduced a side effect where CMD13 SEND_STATUS is issued in case mmc_wait_dat0() does not return -ENOSYS and $send_status is not set. This happens on all hardware which does implement .mmc_wait_dat0 callback, e.g. i.MX8M .

This leads to lengthy timeout before booting OS in case of eMMC in one of the HS200/HS400 modes, since the card cannot respond to CMD13 while downgrading from HS200/HS400 to regular HS mode.

Fix this by adding the missing conditional.

Quoted 7 lines
Fixes 44645f87de5 ("mmc: Fix mmc_switch excessive timeout")
Cc Jaehoon Chung <[email protected]>
Cc Kirill Kapranov <[email protected]>
Cc Marek Behún <[email protected]>
Cc Pantelis Antoniou <[email protected]>
Quoted 3 lines

Does the lenghty timeout occur even on xenon with the patch
https://source.denx.de/u-boot/u-boot/-/commit/0f3466f52fbacce67e147b9234e6323edff26a6d
?

Unlikely, you will get -ENOSYS from wait on dat0 and bail out, i.e. you'd hit the condition before this one because wait on dat0 is not implemented.

Reviewed-by on v1 1/1
#3 lore raw
In reply to Marek Vasut
Quoted 11 lines · Marek Vasut

Commit 44645f87de5 ("mmc: Fix mmc_switch excessive timeout") introduced a side effect where CMD13 SEND_STATUS is issued in case mmc_wait_dat0() does not return -ENOSYS and $send_status is not set. This happens on all hardware which does implement .mmc_wait_dat0 callback, e.g. i.MX8M .

This leads to lengthy timeout before booting OS in case of eMMC in one of the HS200/HS400 modes, since the card cannot respond to CMD13 while downgrading from HS200/HS400 to regular HS mode.

Fix this by adding the missing conditional.

Quoted 7 lines
Fixes 44645f87de5 ("mmc: Fix mmc_switch excessive timeout")
Cc Jaehoon Chung <[email protected]>
Cc Kirill Kapranov <[email protected]>
Cc Marek Behún <[email protected]>
Cc Pantelis Antoniou <[email protected]>

Best Regards,
Jaehoon Chung

Quoted 18 lines
---
 drivers/mmc/mmc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mmc/mmc.c +3 -0
index 12d29da528a..b62baca8457 100644
@@ -831,6 +831,9 @@ static int __mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value,
 		return 0;
 	}
 
+	if (!send_status)
+		return 0;
+
 	/* Finally wait until the card is ready or indicates a failure
 	 * to switch. It doesn't hurt to use CMD13 here even if send_status
 	 * is false, because by now (after 'timeout_ms' ms) the bus should be
#4 lore raw
In reply to Marek Vasut
Quoted 11 lines · Marek Vasut

Commit 44645f87de5 ("mmc: Fix mmc_switch excessive timeout") introduced a side effect where CMD13 SEND_STATUS is issued in case mmc_wait_dat0() does not return -ENOSYS and $send_status is not set. This happens on all hardware which does implement .mmc_wait_dat0 callback, e.g. i.MX8M .

This leads to lengthy timeout before booting OS in case of eMMC in one of the HS200/HS400 modes, since the card cannot respond to CMD13 while downgrading from HS200/HS400 to regular HS mode.

Fix this by adding the missing conditional.

Quoted 8 lines
Fixes 44645f87de5 ("mmc: Fix mmc_switch excessive timeout")
Cc Jaehoon Chung <[email protected]>
Cc Kirill Kapranov <[email protected]>
Cc Marek Behún <[email protected]>
Cc Pantelis Antoniou <[email protected]>

Applied to u-boot/master, thanks!

Signature · 1 line
Tom