Skip to contentSkip to conversation

mmc: atmel-mci: fix timeout errors in SDIO mode when using DMA

PATCH New ludovic.desroches at atmel.com 3 participants 4 messages Nov 20, 2013 – Nov 27, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: atmel-mci: fix timeout errors in SDIO mode when using DMA

From: Ludovic Desroches <[email protected]>

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.

---
 drivers/mmc/host/atmel-mci.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/mmc/host/atmel-mci.c +12 -1
index b8dfe0d..289da71 100644
@@ -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;
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 mmc: atmel-mci: fix timeout errors in SDIO mode when using DMA

On 20/11/2013 16:01, ludovic.desroches at atmel.com :

Quoted 9 lines

From: Ludovic Desroches <[email protected]>

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.

Thanks, bye,

Quoted 33 lines
---
  drivers/mmc/host/atmel-mci.c |   13 ++++++++++++-
  1 file changed, 12 insertions(+), 1 deletion(-)
drivers/mmc/host/atmel-mci.c +12 -1
index b8dfe0d..289da71 100644
@@ -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;
Signature · 1 line
Nicolas Ferre
#2 lore raw

PATCH 1/1 mmc: atmel-mci: fix timeout errors in SDIO mode when using DMA

Hi,

Quoted 8 lines · Nicolas Ferre

On 20/11/2013 16:01, ludovic.desroches at atmel.com :

Quoted 7 lines

From: Ludovic Desroches <[email protected]>

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.

Quoted 4 lines
Quoted 2 lines

Thanks, pushed to mmc-next for 3.14.

- Chris.

Signature · 1 line
Chris Ball   <[email protected]>   <http://printf.net/>
#3 lore raw

PATCH 1/1 mmc: atmel-mci: fix timeout errors in SDIO mode when using DMA

On 26/11/2013 23:24, Chris Ball :

Quoted 11 lines

Hi,

Quoted 8 lines · Nicolas Ferre

On 20/11/2013 16:01, ludovic.desroches at atmel.com :

Quoted 7 lines

From: Ludovic Desroches <[email protected]>

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.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

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,

Signature · 1 line
Nicolas Ferre