OSDN Git Service

mmc: sdhci: Flag re-tuning is needed on CRC or End-Bit errors
authorAdrian Hunter <adrian.hunter@intel.com>
Mon, 20 Apr 2015 12:09:53 +0000 (15:09 +0300)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Tue, 28 Apr 2015 17:05:47 +0000 (01:05 +0800)
CRC or End-Bit errors could possibly be alleviated by
re-tuning so flag re-tuning needed in those cases.
Note this has no effect if re-tuning has not been
enabled.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
drivers/mmc/host/sdhci.c

index b345844..d11fae7 100644 (file)
@@ -2307,8 +2307,10 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask, u32 *mask)
        if (intmask & SDHCI_INT_TIMEOUT)
                host->cmd->error = -ETIMEDOUT;
        else if (intmask & (SDHCI_INT_CRC | SDHCI_INT_END_BIT |
-                       SDHCI_INT_INDEX))
+                       SDHCI_INT_INDEX)) {
                host->cmd->error = -EILSEQ;
+               mmc_retune_needed(host->mmc);
+       }
 
        if (host->cmd->error) {
                tasklet_schedule(&host->finish_tasklet);
@@ -2433,13 +2435,15 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
 
        if (intmask & SDHCI_INT_DATA_TIMEOUT)
                host->data->error = -ETIMEDOUT;
-       else if (intmask & SDHCI_INT_DATA_END_BIT)
+       else if (intmask & SDHCI_INT_DATA_END_BIT) {
                host->data->error = -EILSEQ;
-       else if ((intmask & SDHCI_INT_DATA_CRC) &&
+               mmc_retune_needed(host->mmc);
+       } else if ((intmask & SDHCI_INT_DATA_CRC) &&
                SDHCI_GET_CMD(sdhci_readw(host, SDHCI_COMMAND))
-                       != MMC_BUS_TEST_R)
+                       != MMC_BUS_TEST_R) {
                host->data->error = -EILSEQ;
-       else if (intmask & SDHCI_INT_ADMA_ERROR) {
+               mmc_retune_needed(host->mmc);
+       } else if (intmask & SDHCI_INT_ADMA_ERROR) {
                pr_err("%s: ADMA error\n", mmc_hostname(host->mmc));
                sdhci_adma_show_error(host);
                host->data->error = -EIO;