aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2009-10-31 12:52:16 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-02-15 10:21:43 -0500
commit18eabe2347ae7a11b3db768695913724166dfb0e (patch)
tree2f6a9bb654d01e07a62be75adc1282e97b5c16d4 /arch/arm/mm
parentbf32eb85492af197ea5ff20e0be56f667a80584d (diff)
ARM: dma-mapping: introduce the idea of buffer ownership
The DMA API has the notion of buffer ownership; make it explicit in the ARM implementation of this API. This gives us a set of hooks to allow us to deal with CPU cache issues arising from non-cache coherent DMA. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Tested-By: Santosh Shilimkar <santosh.shilimkar@ti.com> Tested-By: Jamie Iles <jamie@jamieiles.com>
Diffstat (limited to 'arch/arm/mm')
-rw-r--r--arch/arm/mm/dma-mapping.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 26325cb5d368..a316c9459526 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -573,8 +573,12 @@ void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
573 int i; 573 int i;
574 574
575 for_each_sg(sg, s, nents, i) { 575 for_each_sg(sg, s, nents, i) {
576 dmabounce_sync_for_cpu(dev, sg_dma_address(s), 0, 576 if (!dmabounce_sync_for_cpu(dev, sg_dma_address(s), 0,
577 sg_dma_len(s), dir); 577 sg_dma_len(s), dir))
578 continue;
579
580 __dma_page_dev_to_cpu(sg_page(s), s->offset,
581 s->length, dir);
578 } 582 }
579} 583}
580EXPORT_SYMBOL(dma_sync_sg_for_cpu); 584EXPORT_SYMBOL(dma_sync_sg_for_cpu);
@@ -597,9 +601,8 @@ void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
597 sg_dma_len(s), dir)) 601 sg_dma_len(s), dir))
598 continue; 602 continue;
599 603
600 if (!arch_is_coherent()) 604 __dma_page_cpu_to_dev(sg_page(s), s->offset,
601 dma_cache_maint_page(sg_page(s), s->offset, 605 s->length, dir);
602 s->length, dir);
603 } 606 }
604} 607}
605EXPORT_SYMBOL(dma_sync_sg_for_device); 608EXPORT_SYMBOL(dma_sync_sg_for_device);