mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master 2/2] mci: sdhci: fix too short timeout in sdhci_wait_idle_data
Date: Wed,  2 Jul 2025 12:59:47 +0200	[thread overview]
Message-ID: <20250702105947.2232095-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250702105947.2232095-1-a.fatoum@pengutronix.de>

cmd::busy_timeout is in milliseconds like its Linux counterpart and was
correctly used as such, when it was first added.
Switching the function to use SDHCI_CMD_DEFAULT_BUSY_TIMEOUT_NS
instead of SDHCI_CMD_DEFAULT_BUSY_TIMEOUT_MS mixed up the units and
probably reintroduced the regression that commit 8242c8e6fbef
("mci: sdhci: use the busy_timeout value in the sdhci_wait_idle functions")
originally fixed.

Fixes: bbecd0b7bb7e ("mci: sdhci: add support for struct mci_data::timeout_ns")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/mci/sdhci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mci/sdhci.c b/drivers/mci/sdhci.c
index 9bf886dfe3f4..38a108adb1a8 100644
--- a/drivers/mci/sdhci.c
+++ b/drivers/mci/sdhci.c
@@ -852,7 +852,7 @@ int sdhci_wait_idle(struct sdhci *host, struct mci_cmd *cmd, struct mci_data *da
 int sdhci_wait_idle_data(struct sdhci *host, struct mci_cmd *cmd)
 {
 	u32 mask;
-	unsigned timeout_ns;
+	ktime_t timeout_ns;
 	int ret;
 
 	mask = SDHCI_CMD_INHIBIT_CMD | SDHCI_CMD_INHIBIT_DATA;
@@ -863,7 +863,7 @@ int sdhci_wait_idle_data(struct sdhci *host, struct mci_cmd *cmd)
 		mask &= ~SDHCI_CMD_INHIBIT_DATA;
 
 	if (cmd && cmd->busy_timeout != 0)
-		timeout_ns = cmd->busy_timeout;
+		timeout_ns = ms_to_ktime(cmd->busy_timeout);
 
 	ret = wait_on_timeout(timeout_ns,
 			!(sdhci_read32(host, SDHCI_PRESENT_STATE) & mask));
-- 
2.39.5




  reply	other threads:[~2025-07-02 12:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-02 10:59 [PATCH master 1/2] mci: imx-esdhc: restore longer timeouts for idle Ahmad Fatoum
2025-07-02 10:59 ` Ahmad Fatoum [this message]
2025-07-02 12:27 ` Sascha Hauer

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=20250702105947.2232095-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@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