aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSantosh Shilimkar <santosh.shilimkar@ti.com>2010-07-11 05:05:37 -0400
committerSantosh Shilimkar <santosh.shilimkar@ti.com>2010-10-26 02:10:03 -0400
commit5ba70372289a1fb378b95cee2cf46b0203d65291 (patch)
tree9f5fed0e160ff3476af12e51689cd6eeb9ae48a7 /arch
parent7db27e864abe0110cec5087b77de777455581e8f (diff)
ARM: l2x0: Determine the cache size
The cache size is needed for to optimise range based maintainance operations Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/hardware/cache-l2x0.h1
-rw-r--r--arch/arm/mm/cache-l2x0.c13
2 files changed, 12 insertions, 2 deletions
diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h
index d833355569cb..4633d2a8817a 100644
--- a/arch/arm/include/asm/hardware/cache-l2x0.h
+++ b/arch/arm/include/asm/hardware/cache-l2x0.h
@@ -55,6 +55,7 @@
55#define L2X0_CACHE_ID_PART_MASK (0xf << 6) 55#define L2X0_CACHE_ID_PART_MASK (0xf << 6)
56#define L2X0_CACHE_ID_PART_L210 (1 << 6) 56#define L2X0_CACHE_ID_PART_L210 (1 << 6)
57#define L2X0_CACHE_ID_PART_L310 (3 << 6) 57#define L2X0_CACHE_ID_PART_L310 (3 << 6)
58#define L2X0_AUX_CTRL_WAY_SIZE_MASK (0x3 << 17)
58 59
59#ifndef __ASSEMBLY__ 60#ifndef __ASSEMBLY__
60extern void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask); 61extern void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask);
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 9310d618070b..262c7529bcdb 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -28,6 +28,7 @@
28static void __iomem *l2x0_base; 28static void __iomem *l2x0_base;
29static DEFINE_SPINLOCK(l2x0_lock); 29static DEFINE_SPINLOCK(l2x0_lock);
30static uint32_t l2x0_way_mask; /* Bitmask of active ways */ 30static uint32_t l2x0_way_mask; /* Bitmask of active ways */
31static uint32_t l2x0_size;
31 32
32static inline void cache_wait_way(void __iomem *reg, unsigned long mask) 33static inline void cache_wait_way(void __iomem *reg, unsigned long mask)
33{ 34{
@@ -242,6 +243,7 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
242{ 243{
243 __u32 aux; 244 __u32 aux;
244 __u32 cache_id; 245 __u32 cache_id;
246 __u32 way_size = 0;
245 int ways; 247 int ways;
246 const char *type; 248 const char *type;
247 249
@@ -276,6 +278,13 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
276 l2x0_way_mask = (1 << ways) - 1; 278 l2x0_way_mask = (1 << ways) - 1;
277 279
278 /* 280 /*
281 * L2 cache Size = Way size * Number of ways
282 */
283 way_size = (aux & L2X0_AUX_CTRL_WAY_SIZE_MASK) >> 17;
284 way_size = 1 << (way_size + 3);
285 l2x0_size = ways * way_size * SZ_1K;
286
287 /*
279 * Check if l2x0 controller is already enabled. 288 * Check if l2x0 controller is already enabled.
280 * If you are booting from non-secure mode 289 * If you are booting from non-secure mode
281 * accessing the below registers will fault. 290 * accessing the below registers will fault.
@@ -300,6 +309,6 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
300 outer_cache.disable = l2x0_disable; 309 outer_cache.disable = l2x0_disable;
301 310
302 printk(KERN_INFO "%s cache controller enabled\n", type); 311 printk(KERN_INFO "%s cache controller enabled\n", type);
303 printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x\n", 312 printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n",
304 ways, cache_id, aux); 313 ways, cache_id, aux, l2x0_size);
305} 314}