summaryrefslogtreecommitdiffstats
path: root/arch/microblaze
diff options
context:
space:
mode:
authorMichal Simek <monstr@monstr.eu>2010-01-20 14:36:24 +0100
committerMichal Simek <monstr@monstr.eu>2010-03-11 13:58:11 +0100
commit2549edd353196d7de9c18e08146d7a8836f97235 (patch)
tree0ae7f1c8935003a05da45ecdbf550b1a1a77d8b4 /arch/microblaze
parentccfe27d7000668b02d10fc3e06aa49e3e3603162 (diff)
downloadop-kernel-dev-2549edd353196d7de9c18e08146d7a8836f97235.zip
op-kernel-dev-2549edd353196d7de9c18e08146d7a8836f97235.tar.gz
microblaze: Implement __dma_sync_page
There is necessary to do some cache handling for dma operations. Signed-off-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch/microblaze')
-rw-r--r--arch/microblaze/include/asm/dma-mapping.h1
-rw-r--r--arch/microblaze/kernel/dma.c26
2 files changed, 23 insertions, 4 deletions
diff --git a/arch/microblaze/include/asm/dma-mapping.h b/arch/microblaze/include/asm/dma-mapping.h
index 096fa96..18b3731 100644
--- a/arch/microblaze/include/asm/dma-mapping.h
+++ b/arch/microblaze/include/asm/dma-mapping.h
@@ -34,7 +34,6 @@
#define __dma_alloc_coherent(dev, gfp, size, handle) NULL
#define __dma_free_coherent(size, addr) ((void)0)
#define __dma_sync(addr, size, rw) ((void)0)
-#define __dma_sync_page(pg, off, sz, rw) ((void)0)
static inline unsigned long device_to_mask(struct device *dev)
{
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c
index 300fea4..64bc39f 100644
--- a/arch/microblaze/kernel/dma.c
+++ b/arch/microblaze/kernel/dma.c
@@ -10,6 +10,7 @@
#include <linux/dma-mapping.h>
#include <linux/dma-debug.h>
#include <asm/bug.h>
+#include <asm/cacheflush.h>
/*
* Generic direct DMA implementation
@@ -20,6 +21,23 @@
* default the offset is PCI_DRAM_OFFSET.
*/
+static inline void __dma_sync_page(void *vaddr, unsigned long offset,
+ size_t size, enum dma_data_direction direction)
+{
+ unsigned long start = virt_to_phys(vaddr);
+
+ switch (direction) {
+ case DMA_TO_DEVICE:
+ flush_dcache_range(start + offset, start + offset + size);
+ break;
+ case DMA_FROM_DEVICE:
+ invalidate_dcache_range(start + offset, start + offset + size);
+ break;
+ default:
+ BUG();
+ }
+}
+
static unsigned long get_dma_direct_offset(struct device *dev)
{
if (dev)
@@ -85,11 +103,11 @@ static inline dma_addr_t dma_direct_map_page(struct device *dev,
struct page *page,
unsigned long offset,
size_t size,
- enum dma_data_direction dir,
+ enum dma_data_direction direction,
struct dma_attrs *attrs)
{
- BUG_ON(dir == DMA_NONE);
- __dma_sync_page(page, offset, size, dir);
+ BUG_ON(direction == DMA_NONE);
+ __dma_sync_page(page, offset, size, direction);
return page_to_phys(page) + offset + get_dma_direct_offset(dev);
}
@@ -99,6 +117,8 @@ static inline void dma_direct_unmap_page(struct device *dev,
enum dma_data_direction direction,
struct dma_attrs *attrs)
{
+/* There is not necessary to do cache cleanup */
+ /* __dma_sync_page(dma_address, 0 , size, direction); */
}
struct dma_map_ops dma_direct_ops = {
OpenPOWER on IntegriCloud