* [PATCH] mmc: atmel-mci: fix timeout errors in SDIO mode when using DMA
@ 2013-11-20 15:01 ludovic.desroches
2013-11-21 15:42 ` Nicolas Ferre
0 siblings, 1 reply; 4+ messages in thread
From: ludovic.desroches @ 2013-11-20 15:01 UTC (permalink / raw)
To: linux-arm-kernel, linux-mmc; +Cc: nicolas.ferre, cjb, Ludovic Desroches
From: Ludovic Desroches <ludovic.desroches@atmel.com>
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@vger.kernel.org> #3.2+
Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
drivers/mmc/host/atmel-mci.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index b8dfe0d..289da71 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -1193,11 +1193,22 @@ static void atmci_start_request(struct atmel_mci *host,
iflags |= ATMCI_CMDRDY;
cmd = mrq->cmd;
cmdflags = atmci_prepare_command(slot->mmc, cmd);
- atmci_send_command(host, cmd, cmdflags);
+
+ /*
+ * DMA transfer should be started before sending the command to avoid
+ * unexpected errors especially for read operations in SDIO mode.
+ * Unfortunately, in PDC mode, command has to be sent before starting
+ * the transfer.
+ */
+ if (host->submit_data != &atmci_submit_data_dma)
+ atmci_send_command(host, cmd, cmdflags);
if (data)
host->submit_data(host, data);
+ if (host->submit_data == &atmci_submit_data_dma)
+ atmci_send_command(host, cmd, cmdflags);
+
if (mrq->stop) {
host->stop_cmdr = atmci_prepare_command(slot->mmc, mrq->stop);
host->stop_cmdr |= ATMCI_CMDR_STOP_XFER;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mmc: atmel-mci: fix timeout errors in SDIO mode when using DMA
2013-11-20 15:01 [PATCH] mmc: atmel-mci: fix timeout errors in SDIO mode when using DMA ludovic.desroches
@ 2013-11-21 15:42 ` Nicolas Ferre
2013-11-26 22:24 ` Chris Ball
0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Ferre @ 2013-11-21 15:42 UTC (permalink / raw)
To: ludovic.desroches, linux-arm-kernel, linux-mmc, cjb
On 20/11/2013 16:01, ludovic.desroches@atmel.com :
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
>
> 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@vger.kernel.org> #3.2+
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Thanks, bye,
> ---
> drivers/mmc/host/atmel-mci.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index b8dfe0d..289da71 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -1193,11 +1193,22 @@ static void atmci_start_request(struct atmel_mci *host,
> iflags |= ATMCI_CMDRDY;
> cmd = mrq->cmd;
> cmdflags = atmci_prepare_command(slot->mmc, cmd);
> - atmci_send_command(host, cmd, cmdflags);
> +
> + /*
> + * DMA transfer should be started before sending the command to avoid
> + * unexpected errors especially for read operations in SDIO mode.
> + * Unfortunately, in PDC mode, command has to be sent before starting
> + * the transfer.
> + */
> + if (host->submit_data != &atmci_submit_data_dma)
> + atmci_send_command(host, cmd, cmdflags);
>
> if (data)
> host->submit_data(host, data);
>
> + if (host->submit_data == &atmci_submit_data_dma)
> + atmci_send_command(host, cmd, cmdflags);
> +
> if (mrq->stop) {
> host->stop_cmdr = atmci_prepare_command(slot->mmc, mrq->stop);
> host->stop_cmdr |= ATMCI_CMDR_STOP_XFER;
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mmc: atmel-mci: fix timeout errors in SDIO mode when using DMA
2013-11-21 15:42 ` Nicolas Ferre
@ 2013-11-26 22:24 ` Chris Ball
2013-11-27 9:41 ` Nicolas Ferre
0 siblings, 1 reply; 4+ messages in thread
From: Chris Ball @ 2013-11-26 22:24 UTC (permalink / raw)
To: Nicolas Ferre; +Cc: ludovic.desroches, linux-arm-kernel, linux-mmc
Hi,
On Thu, Nov 21 2013, Nicolas Ferre wrote:
> On 20/11/2013 16:01, ludovic.desroches@atmel.com :
>> From: Ludovic Desroches <ludovic.desroches@atmel.com>
>>
>> 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@vger.kernel.org> #3.2+
>> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
>
> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Thanks, pushed to mmc-next for 3.14.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mmc: atmel-mci: fix timeout errors in SDIO mode when using DMA
2013-11-26 22:24 ` Chris Ball
@ 2013-11-27 9:41 ` Nicolas Ferre
0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Ferre @ 2013-11-27 9:41 UTC (permalink / raw)
To: Chris Ball; +Cc: ludovic.desroches, linux-arm-kernel, linux-mmc
On 26/11/2013 23:24, Chris Ball :
> Hi,
>
> On Thu, Nov 21 2013, Nicolas Ferre wrote:
>> On 20/11/2013 16:01, ludovic.desroches@atmel.com :
>>> From: Ludovic Desroches <ludovic.desroches@atmel.com>
>>>
>>> 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@vger.kernel.org> #3.2+
>>> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
>>
>> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>
> Thanks, pushed to mmc-next for 3.14.
Nice, thank you Chris, but what about considering its inclusion in 3.13?
I know that it will anyway hit the 3.13.y stable update but I do think
that it would be nice to have this fix sooner in official 3.13...
Bye,
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-11-27 9:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-20 15:01 [PATCH] mmc: atmel-mci: fix timeout errors in SDIO mode when using DMA ludovic.desroches
2013-11-21 15:42 ` Nicolas Ferre
2013-11-26 22:24 ` Chris Ball
2013-11-27 9:41 ` Nicolas Ferre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox