[U-Boot] [U-BOOT] [PATCH] arm: fix flush cache function on arm926ejs

Lei Wen leiwen at marvell.com
Tue Jan 11 16:40:20 CET 2011


flush_cache function should only be called when the dcache is on.
And original flush method for arm926ejs seems don't work, replace
it with new version.

Test on Marvell Pantheon pxa920 board with usb ether function.

Signed-off-by: Lei Wen <leiwen at marvell.com>
---
 arch/arm/lib/cache.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/lib/cache.c b/arch/arm/lib/cache.c
index 30686fe..b8d5eee 100644
--- a/arch/arm/lib/cache.c
+++ b/arch/arm/lib/cache.c
@@ -27,16 +27,16 @@
 
 void  flush_cache (unsigned long dummy1, unsigned long dummy2)
 {
+	if (!dcache_status())
+		return;
 #if defined(CONFIG_OMAP2420) || defined(CONFIG_ARM1136)
 	void arm1136_cache_flush(void);
 
 	arm1136_cache_flush();
 #endif
 #ifdef CONFIG_ARM926EJS
-	/* test and clean, page 2-23 of arm926ejs manual */
-	asm("0: mrc p15, 0, r15, c7, c10, 3\n\t" "bne 0b\n" : : : "memory");
-	/* disable write buffer as well (page 2-22) */
-	asm("mcr p15, 0, %0, c7, c10, 4" : : "r" (0));
+	/* clean & invalidate all D cache */
+	asm("mcr p15, 0, %0, c7, c14, 0" : : "r" (0));
 #endif
 #ifdef CONFIG_OMAP34XX
 	void v7_flush_cache_all(void);
-- 
1.7.0.4



More information about the U-Boot mailing list