aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/kernel/cpu-probe.c25
-rw-r--r--arch/mips/mm/c-r3k.c2
-rw-r--r--arch/mips/mm/c-r4k.c2
-rw-r--r--arch/mips/mm/c-sb1.c2
-rw-r--r--arch/mips/mm/c-tx39.c2
-rw-r--r--arch/mips/mm/cache.c90
-rw-r--r--include/asm-mips/cpu-features.h15
-rw-r--r--include/asm-mips/cpu.h40
-rw-r--r--include/asm-mips/mach-ip22/cpu-feature-overrides.h2
-rw-r--r--include/asm-mips/mach-mips/cpu-feature-overrides.h4
-rw-r--r--include/asm-mips/mach-rm200/cpu-feature-overrides.h2
-rw-r--r--include/asm-mips/mach-sim/cpu-feature-overrides.h4
12 files changed, 102 insertions, 88 deletions
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 5d71eca41575..8e6427a50916 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -191,7 +191,7 @@ static inline int __cpu_has_fpu(void)
191 return ((cpu_get_fpu_id() & 0xff00) != FPIR_IMP_NONE); 191 return ((cpu_get_fpu_id() & 0xff00) != FPIR_IMP_NONE);
192} 192}
193 193
194#define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4KTLB \ 194#define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \
195 | MIPS_CPU_COUNTER) 195 | MIPS_CPU_COUNTER)
196 196
197static inline void cpu_probe_legacy(struct cpuinfo_mips *c) 197static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
@@ -200,7 +200,8 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
200 case PRID_IMP_R2000: 200 case PRID_IMP_R2000:
201 c->cputype = CPU_R2000; 201 c->cputype = CPU_R2000;
202 c->isa_level = MIPS_CPU_ISA_I; 202 c->isa_level = MIPS_CPU_ISA_I;
203 c->options = MIPS_CPU_TLB | MIPS_CPU_NOFPUEX; 203 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
204 MIPS_CPU_NOFPUEX;
204 if (__cpu_has_fpu()) 205 if (__cpu_has_fpu())
205 c->options |= MIPS_CPU_FPU; 206 c->options |= MIPS_CPU_FPU;
206 c->tlbsize = 64; 207 c->tlbsize = 64;
@@ -214,7 +215,8 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
214 else 215 else
215 c->cputype = CPU_R3000; 216 c->cputype = CPU_R3000;
216 c->isa_level = MIPS_CPU_ISA_I; 217 c->isa_level = MIPS_CPU_ISA_I;
217 c->options = MIPS_CPU_TLB | MIPS_CPU_NOFPUEX; 218 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
219 MIPS_CPU_NOFPUEX;
218 if (__cpu_has_fpu()) 220 if (__cpu_has_fpu())
219 c->options |= MIPS_CPU_FPU; 221 c->options |= MIPS_CPU_FPU;
220 c->tlbsize = 64; 222 c->tlbsize = 64;
@@ -297,7 +299,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
297 #endif 299 #endif
298 case PRID_IMP_TX39: 300 case PRID_IMP_TX39:
299 c->isa_level = MIPS_CPU_ISA_I; 301 c->isa_level = MIPS_CPU_ISA_I;
300 c->options = MIPS_CPU_TLB; 302 c->options = MIPS_CPU_TLB | MIPS_CPU_TX39_CACHE;
301 303
302 if ((c->processor_id & 0xf0) == (PRID_REV_TX3927 & 0xf0)) { 304 if ((c->processor_id & 0xf0) == (PRID_REV_TX3927 & 0xf0)) {
303 c->cputype = CPU_TX3927; 305 c->cputype = CPU_TX3927;
@@ -441,7 +443,7 @@ static inline unsigned int decode_config0(struct cpuinfo_mips *c)
441 config0 = read_c0_config(); 443 config0 = read_c0_config();
442 444
443 if (((config0 & MIPS_CONF_MT) >> 7) == 1) 445 if (((config0 & MIPS_CONF_MT) >> 7) == 1)
444 c->options |= MIPS_CPU_TLB | MIPS_CPU_4KTLB; 446 c->options |= MIPS_CPU_TLB;
445 isa = (config0 & MIPS_CONF_AT) >> 13; 447 isa = (config0 & MIPS_CONF_AT) >> 13;
446 switch (isa) { 448 switch (isa) {
447 case 0: 449 case 0:
@@ -516,8 +518,8 @@ static inline unsigned int decode_config3(struct cpuinfo_mips *c)
516static inline void decode_configs(struct cpuinfo_mips *c) 518static inline void decode_configs(struct cpuinfo_mips *c)
517{ 519{
518 /* MIPS32 or MIPS64 compliant CPU. */ 520 /* MIPS32 or MIPS64 compliant CPU. */
519 c->options = MIPS_CPU_4KEX | MIPS_CPU_COUNTER | MIPS_CPU_DIVEC | 521 c->options = MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER |
520 MIPS_CPU_LLSC | MIPS_CPU_MCHECK; 522 MIPS_CPU_DIVEC | MIPS_CPU_LLSC | MIPS_CPU_MCHECK;
521 523
522 c->scache.flags = MIPS_CACHE_NOT_PRESENT; 524 c->scache.flags = MIPS_CACHE_NOT_PRESENT;
523 525
@@ -603,6 +605,15 @@ static inline void cpu_probe_alchemy(struct cpuinfo_mips *c)
603static inline void cpu_probe_sibyte(struct cpuinfo_mips *c) 605static inline void cpu_probe_sibyte(struct cpuinfo_mips *c)
604{ 606{
605 decode_configs(c); 607 decode_configs(c);
608
609 /*
610 * For historical reasons the SB1 comes with it's own variant of
611 * cache code which eventually will be folded into c-r4k.c. Until
612 * then we pretend it's got it's own cache architecture.
613 */
614 c->options &= MIPS_CPU_4K_CACHE;
615 c->options |= MIPS_CPU_SB1_CACHE;
616
606 switch (c->processor_id & 0xff00) { 617 switch (c->processor_id & 0xff00) {
607 case PRID_IMP_SB1: 618 case PRID_IMP_SB1:
608 c->cputype = CPU_SB1; 619 c->cputype = CPU_SB1;
diff --git a/arch/mips/mm/c-r3k.c b/arch/mips/mm/c-r3k.c
index 03492a5c21f1..27f4fa25e8c9 100644
--- a/arch/mips/mm/c-r3k.c
+++ b/arch/mips/mm/c-r3k.c
@@ -319,7 +319,7 @@ static void r3k_dma_cache_wback_inv(unsigned long start, unsigned long size)
319 r3k_flush_dcache_range(start, start + size); 319 r3k_flush_dcache_range(start, start + size);
320} 320}
321 321
322void __init ld_mmu_r23000(void) 322void __init r3k_cache_init(void)
323{ 323{
324 extern void build_clear_page(void); 324 extern void build_clear_page(void);
325 extern void build_copy_page(void); 325 extern void build_copy_page(void);
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index aa87ae552170..31f080b5f44c 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -1221,7 +1221,7 @@ static inline void coherency_setup(void)
1221 } 1221 }
1222} 1222}
1223 1223
1224void __init ld_mmu_r4xx0(void) 1224void __init r4k_cache_init(void)
1225{ 1225{
1226 extern void build_clear_page(void); 1226 extern void build_clear_page(void);
1227 extern void build_copy_page(void); 1227 extern void build_copy_page(void);
diff --git a/arch/mips/mm/c-sb1.c b/arch/mips/mm/c-sb1.c
index d183dbced687..70d1ab30f7af 100644
--- a/arch/mips/mm/c-sb1.c
+++ b/arch/mips/mm/c-sb1.c
@@ -496,7 +496,7 @@ static __init void probe_cache_sizes(void)
496 * memory management function pointers, as well as initialize 496 * memory management function pointers, as well as initialize
497 * the caches and tlbs 497 * the caches and tlbs
498 */ 498 */
499void ld_mmu_sb1(void) 499void sb1_cache_init(void)
500{ 500{
501 extern char except_vec2_sb1; 501 extern char except_vec2_sb1;
502 extern char handle_vec2_sb1; 502 extern char handle_vec2_sb1;
diff --git a/arch/mips/mm/c-tx39.c b/arch/mips/mm/c-tx39.c
index c3ba81dab31d..0a97a9434eba 100644
--- a/arch/mips/mm/c-tx39.c
+++ b/arch/mips/mm/c-tx39.c
@@ -410,7 +410,7 @@ static __init void tx39_probe_cache(void)
410 } 410 }
411} 411}
412 412
413void __init ld_mmu_tx39(void) 413void __init tx39_cache_init(void)
414{ 414{
415 extern void build_clear_page(void); 415 extern void build_clear_page(void);
416 extern void build_copy_page(void); 416 extern void build_copy_page(void);
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 172293b58390..611b48dde737 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -104,58 +104,48 @@ void __update_cache(struct vm_area_struct *vma, unsigned long address,
104 } 104 }
105} 105}
106 106
107extern void ld_mmu_r23000(void); 107#define __weak __attribute__((weak))
108extern void ld_mmu_r4xx0(void); 108
109extern void ld_mmu_tx39(void); 109static char cache_panic[] __initdata = "Yeee, unsupported cache architecture.";
110extern void ld_mmu_r6000(void);
111extern void ld_mmu_tfp(void);
112extern void ld_mmu_andes(void);
113extern void ld_mmu_sb1(void);
114 110
115void __init cpu_cache_init(void) 111void __init cpu_cache_init(void)
116{ 112{
117 if (cpu_has_4ktlb) { 113 if (cpu_has_3k_cache) {
118#if defined(CONFIG_CPU_R4X00) || defined(CONFIG_CPU_VR41XX) || \ 114 extern void __weak r3k_cache_init(void);
119 defined(CONFIG_CPU_R4300) || defined(CONFIG_CPU_R5000) || \ 115
120 defined(CONFIG_CPU_NEVADA) || defined(CONFIG_CPU_R5432) || \ 116 r3k_cache_init();
121 defined(CONFIG_CPU_R5500) || defined(CONFIG_CPU_MIPS32_R1) || \ 117 return;
122 defined(CONFIG_CPU_MIPS64_R1) || defined(CONFIG_CPU_TX49XX) || \ 118 }
123 defined(CONFIG_CPU_RM7000) || defined(CONFIG_CPU_RM9000) 119 if (cpu_has_6k_cache) {
124 ld_mmu_r4xx0(); 120 extern void __weak r6k_cache_init(void);
125#endif 121
126 } else switch (current_cpu_data.cputype) { 122 r6k_cache_init();
127#ifdef CONFIG_CPU_R3000 123 return;
128 case CPU_R2000:
129 case CPU_R3000:
130 case CPU_R3000A:
131 case CPU_R3081E:
132 ld_mmu_r23000();
133 break;
134#endif
135#ifdef CONFIG_CPU_TX39XX
136 case CPU_TX3912:
137 case CPU_TX3922:
138 case CPU_TX3927:
139 ld_mmu_tx39();
140 break;
141#endif
142#ifdef CONFIG_CPU_R10000
143 case CPU_R10000:
144 case CPU_R12000:
145 ld_mmu_r4xx0();
146 break;
147#endif
148#ifdef CONFIG_CPU_SB1
149 case CPU_SB1:
150 ld_mmu_sb1();
151 break;
152#endif
153
154 case CPU_R8000:
155 panic("R8000 is unsupported");
156 break;
157
158 default:
159 panic("Yeee, unsupported cache architecture.");
160 } 124 }
125 if (cpu_has_4k_cache) {
126 extern void __weak r4k_cache_init(void);
127
128 r4k_cache_init();
129 return;
130 }
131 if (cpu_has_8k_cache) {
132 extern void __weak r8k_cache_init(void);
133
134 r8k_cache_init();
135 return;
136 }
137 if (cpu_has_tx39_cache) {
138 extern void __weak tx39_cache_init(void);
139
140 tx39_cache_init();
141 return;
142 }
143 if (cpu_has_sb1_cache) {
144 extern void __weak sb1_cache_init(void);
145
146 sb1_cache_init();
147 return;
148 }
149
150 panic(cache_panic);
161} 151}
diff --git a/include/asm-mips/cpu-features.h b/include/asm-mips/cpu-features.h
index 698c21125a5c..03627cfb3e45 100644
--- a/include/asm-mips/cpu-features.h
+++ b/include/asm-mips/cpu-features.h
@@ -25,8 +25,19 @@
25#ifndef cpu_has_4kex 25#ifndef cpu_has_4kex
26#define cpu_has_4kex (cpu_data[0].options & MIPS_CPU_4KEX) 26#define cpu_has_4kex (cpu_data[0].options & MIPS_CPU_4KEX)
27#endif 27#endif
28#ifndef cpu_has_4ktlb 28#ifndef cpu_has_3k_cache
29#define cpu_has_4ktlb (cpu_data[0].options & MIPS_CPU_4KTLB) 29#define cpu_has_3k_cache (cpu_data[0].options & MIPS_CPU_3K_CACHE)
30#endif
31#define cpu_has_6k_cache 0
32#define cpu_has_8k_cache 0
33#ifndef cpu_has_4k_cache
34#define cpu_has_4k_cache (cpu_data[0].options & MIPS_CPU_4K_CACHE)
35#endif
36#ifndef cpu_has_tx39_cache
37#define cpu_has_tx39_cache (cpu_data[0].options & MIPS_CPU_TX39_CACHE)
38#endif
39#ifndef cpu_has_sb1_cache
40#define cpu_has_sb1_cache (cpu_data[0].options & MIPS_CPU_SB1_CACHE)
30#endif 41#endif
31#ifndef cpu_has_fpu 42#ifndef cpu_has_fpu
32#define cpu_has_fpu (cpu_data[0].options & MIPS_CPU_FPU) 43#define cpu_has_fpu (cpu_data[0].options & MIPS_CPU_FPU)
diff --git a/include/asm-mips/cpu.h b/include/asm-mips/cpu.h
index 2e8b5a48b99f..46b2a8dc2ee0 100644
--- a/include/asm-mips/cpu.h
+++ b/include/asm-mips/cpu.h
@@ -217,25 +217,27 @@
217 * CPU Option encodings 217 * CPU Option encodings
218 */ 218 */
219#define MIPS_CPU_TLB 0x00000001 /* CPU has TLB */ 219#define MIPS_CPU_TLB 0x00000001 /* CPU has TLB */
220/* Leave a spare bit for variant MMU types... */ 220#define MIPS_CPU_4KEX 0x00000002 /* "R4K" exception model */
221#define MIPS_CPU_4KEX 0x00000004 /* "R4K" exception model */ 221#define MIPS_CPU_3K_CACHE 0x00000004 /* R3000-style caches */
222#define MIPS_CPU_4KTLB 0x00000008 /* "R4K" TLB handler */ 222#define MIPS_CPU_4K_CACHE 0x00000008 /* R4000-style caches */
223#define MIPS_CPU_FPU 0x00000010 /* CPU has FPU */ 223#define MIPS_CPU_TX39_CACHE 0x00000010 /* TX3900-style caches */
224#define MIPS_CPU_32FPR 0x00000020 /* 32 dbl. prec. FP registers */ 224#define MIPS_CPU_SB1_CACHE 0x00000020 /* SB1-style caches */
225#define MIPS_CPU_COUNTER 0x00000040 /* Cycle count/compare */ 225#define MIPS_CPU_FPU 0x00000040 /* CPU has FPU */
226#define MIPS_CPU_WATCH 0x00000080 /* watchpoint registers */ 226#define MIPS_CPU_32FPR 0x00000080 /* 32 dbl. prec. FP registers */
227#define MIPS_CPU_DIVEC 0x00000200 /* dedicated interrupt vector */ 227#define MIPS_CPU_COUNTER 0x00000100 /* Cycle count/compare */
228#define MIPS_CPU_VCE 0x00000400 /* virt. coherence conflict possible */ 228#define MIPS_CPU_WATCH 0x00000200 /* watchpoint registers */
229#define MIPS_CPU_CACHE_CDEX_P 0x00000800 /* Create_Dirty_Exclusive CACHE op */ 229#define MIPS_CPU_DIVEC 0x00000400 /* dedicated interrupt vector */
230#define MIPS_CPU_CACHE_CDEX_S 0x00001000 /* ... same for seconary cache ... */ 230#define MIPS_CPU_VCE 0x00000800 /* virt. coherence conflict possible */
231#define MIPS_CPU_MCHECK 0x00002000 /* Machine check exception */ 231#define MIPS_CPU_CACHE_CDEX_P 0x00001000 /* Create_Dirty_Exclusive CACHE op */
232#define MIPS_CPU_EJTAG 0x00004000 /* EJTAG exception */ 232#define MIPS_CPU_CACHE_CDEX_S 0x00002000 /* ... same for seconary cache ... */
233#define MIPS_CPU_NOFPUEX 0x00008000 /* no FPU exception */ 233#define MIPS_CPU_MCHECK 0x00004000 /* Machine check exception */
234#define MIPS_CPU_LLSC 0x00010000 /* CPU has ll/sc instructions */ 234#define MIPS_CPU_EJTAG 0x00008000 /* EJTAG exception */
235#define MIPS_CPU_SUBSET_CACHES 0x00020000 /* P-cache subset enforced */ 235#define MIPS_CPU_NOFPUEX 0x00010000 /* no FPU exception */
236#define MIPS_CPU_PREFETCH 0x00040000 /* CPU has usable prefetch */ 236#define MIPS_CPU_LLSC 0x00020000 /* CPU has ll/sc instructions */
237#define MIPS_CPU_VINT 0x00080000 /* CPU supports MIPSR2 vectored interrupts */ 237#define MIPS_CPU_SUBSET_CACHES 0x00040000 /* P-cache subset enforced */
238#define MIPS_CPU_VEIC 0x00100000 /* CPU supports MIPSR2 external interrupt controller mode */ 238#define MIPS_CPU_PREFETCH 0x00080000 /* CPU has usable prefetch */
239#define MIPS_CPU_VINT 0x00100000 /* CPU supports MIPSR2 vectored interrupts */
240#define MIPS_CPU_VEIC 0x00200000 /* CPU supports MIPSR2 external interrupt controller mode */
239 241
240/* 242/*
241 * CPU ASE encodings 243 * CPU ASE encodings
diff --git a/include/asm-mips/mach-ip22/cpu-feature-overrides.h b/include/asm-mips/mach-ip22/cpu-feature-overrides.h
index ac71b4d6510a..ab9714668177 100644
--- a/include/asm-mips/mach-ip22/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ip22/cpu-feature-overrides.h
@@ -13,7 +13,7 @@
13 */ 13 */
14#define cpu_has_tlb 1 14#define cpu_has_tlb 1
15#define cpu_has_4kex 1 15#define cpu_has_4kex 1
16#define cpu_has_4ktlb 1 16#define cpu_has_4kcache 1
17#define cpu_has_fpu 1 17#define cpu_has_fpu 1
18#define cpu_has_32fpr 1 18#define cpu_has_32fpr 1
19#define cpu_has_counter 1 19#define cpu_has_counter 1
diff --git a/include/asm-mips/mach-mips/cpu-feature-overrides.h b/include/asm-mips/mach-mips/cpu-feature-overrides.h
index 98927f8b5f6d..5c5edbf93707 100644
--- a/include/asm-mips/mach-mips/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-mips/cpu-feature-overrides.h
@@ -17,7 +17,7 @@
17#ifdef CONFIG_CPU_MIPS32_R1 17#ifdef CONFIG_CPU_MIPS32_R1
18#define cpu_has_tlb 1 18#define cpu_has_tlb 1
19#define cpu_has_4kex 1 19#define cpu_has_4kex 1
20#define cpu_has_4ktlb 1 20#define cpu_has_4kcache 1
21/* #define cpu_has_fpu ? */ 21/* #define cpu_has_fpu ? */
22/* #define cpu_has_32fpr ? */ 22/* #define cpu_has_32fpr ? */
23#define cpu_has_counter 1 23#define cpu_has_counter 1
@@ -43,7 +43,7 @@
43#ifdef CONFIG_CPU_MIPS64_R1 43#ifdef CONFIG_CPU_MIPS64_R1
44#define cpu_has_tlb 1 44#define cpu_has_tlb 1
45#define cpu_has_4kex 1 45#define cpu_has_4kex 1
46#define cpu_has_4ktlb 1 46#define cpu_has_4kcache 1
47/* #define cpu_has_fpu ? */ 47/* #define cpu_has_fpu ? */
48/* #define cpu_has_32fpr ? */ 48/* #define cpu_has_32fpr ? */
49#define cpu_has_counter 1 49#define cpu_has_counter 1
diff --git a/include/asm-mips/mach-rm200/cpu-feature-overrides.h b/include/asm-mips/mach-rm200/cpu-feature-overrides.h
index 9b2a40524679..79f9b064c864 100644
--- a/include/asm-mips/mach-rm200/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-rm200/cpu-feature-overrides.h
@@ -14,7 +14,7 @@
14 14
15#define cpu_has_tlb 1 15#define cpu_has_tlb 1
16#define cpu_has_4kex 1 16#define cpu_has_4kex 1
17#define cpu_has_4ktlb 1 17#define cpu_has_4kcache 1
18#define cpu_has_fpu 1 18#define cpu_has_fpu 1
19#define cpu_has_32fpr 1 19#define cpu_has_32fpr 1
20#define cpu_has_counter 1 20#define cpu_has_counter 1
diff --git a/include/asm-mips/mach-sim/cpu-feature-overrides.h b/include/asm-mips/mach-sim/cpu-feature-overrides.h
index 09457217a57d..cadbe8eda79c 100644
--- a/include/asm-mips/mach-sim/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-sim/cpu-feature-overrides.h
@@ -16,7 +16,7 @@
16#ifdef CONFIG_CPU_MIPS32 16#ifdef CONFIG_CPU_MIPS32
17#define cpu_has_tlb 1 17#define cpu_has_tlb 1
18#define cpu_has_4kex 1 18#define cpu_has_4kex 1
19#define cpu_has_4ktlb 1 19#define cpu_has_4kcache 1
20#define cpu_has_fpu 0 20#define cpu_has_fpu 0
21/* #define cpu_has_32fpr ? */ 21/* #define cpu_has_32fpr ? */
22#define cpu_has_counter 1 22#define cpu_has_counter 1
@@ -41,7 +41,7 @@
41#ifdef CONFIG_CPU_MIPS64 41#ifdef CONFIG_CPU_MIPS64
42#define cpu_has_tlb 1 42#define cpu_has_tlb 1
43#define cpu_has_4kex 1 43#define cpu_has_4kex 1
44#define cpu_has_4ktlb 1 44#define cpu_has_4kcache 1
45/* #define cpu_has_fpu ? */ 45/* #define cpu_has_fpu ? */
46/* #define cpu_has_32fpr ? */ 46/* #define cpu_has_32fpr ? */
47#define cpu_has_counter 1 47#define cpu_has_counter 1