[PATCH] mmci: don't try DMA on anything <= fifosize

Linus Walleij linus.walleij at linaro.org
Tue Feb 1 07:21:36 EST 2011


There is no point in using DMA on anything that will fit just fine
in the FIFO. Let's just read and retrieve it from the FIFO.

Cc: Ulf Hansson <ulf.hansson at stericsson.com>
Cc: Sebastian Rasmussen <sebastian.rasmussen at stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
---
This patch on top of the latest DMA code makes U8500 work again,
without the need for any completion callback patches.
---
 drivers/mmc/host/mmci.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 800b69c..c87a8d2 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -463,10 +463,12 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data)
 		datactrl |= MCI_DPSM_DIRECTION;
 
 	/*
-	 * Attempt to use DMA operation mode, if this
-	 * should fail, fall back to PIO mode
+	 * When we want to transfer something less than or equal to the FIFO
+	 * depth, PIO works just fine, no risk of overrun. Else try DMA
+	 * first and foremost.
 	 */
-	if (!mmci_dma_start_data(host, datactrl))
+	if (host->size > variant->fifosize &&
+	    !mmci_dma_start_data(host, datactrl))
 		return;
 
 	/* IRQ mode, map the SG list for CPU reading/writing */
-- 
1.7.3.2




More information about the linux-arm-kernel mailing list