cns3xxx: fix missing and incomplete cache flushes on DMA cache sync for cpu - fixes...
[openwrt/svn-archive/archive.git] / target / linux / cns3xxx / patches-2.6.31 / 300-flush_cache_on_dma_cache_sync_for_cpu.patch
1 --- a/arch/arm/include/asm/dma-mapping.h
2 +++ b/arch/arm/include/asm/dma-mapping.h
3 @@ -350,7 +350,8 @@ static inline dma_addr_t dma_map_page(st
4 static inline void dma_unmap_single(struct device *dev, dma_addr_t handle,
5 size_t size, enum dma_data_direction dir)
6 {
7 - /* nothing to do */
8 + if (dir != DMA_TO_DEVICE)
9 + dma_cache_maint(dma_to_virt(dev, handle), size, DMA_FROM_DEVICE);
10 }
11 #endif /* CONFIG_DMABOUNCE */
12
13 @@ -398,6 +399,8 @@ static inline void dma_sync_single_range
14 {
15 BUG_ON(!valid_dma_direction(dir));
16
17 + if (dir != DMA_TO_DEVICE)
18 + dma_cache_maint(dma_to_virt(dev, handle) + offset, size, DMA_FROM_DEVICE);
19 dmabounce_sync_for_cpu(dev, handle, offset, size, dir);
20 }
21