public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: George G. Davis <gdavis@mvista.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] ARM1136: Fix cache_flush() error and correct cpu_init_crit() comments
Date: Wed, 5 May 2010 16:57:33 -0400	[thread overview]
Message-ID: <20100505205733.GA18436@mvista.com> (raw)

The ARM1136 cache_flush() function uses the "mcr p15, 0, rn, c7, c7, 0"
instruction which means "Invalidate Both Caches" when in fact the intent
is to "Clean and Invalidate Entire Data Cache".  So change the ARM1136
cache_flush() function to use the "mcr p15, 0, rn, c7, c7, 0 @ Clean &
invalidate D-Cache" instruction to insure that memory is consistent
with any dirty cache lines.

Also fix a couple of "flush v*" comments in ARM1136 cpu_init_crit() so
that they correctly describe the actual ARM1136 CP15 C7 Cache Operations
used.

Signed-off-by: George G. Davis <gdavis@mvista.com>
---
 arch/arm/cpu/arm1136/cpu.c   |    8 ++++----
 arch/arm/cpu/arm1136/start.S |    4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/cpu/arm1136/cpu.c b/arch/arm/cpu/arm1136/cpu.c
index ade7f46..a00698f 100644
--- a/arch/arm/cpu/arm1136/cpu.c
+++ b/arch/arm/cpu/arm1136/cpu.c
@@ -69,8 +69,8 @@ int cleanup_before_linux (void)
 
 static void cache_flush(void)
 {
-	unsigned long i = 0;
-
-	asm ("mcr p15, 0, %0, c7, c7, 0": :"r" (i));  /* invalidate both caches and flush btb */
-	asm ("mcr p15, 0, %0, c7, c10, 4": :"r" (i)); /* mem barrier to sync things */
+	asm (
+	"	mcr p15, 0, %0, c7, c14, 0	@ Clean & invalidate D-Cache\n"
+	"	mcr p15, 0, %0, c7, c10, 4	@ DSB\n"
+		: : "r" (0) : "memory");
 }
diff --git a/arch/arm/cpu/arm1136/start.S b/arch/arm/cpu/arm1136/start.S
index 957f438..922d01c 100644
--- a/arch/arm/cpu/arm1136/start.S
+++ b/arch/arm/cpu/arm1136/start.S
@@ -226,8 +226,8 @@ cpu_init_crit:
 	 * flush v4 I/D caches
 	 */
 	mov	r0, #0
-	mcr	p15, 0, r0, c7, c7, 0	/* flush v3/v4 cache */
-	mcr	p15, 0, r0, c8, c7, 0	/* flush v4 TLB */
+	mcr	p15, 0, r0, c7, c7, 0	/* Invalidate I+D+BTB caches */
+	mcr	p15, 0, r0, c8, c7, 0	/* Invalidate Unified TLB */
 
 	/*
 	 * disable MMU stuff and caches
-- 
1.6.3.3.328.ga9ee94

             reply	other threads:[~2010-05-05 20:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-05 20:57 George G. Davis [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-05-05 21:09 [U-Boot] [PATCH] ARM1136: Fix cache_flush() error and correct cpu_init_crit() comments George G. Davis
2010-05-10 14:02 ` Dirk Behme
2010-05-11  3:33   ` George G. Davis
2010-05-11  8:56     ` Wolfgang Denk
2010-05-11 13:13       ` George G. Davis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100505205733.GA18436@mvista.com \
    --to=gdavis@mvista.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox