Skip to content

Commit 2013d6e

Browse files
VynDragonfabiobaltieri
authored andcommitted
dts: wch: Introduce CH32V203
Introduce CH32V203 SoC Signed-off-by: Camille BAUD <[email protected]>
1 parent 72dadd3 commit 2013d6e

15 files changed

+482
-0
lines changed

dts/bindings/cpu/wch,qingke-v4b.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
description: WCH QingKe V4B RISC-V MCU
5+
6+
compatible: "wch,qingke-v4b"
7+
8+
include: riscv,cpus.yaml

dts/riscv/wch/ch32v203/ch32v203.dtsi

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
/*
2+
* Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <freq.h>
8+
#include <mem.h>
9+
#include <wch/qingke-v4b.dtsi>
10+
#include <zephyr/dt-bindings/gpio/gpio.h>
11+
#include <zephyr/dt-bindings/i2c/i2c.h>
12+
#include <zephyr/dt-bindings/clock/ch32v20x_30x-clocks.h>
13+
14+
/ {
15+
clocks {
16+
clk_hse: clk-hse {
17+
#clock-cells = <0>;
18+
compatible = "wch,ch32v00x-hse-clock";
19+
clock-frequency = <DT_FREQ_M(8)>;
20+
status = "disabled";
21+
};
22+
23+
clk_hsi: clk-hsi {
24+
#clock-cells = <0>;
25+
compatible = "wch,ch32v00x-hsi-clock";
26+
clock-frequency = <DT_FREQ_M(8)>;
27+
status = "disabled";
28+
};
29+
30+
clk_lsi: clk-lsi {
31+
#clock-cells = <0>;
32+
compatible = "fixed-clock";
33+
clock-frequency = <DT_FREQ_K(32)>;
34+
status = "disabled";
35+
};
36+
37+
pll: pll {
38+
#clock-cells = <0>;
39+
compatible = "wch,ch32v20x_30x-pll-clock";
40+
mul = <15>;
41+
status = "disabled";
42+
};
43+
};
44+
45+
soc {
46+
sram0: memory@20000000 {
47+
compatible = "mmio-sram";
48+
};
49+
50+
flash: flash-controller@40022000 {
51+
compatible = "wch,ch32v20x_30x-flash-controller";
52+
reg = <0x40022000 0x400>;
53+
#address-cells = <1>;
54+
#size-cells = <1>;
55+
56+
flash0: flash@8000000 {
57+
compatible = "soc-nv-flash";
58+
reg = <0x08000000 DT_SIZE_K(224)>;
59+
};
60+
};
61+
62+
pwr: pwr@40007000 {
63+
compatible = "wch,pwr";
64+
reg = <0x40007000 16>;
65+
};
66+
67+
pinctrl: pin-controller@40010000 {
68+
compatible = "wch,20x_30x-afio";
69+
reg = <0x40010000 16>;
70+
#address-cells = <1>;
71+
#size-cells = <1>;
72+
73+
gpioa: gpio@40010800 {
74+
compatible = "wch,gpio";
75+
reg = <0x40010800 0x20>;
76+
gpio-controller;
77+
#gpio-cells = <2>;
78+
ngpios = <8>;
79+
clocks = <&rcc CH32V20X_V30X_CLOCK_IOPA>;
80+
};
81+
82+
gpiob: gpio@40010C00 {
83+
compatible = "wch,gpio";
84+
reg = <0x40010C00 0x20>;
85+
gpio-controller;
86+
#gpio-cells = <2>;
87+
ngpios = <8>;
88+
clocks = <&rcc CH32V20X_V30X_CLOCK_IOPB>;
89+
};
90+
91+
gpioc: gpio@40011000 {
92+
compatible = "wch,gpio";
93+
reg = <0x40011000 0x20>;
94+
gpio-controller;
95+
#gpio-cells = <2>;
96+
ngpios = <8>;
97+
clocks = <&rcc CH32V20X_V30X_CLOCK_IOPC>;
98+
};
99+
100+
gpiod: gpio@40011400 {
101+
compatible = "wch,gpio";
102+
reg = <0x40011400 0x20>;
103+
gpio-controller;
104+
#gpio-cells = <2>;
105+
ngpios = <8>;
106+
clocks = <&rcc CH32V20X_V30X_CLOCK_IOPD>;
107+
};
108+
};
109+
110+
usart1: uart@40013800 {
111+
compatible = "wch,usart";
112+
reg = <0x40013800 0x20>;
113+
clocks = <&rcc CH32V20X_V30X_CLOCK_USART1>;
114+
interrupt-parent = <&pfic>;
115+
interrupts = <53>;
116+
status = "disabled";
117+
};
118+
119+
usart2: uart@40004400 {
120+
compatible = "wch,usart";
121+
reg = <0x40004400 0x20>;
122+
clocks = <&rcc CH32V20X_V30X_CLOCK_USART2>;
123+
interrupt-parent = <&pfic>;
124+
interrupts = <54>;
125+
status = "disabled";
126+
};
127+
128+
rcc: rcc@40021000 {
129+
compatible = "wch,rcc";
130+
reg = <0x40021000 16>;
131+
#clock-cells = <1>;
132+
};
133+
};
134+
};
135+
136+
&cpu0 {
137+
clock-frequency = <DT_FREQ_M(120)>;
138+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <wch/ch32v203/ch32v203.dtsi>
8+
9+
&gpioc {
10+
gpio-reserved-ranges = <0 13>;
11+
};
12+
13+
&gpiod {
14+
gpio-reserved-ranges = <2 16>;
15+
};
16+
17+
&sram0 {
18+
reg = <0x20000000 DT_SIZE_K(10)>;
19+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
* Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <wch/ch32v203/ch32v203c6t.dtsi>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <wch/ch32v203/ch32v203.dtsi>
8+
9+
&gpioc {
10+
gpio-reserved-ranges = <0 13>;
11+
};
12+
13+
&gpiod {
14+
gpio-reserved-ranges = <2 16>;
15+
};
16+
17+
&sram0 {
18+
reg = <0x20000000 DT_SIZE_K(20)>;
19+
};
20+
21+
/ {
22+
soc {
23+
usart3: uart@40004800 {
24+
compatible = "wch,usart";
25+
reg = <0x40004800 0x20>;
26+
clocks = <&rcc CH32V20X_V30X_CLOCK_USART3>;
27+
interrupt-parent = <&pfic>;
28+
interrupts = <55>;
29+
status = "disabled";
30+
};
31+
32+
usart4: uart@40004c00 {
33+
compatible = "wch,usart";
34+
reg = <0x40004C00 0x20>;
35+
clocks = <&rcc CH32V20X_V30X_CLOCK_USART4>;
36+
interrupt-parent = <&pfic>;
37+
interrupts = <68>;
38+
status = "disabled";
39+
};
40+
};
41+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
* Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <wch/ch32v203/ch32v203c8t.dtsi>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <wch/ch32v203/ch32v203.dtsi>
8+
9+
&gpioa {
10+
gpio-reserved-ranges = <8 11>, <15 16>;
11+
};
12+
13+
&gpiob {
14+
gpio-reserved-ranges = <0 1>, <2 8>, <9 16>;
15+
};
16+
17+
&gpioc {
18+
gpio-reserved-ranges = <0 16>;
19+
};
20+
21+
&gpiod {
22+
gpio-reserved-ranges = <2 16>;
23+
};
24+
25+
&sram0 {
26+
reg = <0x20000000 DT_SIZE_K(10)>;
27+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <wch/ch32v203/ch32v203.dtsi>
8+
9+
&gpioa {
10+
gpio-reserved-ranges = <11 13>, <15 16>;
11+
};
12+
13+
&gpiob {
14+
gpio-reserved-ranges = <1 6>, <8 13>;
15+
};
16+
17+
&gpioc {
18+
gpio-reserved-ranges = <0 16>;
19+
};
20+
21+
&gpiod {
22+
gpio-reserved-ranges = <0 16>;
23+
};
24+
25+
&sram0 {
26+
reg = <0x20000000 DT_SIZE_K(20)>;
27+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <wch/ch32v203/ch32v203.dtsi>
8+
9+
&gpioa {
10+
gpio-reserved-ranges = <11 13>, <15 16>;
11+
};
12+
13+
&gpiob {
14+
gpio-reserved-ranges = <2 10>, <12 14>;
15+
};
16+
17+
&gpioc {
18+
gpio-reserved-ranges = <0 16>;
19+
};
20+
21+
&gpiod {
22+
gpio-reserved-ranges = <0 16>;
23+
};
24+
25+
&sram0 {
26+
reg = <0x20000000 DT_SIZE_K(20)>;
27+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2025 MASSDRIVER EI (massdriver.space)
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <wch/ch32v203/ch32v203.dtsi>
8+
9+
&gpioa {
10+
gpio-reserved-ranges = <8 9>;
11+
};
12+
13+
&gpiob {
14+
gpio-reserved-ranges = <2 3>, <10 16>;
15+
};
16+
17+
&gpioc {
18+
gpio-reserved-ranges = <0 16>;
19+
};
20+
21+
&gpiod {
22+
gpio-reserved-ranges = <2 16>;
23+
};
24+
25+
&sram0 {
26+
reg = <0x20000000 DT_SIZE_K(10)>;
27+
};

0 commit comments

Comments
 (0)