aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLudovic Desroches <ludovic.desroches@atmel.com>2013-11-20 10:01:11 -0500
committerChris Ball <chris@printf.net>2014-01-13 12:48:12 -0500
commit66b512eda74d59b17eac04c4da1b38d82059e6c9 (patch)
tree6186546f541c530392c2868330fdc630d7cf4e58
parentdd006b3081ccf01ee5ef07dcf8ff274626dbf80b (diff)
mmc: atmel-mci: fix timeout errors in SDIO mode when using DMA
With some SDIO devices, timeout errors can happen when reading data. To solve this issue, the DMA transfer has to be activated before sending the command to the device. This order is incorrect in PDC mode. So we have to take care if we are using DMA or PDC to know when to send the MMC command. Cc: stable <stable@vger.kernel.org> # 3.2+ Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r--drivers/mmc/host/atmel-mci.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 2cbb4516d353..945a31d77364 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -1192,11 +1192,22 @@ static void atmci_start_request(struct atmel_mci *host,
1192 iflags |= ATMCI_CMDRDY; 1192 iflags |= ATMCI_CMDRDY;
1193 cmd = mrq->cmd; 1193 cmd = mrq->cmd;
1194 cmdflags = atmci_prepare_command(slot->mmc, cmd); 1194 cmdflags = atmci_prepare_command(slot->mmc, cmd);
1195 atmci_send_command(host, cmd, cmdflags); 1195
1196 /*
1197 * DMA transfer should be started before sending the command to avoid
1198 * unexpected errors especially for read operations in SDIO mode.
1199 * Unfortunately, in PDC mode, command has to be sent before starting
1200 * the transfer.
1201 */
1202 if (host->submit_data != &atmci_submit_data_dma)
1203 atmci_send_command(host, cmd, cmdflags);
1196 1204
1197 if (data) 1205 if (data)
1198 host->submit_data(host, data); 1206 host->submit_data(host, data);
1199 1207
1208 if (host->submit_data == &atmci_submit_data_dma)
1209 atmci_send_command(host, cmd, cmdflags);
1210
1200 if (mrq->stop) { 1211 if (mrq->stop) {
1201 host->stop_cmdr = atmci_prepare_command(slot->mmc, mrq->stop); 1212 host->stop_cmdr = atmci_prepare_command(slot->mmc, mrq->stop);
1202 host->stop_cmdr |= ATMCI_CMDR_STOP_XFER; 1213 host->stop_cmdr |= ATMCI_CMDR_STOP_XFER;