Skip to content

Commit b9eda39

Browse files
committed
dts/soc: sophgo: Add SOPHGO SG2000/SG2002
SG2000, also named "CV1813H". SG2002, also named "CV1812CP". Both of them are multi-core SoCs developed by SOPHGO, belonging to the CV181x series. Signed-off-by: Chen Xingyu <[email protected]>
1 parent 354af7e commit b9eda39

File tree

6 files changed

+177
-0
lines changed

6 files changed

+177
-0
lines changed

dts/riscv/sophgo/cv181x.dtsi

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/*
2+
* Copyright (c) 2024 Chen Xingyu <[email protected]>
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#include <mem.h>
7+
#include <freq.h>
8+
9+
#include <sophgo/cv18xx-c906-common.dtsi>
10+
11+
/ {
12+
soc {
13+
compatible = "sophgo,cv181x", "simple-bus";
14+
15+
gpioa: gpio@3020000 {
16+
compatible = "snps,designware-gpio";
17+
reg = <0x3020000 DT_SIZE_K(4)>;
18+
interrupts = <41 1>;
19+
gpio-controller;
20+
#gpio-cells = <2>;
21+
status = "disabled";
22+
};
23+
24+
gpiob: gpio@3021000 {
25+
compatible = "snps,designware-gpio";
26+
reg = <0x3021000 DT_SIZE_K(4)>;
27+
interrupts = <42 1>;
28+
gpio-controller;
29+
#gpio-cells = <2>;
30+
status = "disabled";
31+
};
32+
33+
gpioc: gpio@3022000 {
34+
compatible = "snps,designware-gpio";
35+
reg = <0x3022000 DT_SIZE_K(4)>;
36+
interrupts = <43 1>;
37+
gpio-controller;
38+
#gpio-cells = <2>;
39+
status = "disabled";
40+
};
41+
42+
gpiod: gpio@3023000 {
43+
compatible = "snps,designware-gpio";
44+
reg = <0x3023000 DT_SIZE_K(4)>;
45+
interrupts = <44 1>;
46+
gpio-controller;
47+
#gpio-cells = <2>;
48+
status = "disabled";
49+
};
50+
51+
uart0: uart@4140000 {
52+
compatible = "ns16550";
53+
reg = <0x4140000 DT_SIZE_K(64)>;
54+
interrupts = <30 1>;
55+
reg-shift = <2>;
56+
clock-frequency = <DT_FREQ_M(25)>;
57+
status = "disabled";
58+
};
59+
60+
uart1: uart@4150000 {
61+
compatible = "ns16550";
62+
reg = <0x4150000 DT_SIZE_K(64)>;
63+
interrupts = <31 1>;
64+
reg-shift = <2>;
65+
clock-frequency = <DT_FREQ_M(25)>;
66+
status = "disabled";
67+
};
68+
69+
uart2: uart@4160000 {
70+
compatible = "ns16550";
71+
reg = <0x4160000 DT_SIZE_K(64)>;
72+
/* interrupt is not supported */
73+
reg-shift = <2>;
74+
clock-frequency = <DT_FREQ_M(25)>;
75+
status = "disabled";
76+
};
77+
78+
uart3: uart@4170000 {
79+
compatible = "ns16550";
80+
reg = <0x4170000 DT_SIZE_K(64)>;
81+
/* interrupt is not supported */
82+
reg-shift = <2>;
83+
clock-frequency = <DT_FREQ_M(25)>;
84+
status = "disabled";
85+
};
86+
87+
uart4: uart@41c0000 {
88+
compatible = "ns16550";
89+
reg = <0x41c0000 DT_SIZE_K(64)>;
90+
/* interrupt is not supported */
91+
reg-shift = <2>;
92+
clock-frequency = <DT_FREQ_M(25)>;
93+
status = "disabled";
94+
};
95+
96+
pwr_gpio: gpio@5021000 {
97+
compatible = "snps,designware-gpio";
98+
reg = <0x5021000 DT_SIZE_K(4)>;
99+
interrupts = <48 1>;
100+
gpio-controller;
101+
#gpio-cells = <2>;
102+
status = "disabled";
103+
};
104+
};
105+
};

soc/sophgo/cv181x/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "")

soc/sophgo/cv181x/Kconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (c) 2024 Chen Xingyu <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_SERIES_CV181X
5+
select 64BIT
6+
select RISCV
7+
select RISCV_PRIVILEGED
8+
select RISCV_ISA_RV64I
9+
select RISCV_ISA_EXT_M
10+
select RISCV_ISA_EXT_A
11+
select RISCV_ISA_EXT_F
12+
select RISCV_ISA_EXT_D
13+
select RISCV_ISA_EXT_C
14+
select RISCV_ISA_EXT_ZICSR
15+
select RISCV_ISA_EXT_ZIFENCEI
16+
select RISCV_SOC_HAS_GP_RELATIVE_ADDRESSING
17+
select INCLUDE_RESET_VECTOR
18+
select ATOMIC_OPERATIONS_C

soc/sophgo/cv181x/Kconfig.defconfig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright (c) 2024 Chen Xingyu <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if SOC_SERIES_CV181X
5+
6+
config SYS_CLOCK_HW_CYCLES_PER_SEC
7+
default 25000000
8+
9+
config NUM_IRQS
10+
int
11+
default 128
12+
13+
config RISCV_SOC_INTERRUPT_INIT
14+
default y
15+
16+
config RISCV_HAS_PLIC
17+
default y
18+
19+
config 2ND_LVL_INTR_00_OFFSET
20+
default 11
21+
22+
endif # SOC_SERIES_CV181X

soc/sophgo/cv181x/Kconfig.soc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) 2024 Chen Xingyu <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_SERIES_CV181X
5+
bool
6+
select SOC_FAMILY_SOPHGO
7+
8+
config SOC_SERIES
9+
default "cv181x" if SOC_SERIES_CV181X
10+
11+
config SOC_SG2000
12+
bool
13+
select SOC_SERIES_CV181X
14+
15+
config SOC_SG2002
16+
bool
17+
select SOC_SERIES_CV181X
18+
19+
config SOC
20+
default "sg2000" if SOC_SG2000
21+
default "sg2002" if SOC_SG2002

soc/sophgo/soc.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,11 @@ family:
66
- name: cv1800b
77
cpuclusters:
88
- name: c906_1
9+
- name: cv181x
10+
socs:
11+
- name: sg2000
12+
cpuclusters:
13+
- name: c906_1
14+
- name: sg2002
15+
cpuclusters:
16+
- name: c906_1

0 commit comments

Comments
 (0)