diff options
author | Nicolas Ferre <nicolas.ferre@atmel.com> | 2008-06-10 05:27:29 -0400 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2008-07-15 08:14:42 -0400 |
commit | fa1fe010c126ee69f2f75e3a4efc2f6252281ff8 (patch) | |
tree | 807bef63045ebe8e3de3c91fd71e9f62b23a3b61 /drivers/mmc/host/at91_mci.c | |
parent | ba7deeed96ca1855c153ad81c45baf6efe1a3362 (diff) |
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>
Diffstat (limited to 'drivers/mmc/host/at91_mci.c')
-rw-r--r-- | drivers/mmc/host/at91_mci.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c index e1f91a42d521..e4d018b2fe9f 100644 --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c | |||
@@ -663,6 +663,7 @@ static void at91_mci_process_next(struct at91mci_host *host) | |||
663 | static void at91_mci_completed_command(struct at91mci_host *host, unsigned int status) | 663 | static void at91_mci_completed_command(struct at91mci_host *host, unsigned int status) |
664 | { | 664 | { |
665 | struct mmc_command *cmd = host->cmd; | 665 | struct mmc_command *cmd = host->cmd; |
666 | struct mmc_data *data = cmd->data; | ||
666 | 667 | ||
667 | at91_mci_write(host, AT91_MCI_IDR, 0xffffffff & ~(AT91_MCI_SDIOIRQA | AT91_MCI_SDIOIRQB)); | 668 | at91_mci_write(host, AT91_MCI_IDR, 0xffffffff & ~(AT91_MCI_SDIOIRQA | AT91_MCI_SDIOIRQB)); |
668 | 669 | ||
@@ -685,15 +686,25 @@ static void at91_mci_completed_command(struct at91mci_host *host, unsigned int s | |||
685 | cmd->error = 0; | 686 | cmd->error = 0; |
686 | } | 687 | } |
687 | else { | 688 | else { |
688 | if (status & (AT91_MCI_RTOE | AT91_MCI_DTOE)) | 689 | if (status & (AT91_MCI_DTOE | AT91_MCI_DCRCE)) { |
689 | cmd->error = -ETIMEDOUT; | 690 | if (data) { |
690 | else if (status & (AT91_MCI_RCRCE | AT91_MCI_DCRCE)) | 691 | if (status & AT91_MCI_DTOE) |
691 | cmd->error = -EILSEQ; | 692 | data->error = -ETIMEDOUT; |
692 | else | 693 | else if (status & AT91_MCI_DCRCE) |
693 | cmd->error = -EIO; | 694 | data->error = -EILSEQ; |
695 | } | ||
696 | } else { | ||
697 | if (status & AT91_MCI_RTOE) | ||
698 | cmd->error = -ETIMEDOUT; | ||
699 | else if (status & AT91_MCI_RCRCE) | ||
700 | cmd->error = -EILSEQ; | ||
701 | else | ||
702 | cmd->error = -EIO; | ||
703 | } | ||
694 | 704 | ||
695 | pr_debug("Error detected and set to %d (cmd = %d, retries = %d)\n", | 705 | pr_debug("Error detected and set to %d/%d (cmd = %d, retries = %d)\n", |
696 | cmd->error, cmd->opcode, cmd->retries); | 706 | cmd->error, data ? data->error : 0, |
707 | cmd->opcode, cmd->retries); | ||
697 | } | 708 | } |
698 | } | 709 | } |
699 | else | 710 | else |