Blackfin arch: push cache flushing up to dma_memcpy
push cache flushing up to dma_memcpy() so that we call the flush functions just once Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
This commit is contained in:
parent
596b565bd1
commit
7ad883a94d
1 changed files with 14 additions and 11 deletions
|
@ -304,7 +304,7 @@ static void __dma_memcpy(u32 daddr, s16 dmod, u32 saddr, s16 smod, size_t cnt, u
|
||||||
* _dma_memcpy - translate C memcpy settings into MDMA settings
|
* _dma_memcpy - translate C memcpy settings into MDMA settings
|
||||||
*
|
*
|
||||||
* Handle all the high level steps before we touch the MDMA registers. So
|
* Handle all the high level steps before we touch the MDMA registers. So
|
||||||
* handle caching, tweaking of sizes, and formatting of addresses.
|
* handle direction, tweaking of sizes, and formatting of addresses.
|
||||||
*/
|
*/
|
||||||
static void *_dma_memcpy(void *pdst, const void *psrc, size_t size)
|
static void *_dma_memcpy(void *pdst, const void *psrc, size_t size)
|
||||||
{
|
{
|
||||||
|
@ -316,12 +316,6 @@ static void *_dma_memcpy(void *pdst, const void *psrc, size_t size)
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (bfin_addr_dcachable(src))
|
|
||||||
blackfin_dcache_flush_range(src, src + size);
|
|
||||||
|
|
||||||
if (bfin_addr_dcachable(dst))
|
|
||||||
blackfin_dcache_invalidate_range(dst, dst + size);
|
|
||||||
|
|
||||||
if (dst % 4 == 0 && src % 4 == 0 && size % 4 == 0) {
|
if (dst % 4 == 0 && src % 4 == 0 && size % 4 == 0) {
|
||||||
conf = WDSIZE_32;
|
conf = WDSIZE_32;
|
||||||
shift = 2;
|
shift = 2;
|
||||||
|
@ -360,15 +354,24 @@ static void *_dma_memcpy(void *pdst, const void *psrc, size_t size)
|
||||||
* up into two pieces. The first transfer is in multiples of 64k and the
|
* up into two pieces. The first transfer is in multiples of 64k and the
|
||||||
* second transfer is the piece smaller than 64k.
|
* second transfer is the piece smaller than 64k.
|
||||||
*/
|
*/
|
||||||
void *dma_memcpy(void *dst, const void *src, size_t size)
|
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;
|
size_t bulk, rest;
|
||||||
|
|
||||||
|
if (bfin_addr_dcachable(src))
|
||||||
|
blackfin_dcache_flush_range(src, src + size);
|
||||||
|
|
||||||
|
if (bfin_addr_dcachable(dst))
|
||||||
|
blackfin_dcache_invalidate_range(dst, dst + size);
|
||||||
|
|
||||||
bulk = size & ~0xffff;
|
bulk = size & ~0xffff;
|
||||||
rest = size - bulk;
|
rest = size - bulk;
|
||||||
if (bulk)
|
if (bulk)
|
||||||
_dma_memcpy(dst, src, bulk);
|
_dma_memcpy(pdst, psrc, bulk);
|
||||||
_dma_memcpy(dst + bulk, src + bulk, rest);
|
_dma_memcpy(pdst + bulk, psrc + bulk, rest);
|
||||||
return dst;
|
return pdst;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(dma_memcpy);
|
EXPORT_SYMBOL(dma_memcpy);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue