linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] tmio_mmc_dma: fix PIO fallback on SDHI
@ 2013-08-02 22:33 Sergei Shtylyov
  2013-08-03 22:36 ` Guennadi Liakhovetski
  2013-08-09 18:32 ` Sergei Shtylyov
  0 siblings, 2 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2013-08-02 22:33 UTC (permalink / raw)
  To: linux-mmc, g.liakhovetski, ian, cjb; +Cc: linux-sh, max.filippov

I'm testing SH-Mobile SDHI driver in DMA mode with  a new DMA controller  using
'bonnie++' and getting DMA error after which the tmio_mmc_dma.c code falls back
to PIO but all commands time out after that.  It turned out that the fallback
code calls tmio_mmc_enable_dma() with RX/TX channels already freed and pointers
to them cleared, so that the function bails out early instead  of clearing the
DMA bit in the CTL_DMA_ENABLE register. The regression was introduced by commit
162f43e31c5a376ec16336e5d0ac973373d54c89 (mmc: tmio: fix a deadlock).
Moving tmio_mmc_enable_dma() calls to the top of the PIO fallback code in
tmio_mmc_start_dma_{rx|tx}() helps.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: stable@vger.kernel.org # 3.1+

---
The patch is against Chris Ball's 'mmc.git' repo, 'master' branch.

Changes in version 2:
- removed extra check from tmio_mmc_enable_dma();
- moved tmio_mmc_enable_dma() calls to the top of the PIO fallback code in
  tmio_mmc_start_dma_{rx|tx}().

 drivers/mmc/host/tmio_mmc_dma.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: renesas/drivers/mmc/host/tmio_mmc_dma.c
=================================--- renesas.orig/drivers/mmc/host/tmio_mmc_dma.c
+++ renesas/drivers/mmc/host/tmio_mmc_dma.c
@@ -104,6 +104,7 @@ static void tmio_mmc_start_dma_rx(struct
 pio:
 	if (!desc) {
 		/* DMA failed, fall back to PIO */
+		tmio_mmc_enable_dma(host, false);
 		if (ret >= 0)
 			ret = -EIO;
 		host->chan_rx = NULL;
@@ -116,7 +117,6 @@ pio:
 		}
 		dev_warn(&host->pdev->dev,
 			 "DMA failed: %d, falling back to PIO\n", ret);
-		tmio_mmc_enable_dma(host, false);
 	}
 
 	dev_dbg(&host->pdev->dev, "%s(): desc %p, cookie %d, sg[%d]\n", __func__,
@@ -185,6 +185,7 @@ static void tmio_mmc_start_dma_tx(struct
 pio:
 	if (!desc) {
 		/* DMA failed, fall back to PIO */
+		tmio_mmc_enable_dma(host, false);
 		if (ret >= 0)
 			ret = -EIO;
 		host->chan_tx = NULL;
@@ -197,7 +198,6 @@ pio:
 		}
 		dev_warn(&host->pdev->dev,
 			 "DMA failed: %d, falling back to PIO\n", ret);
-		tmio_mmc_enable_dma(host, false);
 	}
 
 	dev_dbg(&host->pdev->dev, "%s(): desc %p, cookie %d\n", __func__,

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-08-25  3:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-02 22:33 [PATCH v2] tmio_mmc_dma: fix PIO fallback on SDHI Sergei Shtylyov
2013-08-03 22:36 ` Guennadi Liakhovetski
2013-08-04 14:10   ` Sergei Shtylyov
2013-08-05 22:37     ` Sergei Shtylyov
2013-08-09 18:41       ` Sergei Shtylyov
2013-08-25  3:39   ` Chris Ball
2013-08-09 18:32 ` Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).