Skip to content

Commit 71e2f4d

Browse files
FlyGoatpaulburton
authored andcommitted
MIPS: Fork loongson2ef from loongson64
As later model of GSx64 family processors including 2-series-soc have similar design with initial loongson3a while loongson2e/f seems less identical, we separate loongson2e/f support code out of mach-loongson64 to make our life easier. This patch contains mostly file moving works. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> [paulburton@kernel.org: Squash in the MAINTAINERS updates] Signed-off-by: Paul Burton <paulburton@kernel.org> Cc: linux-mips@vger.kernel.org Cc: paul.burton@mips.com
1 parent 268a2d6 commit 71e2f4d

71 files changed

Lines changed: 3351 additions & 132 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎MAINTAINERS‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10871,18 +10871,18 @@ F: arch/mips/include/asm/mach-loongson32/
1087110871
F: drivers/*/*loongson1*
1087210872
F: drivers/*/*/*loongson1*
1087310873

10874-
MIPS/LOONGSON2 ARCHITECTURE
10874+
MIPS/LOONGSON2EF ARCHITECTURE
1087510875
M: Jiaxun Yang <jiaxun.yang@flygoat.com>
1087610876
L: linux-mips@vger.kernel.org
1087710877
S: Maintained
10878-
F: arch/mips/loongson64/fuloong-2e/
10879-
F: arch/mips/loongson64/lemote-2f/
10880-
F: arch/mips/include/asm/mach-loongson64/
10878+
F: arch/mips/loongson2ef/
10879+
F: arch/mips/include/asm/mach-loongson2ef/
1088110880
F: drivers/*/*loongson2*
1088210881
F: drivers/*/*/*loongson2*
1088310882

10884-
MIPS/LOONGSON3 ARCHITECTURE
10883+
MIPS/LOONGSON64 ARCHITECTURE
1088510884
M: Huacai Chen <chenhc@lemote.com>
10885+
M: Jiaxun Yang <jiaxun.yang@flygoat.com>
1088610886
L: linux-mips@vger.kernel.org
1088710887
S: Maintained
1088810888
F: arch/mips/loongson64/

‎arch/mips/Kbuild.platforms‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ platforms += jazz
1717
platforms += jz4740
1818
platforms += lantiq
1919
platforms += lasat
20+
platforms += loongson2ef
2021
platforms += loongson32
2122
platforms += loongson64
2223
platforms += mti-malta

‎arch/mips/Kconfig‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -453,18 +453,18 @@ config MACH_LOONGSON32
453453
the Institute of Computing Technology (ICT), Chinese Academy of
454454
Sciences (CAS).
455455

456-
config MACH_LOONGSON64
457-
bool "Loongson-2/3 family of machines"
456+
config MACH_LOONGSON2EF
457+
bool "Loongson-2E/F family of machines"
458458
select SYS_SUPPORTS_ZBOOT
459459
help
460-
This enables the support of Loongson-2/3 family of machines.
460+
This enables the support of early Loongson-2E/F family of machines.
461461

462-
Loongson-2 is a family of single-core CPUs and Loongson-3 is a
463-
family of multi-core CPUs. They are both 64-bit general-purpose
464-
MIPS-compatible CPUs. Loongson-2/3 are developed by the Institute
465-
of Computing Technology (ICT), Chinese Academy of Sciences (CAS)
466-
in the People's Republic of China. The chief architect is Professor
467-
Weiwu Hu.
462+
config MACH_LOONGSON64
463+
bool "Loongson-2/3 GSx64 family of machines"
464+
select SYS_SUPPORTS_ZBOOT
465+
help
466+
This enables the support of Loongson-2/3 family of processors with
467+
GSx64 microarchitecture.
468468

469469
config MACH_PISTACHIO
470470
bool "IMG Pistachio SoC based boards"
@@ -1037,6 +1037,7 @@ source "arch/mips/sibyte/Kconfig"
10371037
source "arch/mips/txx9/Kconfig"
10381038
source "arch/mips/vr41xx/Kconfig"
10391039
source "arch/mips/cavium-octeon/Kconfig"
1040+
source "arch/mips/loongson2ef/Kconfig"
10401041
source "arch/mips/loongson32/Kconfig"
10411042
source "arch/mips/loongson64/Kconfig"
10421043
source "arch/mips/netlogic/Kconfig"

‎arch/mips/configs/fuloong2e_defconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ CONFIG_EXPERT=y
1515
# CONFIG_COMPAT_BRK is not set
1616
CONFIG_SLAB=y
1717
CONFIG_PROFILING=y
18-
CONFIG_MACH_LOONGSON64=y
18+
CONFIG_MACH_LOONGSON2EF=y
1919
CONFIG_PCI=y
2020
CONFIG_MIPS32_O32=y
2121
CONFIG_MIPS32_N32=y

‎arch/mips/configs/lemote2f_defconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ CONFIG_LOG_BUF_SHIFT=15
1212
CONFIG_BLK_DEV_INITRD=y
1313
CONFIG_EXPERT=y
1414
CONFIG_PROFILING=y
15-
CONFIG_MACH_LOONGSON64=y
15+
CONFIG_MACH_LOONGSON2EF=y
1616
CONFIG_LEMOTE_MACH2F=y
1717
CONFIG_KEXEC=y
1818
# CONFIG_SECCOMP is not set
Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef __ASM_MACH_LOONGSON64_BOOT_PARAM_H_
3+
#define __ASM_MACH_LOONGSON64_BOOT_PARAM_H_
4+
5+
#define SYSTEM_RAM_LOW 1
6+
#define SYSTEM_RAM_HIGH 2
7+
#define SYSTEM_RAM_RESERVED 3
8+
#define PCI_IO 4
9+
#define PCI_MEM 5
10+
#define LOONGSON_CFG_REG 6
11+
#define VIDEO_ROM 7
12+
#define ADAPTER_ROM 8
13+
#define ACPI_TABLE 9
14+
#define SMBIOS_TABLE 10
15+
#define MAX_MEMORY_TYPE 11
16+
17+
#define LOONGSON3_BOOT_MEM_MAP_MAX 128
18+
struct efi_memory_map_loongson {
19+
u16 vers; /* version of efi_memory_map */
20+
u32 nr_map; /* number of memory_maps */
21+
u32 mem_freq; /* memory frequence */
22+
struct mem_map {
23+
u32 node_id; /* node_id which memory attached to */
24+
u32 mem_type; /* system memory, pci memory, pci io, etc. */
25+
u64 mem_start; /* memory map start address */
26+
u32 mem_size; /* each memory_map size, not the total size */
27+
} map[LOONGSON3_BOOT_MEM_MAP_MAX];
28+
} __packed;
29+
30+
enum loongson_cpu_type {
31+
Legacy_2E = 0x0,
32+
Legacy_2F = 0x1,
33+
Legacy_3A = 0x2,
34+
Legacy_3B = 0x3,
35+
Legacy_1A = 0x4,
36+
Legacy_1B = 0x5,
37+
Legacy_2G = 0x6,
38+
Legacy_2H = 0x7,
39+
Loongson_1A = 0x100,
40+
Loongson_1B = 0x101,
41+
Loongson_2E = 0x200,
42+
Loongson_2F = 0x201,
43+
Loongson_2G = 0x202,
44+
Loongson_2H = 0x203,
45+
Loongson_3A = 0x300,
46+
Loongson_3B = 0x301
47+
};
48+
49+
/*
50+
* Capability and feature descriptor structure for MIPS CPU
51+
*/
52+
struct efi_cpuinfo_loongson {
53+
u16 vers; /* version of efi_cpuinfo_loongson */
54+
u32 processor_id; /* PRID, e.g. 6305, 6306 */
55+
u32 cputype; /* Loongson_3A/3B, etc. */
56+
u32 total_node; /* num of total numa nodes */
57+
u16 cpu_startup_core_id; /* Boot core id */
58+
u16 reserved_cores_mask;
59+
u32 cpu_clock_freq; /* cpu_clock */
60+
u32 nr_cpus;
61+
} __packed;
62+
63+
#define MAX_UARTS 64
64+
struct uart_device {
65+
u32 iotype; /* see include/linux/serial_core.h */
66+
u32 uartclk;
67+
u32 int_offset;
68+
u64 uart_base;
69+
} __packed;
70+
71+
#define MAX_SENSORS 64
72+
#define SENSOR_TEMPER 0x00000001
73+
#define SENSOR_VOLTAGE 0x00000002
74+
#define SENSOR_FAN 0x00000004
75+
struct sensor_device {
76+
char name[32]; /* a formal name */
77+
char label[64]; /* a flexible description */
78+
u32 type; /* SENSOR_* */
79+
u32 id; /* instance id of a sensor-class */
80+
u32 fan_policy; /* see loongson_hwmon.h */
81+
u32 fan_percent;/* only for constant speed policy */
82+
u64 base_addr; /* base address of device registers */
83+
} __packed;
84+
85+
struct system_loongson {
86+
u16 vers; /* version of system_loongson */
87+
u32 ccnuma_smp; /* 0: no numa; 1: has numa */
88+
u32 sing_double_channel; /* 1:single; 2:double */
89+
u32 nr_uarts;
90+
struct uart_device uarts[MAX_UARTS];
91+
u32 nr_sensors;
92+
struct sensor_device sensors[MAX_SENSORS];
93+
char has_ec;
94+
char ec_name[32];
95+
u64 ec_base_addr;
96+
char has_tcm;
97+
char tcm_name[32];
98+
u64 tcm_base_addr;
99+
u64 workarounds; /* see workarounds.h */
100+
} __packed;
101+
102+
struct irq_source_routing_table {
103+
u16 vers;
104+
u16 size;
105+
u16 rtr_bus;
106+
u16 rtr_devfn;
107+
u32 vendor;
108+
u32 device;
109+
u32 PIC_type; /* conform use HT or PCI to route to CPU-PIC */
110+
u64 ht_int_bit; /* 3A: 1<<24; 3B: 1<<16 */
111+
u64 ht_enable; /* irqs used in this PIC */
112+
u32 node_id; /* node id: 0x0-0; 0x1-1; 0x10-2; 0x11-3 */
113+
u64 pci_mem_start_addr;
114+
u64 pci_mem_end_addr;
115+
u64 pci_io_start_addr;
116+
u64 pci_io_end_addr;
117+
u64 pci_config_addr;
118+
u32 dma_mask_bits;
119+
} __packed;
120+
121+
struct interface_info {
122+
u16 vers; /* version of the specificition */
123+
u16 size;
124+
u8 flag;
125+
char description[64];
126+
} __packed;
127+
128+
#define MAX_RESOURCE_NUMBER 128
129+
struct resource_loongson {
130+
u64 start; /* resource start address */
131+
u64 end; /* resource end address */
132+
char name[64];
133+
u32 flags;
134+
};
135+
136+
struct archdev_data {}; /* arch specific additions */
137+
138+
struct board_devices {
139+
char name[64]; /* hold the device name */
140+
u32 num_resources; /* number of device_resource */
141+
/* for each device's resource */
142+
struct resource_loongson resource[MAX_RESOURCE_NUMBER];
143+
/* arch specific additions */
144+
struct archdev_data archdata;
145+
};
146+
147+
struct loongson_special_attribute {
148+
u16 vers; /* version of this special */
149+
char special_name[64]; /* special_atribute_name */
150+
u32 loongson_special_type; /* type of special device */
151+
/* for each device's resource */
152+
struct resource_loongson resource[MAX_RESOURCE_NUMBER];
153+
};
154+
155+
struct loongson_params {
156+
u64 memory_offset; /* efi_memory_map_loongson struct offset */
157+
u64 cpu_offset; /* efi_cpuinfo_loongson struct offset */
158+
u64 system_offset; /* system_loongson struct offset */
159+
u64 irq_offset; /* irq_source_routing_table struct offset */
160+
u64 interface_offset; /* interface_info struct offset */
161+
u64 special_offset; /* loongson_special_attribute struct offset */
162+
u64 boarddev_table_offset; /* board_devices offset */
163+
};
164+
165+
struct smbios_tables {
166+
u16 vers; /* version of smbios */
167+
u64 vga_bios; /* vga_bios address */
168+
struct loongson_params lp;
169+
};
170+
171+
struct efi_reset_system_t {
172+
u64 ResetCold;
173+
u64 ResetWarm;
174+
u64 ResetType;
175+
u64 Shutdown;
176+
u64 DoSuspend; /* NULL if not support */
177+
};
178+
179+
struct efi_loongson {
180+
u64 mps; /* MPS table */
181+
u64 acpi; /* ACPI table (IA64 ext 0.71) */
182+
u64 acpi20; /* ACPI table (ACPI 2.0) */
183+
struct smbios_tables smbios; /* SM BIOS table */
184+
u64 sal_systab; /* SAL system table */
185+
u64 boot_info; /* boot info table */
186+
};
187+
188+
struct boot_params {
189+
struct efi_loongson efi;
190+
struct efi_reset_system_t reset_system;
191+
};
192+
193+
struct loongson_system_configuration {
194+
u32 nr_cpus;
195+
u32 nr_nodes;
196+
int cores_per_node;
197+
int cores_per_package;
198+
u16 boot_cpu_id;
199+
u16 reserved_cpus_mask;
200+
enum loongson_cpu_type cputype;
201+
u64 ht_control_base;
202+
u64 pci_mem_start_addr;
203+
u64 pci_mem_end_addr;
204+
u64 pci_io_base;
205+
u64 restart_addr;
206+
u64 poweroff_addr;
207+
u64 suspend_addr;
208+
u64 vgabios_addr;
209+
u32 dma_mask_bits;
210+
char ecname[32];
211+
u32 nr_uarts;
212+
struct uart_device uarts[MAX_UARTS];
213+
u32 nr_sensors;
214+
struct sensor_device sensors[MAX_SENSORS];
215+
u64 workarounds;
216+
};
217+
218+
extern struct efi_memory_map_loongson *loongson_memmap;
219+
extern struct loongson_system_configuration loongson_sysconf;
220+
221+
#endif
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* This file is subject to the terms and conditions of the GNU General Public
3+
* License. See the file "COPYING" in the main directory of this archive
4+
* for more details.
5+
*
6+
* Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
7+
* Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
8+
* Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
9+
*
10+
* reference: /proc/cpuinfo,
11+
* arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12+
* arch/mips/kernel/proc.c(show_cpuinfo),
13+
* loongson2f user manual.
14+
*/
15+
16+
#ifndef __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H
17+
#define __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H
18+
19+
#define cpu_has_32fpr 1
20+
#define cpu_has_3k_cache 0
21+
#define cpu_has_4k_cache 1
22+
#define cpu_has_4kex 1
23+
#define cpu_has_64bits 1
24+
#define cpu_has_cache_cdex_p 0
25+
#define cpu_has_cache_cdex_s 0
26+
#define cpu_has_counter 1
27+
#define cpu_has_dc_aliases (PAGE_SIZE < 0x4000)
28+
#define cpu_has_divec 0
29+
#define cpu_has_ejtag 0
30+
#define cpu_has_inclusive_pcaches 1
31+
#define cpu_has_llsc 1
32+
#define cpu_has_mcheck 0
33+
#define cpu_has_mdmx 0
34+
#define cpu_has_mips16 0
35+
#define cpu_has_mips16e2 0
36+
#define cpu_has_mips3d 0
37+
#define cpu_has_mipsmt 0
38+
#define cpu_has_smartmips 0
39+
#define cpu_has_tlb 1
40+
#define cpu_has_tx39_cache 0
41+
#define cpu_has_vce 0
42+
#define cpu_has_veic 0
43+
#define cpu_has_vint 0
44+
#define cpu_has_vtag_icache 0
45+
#define cpu_has_watch 1
46+
47+
#ifdef CONFIG_CPU_LOONGSON64
48+
#define cpu_has_wsbh 1
49+
#define cpu_has_ic_fills_f_dc 1
50+
#define cpu_hwrena_impl_bits 0xc0000000
51+
#endif
52+
53+
#endif /* __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H */

0 commit comments

Comments
 (0)