]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - arch/m68k/include/asm/dma-mapping.h
Merge remote-tracking branch 'regulator/topic/max8997' into regulator-next
[karo-tx-linux.git] / arch / m68k / include / asm / dma-mapping.h
1 #ifndef _M68K_DMA_MAPPING_H
2 #define _M68K_DMA_MAPPING_H
3
4 #include <asm/cache.h>
5
6 struct scatterlist;
7
8 #ifndef CONFIG_MMU_SUN3
9 static inline int dma_supported(struct device *dev, u64 mask)
10 {
11         return 1;
12 }
13
14 static inline int dma_set_mask(struct device *dev, u64 mask)
15 {
16         return 0;
17 }
18
19 extern void *dma_alloc_coherent(struct device *, size_t,
20                                 dma_addr_t *, gfp_t);
21 extern void dma_free_coherent(struct device *, size_t,
22                               void *, dma_addr_t);
23
24 static inline void *dma_alloc_attrs(struct device *dev, size_t size,
25                                     dma_addr_t *dma_handle, gfp_t flag,
26                                     struct dma_attrs *attrs)
27 {
28         /* attrs is not supported and ignored */
29         return dma_alloc_coherent(dev, size, dma_handle, flag);
30 }
31
32 static inline void dma_free_attrs(struct device *dev, size_t size,
33                                   void *cpu_addr, dma_addr_t dma_handle,
34                                   struct dma_attrs *attrs)
35 {
36         /* attrs is not supported and ignored */
37         dma_free_coherent(dev, size, cpu_addr, dma_handle);
38 }
39
40 static inline void *dma_alloc_noncoherent(struct device *dev, size_t size,
41                                           dma_addr_t *handle, gfp_t flag)
42 {
43         return dma_alloc_coherent(dev, size, handle, flag);
44 }
45 static inline void dma_free_noncoherent(struct device *dev, size_t size,
46                                         void *addr, dma_addr_t handle)
47 {
48         dma_free_coherent(dev, size, addr, handle);
49 }
50 static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
51                                   enum dma_data_direction dir)
52 {
53         /* we use coherent allocation, so not much to do here. */
54 }
55
56 extern dma_addr_t dma_map_single(struct device *, void *, size_t,
57                                  enum dma_data_direction);
58 static inline void dma_unmap_single(struct device *dev, dma_addr_t addr,
59                                     size_t size, enum dma_data_direction dir)
60 {
61 }
62
63 extern dma_addr_t dma_map_page(struct device *, struct page *,
64                                unsigned long, size_t size,
65                                enum dma_data_direction);
66 static inline void dma_unmap_page(struct device *dev, dma_addr_t address,
67                                   size_t size, enum dma_data_direction dir)
68 {
69 }
70
71 extern int dma_map_sg(struct device *, struct scatterlist *, int,
72                       enum dma_data_direction);
73 static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
74                                 int nhwentries, enum dma_data_direction dir)
75 {
76 }
77
78 extern void dma_sync_single_for_device(struct device *, dma_addr_t, size_t,
79                                        enum dma_data_direction);
80 extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int,
81                                    enum dma_data_direction);
82
83 static inline void dma_sync_single_range_for_device(struct device *dev,
84                 dma_addr_t dma_handle, unsigned long offset, size_t size,
85                 enum dma_data_direction direction)
86 {
87         /* just sync everything for now */
88         dma_sync_single_for_device(dev, dma_handle, offset + size, direction);
89 }
90
91 static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
92                                            size_t size, enum dma_data_direction dir)
93 {
94 }
95
96 static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
97                                        int nents, enum dma_data_direction dir)
98 {
99 }
100
101 static inline void dma_sync_single_range_for_cpu(struct device *dev,
102                 dma_addr_t dma_handle, unsigned long offset, size_t size,
103                 enum dma_data_direction direction)
104 {
105         /* just sync everything for now */
106         dma_sync_single_for_cpu(dev, dma_handle, offset + size, direction);
107 }
108
109 static inline int dma_mapping_error(struct device *dev, dma_addr_t handle)
110 {
111         return 0;
112 }
113
114 #else
115 #include <asm-generic/dma-mapping-broken.h>
116 #endif
117
118 /* drivers/base/dma-mapping.c */
119 extern int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
120                            void *cpu_addr, dma_addr_t dma_addr, size_t size);
121 extern int dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
122                                   void *cpu_addr, dma_addr_t dma_addr,
123                                   size_t size);
124
125 #define dma_mmap_coherent(d, v, c, h, s) dma_common_mmap(d, v, c, h, s)
126 #define dma_get_sgtable(d, t, v, h, s) dma_common_get_sgtable(d, t, v, h, s)
127
128 #endif  /* _M68K_DMA_MAPPING_H */