Skip to content

Commit c89b3a8

Browse files
gmarullcfriedt
authored andcommitted
dts: arm: sifli: sf32lb52x: define gpioa nodes
Add nodes for the GPIO controller (controlling pins PA00-44). Naming is a bit confusing. In some places you'll find HPSYS_GPIO, other GPIO1, pins are named PA00-PA44... I've chosen "GPIOA". Because the Zephyr GPIO API assumes a maximum of 32 pins per controller, we have to split the controller into 32-bit wide blocks. In reality, the controller internally works like that (see the `reg` addresses), however, the whole block is clocked by a single RCC _switch_. Signed-off-by: Gerard Marull-Paretas <[email protected]>
1 parent 3eca7ef commit c89b3a8

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

dts/arm/sifli/sf32lb52x.dtsi

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <freq.h>
88

99
#include <zephyr/dt-bindings/clock/sf32lb52x-clocks.h>
10+
#include <zephyr/dt-bindings/pinctrl/sf32lb52x-pinctrl.h>
1011

1112
/ {
1213
cpus {
@@ -118,6 +119,41 @@
118119
status = "disabled";
119120
};
120121

122+
gpioa: gpio@500a0000 {
123+
compatible = "sifli,sf32lb-gpio-parent";
124+
reg = <0x500a0000 0x1000>;
125+
ranges = <0x0 0x500a0000 0x1000>;
126+
#address-cells = <1>;
127+
#size-cells = <1>;
128+
clocks = <&rcc_clk SF32LB52X_CLOCK_GPIO1>;
129+
interrupts = <84 0>;
130+
131+
/*
132+
* Split into 32 pin blocks due to Zephyr requiring GPIO
133+
* ports to have a maximum of 32 pins. This is a
134+
* Zephyrism, but it is what it is!
135+
*/
136+
gpioa_00_31: gpio@0 {
137+
compatible = "sifli,sf32lb-gpio";
138+
reg = <0x0 0x6c>;
139+
#gpio-cells = <2>;
140+
gpio-controller;
141+
ngpios = <32>;
142+
sifli,pinmuxs = <&pinctrl SF32LB_PORT_PA 0x0>;
143+
status = "disabled";
144+
};
145+
146+
gpioa_32_44: gpio@80 {
147+
compatible = "sifli,sf32lb-gpio";
148+
reg = <0x80 0x6c>;
149+
#gpio-cells = <2>;
150+
gpio-controller;
151+
ngpios = <13>;
152+
sifli,pinmuxs = <&pinctrl SF32LB_PORT_PA 0x80>;
153+
status = "disabled";
154+
};
155+
};
156+
121157
cfg: syscon@5000b000 {
122158
compatible = "sifli,sf32lb-cfg", "syscon";
123159
reg = <0x5000b000 0x1000>;

0 commit comments

Comments
 (0)