diff options
author | Huacai Chen <chenhc@lemote.com> | 2017-06-22 11:06:48 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2017-06-28 06:22:42 -0400 |
commit | 0a00024d7a779b283db2a02130ffa46f47634d0c (patch) | |
tree | 519410b634828c62075b23cede685fab98d04130 | |
parent | d3f616346def161cfb0e4153692713f066755639 (diff) |
MIPS: Loongson: Add Loongson-3A R3 basic support
Loongson-3A R3 is very similar to Loongson-3A R2.
All Loongson-3 CPU family:
Code-name Brand-name PRId
Loongson-3A R1 Loongson-3A1000 0x6305
Loongson-3A R2 Loongson-3A2000 0x6308
Loongson-3A R3 Loongson-3A3000 0x6309
Loongson-3B R1 Loongson-3B1000 0x6306
Loongson-3B R2 Loongson-3B1500 0x6307
Signed-off-by: Huacai Chen <chenhc@lemote.com>
Cc: John Crispin <john@phrozen.org>
Cc: Steven J . Hill <Steven.Hill@cavium.com>
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16585/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/include/asm/cpu.h | 1 | ||||
-rw-r--r-- | arch/mips/kernel/cpu-probe.c | 6 | ||||
-rw-r--r-- | arch/mips/loongson64/common/env.c | 1 | ||||
-rw-r--r-- | arch/mips/loongson64/loongson-3/smp.c | 5 | ||||
-rw-r--r-- | drivers/platform/mips/cpu_hwmon.c | 17 |
5 files changed, 24 insertions, 6 deletions
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h index 3069359b0120..53b8b1f49084 100644 --- a/arch/mips/include/asm/cpu.h +++ b/arch/mips/include/asm/cpu.h | |||
@@ -248,6 +248,7 @@ | |||
248 | #define PRID_REV_LOONGSON3B_R1 0x0006 | 248 | #define PRID_REV_LOONGSON3B_R1 0x0006 |
249 | #define PRID_REV_LOONGSON3B_R2 0x0007 | 249 | #define PRID_REV_LOONGSON3B_R2 0x0007 |
250 | #define PRID_REV_LOONGSON3A_R2 0x0008 | 250 | #define PRID_REV_LOONGSON3A_R2 0x0008 |
251 | #define PRID_REV_LOONGSON3A_R3 0x0009 | ||
251 | 252 | ||
252 | /* | 253 | /* |
253 | * Older processors used to encode processor version and revision in two | 254 | * Older processors used to encode processor version and revision in two |
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 353ade2c130a..09462bba629f 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c | |||
@@ -1836,6 +1836,12 @@ static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu) | |||
1836 | set_elf_platform(cpu, "loongson3a"); | 1836 | set_elf_platform(cpu, "loongson3a"); |
1837 | set_isa(c, MIPS_CPU_ISA_M64R2); | 1837 | set_isa(c, MIPS_CPU_ISA_M64R2); |
1838 | break; | 1838 | break; |
1839 | case PRID_REV_LOONGSON3A_R3: | ||
1840 | c->cputype = CPU_LOONGSON3; | ||
1841 | __cpu_name[cpu] = "ICT Loongson-3"; | ||
1842 | set_elf_platform(cpu, "loongson3a"); | ||
1843 | set_isa(c, MIPS_CPU_ISA_M64R2); | ||
1844 | break; | ||
1839 | } | 1845 | } |
1840 | 1846 | ||
1841 | decode_configs(c); | 1847 | decode_configs(c); |
diff --git a/arch/mips/loongson64/common/env.c b/arch/mips/loongson64/common/env.c index 6afa21850267..4707abfe9d64 100644 --- a/arch/mips/loongson64/common/env.c +++ b/arch/mips/loongson64/common/env.c | |||
@@ -193,6 +193,7 @@ void __init prom_init_env(void) | |||
193 | break; | 193 | break; |
194 | case PRID_REV_LOONGSON3A_R1: | 194 | case PRID_REV_LOONGSON3A_R1: |
195 | case PRID_REV_LOONGSON3A_R2: | 195 | case PRID_REV_LOONGSON3A_R2: |
196 | case PRID_REV_LOONGSON3A_R3: | ||
196 | cpu_clock_freq = 900000000; | 197 | cpu_clock_freq = 900000000; |
197 | break; | 198 | break; |
198 | case PRID_REV_LOONGSON3B_R1: | 199 | case PRID_REV_LOONGSON3B_R1: |
diff --git a/arch/mips/loongson64/loongson-3/smp.c b/arch/mips/loongson64/loongson-3/smp.c index 64659fc73940..1629743ba96a 100644 --- a/arch/mips/loongson64/loongson-3/smp.c +++ b/arch/mips/loongson64/loongson-3/smp.c | |||
@@ -503,7 +503,7 @@ static void loongson3a_r1_play_dead(int *state_addr) | |||
503 | : "a1"); | 503 | : "a1"); |
504 | } | 504 | } |
505 | 505 | ||
506 | static void loongson3a_r2_play_dead(int *state_addr) | 506 | static void loongson3a_r2r3_play_dead(int *state_addr) |
507 | { | 507 | { |
508 | register int val; | 508 | register int val; |
509 | register long cpuid, core, node, count; | 509 | register long cpuid, core, node, count; |
@@ -664,8 +664,9 @@ void play_dead(void) | |||
664 | (void *)CKSEG1ADDR((unsigned long)loongson3a_r1_play_dead); | 664 | (void *)CKSEG1ADDR((unsigned long)loongson3a_r1_play_dead); |
665 | break; | 665 | break; |
666 | case PRID_REV_LOONGSON3A_R2: | 666 | case PRID_REV_LOONGSON3A_R2: |
667 | case PRID_REV_LOONGSON3A_R3: | ||
667 | play_dead_at_ckseg1 = | 668 | play_dead_at_ckseg1 = |
668 | (void *)CKSEG1ADDR((unsigned long)loongson3a_r2_play_dead); | 669 | (void *)CKSEG1ADDR((unsigned long)loongson3a_r2r3_play_dead); |
669 | break; | 670 | break; |
670 | case PRID_REV_LOONGSON3B_R1: | 671 | case PRID_REV_LOONGSON3B_R1: |
671 | case PRID_REV_LOONGSON3B_R2: | 672 | case PRID_REV_LOONGSON3B_R2: |
diff --git a/drivers/platform/mips/cpu_hwmon.c b/drivers/platform/mips/cpu_hwmon.c index 4300a558d0f3..46ab7d86ae1c 100644 --- a/drivers/platform/mips/cpu_hwmon.c +++ b/drivers/platform/mips/cpu_hwmon.c | |||
@@ -17,14 +17,23 @@ | |||
17 | */ | 17 | */ |
18 | int loongson3_cpu_temp(int cpu) | 18 | int loongson3_cpu_temp(int cpu) |
19 | { | 19 | { |
20 | u32 reg; | 20 | u32 reg, prid_rev; |
21 | 21 | ||
22 | reg = LOONGSON_CHIPTEMP(cpu); | 22 | reg = LOONGSON_CHIPTEMP(cpu); |
23 | if ((read_c0_prid() & PRID_REV_MASK) == PRID_REV_LOONGSON3A_R1) | 23 | prid_rev = read_c0_prid() & PRID_REV_MASK; |
24 | switch (prid_rev) { | ||
25 | case PRID_REV_LOONGSON3A_R1: | ||
24 | reg = (reg >> 8) & 0xff; | 26 | reg = (reg >> 8) & 0xff; |
25 | else | 27 | break; |
28 | case PRID_REV_LOONGSON3A_R2: | ||
29 | case PRID_REV_LOONGSON3B_R1: | ||
30 | case PRID_REV_LOONGSON3B_R2: | ||
26 | reg = ((reg >> 8) & 0xff) - 100; | 31 | reg = ((reg >> 8) & 0xff) - 100; |
27 | 32 | break; | |
33 | case PRID_REV_LOONGSON3A_R3: | ||
34 | reg = (reg & 0xffff)*731/0x4000 - 273; | ||
35 | break; | ||
36 | } | ||
28 | return (int)reg * 1000; | 37 | return (int)reg * 1000; |
29 | } | 38 | } |
30 | 39 | ||