2 * Implements the generic device dma API for microblaze and the pci
4 * Copyright (C) 2009-2010 Michal Simek <monstr@monstr.eu>
5 * Copyright (C) 2009-2010 PetaLogix
7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this
9 * archive for more details.
11 * This file is base on powerpc and x86 dma-mapping.h versions
12 * Copyright (C) 2004 IBM
15 #ifndef _ASM_MICROBLAZE_DMA_MAPPING_H
16 #define _ASM_MICROBLAZE_DMA_MAPPING_H
19 * See Documentation/DMA-API-HOWTO.txt and
20 * Documentation/DMA-API.txt for documentation.
23 #include <linux/types.h>
24 #include <linux/cache.h>
26 #include <linux/scatterlist.h>
27 #include <linux/dma-debug.h>
29 #include <asm/cacheflush.h>
31 #define __dma_alloc_coherent(dev, gfp, size, handle) NULL
32 #define __dma_free_coherent(size, addr) ((void)0)
35 * Available generic sets of operations
37 extern const struct dma_map_ops dma_direct_ops
;
39 static inline const struct dma_map_ops
*get_arch_dma_ops(struct bus_type
*bus
)
41 return &dma_direct_ops
;
44 static inline void __dma_sync(unsigned long paddr
,
45 size_t size
, enum dma_data_direction direction
)
49 case DMA_BIDIRECTIONAL
:
50 flush_dcache_range(paddr
, paddr
+ size
);
53 invalidate_dcache_range(paddr
, paddr
+ size
);
60 static inline void dma_cache_sync(struct device
*dev
, void *vaddr
, size_t size
,
61 enum dma_data_direction direction
)
63 BUG_ON(direction
== DMA_NONE
);
64 __dma_sync(virt_to_phys(vaddr
), size
, (int)direction
);
67 #endif /* _ASM_MICROBLAZE_DMA_MAPPING_H */