]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.10.30/mmc-atmel-mci-fix-timeout-errors-in-sdio-mode-when-using-dma.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.10.30 / mmc-atmel-mci-fix-timeout-errors-in-sdio-mode-when-using-dma.patch
CommitLineData
c6af9cf9
GKH
1From 66b512eda74d59b17eac04c4da1b38d82059e6c9 Mon Sep 17 00:00:00 2001
2From: Ludovic Desroches <ludovic.desroches@atmel.com>
3Date: Wed, 20 Nov 2013 16:01:11 +0100
4Subject: mmc: atmel-mci: fix timeout errors in SDIO mode when using DMA
5
6From: Ludovic Desroches <ludovic.desroches@atmel.com>
7
8commit 66b512eda74d59b17eac04c4da1b38d82059e6c9 upstream.
9
10With some SDIO devices, timeout errors can happen when reading data.
11To solve this issue, the DMA transfer has to be activated before sending
12the command to the device. This order is incorrect in PDC mode. So we
13have to take care if we are using DMA or PDC to know when to send the
14MMC command.
15
16Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
17Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
18Signed-off-by: Chris Ball <cjb@laptop.org>
19Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20
21---
22 drivers/mmc/host/atmel-mci.c | 13 ++++++++++++-
23 1 file changed, 12 insertions(+), 1 deletion(-)
24
25--- a/drivers/mmc/host/atmel-mci.c
26+++ b/drivers/mmc/host/atmel-mci.c
27@@ -1188,11 +1188,22 @@ static void atmci_start_request(struct a
28 iflags |= ATMCI_CMDRDY;
29 cmd = mrq->cmd;
30 cmdflags = atmci_prepare_command(slot->mmc, cmd);
31- atmci_send_command(host, cmd, cmdflags);
32+
33+ /*
34+ * DMA transfer should be started before sending the command to avoid
35+ * unexpected errors especially for read operations in SDIO mode.
36+ * Unfortunately, in PDC mode, command has to be sent before starting
37+ * the transfer.
38+ */
39+ if (host->submit_data != &atmci_submit_data_dma)
40+ atmci_send_command(host, cmd, cmdflags);
41
42 if (data)
43 host->submit_data(host, data);
44
45+ if (host->submit_data == &atmci_submit_data_dma)
46+ atmci_send_command(host, cmd, cmdflags);
47+
48 if (mrq->stop) {
49 host->stop_cmdr = atmci_prepare_command(slot->mmc, mrq->stop);
50 host->stop_cmdr |= ATMCI_CMDR_STOP_XFER;