forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-09-20 a36159eec6ca17402b0e146b86efaf76568dc353
kernel/arch/mips/mm/sc-mips.c
....@@ -12,7 +12,6 @@
1212 #include <asm/bcache.h>
1313 #include <asm/cacheops.h>
1414 #include <asm/page.h>
15
-#include <asm/pgtable.h>
1615 #include <asm/mmu_context.h>
1716 #include <asm/r4kcache.h>
1817 #include <asm/mips-cps.h>
....@@ -147,7 +146,7 @@
147146 return 1;
148147 }
149148
150
-static int __init mips_sc_probe_cm3(void)
149
+static int mips_sc_probe_cm3(void)
151150 {
152151 struct cpuinfo_mips *c = &current_cpu_data;
153152 unsigned long cfg = read_gcr_l2_config();
....@@ -181,7 +180,7 @@
181180 return 0;
182181 }
183182
184
-static inline int __init mips_sc_probe(void)
183
+static inline int mips_sc_probe(void)
185184 {
186185 struct cpuinfo_mips *c = &current_cpu_data;
187186 unsigned int config1, config2;
....@@ -194,9 +193,10 @@
194193 return mips_sc_probe_cm3();
195194
196195 /* Ignore anything but MIPSxx processors */
197
- if (!(c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 |
198
- MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R1 |
199
- MIPS_CPU_ISA_M64R2 | MIPS_CPU_ISA_M64R6)))
196
+ if (!(c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M64R1 |
197
+ MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2 |
198
+ MIPS_CPU_ISA_M32R5 | MIPS_CPU_ISA_M64R5 |
199
+ MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R6)))
200200 return 0;
201201
202202 /* Does this MIPS32/MIPS64 CPU have a config2 register? */
....@@ -221,13 +221,28 @@
221221 else
222222 return 0;
223223
224
- /*
225
- * According to config2 it would be 5-ways, but that is contradicted
226
- * by all documentation.
227
- */
228
- if (current_cpu_type() == CPU_JZRISC &&
229
- mips_machtype == MACH_INGENIC_JZ4770)
230
- c->scache.ways = 4;
224
+ if (current_cpu_type() == CPU_XBURST) {
225
+ switch (mips_machtype) {
226
+ /*
227
+ * According to config2 it would be 5-ways, but that is
228
+ * contradicted by all documentation.
229
+ */
230
+ case MACH_INGENIC_JZ4770:
231
+ case MACH_INGENIC_JZ4775:
232
+ c->scache.ways = 4;
233
+ break;
234
+
235
+ /*
236
+ * According to config2 it would be 5-ways and 512-sets,
237
+ * but that is contradicted by all documentation.
238
+ */
239
+ case MACH_INGENIC_X1000:
240
+ case MACH_INGENIC_X1000E:
241
+ c->scache.sets = 256;
242
+ c->scache.ways = 4;
243
+ break;
244
+ }
245
+ }
231246
232247 c->scache.waysize = c->scache.sets * c->scache.linesz;
233248 c->scache.waybit = __ffs(c->scache.waysize);