* [PATCH] ARM: Fix up l2x0_init log message
@ 2013-02-13 19:14 Sherman Yin
2013-02-13 19:14 ` Sherman Yin
0 siblings, 1 reply; 2+ messages in thread
From: Sherman Yin @ 2013-02-13 19:14 UTC (permalink / raw)
To: linux-arm-kernel
At the end of the function l2x0_init(), printk displays the ?ways? and
?l2x0_size? variables, but these are calculated based on the aux_val
parameter, instead of the actual value in the aux register.
I think a better way is to leave the ?ways?, ?way_size? and ?l2x0_size?
derivation until after the following lines:
/* Re-read it in case some bits are reserved. */
aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);
Then we will be reporting based on what the hardware tells us, instead of the
function argument. Below is a proposed patch, although I'm not entirely happy
with the repeated switch statement.
Or is there a reason why we want to print the values derived from aux_val
instead?
Sherman Yin (1):
ARM: Fix up l2x0_init log message
arch/arm/mm/cache-l2x0.c | 39 +++++++++++++++++++++++++++++++--------
1 file changed, 31 insertions(+), 8 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] ARM: Fix up l2x0_init log message
2013-02-13 19:14 [PATCH] ARM: Fix up l2x0_init log message Sherman Yin
@ 2013-02-13 19:14 ` Sherman Yin
0 siblings, 0 replies; 2+ messages in thread
From: Sherman Yin @ 2013-02-13 19:14 UTC (permalink / raw)
To: linux-arm-kernel
The log at the end of l2x0_init() should print L2 cache info based on current
register value instead of function argument.
---
arch/arm/mm/cache-l2x0.c | 39 +++++++++++++++++++++++++++++++--------
1 file changed, 31 insertions(+), 8 deletions(-)
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index c2f3739..011a584 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -377,14 +377,6 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
l2x0_way_mask = (1 << ways) - 1;
/*
- * L2 cache Size = Way size * Number of ways
- */
- way_size = (aux & L2X0_AUX_CTRL_WAY_SIZE_MASK) >> 17;
- way_size = 1 << (way_size + way_size_shift);
-
- l2x0_size = ways * way_size * SZ_1K;
-
- /*
* Check if l2x0 controller is already enabled.
* If you are booting from non-secure mode
* accessing the below registers will fault.
@@ -418,6 +410,37 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
outer_cache.disable = l2x0_disable;
}
+ /* Update number of ways based on aux ctrl register value */
+ switch (cache_id) {
+ case L2X0_CACHE_ID_PART_L310:
+ if (aux & (1 << 16))
+ ways = 16;
+ else
+ ways = 8;
+ break;
+ case L2X0_CACHE_ID_PART_L210:
+ ways = (aux >> 13) & 0xf;
+ break;
+
+ case AURORA_CACHE_ID:
+ ways = (aux >> 13) & 0xf;
+ ways = 2 << ((ways + 1) >> 2);
+ way_size_shift = AURORA_WAY_SIZE_SHIFT;
+ break;
+ default:
+ /* Assume unknown chips have 8 ways */
+ ways = 8;
+ break;
+ }
+
+ /*
+ * L2 cache Size = Way size * Number of ways
+ */
+ way_size = (aux & L2X0_AUX_CTRL_WAY_SIZE_MASK) >> 17;
+ way_size = 1 << (way_size + way_size_shift);
+
+ l2x0_size = ways * way_size * SZ_1K;
+
printk(KERN_INFO "%s cache controller enabled\n", type);
printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n",
ways, cache_id, aux, l2x0_size);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-02-13 19:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-13 19:14 [PATCH] ARM: Fix up l2x0_init log message Sherman Yin
2013-02-13 19:14 ` Sherman Yin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).