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>
This commit is contained in:

committed by
Mike Frysinger

parent
502c8a0e07
commit
d1401e1dc2
@@ -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
|
||||
|
Reference in New Issue
Block a user