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] mci: sdhci: suppress register dump on expected time out
Date: Wed, 27 May 2026 10:49:38 +0200	[thread overview]
Message-ID: <20260527084939.3113225-1-a.fatoum@pengutronix.de> (raw)

A time out is the usual way a non-existent SD-Card is detected if there
is no card detect.

Emitting a whole register dump in that case is just confusing, so
suppress register dumps on timeout during card probe.

Fixes: 19ce0bdebf48 ("mci: sdhci: rockchip: Use generic sdhci_send_command()")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/mci/sdhci.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/mci/sdhci.c b/drivers/mci/sdhci.c
index 0d20f3b63e02..3474ef129bd5 100644
--- a/drivers/mci/sdhci.c
+++ b/drivers/mci/sdhci.c
@@ -116,6 +116,13 @@ static void sdhci_reset_for_reason(struct sdhci *host, enum sdhci_reset_reason r
 
 #define sdhci_reset_for(h, r) sdhci_reset_for_reason((h), SDHCI_RESET_FOR_##r)
 
+static inline bool sdhci_card_ready(struct sdhci *sdhci)
+{
+	struct mci_host *host = sdhci->mci;
+
+	return host && host->mci->ready_for_use;
+}
+
 int sdhci_send_command(struct sdhci *host, struct mci_cmd *cmd)
 {
 	u32 mask, command, xfer;
@@ -157,7 +164,12 @@ int sdhci_send_command(struct sdhci *host, struct mci_cmd *cmd)
 	ret = sdhci_wait_for_done(host, mask);
 	if (ret) {
 		sdhci_teardown_data(host, cmd->data, dma);
-		sdhci_dumpregs(host);
+#ifndef DEBUG
+		if (sdhci_card_ready(host) || ret != -ETIMEDOUT)
+#endif
+		{
+			sdhci_dumpregs(host);
+		}
 		goto error;
 	}
 
-- 
2.47.3




             reply	other threads:[~2026-05-27  8:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27  8:49 Ahmad Fatoum [this message]
2026-05-28 10:55 ` 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=20260527084939.3113225-1-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