u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: Do not send status of send_status is false
@ 2022-07-14 23:58 Marek Vasut
  2022-07-15  8:49 ` Marek Behún
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Marek Vasut @ 2022-07-14 23:58 UTC (permalink / raw)
  To: u-boot
  Cc: Marek Vasut, Jaehoon Chung, Kirill Kapranov, Marek Behún,
	Pantelis Antoniou, Ye Li

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")
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Cc: Marek Behún <marek.behun@nic.cz>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
Cc: Ye Li <ye.li@nxp.com>
---
 drivers/mmc/mmc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 12d29da528a..b62baca8457 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -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
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mmc: Do not send status of send_status is false
  2022-07-14 23:58 [PATCH] mmc: Do not send status of send_status is false Marek Vasut
@ 2022-07-15  8:49 ` Marek Behún
  2022-07-15 10:17   ` Marek Vasut
       [not found] ` <CGME20220726082840epcas1p495e05045d32a4f4e85642b4000703eff@epcas1p4.samsung.com>
  2022-08-10 21:50 ` Tom Rini
  2 siblings, 1 reply; 5+ messages in thread
From: Marek Behún @ 2022-07-15  8:49 UTC (permalink / raw)
  To: Marek Vasut
  Cc: u-boot, Jaehoon Chung, Kirill Kapranov, Pantelis Antoniou, Ye Li

On Fri, 15 Jul 2022 01:58:24 +0200
Marek Vasut <marex@denx.de> 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.
> 
> Fixes: 44645f87de5 ("mmc: Fix mmc_switch excessive timeout")
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Kirill Kapranov <kirill.kapranov@compulab.co.il>
> Cc: Marek Behún <marek.behun@nic.cz>
> Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
> Cc: Ye Li <ye.li@nxp.com>

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

Marek

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mmc: Do not send status of send_status is false
  2022-07-15  8:49 ` Marek Behún
@ 2022-07-15 10:17   ` Marek Vasut
  0 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2022-07-15 10:17 UTC (permalink / raw)
  To: Marek Behún
  Cc: u-boot, Jaehoon Chung, Kirill Kapranov, Pantelis Antoniou, Ye Li

On 7/15/22 10:49, Marek Behún wrote:
> On Fri, 15 Jul 2022 01:58:24 +0200
> Marek Vasut <marex@denx.de> 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.
>>
>> Fixes: 44645f87de5 ("mmc: Fix mmc_switch excessive timeout")
>> Signed-off-by: Marek Vasut <marex@denx.de>
>> Cc: Jaehoon Chung <jh80.chung@samsung.com>
>> Cc: Kirill Kapranov <kirill.kapranov@compulab.co.il>
>> Cc: Marek Behún <marek.behun@nic.cz>
>> Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
>> Cc: Ye Li <ye.li@nxp.com>
> 
> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mmc: Do not send status of send_status is false
       [not found] ` <CGME20220726082840epcas1p495e05045d32a4f4e85642b4000703eff@epcas1p4.samsung.com>
@ 2022-07-26  8:28   ` Jaehoon Chung
  0 siblings, 0 replies; 5+ messages in thread
From: Jaehoon Chung @ 2022-07-26  8:28 UTC (permalink / raw)
  To: Marek Vasut, u-boot
  Cc: Kirill Kapranov, Marek Behún, Pantelis Antoniou, Ye Li

On 7/15/22 08:58, Marek Vasut 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.
> 
> Fixes: 44645f87de5 ("mmc: Fix mmc_switch excessive timeout")
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Kirill Kapranov <kirill.kapranov@compulab.co.il>
> Cc: Marek Behún <marek.behun@nic.cz>
> Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
> Cc: Ye Li <ye.li@nxp.com>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> ---
>  drivers/mmc/mmc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 12d29da528a..b62baca8457 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mmc: Do not send status of send_status is false
  2022-07-14 23:58 [PATCH] mmc: Do not send status of send_status is false Marek Vasut
  2022-07-15  8:49 ` Marek Behún
       [not found] ` <CGME20220726082840epcas1p495e05045d32a4f4e85642b4000703eff@epcas1p4.samsung.com>
@ 2022-08-10 21:50 ` Tom Rini
  2 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2022-08-10 21:50 UTC (permalink / raw)
  To: Marek Vasut
  Cc: u-boot, Jaehoon Chung, Kirill Kapranov, Marek Behún,
	Pantelis Antoniou, Ye Li

[-- Attachment #1: Type: text/plain, Size: 1063 bytes --]

On Fri, Jul 15, 2022 at 01:58:24AM +0200, Marek Vasut 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.
> 
> Fixes: 44645f87de5 ("mmc: Fix mmc_switch excessive timeout")
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Kirill Kapranov <kirill.kapranov@compulab.co.il>
> Cc: Marek Behún <marek.behun@nic.cz>
> Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
> Cc: Ye Li <ye.li@nxp.com>
> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-10 21:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-14 23:58 [PATCH] mmc: Do not send status of send_status is false Marek Vasut
2022-07-15  8:49 ` Marek Behún
2022-07-15 10:17   ` Marek Vasut
     [not found] ` <CGME20220726082840epcas1p495e05045d32a4f4e85642b4000703eff@epcas1p4.samsung.com>
2022-07-26  8:28   ` Jaehoon Chung
2022-08-10 21:50 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).