Linux MultiMedia Card development
 help / color / mirror / Atom feed
* [RFC/RFT PATCH] mmc: renesas_sdhi: add delay between tuning cmds
@ 2023-05-31  7:00 Wolfram Sang
  2023-05-31 14:30 ` Adam Ford
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2023-05-31  7:00 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Yoshihiro Shimoda, Wolfram Sang, Adam Ford

Some SD cards failed to tune SDR104 occasionally. Adding a delay between
tuning commands makes the cards work although it is not yet known why.
It seems to be host dependent, only a few need such a delay (I found AMD
SDHCI and Freescale eSDHC so far). 25us is not enough, 50us never failed
up to now, so let's double that value until we know what is going on.
Extra thank you to Adam for sending me a problematic SD card to test.

Reported-by: Adam Ford <aford173@gmail.com>
Closes: https://lore.kernel.org/all/CAHCN7xK_fr_gREVsOzN=atcS08mwufr-=7q1JAN=CCyVk_k-dA@mail.gmail.com/
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

This is one of the patches which look simple but took quite a while to
come up with. Part of it was identifying the issue, part of it was
trying to understand the issue. But I am stuck now, so I need help:

@Adam: could you kindly test this patch with your setup? First, we need
to make sure it helps your case as well.

@Shimoda: If it helps for Adam's case, maybe we could ask the HW team if
they see a reason for this delay? I already scanned the SD/MMC/SDHI specs
without finding any trace, Marek helped as well. My gut feeling says it
is host controller specific. But first, let's hope it works for Adam.

 drivers/mmc/host/renesas_sdhi_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 345934e4f59e..6088cf94e1d3 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -711,6 +711,9 @@ static int renesas_sdhi_execute_tuning(struct mmc_host *mmc, u32 opcode)
 
 		if (cmd_error)
 			mmc_send_abort_tuning(mmc, opcode);
+
+		/* FIXME: Needed for some SD cards. The reason is not known yet */
+		usleep_range(100, 250);
 	}
 
 	ret = renesas_sdhi_select_tuning(host);
-- 
2.30.2


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

end of thread, other threads:[~2023-11-14 16:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-31  7:00 [RFC/RFT PATCH] mmc: renesas_sdhi: add delay between tuning cmds Wolfram Sang
2023-05-31 14:30 ` Adam Ford
2023-05-31 17:45   ` Wolfram Sang
2023-06-16 14:35     ` Adam Ford
2023-06-16 14:39       ` Biju Das
2023-06-16 14:57         ` Adam Ford
2023-06-19  6:02       ` Wolfram Sang
2023-06-19 10:39         ` Adam Ford
2023-11-14 16:29           ` Adam Ford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox