summaryrefslogtreecommitdiffstats
path: root/arch/mips/lib/cpu-probe.c
diff options
context:
space:
mode:
authorAntony Pavlov <antonynpavlov@gmail.com>2014-01-18 19:12:55 +0400
committerSascha Hauer <s.hauer@pengutronix.de>2014-01-21 07:59:37 +0100
commit7c0da296139600761700d1e3b16a764372d6d0f6 (patch)
tree0fb42ef4be2cf5acca1c1eac8f9ab057626a73a3 /arch/mips/lib/cpu-probe.c
parent2118632f5b5a06fcef5610f101778d22350c1aec (diff)
downloadbarebox-7c0da296139600761700d1e3b16a764372d6d0f6.tar.gz
barebox-7c0da296139600761700d1e3b16a764372d6d0f6.tar.xz
MIPS: add Loongson-1B processor constants and CPU probe
This commit is based on this linux commit: commit 2fa36399e63c911134f28b6878aada9b395c4209 Author: Kelvin Cheung <keguang.zhang@gmail.com> Date: Wed Jun 20 20:05:32 2012 +0100 MIPS: Add CPU support for Loongson1B Loongson 1B is a 32-bit SoC designed by Institute of Computing Technology (ICT) and the Chinese Academy of Sciences (CAS), which implements the MIPS32 release 2 instruction set. [ralf@linux-mips.org: But which is not strictly a MIPS32 compliant device which also is why it identifies itself with the Legacy Vendor ID in the PrID register. When applying the patch I shoveled some code around to keep things in alphabetical order and avoid forward declarations.] Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/mips/lib/cpu-probe.c')
-rw-r--r--arch/mips/lib/cpu-probe.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/mips/lib/cpu-probe.c b/arch/mips/lib/cpu-probe.c
index de45421df7..8235a54ae7 100644
--- a/arch/mips/lib/cpu-probe.c
+++ b/arch/mips/lib/cpu-probe.c
@@ -81,6 +81,24 @@ static void decode_configs(struct cpuinfo_mips *c)
BUG_ON(!ok); /* Arch spec violation! */
}
+static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
+{
+ switch (c->processor_id & PRID_IMP_MASK) {
+ case PRID_IMP_LOONGSON1:
+ decode_configs(c);
+
+ c->cputype = CPU_LOONGSON1;
+
+ switch (c->processor_id & PRID_REV_MASK) {
+ case PRID_REV_LOONGSON1B:
+ __cpu_name = "Loongson 1B";
+ break;
+ }
+
+ break;
+ }
+}
+
static inline void cpu_probe_mips(struct cpuinfo_mips *c)
{
decode_configs(c);
@@ -130,6 +148,9 @@ void cpu_probe(void)
c->processor_id = read_c0_prid();
switch (c->processor_id & 0xff0000) {
+ case PRID_COMP_LEGACY:
+ cpu_probe_legacy(c);
+ break;
case PRID_COMP_MIPS:
cpu_probe_mips(c);
break;