diff options
author | Mike Frysinger <vapier.adi@gmail.com> | 2009-01-07 10:14:39 -0500 |
---|---|---|
committer | Bryan Wu <cooloney@kernel.org> | 2009-01-07 10:14:39 -0500 |
commit | 7ad883a94df143dcef5d83fde424b2ec27833c71 (patch) | |
tree | 23059d47a852ae4f36d81f2ab6b6189d13aecca9 | |
parent | 596b565bd10167bc6820aa09c1d3233b23743615 (diff) |
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>
-rw-r--r-- | arch/blackfin/kernel/bfin_dma_5xx.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c index 9c36b2d172d0..07e02c0d1c07 100644 --- a/arch/blackfin/kernel/bfin_dma_5xx.c +++ b/arch/blackfin/kernel/bfin_dma_5xx.c | |||
@@ -304,7 +304,7 @@ static void __dma_memcpy(u32 daddr, s16 dmod, u32 saddr, s16 smod, size_t cnt, u | |||
304 | * _dma_memcpy - translate C memcpy settings into MDMA settings | 304 | * _dma_memcpy - translate C memcpy settings into MDMA settings |
305 | * | 305 | * |
306 | * Handle all the high level steps before we touch the MDMA registers. So | 306 | * Handle all the high level steps before we touch the MDMA registers. So |
307 | * handle caching, tweaking of sizes, and formatting of addresses. | 307 | * handle direction, tweaking of sizes, and formatting of addresses. |
308 | */ | 308 | */ |
309 | static void *_dma_memcpy(void *pdst, const void *psrc, size_t size) | 309 | static void *_dma_memcpy(void *pdst, const void *psrc, size_t size) |
310 | { | 310 | { |
@@ -316,12 +316,6 @@ static void *_dma_memcpy(void *pdst, const void *psrc, size_t size) | |||
316 | if (size == 0) | 316 | if (size == 0) |
317 | return NULL; | 317 | return NULL; |
318 | 318 | ||
319 | if (bfin_addr_dcachable(src)) | ||
320 | blackfin_dcache_flush_range(src, src + size); | ||
321 | |||
322 | if (bfin_addr_dcachable(dst)) | ||
323 | blackfin_dcache_invalidate_range(dst, dst + size); | ||
324 | |||
325 | if (dst % 4 == 0 && src % 4 == 0 && size % 4 == 0) { | 319 | if (dst % 4 == 0 && src % 4 == 0 && size % 4 == 0) { |
326 | conf = WDSIZE_32; | 320 | conf = WDSIZE_32; |
327 | shift = 2; | 321 | shift = 2; |
@@ -360,15 +354,24 @@ static void *_dma_memcpy(void *pdst, const void *psrc, size_t size) | |||
360 | * up into two pieces. The first transfer is in multiples of 64k and the | 354 | * up into two pieces. The first transfer is in multiples of 64k and the |
361 | * second transfer is the piece smaller than 64k. | 355 | * second transfer is the piece smaller than 64k. |
362 | */ | 356 | */ |
363 | void *dma_memcpy(void *dst, const void *src, size_t size) | 357 | void *dma_memcpy(void *pdst, const void *psrc, size_t size) |
364 | { | 358 | { |
359 | unsigned long dst = (unsigned long)pdst; | ||
360 | unsigned long src = (unsigned long)psrc; | ||
365 | size_t bulk, rest; | 361 | size_t bulk, rest; |
362 | |||
363 | if (bfin_addr_dcachable(src)) | ||
364 | blackfin_dcache_flush_range(src, src + size); | ||
365 | |||
366 | if (bfin_addr_dcachable(dst)) | ||
367 | blackfin_dcache_invalidate_range(dst, dst + size); | ||
368 | |||
366 | bulk = size & ~0xffff; | 369 | bulk = size & ~0xffff; |
367 | rest = size - bulk; | 370 | rest = size - bulk; |
368 | if (bulk) | 371 | if (bulk) |
369 | _dma_memcpy(dst, src, bulk); | 372 | _dma_memcpy(pdst, psrc, bulk); |
370 | _dma_memcpy(dst + bulk, src + bulk, rest); | 373 | _dma_memcpy(pdst + bulk, psrc + bulk, rest); |
371 | return dst; | 374 | return pdst; |
372 | } | 375 | } |
373 | EXPORT_SYMBOL(dma_memcpy); | 376 | EXPORT_SYMBOL(dma_memcpy); |
374 | 377 | ||