diff mbox

[U-Boot,6/8] arm: Turn of d-cache before i-cache

Message ID 1439726516-5461-7-git-send-email-sjoerd.simons@collabora.co.uk
State Superseded
Delegated to: Simon Glass
Headers show

Commit Message

Sjoerd Simons Aug. 16, 2015, 12:01 p.m. UTC
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
varoius rockchip u-boot forks (first disable d-cache then i-cache) makes
things work.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
---

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

Comments

Simon Glass Aug. 23, 2015, 9:24 p.m. UTC | #1
Hi Sjoerd,

On 16 August 2015 at 06:01, Sjoerd Simons <sjoerd.simons@collabora.co.uk> wrote:
> 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

U-Boot

> it's very early in the linux boot, but following the approach of the
> varoius rockchip u-boot forks (first disable d-cache then i-cache) makes

various

U-Boot

> things work.
>
> Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> ---
>
>  arch/arm/cpu/armv7/cpu.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

It would be good to get other reviews (e.g. Albert and Tom) to look at this one.

>
> 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();
> --
> 2.5.0
>

Regards,
Simon
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();