diff options
author | Michael Hennerich <michael.hennerich@analog.com> | 2010-06-16 09:12:10 (GMT) |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2010-08-06 16:55:50 (GMT) |
commit | d1401e1dc22606a91f577ad3dfd68ae7e60e0357 (patch) | |
tree | 6c59463c60fd4ada2b5d4974afaa30be7059c67f /arch/blackfin/kernel | |
parent | 502c8a0e07450ff886b80a11150a123bae92f3f7 (diff) | |
download | linux-d1401e1dc22606a91f577ad3dfd68ae7e60e0357.tar.xz |
Blackfin: fix DMA/cache bug when resuming from suspend to RAM
The dma_memcpy() function takes care of flushing different caches for us.
Normally this is what we want, but when resuming from mem, we don't yet
have caches enabled. If these functions happen to be placed into L1 mem
(which is what we're trying to relocate), then things aren't going to
work. So define a non-cache dma_memcpy() variant to utilize in situations
like this.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/kernel')
-rw-r--r-- | arch/blackfin/kernel/bfin_dma_5xx.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c index 26403d1..1e485df 100644 --- a/arch/blackfin/kernel/bfin_dma_5xx.c +++ b/arch/blackfin/kernel/bfin_dma_5xx.c @@ -450,7 +450,6 @@ void *dma_memcpy(void *pdst, const void *psrc, size_t size) { unsigned long dst = (unsigned long)pdst; unsigned long src = (unsigned long)psrc; - size_t bulk, rest; if (bfin_addr_dcacheable(src)) blackfin_dcache_flush_range(src, src + size); @@ -458,6 +457,22 @@ void *dma_memcpy(void *pdst, const void *psrc, size_t size) if (bfin_addr_dcacheable(dst)) blackfin_dcache_invalidate_range(dst, dst + size); + return dma_memcpy_nocache(pdst, psrc, size); +} +EXPORT_SYMBOL(dma_memcpy); + +/** + * dma_memcpy_nocache - DMA memcpy under mutex lock + * - No cache flush/invalidate + * + * Do not check arguments before starting the DMA memcpy. Break the transfer + * up into two pieces. The first transfer is in multiples of 64k and the + * second transfer is the piece smaller than 64k. + */ +void *dma_memcpy_nocache(void *pdst, const void *psrc, size_t size) +{ + size_t bulk, rest; + bulk = size & ~0xffff; rest = size - bulk; if (bulk) @@ -465,7 +480,7 @@ void *dma_memcpy(void *pdst, const void *psrc, size_t size) _dma_memcpy(pdst + bulk, psrc + bulk, rest); return pdst; } -EXPORT_SYMBOL(dma_memcpy); +EXPORT_SYMBOL(dma_memcpy_nocache); /** * safe_dma_memcpy - DMA memcpy w/argument checking |