1 From 72e1ab470e483c91ab3aa38bec31faf3dad52735 Mon Sep 17 00:00:00 2001
2 From: Mans Rullgard <mans@mansr.com>
3 Date: Wed, 14 Apr 2010 12:08:00 +0100
4 Subject: [PATCH 28/50] OMAP3: fix and clean up L2 cache enable/disable functions
6 On OMAP34xx ES1.0, the L2 enable bit can only be set in secure mode,
7 so an SMC call to the ROM monitor is required. On later versions,
8 and on newer devices, this bit is banked and we can set it directly.
10 The code checked only the ES revision of the chip, and hence incorrectly
11 used the ROM call on ES1.0 versions of other devices.
13 This patch adds a check for chip family as well as revision, and also
14 removes some code duplication between the enable and disable functions.
16 Signed-off-by: Mans Rullgard <mans@mansr.com>
18 cpu/arm_cortexa8/omap3/cache.S | 74 +++++++++++-----------------------------
19 1 files changed, 20 insertions(+), 54 deletions(-)
21 diff --git a/cpu/arm_cortexa8/omap3/cache.S b/cpu/arm_cortexa8/omap3/cache.S
22 index 0f63815..16afb5d 100644
23 --- a/cpu/arm_cortexa8/omap3/cache.S
24 +++ b/cpu/arm_cortexa8/omap3/cache.S
25 @@ -128,64 +128,30 @@ finished_inval:
27 ldmfd r13!, {r0 - r5, r7, r9 - r12, pc}
31 - push {r0, r1, r2, lr}
32 - @ ES2 onwards we can disable/enable L2 ourselves
37 - cmp r0, #CPU_3XX_ES20
38 - blt l2_cache_disable_EARLIER_THAN_ES2
39 - mrc 15, 0, r3, cr1, cr0, 1
41 - mcr 15, 0, r3, cr1, cr0, 1
42 - b l2_cache_enable_END
43 -l2_cache_enable_EARLIER_THAN_ES2:
44 - @ Save r0, r12 and restore them after usage
51 + @ ES2 onwards we can disable/enable L2 ourselves
52 + cmp r0, #CPU_OMAP34XX
53 + cmpeq r4, #CPU_3XX_ES10
54 + mrc 15, 0, r0, cr1, cr0, 1
56 + orr r0, r0, r5, lsl #1
57 + mcreq 15, 0, r0, cr1, cr0, 1
58 @ GP Device ROM code API usage here
59 @ r12 = AUXCR Write function and r0 value
62 - mrc 15, 0, r0, cr1, cr0, 1
64 - @ SMI instruction to call ROM Code API
70 - pop {r1, r2, r3, pc}
71 + @ SMCNE instruction to call ROM Code API
80 - push {r0, r1, r2, lr}
81 - @ ES2 onwards we can disable/enable L2 ourselves
83 - cmp r0, #CPU_3XX_ES20
84 - blt l2_cache_disable_EARLIER_THAN_ES2
85 - mrc 15, 0, r3, cr1, cr0, 1
87 - mcr 15, 0, r3, cr1, cr0, 1
88 - b l2_cache_disable_END
89 -l2_cache_disable_EARLIER_THAN_ES2:
90 - @ Save r0, r12 and restore them after usage
95 - @ GP Device ROM code API usage here
96 - @ r12 = AUXCR Write function and r0 value
99 - mrc 15, 0, r0, cr1, cr0, 1
101 - @ SMI instruction to call ROM Code API
106 -l2_cache_disable_END:
107 - pop {r1, r2, r3, pc}