aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2012-09-04 00:04:25 -0400
committerVinod Koul <vinod.koul@linux.intel.com>2012-09-13 23:01:47 -0400
commit5e97fa91492b4943f25228e08d24abb31e5bce50 (patch)
tree02495f046ade4a1e99175ba7509ffb5a6b227c7f /drivers/dma
parent8fccc5bfd7f83fd321db42bcad36e2d9fe13d65b (diff)
mxs/dma: Enlarge the CCW descriptor area to 4 pages
In case of a large SPI flash, the amount of DMA descriptors available to the DMA driver is not large enough anymore. For example 8MB SPI flash now needs 129 descriptors to be transfered in one long read. There are currently 53 descriptors available in one PAGE_SIZE-big block. Enlarge the allocated descriptor area to four PAGE_SIZE blocks to fulfill such requirements. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Dan Williams <djbw@fb.com> Cc: Fabio Estevam <fabio.estevam@freescale.com> Cc: Shawn Guo <shawn.guo@linaro.org> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/mxs-dma.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
index 7f41b25805fa..e269325d0f00 100644
--- a/drivers/dma/mxs-dma.c
+++ b/drivers/dma/mxs-dma.c
@@ -101,7 +101,8 @@ struct mxs_dma_ccw {
101 u32 pio_words[MXS_PIO_WORDS]; 101 u32 pio_words[MXS_PIO_WORDS];
102}; 102};
103 103
104#define NUM_CCW (int)(PAGE_SIZE / sizeof(struct mxs_dma_ccw)) 104#define CCW_BLOCK_SIZE (4 * PAGE_SIZE)
105#define NUM_CCW (int)(CCW_BLOCK_SIZE / sizeof(struct mxs_dma_ccw))
105 106
106struct mxs_dma_chan { 107struct mxs_dma_chan {
107 struct mxs_dma_engine *mxs_dma; 108 struct mxs_dma_engine *mxs_dma;
@@ -354,14 +355,15 @@ static int mxs_dma_alloc_chan_resources(struct dma_chan *chan)
354 355
355 mxs_chan->chan_irq = data->chan_irq; 356 mxs_chan->chan_irq = data->chan_irq;
356 357
357 mxs_chan->ccw = dma_alloc_coherent(mxs_dma->dma_device.dev, PAGE_SIZE, 358 mxs_chan->ccw = dma_alloc_coherent(mxs_dma->dma_device.dev,
358 &mxs_chan->ccw_phys, GFP_KERNEL); 359 CCW_BLOCK_SIZE, &mxs_chan->ccw_phys,
360 GFP_KERNEL);
359 if (!mxs_chan->ccw) { 361 if (!mxs_chan->ccw) {
360 ret = -ENOMEM; 362 ret = -ENOMEM;
361 goto err_alloc; 363 goto err_alloc;
362 } 364 }
363 365
364 memset(mxs_chan->ccw, 0, PAGE_SIZE); 366 memset(mxs_chan->ccw, 0, CCW_BLOCK_SIZE);
365 367
366 if (mxs_chan->chan_irq != NO_IRQ) { 368 if (mxs_chan->chan_irq != NO_IRQ) {
367 ret = request_irq(mxs_chan->chan_irq, mxs_dma_int_handler, 369 ret = request_irq(mxs_chan->chan_irq, mxs_dma_int_handler,
@@ -387,7 +389,7 @@ static int mxs_dma_alloc_chan_resources(struct dma_chan *chan)
387err_clk: 389err_clk:
388 free_irq(mxs_chan->chan_irq, mxs_dma); 390 free_irq(mxs_chan->chan_irq, mxs_dma);
389err_irq: 391err_irq:
390 dma_free_coherent(mxs_dma->dma_device.dev, PAGE_SIZE, 392 dma_free_coherent(mxs_dma->dma_device.dev, CCW_BLOCK_SIZE,
391 mxs_chan->ccw, mxs_chan->ccw_phys); 393 mxs_chan->ccw, mxs_chan->ccw_phys);
392err_alloc: 394err_alloc:
393 return ret; 395 return ret;
@@ -402,7 +404,7 @@ static void mxs_dma_free_chan_resources(struct dma_chan *chan)
402 404
403 free_irq(mxs_chan->chan_irq, mxs_dma); 405 free_irq(mxs_chan->chan_irq, mxs_dma);
404 406
405 dma_free_coherent(mxs_dma->dma_device.dev, PAGE_SIZE, 407 dma_free_coherent(mxs_dma->dma_device.dev, CCW_BLOCK_SIZE,
406 mxs_chan->ccw, mxs_chan->ccw_phys); 408 mxs_chan->ccw, mxs_chan->ccw_phys);
407 409
408 clk_disable_unprepare(mxs_dma->clk); 410 clk_disable_unprepare(mxs_dma->clk);