[PATCH 1/2] mci: atmel_mci: improve timeout error message

Sascha Hauer s.hauer at pengutronix.de
Mon Oct 19 02:52:43 PDT 2026


On a command timeout, the driver only prints "command/data timeout",
which says neither which command failed nor whether the card did not
respond at all (RTOE) or the data phase timed out (DTOE).

Print the command index, the kind of timeout and the raw status
register instead, e.g.:

  ERROR: atmel_mci f0000000.mmc at f0000000.of: CMD18: response timeout (SR=0x04100005)

This made it possible to see that it was a read command that the card
did not answer while it was still programming a previous write.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/mci/atmel_mci_common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mci/atmel_mci_common.c b/drivers/mci/atmel_mci_common.c
index 170c021eba..3a081b8b63 100644
--- a/drivers/mci/atmel_mci_common.c
+++ b/drivers/mci/atmel_mci_common.c
@@ -243,7 +243,9 @@ static int atmci_read_response(struct atmel_mci *host, unsigned int stat)
 	resp = (u32 *)cmd->response;
 
 	if (stat & (ATMCI_RTOE | ATMCI_DTOE)) {
-		dev_err(host->hw_dev, "command/data timeout\n");
+		dev_err(host->hw_dev, "CMD%u: %s timeout (SR=0x%08x)\n",
+			cmd->cmdidx, stat & ATMCI_RTOE ? "response" : "data",
+			stat);
 		return -ETIMEDOUT;
 	} else if ((stat & ATMCI_RCRCE) && (cmd->resp_type & MMC_RSP_CRC)) {
 		dev_err(host->hw_dev, "cmd crc error\n");

-- 
2.47.3




More information about the barebox mailing list