summaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>2013-08-24 23:38:15 -0400
committerChris Ball <cjb@laptop.org>2013-08-24 23:38:15 -0400
commitf936f9b67b7f8c2eae01dd303a0e90bd777c4679 (patch)
treef423b47a4c00349be0aeba10c144c82c16fb47e7 /drivers/mmc
parente33c2025c0c2f8a20054c3e031877ff595d1c31f (diff)
mmc: tmio_mmc_dma: fix PIO fallback on SDHI
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> Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Cc: stable@vger.kernel.org # 3.1+ Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/tmio_mmc_dma.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index 47bdb8fa341b..65edb4a62452 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -104,6 +104,7 @@ static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host)
104pio: 104pio:
105 if (!desc) { 105 if (!desc) {
106 /* DMA failed, fall back to PIO */ 106 /* DMA failed, fall back to PIO */
107 tmio_mmc_enable_dma(host, false);
107 if (ret >= 0) 108 if (ret >= 0)
108 ret = -EIO; 109 ret = -EIO;
109 host->chan_rx = NULL; 110 host->chan_rx = NULL;
@@ -116,7 +117,6 @@ pio:
116 } 117 }
117 dev_warn(&host->pdev->dev, 118 dev_warn(&host->pdev->dev,
118 "DMA failed: %d, falling back to PIO\n", ret); 119 "DMA failed: %d, falling back to PIO\n", ret);
119 tmio_mmc_enable_dma(host, false);
120 } 120 }
121 121
122 dev_dbg(&host->pdev->dev, "%s(): desc %p, cookie %d, sg[%d]\n", __func__, 122 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 tmio_mmc_host *host)
185pio: 185pio:
186 if (!desc) { 186 if (!desc) {
187 /* DMA failed, fall back to PIO */ 187 /* DMA failed, fall back to PIO */
188 tmio_mmc_enable_dma(host, false);
188 if (ret >= 0) 189 if (ret >= 0)
189 ret = -EIO; 190 ret = -EIO;
190 host->chan_tx = NULL; 191 host->chan_tx = NULL;
@@ -197,7 +198,6 @@ pio:
197 } 198 }
198 dev_warn(&host->pdev->dev, 199 dev_warn(&host->pdev->dev,
199 "DMA failed: %d, falling back to PIO\n", ret); 200 "DMA failed: %d, falling back to PIO\n", ret);
200 tmio_mmc_enable_dma(host, false);
201 } 201 }
202 202
203 dev_dbg(&host->pdev->dev, "%s(): desc %p, cookie %d\n", __func__, 203 dev_dbg(&host->pdev->dev, "%s(): desc %p, cookie %d\n", __func__,