Enable AT_PLATFORM for Loongson 2F CPU. Signed-off-by: Robert Millan diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 71620e1..69905d2 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c @@ -5,6 +5,7 @@ * Copyright (C) 1994 - 2006 Ralf Baechle * Copyright (C) 2003, 2004 Maciej W. Rozycki * Copyright (C) 2001, 2004 MIPS Inc. + * Copyright (C) 2010 Robert Millan * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -18,6 +19,7 @@ #include #include +#include #include #include #include @@ -613,7 +615,30 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) break; case PRID_IMP_LOONGSON2: c->cputype = CPU_LOONGSON2; - __cpu_name[cpu] = "ICT Loongson-2"; + /* + * On Loongson 2, PRID doesn't specify sub-class reliably. + * We use machtype info passed by bootloader, when available, + * or otherwise fallback to generic "ICT Loongson-2". + */ + switch (mips_machtype) { + case MACH_LEMOTE_FL2E: + __cpu_name[cpu] = "ICT Loongson-2E"; + if (cpu == 0) + __elf_platform = "loongson2e"; + break; + case MACH_LEMOTE_FL2F: + case MACH_LEMOTE_ML2F7: + case MACH_LEMOTE_YL2F89: + case MACH_DEXXON_GDIUM2F10: + case MACH_LEMOTE_NAS: + case MACH_LEMOTE_LL2F: + __cpu_name[cpu] = "ICT Loongson-2F"; + if (cpu == 0) + __elf_platform = "loongson2f"; + break; + default: + __cpu_name[cpu] = "ICT Loongson-2"; + } c->isa_level = MIPS_CPU_ISA_III; c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC | diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index acd3f2c..74b8c16 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -551,6 +551,14 @@ void __init setup_arch(char **cmdline_p) { cpu_probe(); prom_init(); +#ifdef CONFIG_MACH_LOONGSON + /* + * On Loongson 2, CPU detection is defective. machtype + * heuristics are used instead, but they only work after + * prom_init(). + */ + cpu_probe(); +#endif #ifdef CONFIG_EARLY_PRINTK setup_early_printk();