Skip to content

Commit

Permalink
mmc: check error bits before command completion
Browse files Browse the repository at this point in the history
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: Pierre Ossman <drzeus@drzeus.cx>
  • Loading branch information
Pierre Ossman committed Jul 25, 2007
1 parent b8c1c5d commit 43b58b3
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions drivers/mmc/host/sdhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,20 +922,17 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask)
return;
}

if (intmask & SDHCI_INT_RESPONSE)
sdhci_finish_command(host);
else {
if (intmask & SDHCI_INT_TIMEOUT)
host->cmd->error = MMC_ERR_TIMEOUT;
else if (intmask & SDHCI_INT_CRC)
host->cmd->error = MMC_ERR_BADCRC;
else if (intmask & (SDHCI_INT_END_BIT | SDHCI_INT_INDEX))
host->cmd->error = MMC_ERR_FAILED;
else
host->cmd->error = MMC_ERR_INVALID;

if (intmask & SDHCI_INT_TIMEOUT)
host->cmd->error = MMC_ERR_TIMEOUT;
else if (intmask & SDHCI_INT_CRC)
host->cmd->error = MMC_ERR_BADCRC;
else if (intmask & (SDHCI_INT_END_BIT | SDHCI_INT_INDEX))
host->cmd->error = MMC_ERR_FAILED;

if (host->cmd->error != MMC_ERR_NONE)
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)
Expand Down

0 comments on commit 43b58b3

Please sign in to comment.