1
2
3
4
5
6
7#ifndef _BLACKFIN_DMA_MAPPING_H
8#define _BLACKFIN_DMA_MAPPING_H
9
10#include <asm/scatterlist.h>
11
12void dma_alloc_init(unsigned long start, unsigned long end);
13void *dma_alloc_coherent(struct device *dev, size_t size,
14 dma_addr_t *dma_handle, gfp_t gfp);
15void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
16 dma_addr_t dma_handle);
17
18
19
20
21#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
22#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
23
24static inline
25int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
26{
27 return 0;
28}
29
30
31
32
33
34
35
36
37extern dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
38 enum dma_data_direction direction);
39
40static inline dma_addr_t
41dma_map_page(struct device *dev, struct page *page,
42 unsigned long offset, size_t size,
43 enum dma_data_direction dir)
44{
45 return dma_map_single(dev, page_address(page) + offset, size, dir);
46}
47
48
49
50
51
52
53
54
55
56extern void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
57 enum dma_data_direction direction);
58
59static inline void
60dma_unmap_page(struct device *dev, dma_addr_t dma_addr, size_t size,
61 enum dma_data_direction dir)
62{
63 dma_unmap_single(dev, dma_addr, size, dir);
64}
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
83 enum dma_data_direction direction);
84
85
86
87
88
89
90extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
91 int nhwentries, enum dma_data_direction direction);
92
93static inline void dma_sync_single_for_cpu(struct device *dev,
94 dma_addr_t handle, size_t size,
95 enum dma_data_direction dir)
96{
97}
98
99static inline void dma_sync_single_for_device(struct device *dev,
100 dma_addr_t handle, size_t size,
101 enum dma_data_direction dir)
102{
103}
104
105static inline void dma_sync_sg_for_cpu(struct device *dev,
106 struct scatterlist *sg,
107 int nents, enum dma_data_direction dir)
108{
109}
110
111static inline void dma_sync_sg_for_device(struct device *dev,
112 struct scatterlist *sg,
113 int nents, enum dma_data_direction dir)
114{
115}
116
117#endif
118