Skip to content

Commit 957ec63

Browse files
recalcikartben
authored andcommitted
dts: wch: add all ch32v003 packages
Add support for all ch32v003 packages. Signed-off-by: Jianxiong Gu <[email protected]>
1 parent 384144d commit 957ec63

File tree

7 files changed

+105
-47
lines changed

7 files changed

+105
-47
lines changed

boards/wch/ch32v003evt/ch32v003evt.dts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
/dts-v1/;
77

8-
#include <wch/ch32v0/ch32v003.dtsi>
8+
#include <wch/ch32v0/ch32v003f4p.dtsi>
99
#include "ch32v003evt-pinctrl.dtsi"
1010

1111
/ {

dts/riscv/wch/ch32v0/ch32v003.dtsi

Lines changed: 15 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,12 @@
66

77
#include <freq.h>
88
#include <mem.h>
9+
#include <wch/qingke-v2.dtsi>
910
#include <zephyr/dt-bindings/gpio/gpio.h>
1011
#include <zephyr/dt-bindings/i2c/i2c.h>
1112
#include <zephyr/dt-bindings/clock/ch32v00x-clocks.h>
1213

1314
/ {
14-
#address-cells = <1>;
15-
#size-cells = <1>;
16-
17-
cpus {
18-
#address-cells = <1>;
19-
#size-cells = <0>;
20-
21-
cpu0: cpu@0 {
22-
device_type = "cpu";
23-
compatible = "wch,qingke-v2";
24-
reg = <0>;
25-
clock-frequency = <DT_FREQ_M(48)>;
26-
};
27-
};
28-
2915
clocks {
3016
clk_hse: clk-hse {
3117
#clock-cells = <0>;
@@ -55,14 +41,9 @@
5541
};
5642

5743
soc {
58-
#address-cells = <1>;
59-
#size-cells = <1>;
60-
compatible = "simple-bus";
61-
ranges;
62-
6344
sram0: memory@20000000 {
6445
compatible = "mmio-sram";
65-
reg = <0x20000000 0x800>;
46+
reg = <0x20000000 DT_SIZE_K(2)>;
6647
};
6748

6849
flash: flash-controller@40022000 {
@@ -74,51 +55,35 @@
7455

7556
flash0: flash@0 {
7657
compatible = "soc-nv-flash";
77-
reg = <0 0x4000>;
58+
reg = <0 DT_SIZE_K(16)>;
7859
};
7960
};
8061

81-
pfic: interrupt-controller@e000e000 {
82-
compatible = "wch,pfic";
83-
#address-cells = <0>;
84-
#interrupt-cells = <1>;
85-
interrupt-controller;
86-
reg = <0xe000e000 16>;
87-
status = "okay";
88-
};
89-
90-
systick: systimer@e000f000 {
91-
compatible = "wch,systick";
92-
reg = <0xe000f000 16>;
93-
status = "okay";
94-
interrupt-parent = <&pfic>;
95-
interrupts = <12>;
96-
};
97-
9862
pwr: pwr@40007000 {
9963
compatible = "wch,pwr";
100-
reg = <0x40007000 16>;
64+
reg = <0x40007000 0x10>;
10165
};
10266

10367
pinctrl: pin-controller@40010000 {
10468
compatible = "wch,afio";
105-
reg = <0x40010000 16>;
69+
reg = <0x40010000 0x10>;
10670
#address-cells = <1>;
10771
#size-cells = <1>;
10872
status = "okay";
10973

11074
gpioa: gpio@40010800 {
11175
compatible = "wch,gpio";
112-
reg = <0x40010800 32>;
76+
reg = <0x40010800 0x20>;
11377
gpio-controller;
11478
#gpio-cells = <2>;
11579
ngpios = <8>;
80+
gpio-reserved-ranges = <0 1>, <3 5>;
11681
clocks = <&rcc CH32V00X_CLOCK_IOPA>;
11782
};
11883

11984
gpioc: gpio@40011000 {
12085
compatible = "wch,gpio";
121-
reg = <0x40011000 32>;
86+
reg = <0x40011000 0x20>;
12287
gpio-controller;
12388
#gpio-cells = <2>;
12489
ngpios = <8>;
@@ -127,7 +92,7 @@
12792

12893
gpiod: gpio@40011400 {
12994
compatible = "wch,gpio";
130-
reg = <0x40011400 32>;
95+
reg = <0x40011400 0x20>;
13196
gpio-controller;
13297
#gpio-cells = <2>;
13398
ngpios = <8>;
@@ -137,17 +102,21 @@
137102

138103
usart1: uart@40013800 {
139104
compatible = "wch,usart";
140-
reg = <0x40013800 16>;
105+
reg = <0x40013800 0x10>;
141106
clocks = <&rcc CH32V00X_CLOCK_USART1>;
142107
interrupt-parent = <&pfic>;
143108
interrupts = <32>;
144109
};
145110

146111
rcc: rcc@40021000 {
147112
compatible = "wch,rcc";
148-
reg = <0x40021000 16>;
113+
reg = <0x40021000 0x10>;
149114
#clock-cells = <1>;
150115
status = "okay";
151116
};
152117
};
153118
};
119+
120+
&cpu0 {
121+
clock-frequency = <DT_FREQ_M(48)>;
122+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright (c) 2024 Michael Hope
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <wch/ch32v0/ch32v003.dtsi>
8+
9+
&gpioc {
10+
gpio-reserved-ranges = <5 1>;
11+
};
12+
13+
&gpiod {
14+
gpio-reserved-ranges = <0 1>, <2 2>;
15+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
* Copyright (c) 2024 Michael Hope
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <wch/ch32v0/ch32v003.dtsi>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
* Copyright (c) 2024 Michael Hope
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <wch/ch32v0/ch32v003.dtsi>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright (c) 2024 Michael Hope
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <wch/ch32v0/ch32v003.dtsi>
8+
9+
&gpioc {
10+
gpio-reserved-ranges = <0 1>, <3 1>, <5 3>;
11+
};
12+
13+
&gpiod {
14+
gpio-reserved-ranges = <0 1>, <2 2>, <7 1>;
15+
};

dts/riscv/wch/qingke-v2.dtsi

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright (c) 2024 Michael Hope
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
#address-cells = <1>;
9+
#size-cells = <1>;
10+
11+
cpus {
12+
#address-cells = <1>;
13+
#size-cells = <0>;
14+
15+
cpu0: cpu@0 {
16+
device_type = "cpu";
17+
compatible = "wch,qingke-v2";
18+
reg = <0>;
19+
};
20+
};
21+
22+
soc {
23+
#address-cells = <1>;
24+
#size-cells = <1>;
25+
compatible = "simple-bus";
26+
ranges;
27+
28+
pfic: interrupt-controller@e000e000 {
29+
compatible = "wch,pfic";
30+
#address-cells = <0>;
31+
#interrupt-cells = <1>;
32+
interrupt-controller;
33+
reg = <0xe000e000 0x10>;
34+
status = "okay";
35+
};
36+
37+
systick: systimer@e000f000 {
38+
compatible = "wch,systick";
39+
reg = <0xe000f000 0x10>;
40+
status = "okay";
41+
interrupt-parent = <&pfic>;
42+
interrupts = <12>;
43+
};
44+
};
45+
};

0 commit comments

Comments
 (0)