microblaze: Add cache flush

This commit is contained in:
Michal Simek 2009-01-05 13:29:32 +01:00
parent b4f8dda35b
commit e9b737deb2
2 changed files with 32 additions and 3 deletions

View file

@ -194,6 +194,18 @@
#define CONFIG_DOS_PARTITION #define CONFIG_DOS_PARTITION
#endif #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 * BOOTP options
*/ */
@ -208,11 +220,16 @@
#include <config_cmd_default.h> #include <config_cmd_default.h>
#define CONFIG_CMD_ASKENV #define CONFIG_CMD_ASKENV
#define CONFIG_CMD_CACHE
#define CONFIG_CMD_IRQ #define CONFIG_CMD_IRQ
#define CONFIG_CMD_MFSL #define CONFIG_CMD_MFSL
#define CONFIG_CMD_ECHO #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 #ifndef CONFIG_SYS_ENET
#undef CONFIG_CMD_NET #undef CONFIG_CMD_NET
#else #else

View file

@ -26,6 +26,18 @@
void flush_cache (ulong addr, ulong size) void flush_cache (ulong addr, ulong size)
{ {
/* MicroBlaze have write thruough cache. nothing to do. */ int i;
return; 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");
} }