summaryrefslogtreecommitdiff
path: root/lib_microblaze/cache.c
diff options
context:
space:
mode:
authorMichal Simek <monstr@monstr.eu>2009-01-05 13:29:32 +0100
committerMichal Simek <monstr@monstr.eu>2009-01-23 10:39:59 +0100
commite9b737deb2c30125362d20e24170617476026e94 (patch)
tree5343cda3a837595ed07fbefb8402a96936bcbe1d /lib_microblaze/cache.c
parentb4f8dda35bfad447b4106828232705b2e878d168 (diff)
microblaze: Add cache flush
Diffstat (limited to 'lib_microblaze/cache.c')
-rw-r--r--lib_microblaze/cache.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib_microblaze/cache.c b/lib_microblaze/cache.c
index a2f7493b61e..4b2e8e3790e 100644
--- a/lib_microblaze/cache.c
+++ b/lib_microblaze/cache.c
@@ -26,6 +26,18 @@
void flush_cache (ulong addr, ulong size)
{
- /* MicroBlaze have write thruough cache. nothing to do. */
- return;
+ int i;
+ for (i = 0; i < size; i += 4)
+ asm volatile (
+#ifdef CONFIG_ICACHE
+ "wic %0, r0;"
+#endif
+ "nop;"
+#ifdef CONFIG_DCACHE
+ "wdc %0, r0;"
+#endif
+ "nop;"
+ :
+ : "r" (addr + i)
+ : "memory");
}