All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Sakoman <steve@sakoman.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 03/11] ARMV7: OMAP3: Fix and clean up L2 cache enable/disable functions
Date: Tue, 31 Aug 2010 16:21:19 -0700	[thread overview]
Message-ID: <1283296887-8631-4-git-send-email-steve@sakoman.com> (raw)
In-Reply-To: <1283296887-8631-1-git-send-email-steve@sakoman.com>

From: Mans Rullgard <mans@mansr.com>

On OMAP34xx ES1.0, the L2 enable bit can only be set in secure mode,
so an SMC call to the ROM monitor is required.  On later versions,
and on newer devices, this bit is banked and we can set it directly.

The code checked only the ES revision of the chip, and hence incorrectly
used the ROM call on ES1.0 versions of other devices.

This patch adds a check for chip family as well as revision, and also
removes some code duplication between the enable and disable functions.

Signed-off-by: Mans Rullgard <mans@mansr.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 arch/arm/cpu/armv7/omap3/cache.S |   75 +++++++++++---------------------------
 1 files changed, 21 insertions(+), 54 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap3/cache.S b/arch/arm/cpu/armv7/omap3/cache.S
index 4b65ac5..cb7ca11 100644
--- a/arch/arm/cpu/armv7/omap3/cache.S
+++ b/arch/arm/cpu/armv7/omap3/cache.S
@@ -128,64 +128,31 @@ finished_inval:
 
 	ldmfd	r13!, {r0 - r5, r7, r9 - r12, pc}
 
-
-l2_cache_enable:
-	stmfd	r13!, {r0, r1, r2, lr}
-	@ ES2 onwards we can disable/enable L2 ourselves
+l2_cache_set:
+	stmfd	r13!, {r4 - r6, lr}
+	mov	r5,  r0
 	bl	get_cpu_rev
-	cmp	r0, #CPU_3XX_ES20
-	blt	l2_cache_disable_EARLIER_THAN_ES2
-	mrc	15, 0, r3, cr1, cr0, 1
-	orr	r3, r3, #2
-	mcr	15, 0, r3, cr1, cr0, 1
-	b	l2_cache_enable_END
-l2_cache_enable_EARLIER_THAN_ES2:
-	@ Save r0, r12 and restore them after usage
-	mov	r3, ip
-	str	r3, [sp, #4]
-	mov	r3, r0
-	@
+	mov	r4,  r0
+	bl	get_cpu_family
+	@ ES2 onwards we can disable/enable L2 ourselves
+	cmp	r0,  #CPU_OMAP34XX
+	cmpeq	r4,  #CPU_3XX_ES10
+	mrc	15, 0, r0, cr1, cr0, 1
+	bic	r0, r0, #2
+	orr	r0, r0, r5, lsl #1
+	mcreq	15, 0, r0, cr1, cr0, 1
 	@ GP Device ROM code API usage here
 	@ r12 = AUXCR Write function and r0 value
-	@
 	mov	ip, #3
-	mrc	15, 0, r0, cr1, cr0, 1
-	orr	r0, r0, #2
-	@ SMI instruction to call ROM Code API
-	.word	0xe1600070
-	mov	r0, r3
-	mov	ip, r3
-	str	r3, [sp, #4]
-l2_cache_enable_END:
-	ldmfd	r13!, {r1, r2, r3, pc}
+	@ SMCNE instruction to call ROM Code API
+	.word	0x11600070
+	ldmfd	r13!, {r4 - r6, pc}
 
+l2_cache_enable:
+	mov	r0, #1
+	b	l2_cache_set
 
 l2_cache_disable:
-	stmfd	r13!, {r0, r1, r2, lr}
-	@ ES2 onwards we can disable/enable L2 ourselves
-	bl	get_cpu_rev
-	cmp	r0, #CPU_3XX_ES20
-	blt	l2_cache_disable_EARLIER_THAN_ES2
-	mrc	15, 0, r3, cr1, cr0, 1
-	bic	r3, r3, #2
-	mcr	15, 0, r3, cr1, cr0, 1
-	b	l2_cache_disable_END
-l2_cache_disable_EARLIER_THAN_ES2:
-	@ Save r0, r12 and restore them after usage
-	mov	r3, ip
-	str	r3, [sp, #4]
-	mov	r3, r0
-	@
-	@ GP Device ROM code API usage here
-	@ r12 = AUXCR Write function and r0 value
-	@
-	mov	ip, #3
-	mrc	15, 0, r0, cr1, cr0, 1
-	bic	r0, r0, #2
-	@ SMI instruction to call ROM Code API
-	.word	0xe1600070
-	mov	r0, r3
-	mov	ip, r3
-	str	r3, [sp, #4]
-l2_cache_disable_END:
-	ldmfd	r13!, {r1, r2, r3, pc}
+	mov	r0, #0
+	b	l2_cache_set
+
-- 
1.7.0.4

  parent reply	other threads:[~2010-08-31 23:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-31 23:21 [U-Boot] [PATCH 00/11] ARMV7: OMAP: Add support for OMAP36XX/37XX, cleanup OMAP3 common code Steve Sakoman
2010-08-31 23:21 ` [U-Boot] [PATCH 01/11] ARMV7: OMAP3: Update CPU type detection for AM35XX/OMAP36XX/37XX Steve Sakoman
2010-08-31 23:21 ` [U-Boot] [PATCH 02/11] ARMV7: OMAP3: Add clock setup for OMAP36XX/37XX Steve Sakoman
2010-08-31 23:21 ` Steve Sakoman [this message]
2010-08-31 23:21 ` [U-Boot] [PATCH 04/11] ARMV7: OMAP3: Convert setup_auxcr() to pure asm Steve Sakoman
2010-08-31 23:21 ` [U-Boot] [PATCH 05/11] ARMV7: OMAP3: Apply Cortex-A8 errata workarounds only on affected revisions Steve Sakoman
2010-08-31 23:21 ` [U-Boot] [PATCH 06/11] ARMV7: OMAP3: Fix broken reset command on OMAP36XX/37XX and OMAP4 Steve Sakoman
2010-08-31 23:21 ` [U-Boot] [PATCH 07/11] ARMV7: OMAP3: Remove erroneous hard coded sdram setup for 128MB/bank Steve Sakoman
2010-08-31 23:21 ` [U-Boot] [PATCH 08/11] mtd: nand: honor CONFIG_SYS_NAND_QUIET_TEST with unknown NAND printk Steve Sakoman
2010-09-01  0:18   ` Paulraj, Sandeep
2010-09-01 16:26     ` Scott Wood
2010-09-01 16:43       ` Steve Sakoman
2010-09-01 17:55         ` Scott Wood
2010-09-02 15:33           ` [U-Boot] [PATCH V2 08/11] mtd: nand: supress 'unknown NAND' warning if no nand is found Steve Sakoman
2010-09-04 17:38             ` Paulraj, Sandeep
2010-09-04 20:16               ` Steve Sakoman
2010-09-07 17:37               ` Scott Wood
2010-09-07 21:27               ` Steve Sakoman
2010-09-05 10:59             ` Sergei Shtylyov
2010-09-05 21:37               ` Steve Sakoman
2010-09-07 17:37                 ` Scott Wood
2010-08-31 23:21 ` [U-Boot] [PATCH 09/11] ARMV7: OMAP3: Add CONFIG_SYS_NAND_QUIET_TEST to Beagle and Overo configs Steve Sakoman
2010-08-31 23:21 ` [U-Boot] [PATCH 10/11] ARMV7: OMAP3: Add support for Beagle xM Steve Sakoman
2010-08-31 23:21 ` [U-Boot] [PATCH 11/11] ARMV7: OMAP: Overo: Autodetect presence/absence of transceiver on mmc2 Steve Sakoman
2010-08-31 23:35 ` [U-Boot] [PATCH 00/11] ARMV7: OMAP: Add support for OMAP36XX/37XX, cleanup OMAP3 common code Steve Sakoman
2010-09-01  0:20   ` Paulraj, Sandeep

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=1283296887-8631-4-git-send-email-steve@sakoman.com \
    --to=steve@sakoman.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.