aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-06-01 06:38:41 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-06-01 06:38:41 -0400
commit7863d3f7aeae05099a38693a0a7eb7bdc7b2ab05 (patch)
tree8687e010c793b3800ec2ef967d166b71d78be491 /arch/sh
parent43909a938063f9b6f98c05a2e28b072dd972ece7 (diff)
sh: Tidy up the optional L2 probing, wire it up for SH7786.
This tidies up the L2 probing, as it may or may not be implemented on a CPU, regardless of whether it is supported. This converts the cvr validity checks from BUG_ON()'s to simply clearing the CPU_HAS_L2_CACHE flag and moving on with life. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/kernel/cpu/sh4/probe.c61
1 files changed, 33 insertions, 28 deletions
diff --git a/arch/sh/kernel/cpu/sh4/probe.c b/arch/sh/kernel/cpu/sh4/probe.c
index 7d821ce8434f..28a2f0db01db 100644
--- a/arch/sh/kernel/cpu/sh4/probe.c
+++ b/arch/sh/kernel/cpu/sh4/probe.c
@@ -134,7 +134,7 @@ int __init detect_cpu_and_cache_system(void)
134 boot_cpu_data.icache.ways = 4; 134 boot_cpu_data.icache.ways = 4;
135 boot_cpu_data.dcache.ways = 4; 135 boot_cpu_data.dcache.ways = 4;
136 boot_cpu_data.flags |= CPU_HAS_FPU | CPU_HAS_PERF_COUNTER | 136 boot_cpu_data.flags |= CPU_HAS_FPU | CPU_HAS_PERF_COUNTER |
137 CPU_HAS_LLSC | CPU_HAS_PTEAEX; 137 CPU_HAS_LLSC | CPU_HAS_PTEAEX | CPU_HAS_L2_CACHE;
138 break; 138 break;
139 case 0x3008: 139 case 0x3008:
140 boot_cpu_data.icache.ways = 4; 140 boot_cpu_data.icache.ways = 4;
@@ -228,43 +228,48 @@ int __init detect_cpu_and_cache_system(void)
228 } 228 }
229 229
230 /* 230 /*
231 * Setup the L2 cache desc
232 *
233 * SH-4A's have an optional PIPT L2. 231 * SH-4A's have an optional PIPT L2.
234 */ 232 */
235 if (boot_cpu_data.flags & CPU_HAS_L2_CACHE) { 233 if (boot_cpu_data.flags & CPU_HAS_L2_CACHE) {
236 /* Bug if we can't decode the L2 info */
237 BUG_ON(!(cvr & 0xf));
238
239 /* Silicon and specifications have clearly never met.. */
240 cvr ^= 0xf;
241
242 /* 234 /*
243 * Size calculation is much more sensible 235 * Verify that it really has something hooked up, this
244 * than it is for the L1. 236 * is the safety net for CPUs that have optional L2
245 * 237 * support yet do not implement it.
246 * Sizes are 128KB, 258KB, 512KB, and 1MB.
247 */ 238 */
248 size = (cvr & 0xf) << 17; 239 if ((cvr & 0xf) == 0)
240 boot_cpu_data.flags &= ~CPU_HAS_L2_CACHE;
241 else {
242 /*
243 * Silicon and specifications have clearly never
244 * met..
245 */
246 cvr ^= 0xf;
249 247
250 BUG_ON(!size); 248 /*
249 * Size calculation is much more sensible
250 * than it is for the L1.
251 *
252 * Sizes are 128KB, 258KB, 512KB, and 1MB.
253 */
254 size = (cvr & 0xf) << 17;
251 255
252 boot_cpu_data.scache.way_incr = (1 << 16); 256 boot_cpu_data.scache.way_incr = (1 << 16);
253 boot_cpu_data.scache.entry_shift = 5; 257 boot_cpu_data.scache.entry_shift = 5;
254 boot_cpu_data.scache.ways = 4; 258 boot_cpu_data.scache.ways = 4;
255 boot_cpu_data.scache.linesz = L1_CACHE_BYTES; 259 boot_cpu_data.scache.linesz = L1_CACHE_BYTES;
256 260
257 boot_cpu_data.scache.entry_mask = 261 boot_cpu_data.scache.entry_mask =
258 (boot_cpu_data.scache.way_incr - 262 (boot_cpu_data.scache.way_incr -
259 boot_cpu_data.scache.linesz); 263 boot_cpu_data.scache.linesz);
260 264
261 boot_cpu_data.scache.sets = size / 265 boot_cpu_data.scache.sets = size /
262 (boot_cpu_data.scache.linesz * 266 (boot_cpu_data.scache.linesz *
263 boot_cpu_data.scache.ways); 267 boot_cpu_data.scache.ways);
264 268
265 boot_cpu_data.scache.way_size = 269 boot_cpu_data.scache.way_size =
266 (boot_cpu_data.scache.sets * 270 (boot_cpu_data.scache.sets *
267 boot_cpu_data.scache.linesz); 271 boot_cpu_data.scache.linesz);
272 }
268 } 273 }
269 274
270 return 0; 275 return 0;