diff mbox

[U-Boot,1/2] Flush the date cache before disabling it.

Message ID 1326133550-6706-1-git-send-email-urwithsughosh@gmail.com
State Superseded
Headers show

Commit Message

Sughosh Ganu Jan. 9, 2012, 6:25 p.m. UTC
The current implementation invalidates the cache instead of flushing
it. This causes problems on platforms where the spl/u-boot is already
loaded to the RAM, with caches enabled by a first stage bootloader.

The V bit of the cp15's control register c1 is set to the value of
VINITHI on reset. Do not clear this bit by default, as there are SOC's
with no valid memory region at 0x0.

Signed-off-by: Sughosh Ganu <urwithsughosh@gmail.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
---
 arch/arm/cpu/arm926ejs/start.S |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

Comments

Mike Frysinger Jan. 9, 2012, 6:41 p.m. UTC | #1
On Monday 09 January 2012 13:25:50 Sughosh Ganu wrote:
>  arch/arm/cpu/arm926ejs/start.S |   10 +++++++---

your patch summary should include a relevant prefix.  something like "arm: " or 
"arm926: ".  that way non-arm people can ignore this.
-mike
Sughosh Ganu Jan. 9, 2012, 6:51 p.m. UTC | #2
On Mon Jan 09, 2012 at 01:41:58PM -0500, Mike Frysinger wrote:
> On Monday 09 January 2012 13:25:50 Sughosh Ganu wrote:
> >  arch/arm/cpu/arm926ejs/start.S |   10 +++++++---
> 
> your patch summary should include a relevant prefix.  something like "arm: " or 
> "arm926: ".  that way non-arm people can ignore this.
> -mike

  Yep, realised that after i sent the patch. Sorry about that.

-sughosh
diff mbox

Patch

diff --git a/arch/arm/cpu/arm926ejs/start.S b/arch/arm/cpu/arm926ejs/start.S
index 6a09c02..112f708 100644
--- a/arch/arm/cpu/arm926ejs/start.S
+++ b/arch/arm/cpu/arm926ejs/start.S
@@ -355,17 +355,21 @@  _dynsym_start_ofs:
  */
 cpu_init_crit:
 	/*
-	 * flush v4 I/D caches
+	 * flush D cache before disabling it
 	 */
 	mov	r0, #0
-	mcr	p15, 0, r0, c7, c7, 0	/* flush v3/v4 cache */
+flush_dcache:
+	mrc	p15, 0, r15, c7, c10, 3
+	bne	flush_dcache
+
+	mov	r0, #0
 	mcr	p15, 0, r0, c8, c7, 0	/* flush v4 TLB */
 
 	/*
 	 * disable MMU stuff and caches
 	 */
 	mrc	p15, 0, r0, c1, c0, 0
-	bic	r0, r0, #0x00002300	/* clear bits 13, 9:8 (--V- --RS) */
+	bic	r0, r0, #0x00000300	/* clear bits 13, 9:8 ( --RS) */
 	bic	r0, r0, #0x00000087	/* clear bits 7, 2:0 (B--- -CAM) */
 	orr	r0, r0, #0x00000002	/* set bit 2 (A) Align */
 	orr	r0, r0, #0x00001000	/* set bit 12 (I) I-Cache */