microblaze: Consolidate cache code
monstr at monstr.eu
maintainerPATCH 1/1 microblaze: Consolidate cache code
From: Michal Simek <[email protected]>
Merge cpu and lib cache code.
Flush cache before disabling.
Signed-off-by Michal Simek <[email protected]>
--- arch/microblaze/cpu/cache.c | 28 +++++++++++++++++++++++++++ arch/microblaze/lib/Makefile | 1 - arch/microblaze/lib/cache.c | 43 ------------------------------------------ 3 files changed, 28 insertions(+), 44 deletions(-) delete mode 100644 arch/microblaze/lib/cache.c
arch/microblaze/cpu/cache.c +28 -0
@@ -50,6 +50,8 @@ void icache_enable (void) { }void icache_disable (void ) { +/* we are not generate ICACHE size -> flush whole cache */ +flush_cache (0 ,32768 );MSRCLR (0x20 ); }
@@ -58,5 +60,31 @@ void dcache_enable (void) { }void dcache_disable (void ) { +#ifdef XILINX_USE_DCACHE +#ifdef XILINX_DCACHE_BYTE_SIZE +flush_cache (0 ,XILINX_DCACHE_BYTE_SIZE ); +#else +#warning please rebuild BSPs and update configuration +flush_cache (0 ,32768 ); +#endif +#endif MSRCLR (0x80 ); } + +void flush_cache (ulong addr,ulong size) +{ +int i; +for (i =0 ; i < size; i +=4 ) + asmvolatile ( +#ifdef CONFIG_ICACHE + "wic %0, r0;" +#endif + "nop;" +#ifdef CONFIG_DCACHE + "wdc.flush %0, r0;" +#endif +"nop;" + : + :"r" (addr + i) + :"memory" ); +}
arch/microblaze/lib/Makefile +0 -1
@@ -29,7 +29,6 @@ SOBJS-y += COBJS-y += board.o COBJS-y += bootm.o -COBJS-y += cache.o COBJS-y += time.o SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
arch/microblaze/lib/cache.c deleted +0 -43
43 lines not on this page · raw message
Signature · 1 line
1.5.5.1