diff options
Diffstat (limited to 'arch/blackfin/include/asm/dma-mapping.h')
-rw-r--r-- | arch/blackfin/include/asm/dma-mapping.h | 51 |
1 files changed, 9 insertions, 42 deletions
diff --git a/arch/blackfin/include/asm/dma-mapping.h b/arch/blackfin/include/asm/dma-mapping.h index f9172ff30e5c..212cb80fd74b 100644 --- a/arch/blackfin/include/asm/dma-mapping.h +++ b/arch/blackfin/include/asm/dma-mapping.h | |||
@@ -44,13 +44,8 @@ dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | |||
44 | extern void | 44 | extern void |
45 | __dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir); | 45 | __dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir); |
46 | static inline void | 46 | static inline void |
47 | _dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir) | 47 | __dma_sync_inline(dma_addr_t addr, size_t size, enum dma_data_direction dir) |
48 | { | 48 | { |
49 | if (!__builtin_constant_p(dir)) { | ||
50 | __dma_sync(addr, size, dir); | ||
51 | return; | ||
52 | } | ||
53 | |||
54 | switch (dir) { | 49 | switch (dir) { |
55 | case DMA_NONE: | 50 | case DMA_NONE: |
56 | BUG(); | 51 | BUG(); |
@@ -64,14 +59,15 @@ _dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir) | |||
64 | break; | 59 | break; |
65 | } | 60 | } |
66 | } | 61 | } |
62 | static inline void | ||
63 | _dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir) | ||
64 | { | ||
65 | if (__builtin_constant_p(dir)) | ||
66 | __dma_sync_inline(addr, size, dir); | ||
67 | else | ||
68 | __dma_sync(addr, size, dir); | ||
69 | } | ||
67 | 70 | ||
68 | /* | ||
69 | * Map a single buffer of the indicated size for DMA in streaming mode. | ||
70 | * The 32-bit bus address to use is returned. | ||
71 | * | ||
72 | * Once the device is given the dma address, the device owns this memory | ||
73 | * until either pci_unmap_single or pci_dma_sync_single is performed. | ||
74 | */ | ||
75 | static inline dma_addr_t | 71 | static inline dma_addr_t |
76 | dma_map_single(struct device *dev, void *ptr, size_t size, | 72 | dma_map_single(struct device *dev, void *ptr, size_t size, |
77 | enum dma_data_direction dir) | 73 | enum dma_data_direction dir) |
@@ -88,14 +84,6 @@ dma_map_page(struct device *dev, struct page *page, | |||
88 | return dma_map_single(dev, page_address(page) + offset, size, dir); | 84 | return dma_map_single(dev, page_address(page) + offset, size, dir); |
89 | } | 85 | } |
90 | 86 | ||
91 | /* | ||
92 | * Unmap a single streaming mode DMA translation. The dma_addr and size | ||
93 | * must match what was provided for in a previous pci_map_single call. All | ||
94 | * other usages are undefined. | ||
95 | * | ||
96 | * After this call, reads by the cpu to the buffer are guarenteed to see | ||
97 | * whatever the device wrote there. | ||
98 | */ | ||
99 | static inline void | 87 | static inline void |
100 | dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | 88 | dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, |
101 | enum dma_data_direction dir) | 89 | enum dma_data_direction dir) |
@@ -110,30 +98,9 @@ dma_unmap_page(struct device *dev, dma_addr_t dma_addr, size_t size, | |||
110 | dma_unmap_single(dev, dma_addr, size, dir); | 98 | dma_unmap_single(dev, dma_addr, size, dir); |
111 | } | 99 | } |
112 | 100 | ||
113 | /* | ||
114 | * Map a set of buffers described by scatterlist in streaming | ||
115 | * mode for DMA. This is the scather-gather version of the | ||
116 | * above pci_map_single interface. Here the scatter gather list | ||
117 | * elements are each tagged with the appropriate dma address | ||
118 | * and length. They are obtained via sg_dma_{address,length}(SG). | ||
119 | * | ||
120 | * NOTE: An implementation may be able to use a smaller number of | ||
121 | * DMA address/length pairs than there are SG table elements. | ||
122 | * (for example via virtual mapping capabilities) | ||
123 | * The routine returns the number of addr/length pairs actually | ||
124 | * used, at most nents. | ||
125 | * | ||
126 | * Device ownership issues as mentioned above for pci_map_single are | ||
127 | * the same here. | ||
128 | */ | ||
129 | extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | 101 | extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, |
130 | enum dma_data_direction dir); | 102 | enum dma_data_direction dir); |
131 | 103 | ||
132 | /* | ||
133 | * Unmap a set of streaming mode DMA translations. | ||
134 | * Again, cpu read rules concerning calls here are the same as for | ||
135 | * pci_unmap_single() above. | ||
136 | */ | ||
137 | static inline void | 104 | static inline void |
138 | dma_unmap_sg(struct device *dev, struct scatterlist *sg, | 105 | dma_unmap_sg(struct device *dev, struct scatterlist *sg, |
139 | int nhwentries, enum dma_data_direction dir) | 106 | int nhwentries, enum dma_data_direction dir) |