Commit 43b58b36 authored by Pierre Ossman's avatar Pierre Ossman

mmc: check error bits before command completion

Some controllers signal "command complete" even on failures (which
they are allowed to do according to the spec). Make sure we check
the error bits first so we don't get any false positives.
Signed-off-by: default avatarPierre Ossman <drzeus@drzeus.cx>
parent b8c1c5da
...@@ -922,20 +922,17 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask) ...@@ -922,20 +922,17 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask)
return; return;
} }
if (intmask & SDHCI_INT_RESPONSE) if (intmask & SDHCI_INT_TIMEOUT)
sdhci_finish_command(host); host->cmd->error = MMC_ERR_TIMEOUT;
else { else if (intmask & SDHCI_INT_CRC)
if (intmask & SDHCI_INT_TIMEOUT) host->cmd->error = MMC_ERR_BADCRC;
host->cmd->error = MMC_ERR_TIMEOUT; else if (intmask & (SDHCI_INT_END_BIT | SDHCI_INT_INDEX))
else if (intmask & SDHCI_INT_CRC) host->cmd->error = MMC_ERR_FAILED;
host->cmd->error = MMC_ERR_BADCRC;
else if (intmask & (SDHCI_INT_END_BIT | SDHCI_INT_INDEX)) if (host->cmd->error != MMC_ERR_NONE)
host->cmd->error = MMC_ERR_FAILED;
else
host->cmd->error = MMC_ERR_INVALID;
tasklet_schedule(&host->finish_tasklet); tasklet_schedule(&host->finish_tasklet);
} else if (intmask & SDHCI_INT_RESPONSE)
sdhci_finish_command(host);
} }
static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment