diff options
author | Mike Frysinger | 2008-08-07 15:21:47 -0400 |
---|---|---|
committer | Mike Frysinger | 2008-10-23 05:03:50 -0400 |
commit | 50f0d211912a648e31aa9123b4665a0444bb8ca9 (patch) | |
tree | 5e65f4d336a93e4be0f8a4602cd79827129bea8b /lib_blackfin | |
parent | 3c8798983403cb68a827d7a0d09b1134524a1b7d (diff) |
Blackfin: unify cache handling code
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'lib_blackfin')
-rw-r--r-- | lib_blackfin/cache.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib_blackfin/cache.c b/lib_blackfin/cache.c index c2f6e2848ef..41e2a62d12d 100644 --- a/lib_blackfin/cache.c +++ b/lib_blackfin/cache.c @@ -11,6 +11,7 @@ #include <common.h> #include <asm/blackfin.h> +#include <asm/mach-common/bits/mpu.h> void flush_cache(unsigned long addr, unsigned long size) { @@ -24,3 +25,37 @@ void flush_cache(unsigned long addr, unsigned long size) if (dcache_status()) blackfin_dcache_flush_range((void *)addr, (void *)(addr + size)); } + +void icache_enable(void) +{ + bfin_write_IMEM_CONTROL(IMC | ENICPLB); + SSYNC(); +} + +void icache_disable(void) +{ + bfin_write_IMEM_CONTROL(0); + SSYNC(); +} + +int icache_status(void) +{ + return bfin_read_IMEM_CONTROL() & ENICPLB; +} + +void dcache_enable(void) +{ + bfin_write_DMEM_CONTROL(ACACHE_BCACHE | ENDCPLB | PORT_PREF0); + SSYNC(); +} + +void dcache_disable(void) +{ + bfin_write_DMEM_CONTROL(0); + SSYNC(); +} + +int dcache_status(void) +{ + return bfin_read_DMEM_CONTROL() & ENDCPLB; +} |