diff options
Diffstat (limited to 'arch/mips/mm/dma-default.c')
-rw-r--r-- | arch/mips/mm/dma-default.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c index 46d5696c4f27..a39c36af97ad 100644 --- a/arch/mips/mm/dma-default.c +++ b/arch/mips/mm/dma-default.c | |||
@@ -293,7 +293,7 @@ static inline void __dma_sync(struct page *page, | |||
293 | static void mips_dma_unmap_page(struct device *dev, dma_addr_t dma_addr, | 293 | static void mips_dma_unmap_page(struct device *dev, dma_addr_t dma_addr, |
294 | size_t size, enum dma_data_direction direction, unsigned long attrs) | 294 | size_t size, enum dma_data_direction direction, unsigned long attrs) |
295 | { | 295 | { |
296 | if (cpu_needs_post_dma_flush(dev)) | 296 | if (cpu_needs_post_dma_flush(dev) && !(attrs & DMA_ATTR_SKIP_CPU_SYNC)) |
297 | __dma_sync(dma_addr_to_page(dev, dma_addr), | 297 | __dma_sync(dma_addr_to_page(dev, dma_addr), |
298 | dma_addr & ~PAGE_MASK, size, direction); | 298 | dma_addr & ~PAGE_MASK, size, direction); |
299 | plat_post_dma_flush(dev); | 299 | plat_post_dma_flush(dev); |
@@ -307,7 +307,8 @@ static int mips_dma_map_sg(struct device *dev, struct scatterlist *sglist, | |||
307 | struct scatterlist *sg; | 307 | struct scatterlist *sg; |
308 | 308 | ||
309 | for_each_sg(sglist, sg, nents, i) { | 309 | for_each_sg(sglist, sg, nents, i) { |
310 | if (!plat_device_is_coherent(dev)) | 310 | if (!plat_device_is_coherent(dev) && |
311 | !(attrs & DMA_ATTR_SKIP_CPU_SYNC)) | ||
311 | __dma_sync(sg_page(sg), sg->offset, sg->length, | 312 | __dma_sync(sg_page(sg), sg->offset, sg->length, |
312 | direction); | 313 | direction); |
313 | #ifdef CONFIG_NEED_SG_DMA_LENGTH | 314 | #ifdef CONFIG_NEED_SG_DMA_LENGTH |
@@ -324,7 +325,7 @@ static dma_addr_t mips_dma_map_page(struct device *dev, struct page *page, | |||
324 | unsigned long offset, size_t size, enum dma_data_direction direction, | 325 | unsigned long offset, size_t size, enum dma_data_direction direction, |
325 | unsigned long attrs) | 326 | unsigned long attrs) |
326 | { | 327 | { |
327 | if (!plat_device_is_coherent(dev)) | 328 | if (!plat_device_is_coherent(dev) && !(attrs & DMA_ATTR_SKIP_CPU_SYNC)) |
328 | __dma_sync(page, offset, size, direction); | 329 | __dma_sync(page, offset, size, direction); |
329 | 330 | ||
330 | return plat_map_dma_mem_page(dev, page) + offset; | 331 | return plat_map_dma_mem_page(dev, page) + offset; |
@@ -339,6 +340,7 @@ static void mips_dma_unmap_sg(struct device *dev, struct scatterlist *sglist, | |||
339 | 340 | ||
340 | for_each_sg(sglist, sg, nhwentries, i) { | 341 | for_each_sg(sglist, sg, nhwentries, i) { |
341 | if (!plat_device_is_coherent(dev) && | 342 | if (!plat_device_is_coherent(dev) && |
343 | !(attrs & DMA_ATTR_SKIP_CPU_SYNC) && | ||
342 | direction != DMA_TO_DEVICE) | 344 | direction != DMA_TO_DEVICE) |
343 | __dma_sync(sg_page(sg), sg->offset, sg->length, | 345 | __dma_sync(sg_page(sg), sg->offset, sg->length, |
344 | direction); | 346 | direction); |