* [PATCH 1/1] mmc: Fix mmc_switch excessive timeout
@ 2021-10-09 20:49 Kirill Kapranov
2021-10-14 14:51 ` Marek Behún
0 siblings, 1 reply; 2+ messages in thread
From: Kirill Kapranov @ 2021-10-09 20:49 UTC (permalink / raw)
To: u-boot; +Cc: Kirill Kapranov, Pantelis Antoniou, Ye Li
Fix branching to avoid premature falling back on a long timeout instead
of continuation of the initialization attempt.
Clear of the comment to avoid the ambiguity.
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
Cc: Ye Li <ye.li@nxp.com>
---
drivers/mmc/mmc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index ba54b19c14..4d9871d69f 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -819,11 +819,11 @@ static int __mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value,
return ret;
/*
- * In cases when not allowed to poll by using CMD13 or because we aren't
+ * In cases when neiter allowed to poll by using CMD13 nor we are
* capable of polling by using mmc_wait_dat0, then rely on waiting the
* stated timeout to be sufficient.
*/
- if (ret == -ENOSYS || !send_status) {
+ if (ret == -ENOSYS && !send_status) {
mdelay(timeout_ms);
return 0;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] mmc: Fix mmc_switch excessive timeout
2021-10-09 20:49 [PATCH 1/1] mmc: Fix mmc_switch excessive timeout Kirill Kapranov
@ 2021-10-14 14:51 ` Marek Behún
0 siblings, 0 replies; 2+ messages in thread
From: Marek Behún @ 2021-10-14 14:51 UTC (permalink / raw)
To: Kirill Kapranov, Ye Li, Tom Rini, Peng Fan; +Cc: u-boot, Pantelis Antoniou
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Tested-by: Marek Behún <marek.behun@nic.cz>
This fixes a bug introduced in commit 3f4e52fc9d81
https://source.denx.de/u-boot/u-boot/-/commit/3f4e52fc9d81e95ee90f6be7b05ca62fc8c7c1e3
and it is incorrect. It caused the mmc initialization to take 4 seconds
(previously it was <0.1s).
The code in Linux also uses &&, and the comment says:
If the host doesn't support HW polling via the ->card_busy() ops and
when it's not allowed to poll by using CMD13, then we need to rely on
waiting the stated timeout to be sufficient.
See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/mmc/core/mmc_ops.c?h=v5.15-rc5#n598
Peng, could we get this merged ASAP? :)
Marek
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-14 14:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-09 20:49 [PATCH 1/1] mmc: Fix mmc_switch excessive timeout Kirill Kapranov
2021-10-14 14:51 ` Marek Behún
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox