MIPS: Loongson: Add Loongson-3A R2.1 basic support
authorHuacai Chen <chenhc@lemote.com>
Thu, 15 Nov 2018 07:53:52 +0000 (15:53 +0800)
committerPaul Burton <paul.burton@mips.com>
Mon, 19 Nov 2018 23:20:31 +0000 (15:20 -0800)
Loongson-3A R2.1 is the bugfix revision of 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 R2.1  Loongson-3A2000  0x630c
Loongson-3A R3    Loongson-3A3000  0x6309
Loongson-3A R3.1  Loongson-3A3000  0x630d
Loongson-3B R1    Loongson-3B1000  0x6306
Loongson-3B R2    Loongson-3B1500  0x6307

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Signed-off-by: Paul Burton <paul.burton@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/21128/
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <james.hogan@mips.com>
Cc: Steven J . Hill <Steven.Hill@cavium.com>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
arch/mips/include/asm/cpu.h
arch/mips/include/asm/mach-loongson64/kernel-entry-init.h
arch/mips/kernel/cpu-probe.c
arch/mips/kernel/idle.c
arch/mips/loongson64/common/env.c
arch/mips/loongson64/loongson-3/smp.c
arch/mips/mm/c-r4k.c
drivers/platform/mips/cpu_hwmon.c

index dacbdb84516a09134896edd704d129b4f5f516f7..532b49b1dbb3e1d6f67485bfadcd8a8fb89b16b7 100644 (file)
 #define PRID_REV_LOONGSON3A_R1         0x0005
 #define PRID_REV_LOONGSON3B_R1         0x0006
 #define PRID_REV_LOONGSON3B_R2         0x0007
-#define PRID_REV_LOONGSON3A_R2         0x0008
+#define PRID_REV_LOONGSON3A_R2_0       0x0008
 #define PRID_REV_LOONGSON3A_R3_0       0x0009
+#define PRID_REV_LOONGSON3A_R2_1       0x000c
 #define PRID_REV_LOONGSON3A_R3_1       0x000d
 
 /*
index cbac603ced19cb4623f4d91bd2961a4dbee3c3d6..b5e288a12dfe2fa463cbb1084f09b521da544837 100644 (file)
@@ -31,7 +31,7 @@
        /* Enable STFill Buffer */
        mfc0    t0, CP0_PRID
        andi    t0, (PRID_IMP_MASK | PRID_REV_MASK)
-       slti    t0, (PRID_IMP_LOONGSON_64 | PRID_REV_LOONGSON3A_R2)
+       slti    t0, (PRID_IMP_LOONGSON_64 | PRID_REV_LOONGSON3A_R2_0)
        bnez    t0, 1f
        mfc0    t0, CP0_CONFIG6
        or      t0, 0x100
@@ -60,7 +60,7 @@
        /* Enable STFill Buffer */
        mfc0    t0, CP0_PRID
        andi    t0, (PRID_IMP_MASK | PRID_REV_MASK)
-       slti    t0, (PRID_IMP_LOONGSON_64 | PRID_REV_LOONGSON3A_R2)
+       slti    t0, (PRID_IMP_LOONGSON_64 | PRID_REV_LOONGSON3A_R2_0)
        bnez    t0, 1f
        mfc0    t0, CP0_CONFIG6
        or      t0, 0x100
index 71dcef851ca01db4b13417dbdd38997af9d06990..65dc2e699a2ec10597c54b8b159a6f9367fee0a1 100644 (file)
@@ -1871,7 +1871,8 @@ static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu)
        switch (c->processor_id & PRID_IMP_MASK) {
        case PRID_IMP_LOONGSON_64:  /* Loongson-2/3 */
                switch (c->processor_id & PRID_REV_MASK) {
-               case PRID_REV_LOONGSON3A_R2:
+               case PRID_REV_LOONGSON3A_R2_0:
+               case PRID_REV_LOONGSON3A_R2_1:
                        c->cputype = CPU_LOONGSON3;
                        __cpu_name[cpu] = "ICT Loongson-3";
                        set_elf_platform(cpu, "loongson3a");
index 4d335b15826e829d70c8a3d212a4f003a5595610..695f55477503b2fbc52dfb87a528aba478e8f6bb 100644 (file)
@@ -184,7 +184,7 @@ void __init check_wait(void)
                cpu_wait = r4k_wait;
                break;
        case CPU_LOONGSON3:
-               if ((c->processor_id & PRID_REV_MASK) >= PRID_REV_LOONGSON3A_R2)
+               if ((c->processor_id & PRID_REV_MASK) >= PRID_REV_LOONGSON3A_R2_0)
                        cpu_wait = r4k_wait;
                break;
 
index 8f68ee02a8c2447439c9b821f7f9835155333ac8..72e5f8fb2b357b7e14f3f97826199bdfa6abf952 100644 (file)
@@ -197,7 +197,8 @@ void __init prom_init_env(void)
                        cpu_clock_freq = 797000000;
                        break;
                case PRID_REV_LOONGSON3A_R1:
-               case PRID_REV_LOONGSON3A_R2:
+               case PRID_REV_LOONGSON3A_R2_0:
+               case PRID_REV_LOONGSON3A_R2_1:
                case PRID_REV_LOONGSON3A_R3_0:
                case PRID_REV_LOONGSON3A_R3_1:
                        cpu_clock_freq = 900000000;
index b5c1e0aa955e696e1502b975735c4ca7e12e2065..8fba0aa48bf4e9868bc063acbc57acd94ad8cd8c 100644 (file)
@@ -682,7 +682,8 @@ void play_dead(void)
                play_dead_at_ckseg1 =
                        (void *)CKSEG1ADDR((unsigned long)loongson3a_r1_play_dead);
                break;
-       case PRID_REV_LOONGSON3A_R2:
+       case PRID_REV_LOONGSON3A_R2_0:
+       case PRID_REV_LOONGSON3A_R2_1:
        case PRID_REV_LOONGSON3A_R3_0:
        case PRID_REV_LOONGSON3A_R3_1:
                play_dead_at_ckseg1 =
index 05bd77727fb956a998ffbfac8176788e715141c7..7e430b4d877803e53077e852ff4baf337c7a5a5e 100644 (file)
@@ -1352,7 +1352,7 @@ static void probe_pcache(void)
                                          c->dcache.ways *
                                          c->dcache.linesz;
                c->dcache.waybit = 0;
-               if ((prid & PRID_REV_MASK) >= PRID_REV_LOONGSON3A_R2)
+               if ((prid & PRID_REV_MASK) >= PRID_REV_LOONGSON3A_R2_0)
                        c->options |= MIPS_CPU_PREFETCH;
                break;
 
index f66521c7f8462b3ec438f1b07beae4f0efd487cc..42efcb850722cc72182432578383f0a8256f97f7 100644 (file)
@@ -25,9 +25,10 @@ int loongson3_cpu_temp(int cpu)
        case PRID_REV_LOONGSON3A_R1:
                reg = (reg >> 8) & 0xff;
                break;
-       case PRID_REV_LOONGSON3A_R2:
        case PRID_REV_LOONGSON3B_R1:
        case PRID_REV_LOONGSON3B_R2:
+       case PRID_REV_LOONGSON3A_R2_0:
+       case PRID_REV_LOONGSON3A_R2_1:
                reg = ((reg >> 8) & 0xff) - 100;
                break;
        case PRID_REV_LOONGSON3A_R3_0: