diff options
author | Andrzej Pietrasiewicz <andrzej.p@samsung.com> | 2012-03-27 08:32:21 -0400 |
---|---|---|
committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2012-03-28 10:36:32 -0400 |
commit | e8d51e54ab4020d984dda471ca077c7fed094326 (patch) | |
tree | 874f1d1ad6a1ab0aa28559062b0a27743bf5be97 | |
parent | baa676fcf8d555269bd0a5a2496782beee55824d (diff) |
MIPS: adapt for dma_map_ops changes
Adapt core MIPS architecture code for dma_map_ops changes: replace
alloc/free_coherent with generic alloc/free methods.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
[added missing changes to arch/mips/cavium-octeon/dma-octeon.c,
fixed attrs argument in dma-mapping.h]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r-- | arch/mips/cavium-octeon/dma-octeon.c | 12 | ||||
-rw-r--r-- | arch/mips/include/asm/dma-mapping.h | 18 | ||||
-rw-r--r-- | arch/mips/mm/dma-default.c | 8 |
3 files changed, 22 insertions, 16 deletions
diff --git a/arch/mips/cavium-octeon/dma-octeon.c b/arch/mips/cavium-octeon/dma-octeon.c index b6bb92c16a47..41dd00884975 100644 --- a/arch/mips/cavium-octeon/dma-octeon.c +++ b/arch/mips/cavium-octeon/dma-octeon.c | |||
@@ -157,7 +157,7 @@ static void octeon_dma_sync_sg_for_device(struct device *dev, | |||
157 | } | 157 | } |
158 | 158 | ||
159 | static void *octeon_dma_alloc_coherent(struct device *dev, size_t size, | 159 | static void *octeon_dma_alloc_coherent(struct device *dev, size_t size, |
160 | dma_addr_t *dma_handle, gfp_t gfp) | 160 | dma_addr_t *dma_handle, gfp_t gfp, struct dma_attrs *attrs) |
161 | { | 161 | { |
162 | void *ret; | 162 | void *ret; |
163 | 163 | ||
@@ -192,7 +192,7 @@ static void *octeon_dma_alloc_coherent(struct device *dev, size_t size, | |||
192 | } | 192 | } |
193 | 193 | ||
194 | static void octeon_dma_free_coherent(struct device *dev, size_t size, | 194 | static void octeon_dma_free_coherent(struct device *dev, size_t size, |
195 | void *vaddr, dma_addr_t dma_handle) | 195 | void *vaddr, dma_addr_t dma_handle, struct dma_attrs *attrs) |
196 | { | 196 | { |
197 | int order = get_order(size); | 197 | int order = get_order(size); |
198 | 198 | ||
@@ -240,8 +240,8 @@ EXPORT_SYMBOL(dma_to_phys); | |||
240 | 240 | ||
241 | static struct octeon_dma_map_ops octeon_linear_dma_map_ops = { | 241 | static struct octeon_dma_map_ops octeon_linear_dma_map_ops = { |
242 | .dma_map_ops = { | 242 | .dma_map_ops = { |
243 | .alloc_coherent = octeon_dma_alloc_coherent, | 243 | .alloc = octeon_dma_alloc_coherent, |
244 | .free_coherent = octeon_dma_free_coherent, | 244 | .free = octeon_dma_free_coherent, |
245 | .map_page = octeon_dma_map_page, | 245 | .map_page = octeon_dma_map_page, |
246 | .unmap_page = swiotlb_unmap_page, | 246 | .unmap_page = swiotlb_unmap_page, |
247 | .map_sg = octeon_dma_map_sg, | 247 | .map_sg = octeon_dma_map_sg, |
@@ -325,8 +325,8 @@ void __init plat_swiotlb_setup(void) | |||
325 | #ifdef CONFIG_PCI | 325 | #ifdef CONFIG_PCI |
326 | static struct octeon_dma_map_ops _octeon_pci_dma_map_ops = { | 326 | static struct octeon_dma_map_ops _octeon_pci_dma_map_ops = { |
327 | .dma_map_ops = { | 327 | .dma_map_ops = { |
328 | .alloc_coherent = octeon_dma_alloc_coherent, | 328 | .alloc = octeon_dma_alloc_coherent, |
329 | .free_coherent = octeon_dma_free_coherent, | 329 | .free = octeon_dma_free_coherent, |
330 | .map_page = octeon_dma_map_page, | 330 | .map_page = octeon_dma_map_page, |
331 | .unmap_page = swiotlb_unmap_page, | 331 | .unmap_page = swiotlb_unmap_page, |
332 | .map_sg = octeon_dma_map_sg, | 332 | .map_sg = octeon_dma_map_sg, |
diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h index 7aa37ddfca4b..be39a12901c6 100644 --- a/arch/mips/include/asm/dma-mapping.h +++ b/arch/mips/include/asm/dma-mapping.h | |||
@@ -57,25 +57,31 @@ dma_set_mask(struct device *dev, u64 mask) | |||
57 | extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size, | 57 | extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size, |
58 | enum dma_data_direction direction); | 58 | enum dma_data_direction direction); |
59 | 59 | ||
60 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | 60 | #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) |
61 | dma_addr_t *dma_handle, gfp_t gfp) | 61 | |
62 | static inline void *dma_alloc_attrs(struct device *dev, size_t size, | ||
63 | dma_addr_t *dma_handle, gfp_t gfp, | ||
64 | struct dma_attrs *attrs) | ||
62 | { | 65 | { |
63 | void *ret; | 66 | void *ret; |
64 | struct dma_map_ops *ops = get_dma_ops(dev); | 67 | struct dma_map_ops *ops = get_dma_ops(dev); |
65 | 68 | ||
66 | ret = ops->alloc_coherent(dev, size, dma_handle, gfp); | 69 | ret = ops->alloc(dev, size, dma_handle, gfp, attrs); |
67 | 70 | ||
68 | debug_dma_alloc_coherent(dev, size, *dma_handle, ret); | 71 | debug_dma_alloc_coherent(dev, size, *dma_handle, ret); |
69 | 72 | ||
70 | return ret; | 73 | return ret; |
71 | } | 74 | } |
72 | 75 | ||
73 | static inline void dma_free_coherent(struct device *dev, size_t size, | 76 | #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) |
74 | void *vaddr, dma_addr_t dma_handle) | 77 | |
78 | static inline void dma_free_attrs(struct device *dev, size_t size, | ||
79 | void *vaddr, dma_addr_t dma_handle, | ||
80 | struct dma_attrs *attrs) | ||
75 | { | 81 | { |
76 | struct dma_map_ops *ops = get_dma_ops(dev); | 82 | struct dma_map_ops *ops = get_dma_ops(dev); |
77 | 83 | ||
78 | ops->free_coherent(dev, size, vaddr, dma_handle); | 84 | ops->free(dev, size, vaddr, dma_handle, attrs); |
79 | 85 | ||
80 | debug_dma_free_coherent(dev, size, vaddr, dma_handle); | 86 | debug_dma_free_coherent(dev, size, vaddr, dma_handle); |
81 | } | 87 | } |
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c index 46084912e588..3fab2046c8a4 100644 --- a/arch/mips/mm/dma-default.c +++ b/arch/mips/mm/dma-default.c | |||
@@ -98,7 +98,7 @@ void *dma_alloc_noncoherent(struct device *dev, size_t size, | |||
98 | EXPORT_SYMBOL(dma_alloc_noncoherent); | 98 | EXPORT_SYMBOL(dma_alloc_noncoherent); |
99 | 99 | ||
100 | static void *mips_dma_alloc_coherent(struct device *dev, size_t size, | 100 | static void *mips_dma_alloc_coherent(struct device *dev, size_t size, |
101 | dma_addr_t * dma_handle, gfp_t gfp) | 101 | dma_addr_t * dma_handle, gfp_t gfp, struct dma_attrs *attrs) |
102 | { | 102 | { |
103 | void *ret; | 103 | void *ret; |
104 | 104 | ||
@@ -132,7 +132,7 @@ void dma_free_noncoherent(struct device *dev, size_t size, void *vaddr, | |||
132 | EXPORT_SYMBOL(dma_free_noncoherent); | 132 | EXPORT_SYMBOL(dma_free_noncoherent); |
133 | 133 | ||
134 | static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr, | 134 | static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr, |
135 | dma_addr_t dma_handle) | 135 | dma_addr_t dma_handle, struct dma_attrs *attrs) |
136 | { | 136 | { |
137 | unsigned long addr = (unsigned long) vaddr; | 137 | unsigned long addr = (unsigned long) vaddr; |
138 | int order = get_order(size); | 138 | int order = get_order(size); |
@@ -323,8 +323,8 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size, | |||
323 | EXPORT_SYMBOL(dma_cache_sync); | 323 | EXPORT_SYMBOL(dma_cache_sync); |
324 | 324 | ||
325 | static struct dma_map_ops mips_default_dma_map_ops = { | 325 | static struct dma_map_ops mips_default_dma_map_ops = { |
326 | .alloc_coherent = mips_dma_alloc_coherent, | 326 | .alloc = mips_dma_alloc_coherent, |
327 | .free_coherent = mips_dma_free_coherent, | 327 | .free = mips_dma_free_coherent, |
328 | .map_page = mips_dma_map_page, | 328 | .map_page = mips_dma_map_page, |
329 | .unmap_page = mips_dma_unmap_page, | 329 | .unmap_page = mips_dma_unmap_page, |
330 | .map_sg = mips_dma_map_sg, | 330 | .map_sg = mips_dma_map_sg, |