aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/lib/dma-noncoherent.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/lib/dma-noncoherent.c')
-rw-r--r--arch/powerpc/lib/dma-noncoherent.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/powerpc/lib/dma-noncoherent.c b/arch/powerpc/lib/dma-noncoherent.c
index 6656d47841d..5d83907f659 100644
--- a/arch/powerpc/lib/dma-noncoherent.c
+++ b/arch/powerpc/lib/dma-noncoherent.c
@@ -348,8 +348,15 @@ void __dma_sync(void *vaddr, size_t size, int direction)
348 switch (direction) { 348 switch (direction) {
349 case DMA_NONE: 349 case DMA_NONE:
350 BUG(); 350 BUG();
351 case DMA_FROM_DEVICE: /* invalidate only */ 351 case DMA_FROM_DEVICE:
352 invalidate_dcache_range(start, end); 352 /*
353 * invalidate only when cache-line aligned otherwise there is
354 * the potential for discarding uncommitted data from the cache
355 */
356 if ((start & (L1_CACHE_BYTES - 1)) || (size & (L1_CACHE_BYTES - 1)))
357 flush_dcache_range(start, end);
358 else
359 invalidate_dcache_range(start, end);
353 break; 360 break;
354 case DMA_TO_DEVICE: /* writeback only */ 361 case DMA_TO_DEVICE: /* writeback only */
355 clean_dcache_range(start, end); 362 clean_dcache_range(start, end);