Commit ba7deeed authored by Nicolas Ferre's avatar Nicolas Ferre Committed by Pierre Ossman

mmc: at91_mci: do not read irq status twice as it will forget some errors

Reading AT91_MCI_SR again at the end of transfer can corrupt the
error reporting. Some fields in the SR register are read-and-clear.
Signed-off-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: default avatarPierre Ossman <drzeus@drzeus.cx>
parent 7a6588ba
...@@ -660,10 +660,9 @@ static void at91_mci_process_next(struct at91mci_host *host) ...@@ -660,10 +660,9 @@ static void at91_mci_process_next(struct at91mci_host *host)
/* /*
* Handle a command that has been completed * Handle a command that has been completed
*/ */
static void at91_mci_completed_command(struct at91mci_host *host) static void at91_mci_completed_command(struct at91mci_host *host, unsigned int status)
{ {
struct mmc_command *cmd = host->cmd; struct mmc_command *cmd = host->cmd;
unsigned int status;
at91_mci_write(host, AT91_MCI_IDR, 0xffffffff & ~(AT91_MCI_SDIOIRQA | AT91_MCI_SDIOIRQB)); at91_mci_write(host, AT91_MCI_IDR, 0xffffffff & ~(AT91_MCI_SDIOIRQA | AT91_MCI_SDIOIRQB));
...@@ -677,10 +676,9 @@ static void at91_mci_completed_command(struct at91mci_host *host) ...@@ -677,10 +676,9 @@ static void at91_mci_completed_command(struct at91mci_host *host)
host->buffer = NULL; host->buffer = NULL;
} }
status = at91_mci_read(host, AT91_MCI_SR); pr_debug("Status = %08X/%08x [%08X %08X %08X %08X]\n",
status, at91_mci_read(host, AT91_MCI_SR),
pr_debug("Status = %08X [%08X %08X %08X %08X]\n", cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]);
status, cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]);
if (status & AT91_MCI_ERRORS) { if (status & AT91_MCI_ERRORS) {
if ((status & AT91_MCI_RCRCE) && !(mmc_resp_type(cmd) & MMC_RSP_CRC)) { if ((status & AT91_MCI_RCRCE) && !(mmc_resp_type(cmd) & MMC_RSP_CRC)) {
...@@ -877,7 +875,7 @@ static irqreturn_t at91_mci_irq(int irq, void *devid) ...@@ -877,7 +875,7 @@ static irqreturn_t at91_mci_irq(int irq, void *devid)
if (completed) { if (completed) {
pr_debug("Completed command\n"); pr_debug("Completed command\n");
at91_mci_write(host, AT91_MCI_IDR, 0xffffffff & ~(AT91_MCI_SDIOIRQA | AT91_MCI_SDIOIRQB)); at91_mci_write(host, AT91_MCI_IDR, 0xffffffff & ~(AT91_MCI_SDIOIRQA | AT91_MCI_SDIOIRQB));
at91_mci_completed_command(host); at91_mci_completed_command(host, int_status);
} else } else
at91_mci_write(host, AT91_MCI_IDR, int_status & ~(AT91_MCI_SDIOIRQA | AT91_MCI_SDIOIRQB)); at91_mci_write(host, AT91_MCI_IDR, int_status & ~(AT91_MCI_SDIOIRQA | AT91_MCI_SDIOIRQB));
......
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