aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/include/asm/dma-mapping.h
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-08-10 07:18:26 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-08-10 09:05:14 -0400
commit9dd428680573d7867ee5e40fa3f059a98301d416 (patch)
treecedec454e5490d2f09b3cad4b6c2fed46a6f857b /arch/arm/include/asm/dma-mapping.h
parent98ed7d4b1a4eebc1ac25929b6968673bef4d54c3 (diff)
[ARM] dma-mapping: provide sync_range APIs
Convert the existing dma_sync_single_for_* APIs to the new range based APIs, and make the dma_sync_single_for_* API a superset of it. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/include/asm/dma-mapping.h')
-rw-r--r--arch/arm/include/asm/dma-mapping.h39
1 files changed, 28 insertions, 11 deletions
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index 6f45959fe2cc..7b95d2058395 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -351,11 +351,12 @@ extern void dma_unmap_sg(struct device *, struct scatterlist *, int, enum dma_da
351 351
352 352
353/** 353/**
354 * dma_sync_single_for_cpu 354 * dma_sync_single_range_for_cpu
355 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices 355 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
356 * @handle: DMA address of buffer 356 * @handle: DMA address of buffer
357 * @size: size of buffer to map 357 * @offset: offset of region to start sync
358 * @dir: DMA transfer direction 358 * @size: size of region to sync
359 * @dir: DMA transfer direction (same as passed to dma_map_single)
359 * 360 *
360 * Make physical memory consistent for a single streaming mode DMA 361 * Make physical memory consistent for a single streaming mode DMA
361 * translation after a transfer. 362 * translation after a transfer.
@@ -369,25 +370,41 @@ extern void dma_unmap_sg(struct device *, struct scatterlist *, int, enum dma_da
369 */ 370 */
370#ifndef CONFIG_DMABOUNCE 371#ifndef CONFIG_DMABOUNCE
371static inline void 372static inline void
372dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle, size_t size, 373dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t handle,
373 enum dma_data_direction dir) 374 unsigned long offset, size_t size,
375 enum dma_data_direction dir)
374{ 376{
375 if (!arch_is_coherent()) 377 if (!arch_is_coherent())
376 dma_cache_maint(dma_to_virt(dev, handle), size, dir); 378 dma_cache_maint(dma_to_virt(dev, handle) + offset, size, dir);
377} 379}
378 380
379static inline void 381static inline void
380dma_sync_single_for_device(struct device *dev, dma_addr_t handle, size_t size, 382dma_sync_single_range_for_device(struct device *dev, dma_addr_t handle,
381 enum dma_data_direction dir) 383 unsigned long offset, size_t size,
384 enum dma_data_direction dir)
382{ 385{
383 if (!arch_is_coherent()) 386 if (!arch_is_coherent())
384 dma_cache_maint(dma_to_virt(dev, handle), size, dir); 387 dma_cache_maint(dma_to_virt(dev, handle) + offset, size, dir);
385} 388}
386#else 389#else
387extern void dma_sync_single_for_cpu(struct device*, dma_addr_t, size_t, enum dma_data_direction); 390extern void dma_sync_single_range_for_cpu(struct device *, dma_addr_t, unsigned long, size_t, enum dma_data_direction);
388extern void dma_sync_single_for_device(struct device*, dma_addr_t, size_t, enum dma_data_direction); 391extern void dma_sync_single_range_for_device(struct device *, dma_addr_t, unsigned long, size_t, enum dma_data_direction);
389#endif 392#endif
390 393
394static inline void
395dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle, size_t size,
396 enum dma_data_direction dir)
397{
398 dma_sync_single_range_for_cpu(dev, handle, 0, size, dir);
399}
400
401static inline void
402dma_sync_single_for_device(struct device *dev, dma_addr_t handle, size_t size,
403 enum dma_data_direction dir)
404{
405 dma_sync_single_range_for_device(dev, handle, 0, size, dir);
406}
407
391 408
392/** 409/**
393 * dma_sync_sg_for_cpu 410 * dma_sync_sg_for_cpu