diff options
| author | Paul Mundt <lethal@linux-sh.org> | 2007-03-12 03:15:22 -0400 |
|---|---|---|
| committer | Paul Mundt <lethal@linux-sh.org> | 2007-03-12 03:15:22 -0400 |
| commit | ffe1b4e9f436fd7bb784f3bf7ee963c149fbca5f (patch) | |
| tree | 53e5404fda007af8efbb985a4910cbaa39a6b747 | |
| parent | fbd168461e65e73016c34b2eacd76d87218c8a9f (diff) | |
sh: Fix SH-3 cache entry_mask and way_size calculation.
The code for performing the calculation was only in the SH-4 probe
path, move it out to the common path so the other parts get this
right too.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
| -rw-r--r-- | arch/sh/kernel/cpu/init.c | 20 | ||||
| -rw-r--r-- | arch/sh/kernel/cpu/sh4/probe.c | 13 |
2 files changed, 17 insertions, 16 deletions
diff --git a/arch/sh/kernel/cpu/init.c b/arch/sh/kernel/cpu/init.c index 4b339a640b13..726acfcb9b77 100644 --- a/arch/sh/kernel/cpu/init.c +++ b/arch/sh/kernel/cpu/init.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * | 3 | * |
| 4 | * CPU init code | 4 | * CPU init code |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2002 - 2006 Paul Mundt | 6 | * Copyright (C) 2002 - 2007 Paul Mundt |
| 7 | * Copyright (C) 2003 Richard Curnow | 7 | * Copyright (C) 2003 Richard Curnow |
| 8 | * | 8 | * |
| 9 | * This file is subject to the terms and conditions of the GNU General Public | 9 | * This file is subject to the terms and conditions of the GNU General Public |
| @@ -48,8 +48,19 @@ static void __init cache_init(void) | |||
| 48 | { | 48 | { |
| 49 | unsigned long ccr, flags; | 49 | unsigned long ccr, flags; |
| 50 | 50 | ||
| 51 | if (current_cpu_data.type == CPU_SH_NONE) | 51 | /* First setup the rest of the I-cache info */ |
| 52 | panic("Unknown CPU"); | 52 | current_cpu_data.icache.entry_mask = current_cpu_data.icache.way_incr - |
| 53 | current_cpu_data.icache.linesz; | ||
| 54 | |||
| 55 | current_cpu_data.icache.way_size = current_cpu_data.icache.sets * | ||
| 56 | current_cpu_data.icache.linesz; | ||
| 57 | |||
| 58 | /* And the D-cache too */ | ||
| 59 | current_cpu_data.dcache.entry_mask = current_cpu_data.dcache.way_incr - | ||
| 60 | current_cpu_data.dcache.linesz; | ||
| 61 | |||
| 62 | current_cpu_data.dcache.way_size = current_cpu_data.dcache.sets * | ||
| 63 | current_cpu_data.dcache.linesz; | ||
| 53 | 64 | ||
| 54 | jump_to_P2(); | 65 | jump_to_P2(); |
| 55 | ccr = ctrl_inl(CCR); | 66 | ccr = ctrl_inl(CCR); |
| @@ -200,6 +211,9 @@ asmlinkage void __init sh_cpu_init(void) | |||
| 200 | /* First, probe the CPU */ | 211 | /* First, probe the CPU */ |
| 201 | detect_cpu_and_cache_system(); | 212 | detect_cpu_and_cache_system(); |
| 202 | 213 | ||
| 214 | if (current_cpu_data.type == CPU_SH_NONE) | ||
| 215 | panic("Unknown CPU"); | ||
| 216 | |||
| 203 | /* Init the cache */ | 217 | /* Init the cache */ |
| 204 | cache_init(); | 218 | cache_init(); |
| 205 | 219 | ||
diff --git a/arch/sh/kernel/cpu/sh4/probe.c b/arch/sh/kernel/cpu/sh4/probe.c index 9d28c88d2f9d..58950de2696d 100644 --- a/arch/sh/kernel/cpu/sh4/probe.c +++ b/arch/sh/kernel/cpu/sh4/probe.c | |||
| @@ -195,13 +195,6 @@ int __init detect_cpu_and_cache_system(void) | |||
| 195 | 195 | ||
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | /* Setup the rest of the I-cache info */ | ||
| 199 | current_cpu_data.icache.entry_mask = current_cpu_data.icache.way_incr - | ||
| 200 | current_cpu_data.icache.linesz; | ||
| 201 | |||
| 202 | current_cpu_data.icache.way_size = current_cpu_data.icache.sets * | ||
| 203 | current_cpu_data.icache.linesz; | ||
| 204 | |||
| 205 | /* And the rest of the D-cache */ | 198 | /* And the rest of the D-cache */ |
| 206 | if (current_cpu_data.dcache.ways > 1) { | 199 | if (current_cpu_data.dcache.ways > 1) { |
| 207 | size = sizes[(cvr >> 16) & 0xf]; | 200 | size = sizes[(cvr >> 16) & 0xf]; |
| @@ -209,12 +202,6 @@ int __init detect_cpu_and_cache_system(void) | |||
| 209 | current_cpu_data.dcache.sets = (size >> 6); | 202 | current_cpu_data.dcache.sets = (size >> 6); |
| 210 | } | 203 | } |
| 211 | 204 | ||
| 212 | current_cpu_data.dcache.entry_mask = current_cpu_data.dcache.way_incr - | ||
| 213 | current_cpu_data.dcache.linesz; | ||
| 214 | |||
| 215 | current_cpu_data.dcache.way_size = current_cpu_data.dcache.sets * | ||
| 216 | current_cpu_data.dcache.linesz; | ||
| 217 | |||
| 218 | /* | 205 | /* |
| 219 | * Setup the L2 cache desc | 206 | * Setup the L2 cache desc |
| 220 | * | 207 | * |
