summaryrefslogtreecommitdiff
path: root/drivers/dma
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2012-03-15 18:33:18 +0000
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2012-03-29 07:56:25 +0200
commitc3dfe7077630aa5f81d499c08964005d204c2b3b (patch)
treebc6969d3b5a07ea4d402f84d2957d74f3a4982f4 /drivers/dma
parenta4aaad704827616a94c76f0a8efe06555c363545 (diff)
downloadu-boot-imx-c3dfe7077630aa5f81d499c08964005d204c2b3b.zip
u-boot-imx-c3dfe7077630aa5f81d499c08964005d204c2b3b.tar.gz
u-boot-imx-c3dfe7077630aa5f81d499c08964005d204c2b3b.tar.bz2
i.MX28: Add cache support into the APBH DMA driver
The desc_append() now flushes descriptors into RAM. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/apbh_dma.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/dma/apbh_dma.c b/drivers/dma/apbh_dma.c
index e85f5fe..c086629 100644
--- a/drivers/dma/apbh_dma.c
+++ b/drivers/dma/apbh_dma.c
@@ -93,6 +93,21 @@ static int mxs_dma_read_semaphore(int channel)
return tmp;
}
+#ifndef CONFIG_SYS_DCACHE_OFF
+void mxs_dma_flush_desc(struct mxs_dma_desc *desc)
+{
+ uint32_t addr;
+ uint32_t size;
+
+ addr = (uint32_t)desc;
+ size = roundup(sizeof(struct mxs_dma_desc), MXS_DMA_ALIGNMENT);
+
+ flush_dcache_range(addr, addr + size);
+}
+#else
+inline void mxs_dma_flush_desc(struct mxs_dma_desc *desc) {}
+#endif
+
/*
* Enable a DMA channel.
*
@@ -329,8 +344,10 @@ static int mxs_dma_release(int channel)
struct mxs_dma_desc *mxs_dma_desc_alloc(void)
{
struct mxs_dma_desc *pdesc;
+ uint32_t size;
- pdesc = memalign(MXS_DMA_ALIGNMENT, sizeof(struct mxs_dma_desc));
+ size = roundup(sizeof(struct mxs_dma_desc), MXS_DMA_ALIGNMENT);
+ pdesc = memalign(MXS_DMA_ALIGNMENT, size);
if (pdesc == NULL)
return NULL;
@@ -415,12 +432,16 @@ int mxs_dma_desc_append(int channel, struct mxs_dma_desc *pdesc)
last->cmd.next = mxs_dma_cmd_address(pdesc);
last->cmd.data |= MXS_DMA_DESC_CHAIN;
+
+ mxs_dma_flush_desc(last);
}
pdesc->flags |= MXS_DMA_DESC_READY;
if (pdesc->flags & MXS_DMA_DESC_FIRST)
pchan->pending_num++;
list_add_tail(&pdesc->node, &pchan->active);
+ mxs_dma_flush_desc(pdesc);
+
return ret;
}