From: Robert Millan <rmh@gnu.org>
To: Robert Millan <rmh@gnu.org>
Cc: David Daney <ddaney@caviumnetworks.com>,
Aurelien Jarno <aurelien@aurel32.net>,
Ralf Baechle <ralf@linux-mips.org>,
linux-mips@linux-mips.org
Subject: Re: [PATCH] Enable AT_PLATFORM for Loongson 2F CPU
Date: Sun, 07 Nov 2010 13:30:59 +0100 [thread overview]
Message-ID: <1289133059.1547.0@thorin> (raw)
In-Reply-To: <AANLkTik3SH8EmhcgY9HNQLLk9Np+E6LGo8jVoGQiQCx4@mail.gmail.com> (from rmh@gnu.org on Thu Nov 4 19:43:08 2010)
[-- Attachment #1: Type: text/plain, Size: 1002 bytes --]
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.
[-- Attachment #2: loongson2f.diff --]
[-- Type: text/x-patch, Size: 2319 bytes --]
Enable AT_PLATFORM for Loongson 2F CPU.
Signed-off-by: Robert Millan <rmh@gnu.org>
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();
next prev parent reply other threads:[~2010-11-07 12:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-04 12:18 [PATCH] Enable AT_PLATFORM for Loongson 2F CPU Robert Millan
2010-11-04 16:44 ` David Daney
2010-11-04 17:33 ` Aurelien Jarno
2010-11-04 18:43 ` Robert Millan
2010-11-04 19:11 ` David Daney
2010-11-04 19:29 ` Ralf Baechle
2010-11-07 12:30 ` Robert Millan [this message]
2010-11-08 19:13 ` David Daney
2010-11-08 22:27 ` Robert Millan
2010-11-08 22:50 ` David Daney
2010-11-08 23:02 ` Robert Millan
2010-11-09 9:48 ` wu zhangjin
2010-11-09 12:24 ` Robert Millan
2010-11-09 15:40 ` Ralf Baechle
2010-11-11 14:47 ` Robert Millan
2010-11-15 23:50 ` Robert Millan
2010-11-15 23:59 ` David Daney
2010-11-22 12:44 ` Robert Millan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1289133059.1547.0@thorin \
--to=rmh@gnu.org \
--cc=aurelien@aurel32.net \
--cc=ddaney@caviumnetworks.com \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.