mmc: tmio: Add data timeout error detection
authorMasaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>
Wed, 23 Dec 2020 07:30:21 +0000 (16:30 +0900)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 1 Feb 2021 10:54:43 +0000 (11:54 +0100)
Currently, busy timeout is not checked for data transfer command. But,
if the temperature condition changes, the data cannot be acquired
correctly and timeout may occur. Also, we could reproduce an issue by
using mmc_test driver (e.g. "Correct xfer_size at write (start
failure)"). Therefore, this adds timeout error check.

Signed-off-by: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>
[saito: rework commit message.]
Signed-off-by: Takeshi Saito <takeshi.saito.xv@renesas.com>
[shimoda: rebase, add commit description]
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/1608708622-29668-2-git-send-email-yoshihiro.shimoda.uh@renesas.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/tmio_mmc_core.c

index 942b8375179c929b47d3b34c1b4ac84b2ad81647..21492b56b2532b0f2688b83b3313f1e82d47c014 100644 (file)
@@ -477,8 +477,10 @@ static void tmio_mmc_data_irq(struct tmio_mmc_host *host, unsigned int stat)
        if (!data)
                goto out;
 
-       if (stat & TMIO_STAT_CRCFAIL || stat & TMIO_STAT_STOPBIT_ERR ||
-           stat & TMIO_STAT_TXUNDERRUN)
+       if (stat & TMIO_STAT_DATATIMEOUT)
+               data->error = -ETIMEDOUT;
+       else if (stat & TMIO_STAT_CRCFAIL || stat & TMIO_STAT_STOPBIT_ERR ||
+                stat & TMIO_STAT_TXUNDERRUN)
                data->error = -EILSEQ;
        if (host->dma_on && (data->flags & MMC_DATA_WRITE)) {
                u32 status = sd_ctrl_read16_and_16_as_32(host, CTL_STATUS);