[PATCH 4/4] mmc: sunxi: Distinguish CRC and timeout errors
Jernej Skrabec
jernej.skrabec at gmail.com
Tue Nov 3 10:30:30 PST 2026
The driver reports every command and data error as -ETIMEDOUT. The MMC
core however relies on -EILSEQ to recognize CRC errors, which mean
that the sampling point drifted, and flags the host for retuning when
it sees one. With every error reported as a timeout, retuning is never
triggered.
Report response and data CRC, start bit and end bit errors as -EILSEQ
and keep reporting timeouts as -ETIMEDOUT, attributed to the command or
data phase that actually failed. Report any other error as -EIO.
Currently supported SoCs don't implement tuning, so this doesn't change
much for them, but it is needed for the upcoming A523 delay-chain
tuning support.
Signed-off-by: Jernej Skrabec <jernej.skrabec at gmail.com>
---
drivers/mmc/host/sunxi-mmc.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index b875ef4c2b79..eb1b7883a715 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -537,13 +537,29 @@ static irqreturn_t sunxi_mmc_finalize_request(struct sunxi_mmc_host *host)
if (host->int_sum & SDXC_INTERRUPT_ERROR_BIT) {
sunxi_mmc_dump_errinfo(host);
- mrq->cmd->error = -ETIMEDOUT;
+
+ if (host->int_sum &
+ (SDXC_RESP_ERROR | SDXC_RESP_CRC_ERROR))
+ mrq->cmd->error = -EILSEQ;
+ else if (host->int_sum & SDXC_RESP_TIMEOUT)
+ mrq->cmd->error = -ETIMEDOUT;
if (data) {
- data->error = -ETIMEDOUT;
+ if (host->int_sum &
+ (SDXC_DATA_CRC_ERROR | SDXC_START_BIT_ERROR |
+ SDXC_END_BIT_ERROR))
+ data->error = -EILSEQ;
+ else if (host->int_sum &
+ (SDXC_DATA_TIMEOUT | SDXC_FIFO_RUN_ERROR |
+ SDXC_HARD_WARE_LOCKED))
+ data->error = -ETIMEDOUT;
+
host->manual_stop_mrq = mrq;
}
+ if (!mrq->cmd->error && (!data || !data->error))
+ mrq->cmd->error = -EIO;
+
if (mrq->stop)
mrq->stop->error = -ETIMEDOUT;
} else {
--
2.43.0
More information about the linux-arm-kernel
mailing list