mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mci: imx-esdhc: fix waiting for bus idle
@ 2025-06-30 11:40 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2025-06-30 11:40 UTC (permalink / raw)
  To: Barebox List

Commit 02986964885c ("mci: imx-esdhc: implement esdhc_poll using
sdhci_read32_poll_timeout") introduces sdhci_compute_timeout() which
takes a default timeout, but that default timeout is ignored in the
function. Commit bbecd0b7bb7e ("mci: sdhci: add support for
struct mci_data::timeout_ns") then makes use of this function and with
this breaks the polling for DATA0 line by reducing the original 2.5s
timeout to SDHCI_CMD_DEFAULT_BUSY_TIMEOUT_NS which is 10ms. With this
writing to the card times out during a MMC_CMD_STOP_TRANSMISSION
command, observed on i.MX6ul.

This is a stop-gap solution and mainly a heads-up for Ahmad to look into
this.

- Why does sdhci_compute_timeout() ignore the timeout value? Supposedly
  by accident.
- What about the other users of sdhci_compute_timeout()? Do we want to
  use the default timeout sdhci_compute_timeout() provides, or the
  original timeout without this patch?

Fixes: 02986964885c ("mci: imx-esdhc: implement esdhc_poll using sdhci_read32_poll_timeout")
Fixes: bbecd0b7bb7e ("mci: sdhci: add support for struct mci_data::timeout_ns")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mci/imx-esdhc-common.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mci/imx-esdhc-common.c b/drivers/mci/imx-esdhc-common.c
index 228f4a9b03..e593891b93 100644
--- a/drivers/mci/imx-esdhc-common.c
+++ b/drivers/mci/imx-esdhc-common.c
@@ -393,8 +393,7 @@ int __esdhc_send_cmd(struct fsl_esdhc_host *host, struct mci_cmd *cmd,
 		 * timout / 10 usec since DLA polling can be insecure.
 		 */
 		ret = esdhc_poll(host, SDHCI_PRESENT_STATE, val,
-				 val & PRSSTAT_DAT0,
-				 sdhci_compute_timeout(cmd, NULL, 2500 * MSECOND));
+				 val & PRSSTAT_DAT0, 2500 * MSECOND);
 		if (ret) {
 			dev_err(host->dev, "timeout PRSSTAT_DAT0\n");
 			goto undo_setup_data;
-- 
2.39.5




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-06-30 12:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-30 11:40 [PATCH] mci: imx-esdhc: fix waiting for bus idle Sascha Hauer

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