diff options
author | Paul Mundt <lethal@linux-sh.org> | 2008-02-13 06:14:10 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-02-14 00:22:12 -0500 |
commit | 38350e0a00f973dd9c6556beeff0f7eb5ef3f58b (patch) | |
tree | a419a9c9b45a6cb20a2f4f809f628c10a3ce9ab9 /arch/sh/kernel | |
parent | 5c8f82c64941594cdab53bf9f9a66c190781f4f6 (diff) |
sh: Get SH-5 caches working again post-unification.
A number of cleanups to get the SH-5 cache management code in line with
the rest of the SH backend.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel')
-rw-r--r-- | arch/sh/kernel/cpu/sh5/probe.c | 61 |
1 files changed, 28 insertions, 33 deletions
diff --git a/arch/sh/kernel/cpu/sh5/probe.c b/arch/sh/kernel/cpu/sh5/probe.c index 15d167fd0ae7..31f8cb0f6374 100644 --- a/arch/sh/kernel/cpu/sh5/probe.c +++ b/arch/sh/kernel/cpu/sh5/probe.c | |||
@@ -20,19 +20,18 @@ int __init detect_cpu_and_cache_system(void) | |||
20 | { | 20 | { |
21 | unsigned long long cir; | 21 | unsigned long long cir; |
22 | 22 | ||
23 | /* Do peeks in real mode to avoid having to set up a mapping for the | 23 | /* |
24 | WPC registers. On SH5-101 cut2, such a mapping would be exposed to | 24 | * Do peeks in real mode to avoid having to set up a mapping for |
25 | an address translation erratum which would make it hard to set up | 25 | * the WPC registers. On SH5-101 cut2, such a mapping would be |
26 | correctly. */ | 26 | * exposed to an address translation erratum which would make it |
27 | * hard to set up correctly. | ||
28 | */ | ||
27 | cir = peek_real_address_q(0x0d000008); | 29 | cir = peek_real_address_q(0x0d000008); |
28 | if ((cir & 0xffff) == 0x5103) { | 30 | if ((cir & 0xffff) == 0x5103) |
29 | boot_cpu_data.type = CPU_SH5_103; | 31 | boot_cpu_data.type = CPU_SH5_103; |
30 | } else if (((cir >> 32) & 0xffff) == 0x51e2) { | 32 | else if (((cir >> 32) & 0xffff) == 0x51e2) |
31 | /* CPU.VCR aliased at CIR address on SH5-101 */ | 33 | /* CPU.VCR aliased at CIR address on SH5-101 */ |
32 | boot_cpu_data.type = CPU_SH5_101; | 34 | boot_cpu_data.type = CPU_SH5_101; |
33 | } else { | ||
34 | boot_cpu_data.type = CPU_SH_NONE; | ||
35 | } | ||
36 | 35 | ||
37 | /* | 36 | /* |
38 | * First, setup some sane values for the I-cache. | 37 | * First, setup some sane values for the I-cache. |
@@ -40,37 +39,33 @@ int __init detect_cpu_and_cache_system(void) | |||
40 | boot_cpu_data.icache.ways = 4; | 39 | boot_cpu_data.icache.ways = 4; |
41 | boot_cpu_data.icache.sets = 256; | 40 | boot_cpu_data.icache.sets = 256; |
42 | boot_cpu_data.icache.linesz = L1_CACHE_BYTES; | 41 | boot_cpu_data.icache.linesz = L1_CACHE_BYTES; |
42 | boot_cpu_data.icache.way_incr = (1 << 13); | ||
43 | boot_cpu_data.icache.entry_shift = 5; | ||
44 | boot_cpu_data.icache.way_size = boot_cpu_data.icache.sets * | ||
45 | boot_cpu_data.icache.linesz; | ||
46 | boot_cpu_data.icache.entry_mask = 0x1fe0; | ||
47 | boot_cpu_data.icache.flags = 0; | ||
43 | 48 | ||
44 | #if 0 | ||
45 | /* | 49 | /* |
46 | * FIXME: This can probably be cleaned up a bit as well.. for example, | 50 | * Next, setup some sane values for the D-cache. |
47 | * do we really need the way shift _and_ the way_step_shift ?? Judging | 51 | * |
48 | * by the existing code, I would guess no.. is there any valid reason | 52 | * On the SH5, these are pretty consistent with the I-cache settings, |
49 | * why we need to be tracking this around? | 53 | * so we just copy over the existing definitions.. these can be fixed |
54 | * up later, especially if we add runtime CPU probing. | ||
55 | * | ||
56 | * Though in the meantime it saves us from having to duplicate all of | ||
57 | * the above definitions.. | ||
50 | */ | 58 | */ |
51 | boot_cpu_data.icache.way_shift = 13; | 59 | boot_cpu_data.dcache = boot_cpu_data.icache; |
52 | boot_cpu_data.icache.entry_shift = 5; | ||
53 | boot_cpu_data.icache.set_shift = 4; | ||
54 | boot_cpu_data.icache.way_step_shift = 16; | ||
55 | boot_cpu_data.icache.asid_shift = 2; | ||
56 | 60 | ||
57 | /* | 61 | /* |
58 | * way offset = cache size / associativity, so just don't factor in | 62 | * Setup any cache-related flags here |
59 | * associativity in the first place.. | ||
60 | */ | 63 | */ |
61 | boot_cpu_data.icache.way_ofs = boot_cpu_data.icache.sets * | 64 | #if defined(CONFIG_CACHE_WRITETHROUGH) |
62 | boot_cpu_data.icache.linesz; | 65 | set_bit(SH_CACHE_MODE_WT, &(boot_cpu_data.dcache.flags)); |
63 | 66 | #elif defined(CONFIG_CACHE_WRITEBACK) | |
64 | boot_cpu_data.icache.asid_mask = 0x3fc; | 67 | set_bit(SH_CACHE_MODE_WB, &(boot_cpu_data.dcache.flags)); |
65 | boot_cpu_data.icache.idx_mask = 0x1fe0; | ||
66 | boot_cpu_data.icache.epn_mask = 0xffffe000; | ||
67 | #endif | 68 | #endif |
68 | 69 | ||
69 | boot_cpu_data.icache.flags = 0; | ||
70 | |||
71 | /* A trivial starting point.. */ | ||
72 | memcpy(&boot_cpu_data.dcache, | ||
73 | &boot_cpu_data.icache, sizeof(struct cache_info)); | ||
74 | |||
75 | return 0; | 70 | return 0; |
76 | } | 71 | } |