Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Loogson: Make enum loongson_cpu_type more clear

Sort enum loongson_cpu_type in a more reasonable manner, this makes the
CPU names more clear and extensible. Those already defined enum values
are renamed to Legacy_* for compatibility.

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/16591/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Huacai Chen and committed by
Ralf Baechle
b9c4dc2c ecc38a09

+24 -9
+16 -6
arch/mips/include/asm/mach-loongson64/boot_param.h
··· 27 27 } __packed; 28 28 29 29 enum loongson_cpu_type { 30 - Loongson_2E = 0, 31 - Loongson_2F = 1, 32 - Loongson_3A = 2, 33 - Loongson_3B = 3, 34 - Loongson_1A = 4, 35 - Loongson_1B = 5 30 + Legacy_2E = 0x0, 31 + Legacy_2F = 0x1, 32 + Legacy_3A = 0x2, 33 + Legacy_3B = 0x3, 34 + Legacy_1A = 0x4, 35 + Legacy_1B = 0x5, 36 + Legacy_2G = 0x6, 37 + Legacy_2H = 0x7, 38 + Loongson_1A = 0x100, 39 + Loongson_1B = 0x101, 40 + Loongson_2E = 0x200, 41 + Loongson_2F = 0x201, 42 + Loongson_2G = 0x202, 43 + Loongson_2H = 0x203, 44 + Loongson_3A = 0x300, 45 + Loongson_3B = 0x301 36 46 }; 37 47 38 48 /*
+8 -3
arch/mips/loongson64/common/env.c
··· 90 90 91 91 cpu_clock_freq = ecpu->cpu_clock_freq; 92 92 loongson_sysconf.cputype = ecpu->cputype; 93 - if (ecpu->cputype == Loongson_3A) { 93 + switch (ecpu->cputype) { 94 + case Legacy_3A: 95 + case Loongson_3A: 94 96 loongson_sysconf.cores_per_node = 4; 95 97 loongson_sysconf.cores_per_package = 4; 96 98 smp_group[0] = 0x900000003ff01000; ··· 113 111 loongson_freqctrl[3] = 0x900030001fe001d0; 114 112 loongson_sysconf.ht_control_base = 0x90000EFDFB000000; 115 113 loongson_sysconf.workarounds = WORKAROUND_CPUFREQ; 116 - } else if (ecpu->cputype == Loongson_3B) { 114 + break; 115 + case Legacy_3B: 116 + case Loongson_3B: 117 117 loongson_sysconf.cores_per_node = 4; /* One chip has 2 nodes */ 118 118 loongson_sysconf.cores_per_package = 8; 119 119 smp_group[0] = 0x900000003ff01000; ··· 136 132 loongson_freqctrl[3] = 0x900060001fe001d0; 137 133 loongson_sysconf.ht_control_base = 0x90001EFDFB000000; 138 134 loongson_sysconf.workarounds = WORKAROUND_CPUHOTPLUG; 139 - } else { 135 + break; 136 + default: 140 137 loongson_sysconf.cores_per_node = 1; 141 138 loongson_sysconf.cores_per_package = 1; 142 139 loongson_chipcfg[0] = 0x900000001fe00180;