2 * Copyright (C) 2006 Atmark Techno, Inc.
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
9 #ifndef _ASM_MICROBLAZE_DMA_MAPPING_H
10 #define _ASM_MICROBLAZE_DMA_MAPPING_H
12 #include <asm/cacheflush.h>
14 #include <linux/bug.h>
18 #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
19 #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
23 dma_supported(struct device *dev, u64 mask)
28 static inline dma_addr_t
29 dma_map_page(struct device *dev, struct page *page,
30 unsigned long offset, size_t size,
31 enum dma_data_direction direction)
38 dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
39 enum dma_data_direction direction)
45 dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
46 enum dma_data_direction direction)
53 dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
54 enum dma_data_direction direction)
60 dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
61 enum dma_data_direction direction)
67 dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
68 size_t size, enum dma_data_direction direction)
74 dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
75 enum dma_data_direction direction)
81 dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
82 enum dma_data_direction direction)
87 static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
92 static inline void *dma_alloc_coherent(struct device *dev, size_t size,
93 dma_addr_t *dma_handle, int flag)
95 return NULL; /* consistent_alloc(flag, size, dma_handle); */
98 static inline void dma_free_coherent(struct device *dev, size_t size,
99 void *vaddr, dma_addr_t dma_handle)
104 static inline dma_addr_t
105 dma_map_single(struct device *dev, void *ptr, size_t size,
106 enum dma_data_direction direction)
108 BUG_ON(direction == DMA_NONE);
110 return virt_to_bus(ptr);
113 static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
115 enum dma_data_direction direction)
118 case DMA_FROM_DEVICE:
119 flush_dcache_range((unsigned)dma_addr,
120 (unsigned)dma_addr + size);
129 #endif /* _ASM_MICROBLAZE_DMA_MAPPING_H */