diff options
-rw-r--r-- | arch/arm/common/dmabounce.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c index 5797b1b100a1..39dd33ff6f37 100644 --- a/arch/arm/common/dmabounce.c +++ b/arch/arm/common/dmabounce.c | |||
@@ -302,12 +302,24 @@ unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | |||
302 | 302 | ||
303 | DO_STATS ( device_info->bounce_count++ ); | 303 | DO_STATS ( device_info->bounce_count++ ); |
304 | 304 | ||
305 | if ((dir == DMA_FROM_DEVICE) || | 305 | if (dir == DMA_FROM_DEVICE || dir == DMA_BIDIRECTIONAL) { |
306 | (dir == DMA_BIDIRECTIONAL)) { | 306 | unsigned long ptr; |
307 | |||
307 | dev_dbg(dev, | 308 | dev_dbg(dev, |
308 | "%s: copy back safe %p to unsafe %p size %d\n", | 309 | "%s: copy back safe %p to unsafe %p size %d\n", |
309 | __func__, buf->safe, buf->ptr, size); | 310 | __func__, buf->safe, buf->ptr, size); |
310 | memcpy(buf->ptr, buf->safe, size); | 311 | memcpy(buf->ptr, buf->safe, size); |
312 | |||
313 | /* | ||
314 | * DMA buffers must have the same cache properties | ||
315 | * as if they were really used for DMA - which means | ||
316 | * data must be written back to RAM. Note that | ||
317 | * we don't use dmac_flush_range() here for the | ||
318 | * bidirectional case because we know the cache | ||
319 | * lines will be coherent with the data written. | ||
320 | */ | ||
321 | ptr = (unsigned long)buf->ptr; | ||
322 | dmac_clean_range(ptr, ptr + size); | ||
311 | } | 323 | } |
312 | free_safe_buffer(device_info, buf); | 324 | free_safe_buffer(device_info, buf); |
313 | } | 325 | } |