[PATCH master] mci: sdhci: suppress register dump on expected time out

Ahmad Fatoum <[email protected]>
Newsgroups org.infradead.lists.barebox
Message-ID <[email protected]>
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 <[email protected]>
---
 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.