Skip to content

Commit ffe1b4e

Browse files
committed
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>
1 parent fbd1684 commit ffe1b4e

2 files changed

Lines changed: 17 additions & 16 deletions

File tree

‎arch/sh/kernel/cpu/init.c‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* CPU init code
55
*
6-
* Copyright (C) 2002 - 2006 Paul Mundt
6+
* Copyright (C) 2002 - 2007 Paul Mundt
77
* Copyright (C) 2003 Richard Curnow
88
*
99
* This file is subject to the terms and conditions of the GNU General Public
@@ -48,8 +48,19 @@ static void __init cache_init(void)
4848
{
4949
unsigned long ccr, flags;
5050

51-
if (current_cpu_data.type == CPU_SH_NONE)
52-
panic("Unknown CPU");
51+
/* First setup the rest of the I-cache info */
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;
5364

5465
jump_to_P2();
5566
ccr = ctrl_inl(CCR);
@@ -200,6 +211,9 @@ asmlinkage void __init sh_cpu_init(void)
200211
/* First, probe the CPU */
201212
detect_cpu_and_cache_system();
202213

214+
if (current_cpu_data.type == CPU_SH_NONE)
215+
panic("Unknown CPU");
216+
203217
/* Init the cache */
204218
cache_init();
205219

‎arch/sh/kernel/cpu/sh4/probe.c‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -195,26 +195,13 @@ int __init detect_cpu_and_cache_system(void)
195195

196196
}
197197

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-
205198
/* And the rest of the D-cache */
206199
if (current_cpu_data.dcache.ways > 1) {
207200
size = sizes[(cvr >> 16) & 0xf];
208201
current_cpu_data.dcache.way_incr = (size >> 1);
209202
current_cpu_data.dcache.sets = (size >> 6);
210203
}
211204

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-
218205
/*
219206
* Setup the L2 cache desc
220207
*

0 commit comments

Comments
 (0)