]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
microblaze: Add cache flush
authorMichal Simek <monstr@monstr.eu>
Mon, 5 Jan 2009 12:29:32 +0000 (13:29 +0100)
committerMichal Simek <monstr@monstr.eu>
Fri, 23 Jan 2009 09:39:59 +0000 (10:39 +0100)
include/configs/microblaze-generic.h
lib_microblaze/cache.c

index 867f885136cbda8b748f18130a1a7218a19bb12a..4c6cc9fef08d4b8e7427e96efd0d0ad8c409ba59 100644 (file)
        #define CONFIG_DOS_PARTITION
 #endif
 
+#if defined(XILINX_USE_ICACHE)
+       #define CONFIG_ICACHE
+#else
+       #undef CONFIG_ICACHE
+#endif
+
+#if defined(XILINX_USE_DCACHE)
+       #define CONFIG_DCACHE
+#else
+       #undef CONFIG_DCACHE
+#endif
+
 /*
  * BOOTP options
  */
 #include <config_cmd_default.h>
 
 #define CONFIG_CMD_ASKENV
-#define CONFIG_CMD_CACHE
 #define CONFIG_CMD_IRQ
 #define CONFIG_CMD_MFSL
 #define CONFIG_CMD_ECHO
 
+#if defined(CONFIG_DCACHE) || defined(CONFIG_ICACHE)
+       #define CONFIG_CMD_CACHE
+#else
+       #undef CONFIG_CMD_CACHE
+#endif
+
 #ifndef CONFIG_SYS_ENET
        #undef CONFIG_CMD_NET
 #else
index a2f7493b61ee7e42af154f443261fa173bf0980b..4b2e8e3790e6ef3b4197ecc765a441ebcfdabc2c 100644 (file)
 
 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");
 }