aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);