blob: 17f7a45948eac7473b3afb16e86b5512d58a2c4d [file] [log] [blame]
Greg Ungerer9a4048a2009-01-29 15:35:34 +10001#ifndef _M68K_DMA_MAPPING_H
2#define _M68K_DMA_MAPPING_H
3
4#include <asm/cache.h>
5
6struct scatterlist;
7
8#ifndef CONFIG_MMU_SUN3
9static inline int dma_supported(struct device *dev, u64 mask)
10{
11 return 1;
12}
13
14static inline int dma_set_mask(struct device *dev, u64 mask)
15{
16 return 0;
17}
18
Greg Ungerer9a4048a2009-01-29 15:35:34 +100019extern void *dma_alloc_coherent(struct device *, size_t,
20 dma_addr_t *, gfp_t);
21extern void dma_free_coherent(struct device *, size_t,
22 void *, dma_addr_t);
23
24static inline void *dma_alloc_noncoherent(struct device *dev, size_t size,
25 dma_addr_t *handle, gfp_t flag)
26{
27 return dma_alloc_coherent(dev, size, handle, flag);
28}
29static inline void dma_free_noncoherent(struct device *dev, size_t size,
30 void *addr, dma_addr_t handle)
31{
32 dma_free_coherent(dev, size, addr, handle);
33}
34static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
35 enum dma_data_direction dir)
36{
37 /* we use coherent allocation, so not much to do here. */
38}
39
40extern dma_addr_t dma_map_single(struct device *, void *, size_t,
41 enum dma_data_direction);
42static inline void dma_unmap_single(struct device *dev, dma_addr_t addr,
43 size_t size, enum dma_data_direction dir)
44{
45}
46
47extern dma_addr_t dma_map_page(struct device *, struct page *,
48 unsigned long, size_t size,
49 enum dma_data_direction);
50static inline void dma_unmap_page(struct device *dev, dma_addr_t address,
51 size_t size, enum dma_data_direction dir)
52{
53}
54
55extern int dma_map_sg(struct device *, struct scatterlist *, int,
56 enum dma_data_direction);
57static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
58 int nhwentries, enum dma_data_direction dir)
59{
60}
61
62extern void dma_sync_single_for_device(struct device *, dma_addr_t, size_t,
63 enum dma_data_direction);
64extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int,
65 enum dma_data_direction);
66
67static inline void dma_sync_single_range_for_device(struct device *dev,
68 dma_addr_t dma_handle, unsigned long offset, size_t size,
69 enum dma_data_direction direction)
70{
71 /* just sync everything for now */
72 dma_sync_single_for_device(dev, dma_handle, offset + size, direction);
73}
74
75static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
76 size_t size, enum dma_data_direction dir)
77{
78}
79
80static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
81 int nents, enum dma_data_direction dir)
82{
83}
84
85static inline void dma_sync_single_range_for_cpu(struct device *dev,
86 dma_addr_t dma_handle, unsigned long offset, size_t size,
87 enum dma_data_direction direction)
88{
89 /* just sync everything for now */
90 dma_sync_single_for_cpu(dev, dma_handle, offset + size, direction);
91}
92
93static inline int dma_mapping_error(struct device *dev, dma_addr_t handle)
94{
95 return 0;
96}
97
Sam Ravnborg49148022009-01-16 21:58:10 +100098#else
Greg Ungerer9a4048a2009-01-29 15:35:34 +100099#include <asm-generic/dma-mapping-broken.h>
Sam Ravnborg49148022009-01-16 21:58:10 +1000100#endif
Greg Ungerer9a4048a2009-01-29 15:35:34 +1000101
102#endif /* _M68K_DMA_MAPPING_H */