[U-Boot,3/3] ARM: rmobile: Fix to enable icache early in Gen3

Message ID 20181207151429.5172-3-marek.vasut+renesas@gmail.com
State Accepted
Commit 5055a4e9008dcb8db78b98ad6a700605cd3ae0e9
Delegated to: Marek Vasut
Headers show
Series
  • [U-Boot,1/3] ARM: rcar_gen3: fix protection area access error at Cortex-A53
Related show

Commit Message

Marek Vasut Dec. 7, 2018, 3:14 p.m.
From: Takeshi Kihara <takeshi.kihara.df@renesas.com>

This patch fixes the problem that u-boot will not start unless icache is
enabled early.

Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
Signed-off-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
---
 arch/arm/mach-rmobile/cpu_info.c    | 4 ++--
 arch/arm/mach-rmobile/memmap-gen3.c | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

Patch

diff --git a/arch/arm/mach-rmobile/cpu_info.c b/arch/arm/mach-rmobile/cpu_info.c
index 65a9ca8c01..aa5be52dfd 100644
--- a/arch/arm/mach-rmobile/cpu_info.c
+++ b/arch/arm/mach-rmobile/cpu_info.c
@@ -7,8 +7,6 @@ 
 #include <asm/io.h>
 #include <linux/ctype.h>
 
-/* R-Car Gen3 caches are enabled in memmap-gen3.c */
-#ifndef CONFIG_RCAR_GEN3
 #ifdef CONFIG_ARCH_CPU_INIT
 int arch_cpu_init(void)
 {
@@ -17,6 +15,8 @@  int arch_cpu_init(void)
 }
 #endif
 
+/* R-Car Gen3 D-cache is enabled in memmap-gen3.c */
+#ifndef CONFIG_RCAR_GEN3
 #ifndef CONFIG_SYS_DCACHE_OFF
 void enable_caches(void)
 {
diff --git a/arch/arm/mach-rmobile/memmap-gen3.c b/arch/arm/mach-rmobile/memmap-gen3.c
index 3c0f3548cb..1a9eb72bb9 100644
--- a/arch/arm/mach-rmobile/memmap-gen3.c
+++ b/arch/arm/mach-rmobile/memmap-gen3.c
@@ -140,6 +140,8 @@  void enable_caches(void)
 		gen3_mem_map[i].attrs = 0;
 	}
 
-	icache_enable();
+	if (!icache_status())
+		icache_enable();
+
 	dcache_enable();
 }