aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2009-01-22 10:42:11 -0500
committerRalf Baechle <ralf@linux-mips.org>2009-05-14 08:50:26 -0400
commit4f29c057aa81c5440f06b716f768ba9f8a041fe9 (patch)
tree152ebccf4c65945e0c28bb391e5dcbfc69b1863b /arch
parent47740eb887796608fb4c629aa6b8507a2fb6c0eb (diff)
MIPS: Synchronize dma_map_page and dma_map_single
Synchronize dma_map_page/dma_unmap_page and dma_map_single/dma_unmap_single. This will reduce unnecessary writebacks and invalidates. [Ralf: make dma_unmap_page an inline function.] Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/include/asm/dma-mapping.h9
-rw-r--r--arch/mips/mm/dma-default.c19
2 files changed, 8 insertions, 20 deletions
diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h
index c64afb40cd06..d16afddb09a9 100644
--- a/arch/mips/include/asm/dma-mapping.h
+++ b/arch/mips/include/asm/dma-mapping.h
@@ -24,8 +24,13 @@ extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
24 enum dma_data_direction direction); 24 enum dma_data_direction direction);
25extern dma_addr_t dma_map_page(struct device *dev, struct page *page, 25extern dma_addr_t dma_map_page(struct device *dev, struct page *page,
26 unsigned long offset, size_t size, enum dma_data_direction direction); 26 unsigned long offset, size_t size, enum dma_data_direction direction);
27extern void dma_unmap_page(struct device *dev, dma_addr_t dma_address, 27
28 size_t size, enum dma_data_direction direction); 28static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
29 size_t size, enum dma_data_direction direction)
30{
31 dma_unmap_single(dev, dma_address, size, direction);
32}
33
29extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg, 34extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
30 int nhwentries, enum dma_data_direction direction); 35 int nhwentries, enum dma_data_direction direction);
31extern void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, 36extern void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index bed56f1ac837..4fdb7f5216b9 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -209,7 +209,7 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page,
209 unsigned long addr; 209 unsigned long addr;
210 210
211 addr = (unsigned long) page_address(page) + offset; 211 addr = (unsigned long) page_address(page) + offset;
212 dma_cache_wback_inv(addr, size); 212 __dma_sync(addr, size, direction);
213 } 213 }
214 214
215 return plat_map_dma_mem_page(dev, page) + offset; 215 return plat_map_dma_mem_page(dev, page) + offset;
@@ -217,23 +217,6 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page,
217 217
218EXPORT_SYMBOL(dma_map_page); 218EXPORT_SYMBOL(dma_map_page);
219 219
220void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
221 enum dma_data_direction direction)
222{
223 BUG_ON(direction == DMA_NONE);
224
225 if (!plat_device_is_coherent(dev) && direction != DMA_TO_DEVICE) {
226 unsigned long addr;
227
228 addr = dma_addr_to_virt(dma_address);
229 dma_cache_wback_inv(addr, size);
230 }
231
232 plat_unmap_dma_mem(dev, dma_address);
233}
234
235EXPORT_SYMBOL(dma_unmap_page);
236
237void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, 220void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
238 enum dma_data_direction direction) 221 enum dma_data_direction direction)
239{ 222{