diff options
author | Mike Frysinger <vapier@gentoo.org> | 2008-10-06 07:35:44 (GMT) |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-01-28 18:26:12 (GMT) |
commit | 05b75e48832fc4afeecf8e76d704349557dffa35 (patch) | |
tree | 94fdae6bb39256105205cf8823f86b82e49aedd4 | |
parent | 68e5632494168095d75f120af70043b68afd2476 (diff) | |
download | u-boot-fsl-qoriq-05b75e48832fc4afeecf8e76d704349557dffa35.tar.xz |
Blackfin: fix dcache handling when doing dma memcpy's
Our dcache invalidate function doesn't just invalidate, it also flushes.
So rename the function accordingly and fix the dma_memcpy() function so it
doesn't inadvertently corrupt the data destination.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | cpu/blackfin/cache.S | 4 | ||||
-rw-r--r-- | include/asm-blackfin/blackfin_local.h | 2 | ||||
-rw-r--r-- | lib_blackfin/string.c | 11 |
3 files changed, 10 insertions, 7 deletions
diff --git a/cpu/blackfin/cache.S b/cpu/blackfin/cache.S index 51bdb30..9facadf 100644 --- a/cpu/blackfin/cache.S +++ b/cpu/blackfin/cache.S @@ -39,7 +39,7 @@ ENTRY(_blackfin_dcache_flush_range) RTS; ENDPROC(_blackfin_dcache_flush_range) -ENTRY(_blackfin_dcache_invalidate_range) +ENTRY(_blackfin_dcache_flush_invalidate_range) R2 = -32; R2 = R0 & R2; P0 = R2; @@ -58,4 +58,4 @@ ENTRY(_blackfin_dcache_invalidate_range) FLUSHINV[P0]; SSYNC; RTS; -ENDPROC(_blackfin_dcache_invalidate_range) +ENDPROC(_blackfin_dcache_flush_invalidate_range) diff --git a/include/asm-blackfin/blackfin_local.h b/include/asm-blackfin/blackfin_local.h index 6f0e662..c9ee91a 100644 --- a/include/asm-blackfin/blackfin_local.h +++ b/include/asm-blackfin/blackfin_local.h @@ -58,7 +58,7 @@ extern u_long get_sclk(void); extern void blackfin_icache_flush_range(const void *, const void *); extern void blackfin_dcache_flush_range(const void *, const void *); -extern void blackfin_dcache_invalidate_range(const void *, const void *); +extern void blackfin_dcache_flush_invalidate_range(const void *, const void *); /* Use DMA to move data from on chip to external memory. While this is * required for only L1 instruction (it is not directly readable by the diff --git a/lib_blackfin/string.c b/lib_blackfin/string.c index 2a56910..36eecdf 100644 --- a/lib_blackfin/string.c +++ b/lib_blackfin/string.c @@ -175,19 +175,22 @@ void dma_memcpy_nocache(void *dst, const void *src, size_t count) bfin_write_MDMA_D0_CONFIG(0); bfin_write_MDMA_S0_CONFIG(0); } +/* We should do a dcache invalidate on the destination after the dma, but since + * we lack such hardware capability, we'll flush/invalidate the destination + * before the dma and bank on the idea that u-boot is single threaded. + */ void *dma_memcpy(void *dst, const void *src, size_t count) { - if (dcache_status()) + if (dcache_status()) { blackfin_dcache_flush_range(src, src + count); + blackfin_dcache_flush_invalidate_range(dst, dst + count); + } dma_memcpy_nocache(dst, src, count); if (icache_status()) blackfin_icache_flush_range(dst, dst + count); - if (dcache_status()) - blackfin_dcache_invalidate_range(dst, dst + count); - return dst; } |