summaryrefslogtreecommitdiff
path: root/lib_blackfin/cache.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2008-11-04 00:04:03 -0500
committerMike Frysinger <vapier@gentoo.org>2009-02-02 12:24:44 -0500
commitfdce83c108846d6f0d5b1774e1cc29f2573a6ad3 (patch)
tree139791e83afe2517baa6ac1867565c580e91219e /lib_blackfin/cache.c
parent84c5f0dc47d17593fd81206614891bdc94f6d51c (diff)
Blackfin: rewrite cache handling functions
Take the cache flush functions from the kernel as they use hardware loops in order to get optimal performance. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'lib_blackfin/cache.c')
-rw-r--r--lib_blackfin/cache.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib_blackfin/cache.c b/lib_blackfin/cache.c
index 870c5bfbac..1557864f9c 100644
--- a/lib_blackfin/cache.c
+++ b/lib_blackfin/cache.c
@@ -15,15 +15,25 @@
void flush_cache(unsigned long addr, unsigned long size)
{
+ void *start_addr, *end_addr;
+ int istatus, dstatus;
+
/* no need to flush stuff in on chip memory (L1/L2/etc...) */
if (addr >= 0xE0000000)
return;
- if (icache_status())
- blackfin_icache_flush_range((void *)addr, (void *)(addr + size));
+ start_addr = (void *)addr;
+ end_addr = (void *)(addr + size);
+ istatus = icache_status();
+ dstatus = dcache_status();
- if (dcache_status())
- blackfin_dcache_flush_range((void *)addr, (void *)(addr + size));
+ if (istatus) {
+ if (dstatus)
+ blackfin_icache_dcache_flush_range(start_addr, end_addr);
+ else
+ blackfin_icache_flush_range(start_addr, end_addr);
+ } else if (dstatus)
+ blackfin_dcache_flush_range(start_addr, end_addr);
}
void icache_enable(void)