PNX8550 uses a MIPS32-like processor core, not R4xx0.
[powerpc.git] / arch / mips / kernel / cpu-probe.c
index ba2dbc2..a263fb7 100644 (file)
@@ -53,14 +53,13 @@ static void r4k_wait(void)
 /* The Au1xxx wait is available only if using 32khz counter or
  * external timer source, but specifically not CP0 Counter. */
 int allow_au1k_wait;
+
 static void au1k_wait(void)
 {
-       unsigned long addr = 0;
        /* using the wait instruction makes CP0 counter unusable */
-       __asm__("la %0,au1k_wait\n\t"
-               ".set mips3\n\t"
-               "cache 0x14,0(%0)\n\t"
-               "cache 0x14,32(%0)\n\t"
+       __asm__(".set mips3\n\t"
+               "cache 0x14, 0(%0)\n\t"
+               "cache 0x14, 32(%0)\n\t"
                "sync\n\t"
                "nop\n\t"
                "wait\n\t"
@@ -69,14 +68,30 @@ static void au1k_wait(void)
                "nop\n\t"
                "nop\n\t"
                ".set mips0\n\t"
-               : : "r" (addr));
+               : : "r" (au1k_wait));
+}
+
+static int __initdata nowait = 0;
+
+int __init wait_disable(char *s)
+{
+       nowait = 1;
+
+       return 1;
 }
 
+__setup("nowait", wait_disable);
+
 static inline void check_wait(void)
 {
        struct cpuinfo_mips *c = &current_cpu_data;
 
        printk("Checking for 'wait' instruction... ");
+       if (nowait) {
+               printk (" disabled.\n");
+               return;
+       }
+
        switch (c->cputype) {
        case CPU_R3081:
        case CPU_R3081E:
@@ -105,6 +120,8 @@ static inline void check_wait(void)
 /*     case CPU_20KC:*/
        case CPU_24K:
        case CPU_25KF:
+       case CPU_34K:
+       case CPU_PR4450:
                cpu_wait = r4k_wait;
                printk(" available.\n");
                break;
@@ -174,7 +191,7 @@ static inline int __cpu_has_fpu(void)
        return ((cpu_get_fpu_id() & 0xff00) != FPIR_IMP_NONE);
 }
 
-#define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4KTLB \
+#define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE \
                | MIPS_CPU_COUNTER)
 
 static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
@@ -183,7 +200,8 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
        case PRID_IMP_R2000:
                c->cputype = CPU_R2000;
                c->isa_level = MIPS_CPU_ISA_I;
-               c->options = MIPS_CPU_TLB | MIPS_CPU_NOFPUEX;
+               c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
+                            MIPS_CPU_NOFPUEX;
                if (__cpu_has_fpu())
                        c->options |= MIPS_CPU_FPU;
                c->tlbsize = 64;
@@ -197,7 +215,8 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
                else
                        c->cputype = CPU_R3000;
                c->isa_level = MIPS_CPU_ISA_I;
-               c->options = MIPS_CPU_TLB | MIPS_CPU_NOFPUEX;
+               c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
+                            MIPS_CPU_NOFPUEX;
                if (__cpu_has_fpu())
                        c->options |= MIPS_CPU_FPU;
                c->tlbsize = 64;
@@ -260,7 +279,8 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
        case PRID_IMP_R4600:
                c->cputype = CPU_R4600;
                c->isa_level = MIPS_CPU_ISA_III;
-               c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC;
+               c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
+                            MIPS_CPU_LLSC;
                c->tlbsize = 48;
                break;
        #if 0
@@ -279,7 +299,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
        #endif
        case PRID_IMP_TX39:
                c->isa_level = MIPS_CPU_ISA_I;
-               c->options = MIPS_CPU_TLB;
+               c->options = MIPS_CPU_TLB | MIPS_CPU_TX39_CACHE;
 
                if ((c->processor_id & 0xf0) == (PRID_REV_TX3927 & 0xf0)) {
                        c->cputype = CPU_TX3927;
@@ -483,6 +503,14 @@ static inline unsigned int decode_config3(struct cpuinfo_mips *c)
 
        if (config3 & MIPS_CONF3_SM)
                c->ases |= MIPS_ASE_SMARTMIPS;
+       if (config3 & MIPS_CONF3_DSP)
+               c->ases |= MIPS_ASE_DSP;
+       if (config3 & MIPS_CONF3_VINT)
+               c->options |= MIPS_CPU_VINT;
+       if (config3 & MIPS_CONF3_VEIC)
+               c->options |= MIPS_CPU_VEIC;
+       if (config3 & MIPS_CONF3_MT)
+                c->ases |= MIPS_ASE_MIPSMT;
 
        return config3 & MIPS_CONF_M;
 }
@@ -490,8 +518,8 @@ static inline unsigned int decode_config3(struct cpuinfo_mips *c)
 static inline void decode_configs(struct cpuinfo_mips *c)
 {
        /* MIPS32 or MIPS64 compliant CPU.  */
-       c->options = MIPS_CPU_4KEX | MIPS_CPU_COUNTER | MIPS_CPU_DIVEC |
-                    MIPS_CPU_LLSC | MIPS_CPU_MCHECK;
+       c->options = MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER |
+                    MIPS_CPU_DIVEC | MIPS_CPU_LLSC | MIPS_CPU_MCHECK;
 
        c->scache.flags = MIPS_CACHE_NOT_PRESENT;
 
@@ -509,8 +537,6 @@ static inline void decode_configs(struct cpuinfo_mips *c)
 static inline void cpu_probe_mips(struct cpuinfo_mips *c)
 {
        decode_configs(c);
-       if (cpu_has_tlb)
-               c->options |= MIPS_CPU_4KTLB;
        switch (c->processor_id & 0xff00) {
        case PRID_IMP_4KC:
                c->cputype = CPU_4KC;
@@ -522,6 +548,7 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c)
                c->cputype = CPU_4KEC;
                break;
        case PRID_IMP_4KSC:
+       case PRID_IMP_4KSD:
                c->cputype = CPU_4KSC;
                break;
        case PRID_IMP_5KC:
@@ -531,6 +558,7 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c)
                c->cputype = CPU_20KC;
                break;
        case PRID_IMP_24K:
+       case PRID_IMP_24KE:
                c->cputype = CPU_24K;
                break;
        case PRID_IMP_25KF:
@@ -538,6 +566,10 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c)
                /* Probe for L2 cache */
                c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT;
                break;
+       case PRID_IMP_34K:
+               c->cputype = CPU_34K;
+               c->isa_level = MIPS_CPU_ISA_M32;
+               break;
        }
 }
 
@@ -574,6 +606,15 @@ static inline void cpu_probe_alchemy(struct cpuinfo_mips *c)
 static inline void cpu_probe_sibyte(struct cpuinfo_mips *c)
 {
        decode_configs(c);
+
+       /*
+        * For historical reasons the SB1 comes with it's own variant of
+        * cache code which eventually will be folded into c-r4k.c.  Until
+        * then we pretend it's got it's own cache architecture.
+        */
+       c->options &= ~MIPS_CPU_4K_CACHE;
+       c->options |= MIPS_CPU_SB1_CACHE;
+
        switch (c->processor_id & 0xff00) {
        case PRID_IMP_SB1:
                c->cputype = CPU_SB1;
@@ -582,14 +623,15 @@ static inline void cpu_probe_sibyte(struct cpuinfo_mips *c)
                c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR);
 #endif
                break;
+       case PRID_IMP_SB1A:
+               c->cputype = CPU_SB1A;
+               break;
        }
 }
 
 static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c)
 {
        decode_configs(c);
-       if (cpu_has_tlb)
-               c->options |= MIPS_CPU_4KTLB;
        switch (c->processor_id & 0xff00) {
        case PRID_IMP_SR71000:
                c->cputype = CPU_SR71000;
@@ -599,6 +641,21 @@ static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c)
        }
 }
 
+static inline void cpu_probe_philips(struct cpuinfo_mips *c)
+{
+       decode_configs(c);
+       switch (c->processor_id & 0xff00) {
+       case PRID_IMP_PR4450:
+               c->cputype = CPU_PR4450;
+               c->isa_level = MIPS_CPU_ISA_M32;
+               break;
+       default:
+               panic("Unknown Philips Core!"); /* REVISIT: die? */
+               break;
+       }
+}
+
+
 __init void cpu_probe(void)
 {
        struct cpuinfo_mips *c = &current_cpu_data;
@@ -624,6 +681,9 @@ __init void cpu_probe(void)
        case PRID_COMP_SANDCRAFT:
                cpu_probe_sandcraft(c);
                break;
+       case PRID_COMP_PHILIPS:
+               cpu_probe_philips(c);
+               break;
        default:
                c->cputype = CPU_UNKNOWN;
        }