[U-Boot] [PATCH 15/18] ARC: implement function to cleanup caches before linux

Eugeniy Paltsev Eugeniy.Paltsev at synopsys.com
Tue Feb 13 17:34:48 UTC 2018


Implement specialized function to clenup caches (and therefore
sync I/D caches) which can be used for cleanup before linux
launch instead of flush_dcache_all/invalidate_icache_all pair.
It also allow us to safely invalidate L1 D$ and SLC before
linux launch.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev at synopsys.com>
---
 arch/arc/include/asm/cache.h |  1 +
 arch/arc/lib/bootm.c         |  4 ++--
 arch/arc/lib/cache.c         | 10 ++++++++++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h
index 6300676..7f1c247 100644
--- a/arch/arc/include/asm/cache.h
+++ b/arch/arc/include/asm/cache.h
@@ -32,6 +32,7 @@
 void cache_init(void);
 void flush_n_invalidate_dcache_all(void);
 void sync_icache_dcache_all(void);
+void sync_n_cleanup_cache_all(void);
 
 static const inline int is_ioc_enabled(void)
 {
diff --git a/arch/arc/lib/bootm.c b/arch/arc/lib/bootm.c
index 9eef707..c6800cb 100644
--- a/arch/arc/lib/bootm.c
+++ b/arch/arc/lib/bootm.c
@@ -4,6 +4,7 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
+#include <asm/cache.h>
 #include <common.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -45,8 +46,7 @@ int arch_fixup_fdt(void *blob)
 static int cleanup_before_linux(void)
 {
 	disable_interrupts();
-	flush_dcache_all();
-	invalidate_icache_all();
+	sync_n_cleanup_cache_all();
 
 	return 0;
 }
diff --git a/arch/arc/lib/cache.c b/arch/arc/lib/cache.c
index 76602ae..c706fbd 100644
--- a/arch/arc/lib/cache.c
+++ b/arch/arc/lib/cache.c
@@ -501,3 +501,13 @@ void sync_icache_dcache_all(void)
 	__dc_entire_op(OP_FLUSH);
 	__ic_entire_invalidate();
 }
+
+void sync_n_cleanup_cache_all(void)
+{
+	__dc_entire_op(OP_FLUSH_N_INV);
+
+	if (is_isa_arcv2())
+		__slc_entire_op(OP_FLUSH_N_INV);
+
+	__ic_entire_invalidate();
+}
-- 
2.9.3



More information about the U-Boot mailing list