mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] mci: imx-esdhc: fix waiting for bus idle
Date: Mon, 30 Jun 2025 13:40:11 +0200	[thread overview]
Message-ID: <20250630114011.1923777-1-s.hauer@pengutronix.de> (raw)

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




                 reply	other threads:[~2025-06-30 12:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250630114011.1923777-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox