aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2011-09-06 02:45:46 -0400
committerChristopher Kenna <cjk@cs.unc.edu>2012-10-11 18:30:58 -0400
commitb3abe8eabc2dad0a63fe21d0451fc2e2e8a8b777 (patch)
tree7017be60ae667eb098122181ee8a2ac3ca87fc76
parent549f0df67a3346fecc8bebe04d21a2c24045c093 (diff)
ARM: 7080/1: l2x0: make sure I&D are not locked down on init
Fighting unfixed U-Boots and other beasts that may the cache in a locked-down state when starting the kernel, we make sure to disable all cache lock-down when initializing the l2x0 so we are in a known state. Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> Cc: Rabin Vincent <rabin.vincent@stericsson.com> Cc: Adrian Bunk <adrian.bunk@movial.com> Cc: Rob Herring <robherring2@gmail.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will.deacon@arm.com> Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Reported-by: Jan Rinze <janrinze@gmail.com> Tested-by: Robert Marklund <robert.marklund@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Christopher Kenna <cjk@cs.unc.edu>
-rw-r--r--arch/arm/include/asm/hardware/cache-l2x0.h9
-rw-r--r--arch/arm/mm/cache-l2x0.c21
2 files changed, 28 insertions, 2 deletions
diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h
index 16bd48031583..9e2fd1889b6b 100644
--- a/arch/arm/include/asm/hardware/cache-l2x0.h
+++ b/arch/arm/include/asm/hardware/cache-l2x0.h
@@ -45,8 +45,13 @@
45#define L2X0_CLEAN_INV_LINE_PA 0x7F0 45#define L2X0_CLEAN_INV_LINE_PA 0x7F0
46#define L2X0_CLEAN_INV_LINE_IDX 0x7F8 46#define L2X0_CLEAN_INV_LINE_IDX 0x7F8
47#define L2X0_CLEAN_INV_WAY 0x7FC 47#define L2X0_CLEAN_INV_WAY 0x7FC
48#define L2X0_LOCKDOWN_WAY_D 0x900 48/*
49#define L2X0_LOCKDOWN_WAY_I 0x904 49 * The lockdown registers repeat 8 times for L310, the L210 has only one
50 * D and one I lockdown register at 0x0900 and 0x0904.
51 */
52#define L2X0_LOCKDOWN_WAY_D_BASE 0x900
53#define L2X0_LOCKDOWN_WAY_I_BASE 0x904
54#define L2X0_LOCKDOWN_STRIDE 0x08
50#define L2X0_TEST_OPERATION 0xF00 55#define L2X0_TEST_OPERATION 0xF00
51#define L2X0_LINE_DATA 0xF10 56#define L2X0_LINE_DATA 0xF10
52#define L2X0_LINE_TAG 0xF30 57#define L2X0_LINE_TAG 0xF30
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 2cbd6ca0ce23..038d769e0db0 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -279,6 +279,25 @@ static void l2x0_disable(void)
279 spin_unlock_irqrestore(&l2x0_lock, flags); 279 spin_unlock_irqrestore(&l2x0_lock, flags);
280} 280}
281 281
282static void __init l2x0_unlock(__u32 cache_id)
283{
284 int lockregs;
285 int i;
286
287 if (cache_id == L2X0_CACHE_ID_PART_L310)
288 lockregs = 8;
289 else
290 /* L210 and unknown types */
291 lockregs = 1;
292
293 for (i = 0; i < lockregs; i++) {
294 writel_relaxed(0x0, l2x0_base + L2X0_LOCKDOWN_WAY_D_BASE +
295 i * L2X0_LOCKDOWN_STRIDE);
296 writel_relaxed(0x0, l2x0_base + L2X0_LOCKDOWN_WAY_I_BASE +
297 i * L2X0_LOCKDOWN_STRIDE);
298 }
299}
300
282void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask) 301void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
283{ 302{
284 __u32 aux; 303 __u32 aux;
@@ -330,6 +349,8 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
330 * accessing the below registers will fault. 349 * accessing the below registers will fault.
331 */ 350 */
332 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) { 351 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) {
352 /* Make sure that I&D is not locked down when starting */
353 l2x0_unlock(cache_id);
333 354
334 /* l2x0 controller is disabled */ 355 /* l2x0 controller is disabled */
335 writel_relaxed(aux, l2x0_base + L2X0_AUX_CTRL); 356 writel_relaxed(aux, l2x0_base + L2X0_AUX_CTRL);