diff mbox

[v5,38/41] arm: Turn of d-cache before i-cache

Message ID 1440975352-28528-39-git-send-email-sjg@chromium.org
State Accepted
Commit 81b0618ddf449aab669b42068ad8c90f63714c14
Headers show

Commit Message

Simon Glass Aug. 30, 2015, 10:55 p.m. UTC
From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>

Booting the kernel fails on RK3288 (and probably other rockchip SoCs)
when the i-cache is disabled/flushed before d-cache.

I have not investigated whether this is due to U-Boot hanging or whether
it's very early in the linux boot, but following the approach of the
various rockchip U-Boot forks (first disable d-cache then i-cache) makes
things work.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/cpu/armv7/cpu.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Comments

Simon Glass Sept. 3, 2015, 6 p.m. UTC | #1
On 30 August 2015 at 16:55, Simon Glass <sjg@chromium.org> wrote:
> From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
>
> Booting the kernel fails on RK3288 (and probably other rockchip SoCs)
> when the i-cache is disabled/flushed before d-cache.
>
> I have not investigated whether this is due to U-Boot hanging or whether
> it's very early in the linux boot, but following the approach of the
> various rockchip U-Boot forks (first disable d-cache then i-cache) makes
> things work.
>
> Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v5: None
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
>
>  arch/arm/cpu/armv7/cpu.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)

I have not seen any comments on this patch. It looks safe and more
correct to me. Please chime in if you see problem.

Applied to u-boot-rockchip, thanks!
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/cpu.c b/arch/arm/cpu/armv7/cpu.c
index 0b0e500..6eac5ef 100644
--- a/arch/arm/cpu/armv7/cpu.c
+++ b/arch/arm/cpu/armv7/cpu.c
@@ -36,12 +36,6 @@  int cleanup_before_linux_select(int flags)
 	disable_interrupts();
 #endif
 
-	/*
-	 * Turn off I-cache and invalidate it
-	 */
-	icache_disable();
-	invalidate_icache_all();
-
 	if (flags & CBL_DISABLE_CACHES) {
 		/*
 		* turn off D-cache
@@ -61,7 +55,16 @@  int cleanup_before_linux_select(int flags)
 		* to avoid coherency problems for kernel
 		*/
 		invalidate_dcache_all();
+
+		icache_disable();
+		invalidate_icache_all();
 	} else {
+		/*
+		 * Turn off I-cache and invalidate it
+		 */
+		icache_disable();
+		invalidate_icache_all();
+
 		flush_dcache_all();
 		invalidate_icache_all();
 		icache_enable();