El 04/11/10 19:43:08, en/na Robert Millan va escriure: > David Daney a écrit : > > You are claiming that all loongson2 are loongson-2f. Is that > > really true? Or are there other types of loongson2 that are not > > loongson-2f? > > I'll figure out how to distinguish them and send a new patch. I looked at details about CPU identification, and this seems to be broken. See the the notes about PRId in pages 72 and 66, respectively: http://dev.lemote.com/files/resource/documents/Loongson/ls2f/Loongson2FUserGuide.pdf In both 2E and 2F, the implementation field is the same (0x63). Revision field is the same too, according to docs, and it can't be used anyway (no garantee of consistency). I'm sending a new patch that uses machtype instead. Yes, I know it's a bit of a kludge, but it really seems to be the only way. > Well I appreciate consistency with GCC flag names, Actually, I missread GCC flag (it's dashless). I'm using "loongson2f" as David requested.
Enable AT_PLATFORM for Loongson 2F CPU. Signed-off-by: Robert Millan <rmh@xxxxxxx> 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 <linux/stddef.h> #include <linux/module.h> +#include <asm/bootinfo.h> #include <asm/bugs.h> #include <asm/cpu.h> #include <asm/fpu.h> @@ -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();