Thread (28 messages) 28 messages, 5 authors, 2011-05-06
STALE5525d

[PATCH 06/22] mmc: omap_hsmmc: limit scatterlist size for sDMA autoloading

From: Adrian Hunter <hidden>
Date: 2011-05-05 11:51:06
Also in: linux-mmc, linux-omap
Subsystem: multimedia card (mmc), secure digital (sd) and sdio subsystem, omap hs mmc support, the rest · Maintainers: Ulf Hansson, Linus Torvalds

The sDMA descriptor autoloading feature uses a fixed size
buffer to store descriptors for scatterlist segments.
That limits the scatterlist size to the maximum number
of descriptors that fit in the buffer.  The driver must
set this limit for upper layers to obey.

Signed-off-by: Adrian Hunter <redacted>
---
 drivers/mmc/host/omap_hsmmc.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 114cd68..bab25ff 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2239,9 +2239,18 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev)
 			host->dma_caps |= DMA_TYPE_SDMA_DLOAD;
 	}
 
-	/* Since we do only SG emulation, we can have as many segs
-	 * as we want. */
-	mmc->max_segs = 1024;
+	if (host->dma_caps & DMA_TYPE_SDMA_DLOAD) {
+		unsigned int max = DMA_CTRL_BUF_SIZE /
+				   sizeof(struct omap_dma_sglist_node);
+
+		mmc->max_segs = 1 << (fls(max) - 1);
+	} else {
+		/*
+		 * Since we do only SG emulation, we can have as many segs as we
+		 * want.
+		 */
+		mmc->max_segs = 1024;
+	}
 
 	mmc->max_blk_size = 512;       /* Block Length at max can be 1024 */
 	mmc->max_blk_count = 0xFFFF;    /* No. of Blocks is 16 bits */
-- 
1.7.0.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help