at91_mci: manage cmd error and data error independently
In at91_mci_completed_command() function, this patch distinguishes command error and data error. It reports it in the corresponding error field. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
This commit is contained in:
parent
ba7deeed96
commit
fa1fe010c1
|
@ -663,6 +663,7 @@ static void at91_mci_process_next(struct at91mci_host *host)
|
||||||
static void at91_mci_completed_command(struct at91mci_host *host, unsigned int status)
|
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;
|
||||||
|
struct mmc_data *data = cmd->data;
|
||||||
|
|
||||||
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));
|
||||||
|
|
||||||
|
@ -685,15 +686,25 @@ static void at91_mci_completed_command(struct at91mci_host *host, unsigned int s
|
||||||
cmd->error = 0;
|
cmd->error = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (status & (AT91_MCI_RTOE | AT91_MCI_DTOE))
|
if (status & (AT91_MCI_DTOE | AT91_MCI_DCRCE)) {
|
||||||
cmd->error = -ETIMEDOUT;
|
if (data) {
|
||||||
else if (status & (AT91_MCI_RCRCE | AT91_MCI_DCRCE))
|
if (status & AT91_MCI_DTOE)
|
||||||
cmd->error = -EILSEQ;
|
data->error = -ETIMEDOUT;
|
||||||
else
|
else if (status & AT91_MCI_DCRCE)
|
||||||
cmd->error = -EIO;
|
data->error = -EILSEQ;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (status & AT91_MCI_RTOE)
|
||||||
|
cmd->error = -ETIMEDOUT;
|
||||||
|
else if (status & AT91_MCI_RCRCE)
|
||||||
|
cmd->error = -EILSEQ;
|
||||||
|
else
|
||||||
|
cmd->error = -EIO;
|
||||||
|
}
|
||||||
|
|
||||||
pr_debug("Error detected and set to %d (cmd = %d, retries = %d)\n",
|
pr_debug("Error detected and set to %d/%d (cmd = %d, retries = %d)\n",
|
||||||
cmd->error, cmd->opcode, cmd->retries);
|
cmd->error, data ? data->error : 0,
|
||||||
|
cmd->opcode, cmd->retries);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue