Skip to content

Commit 7319ba1

Browse files
manuarguemmahadevan108
authored andcommitted
boards: arm: mr_canhubk3: add support for GPIO
Add GPIO support for mr_canhubk3 board and enable GPIO tests. Signed-off-by: Manuel Argüelles <[email protected]>
1 parent 671d857 commit 7319ba1

File tree

6 files changed

+321
-0
lines changed

6 files changed

+321
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright 2023 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <nxp/s32/S32K344-172MQFP-pinctrl.h>
8+
9+
&pinctrl {
10+
11+
eirq0_default: eirq0_default {
12+
group1 {
13+
pinmux = <PTD15_EIRQ31>;
14+
input-enable;
15+
};
16+
};
17+
};

boards/arm/mr_canhubk3/mr_canhubk3.dts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
/dts-v1/;
88
#include <arm/nxp/nxp_s32k344_m7.dtsi>
9+
#include <dt-bindings/gpio/gpio.h>
10+
#include "mr_canhubk3-pinctrl.dtsi"
911

1012
/ {
1113
model = "NXP MR-CANHUBK3";
@@ -18,6 +20,42 @@
1820
zephyr,dtcm = &dtcm;
1921
zephyr,code-partition = &code_partition;
2022
};
23+
24+
aliases {
25+
led0 = &user_led1_red;
26+
led1 = &user_led1_green;
27+
led2 = &user_led1_blue;
28+
sw0 = &user_button_1;
29+
sw1 = &user_button_2;
30+
};
31+
32+
leds {
33+
compatible = "gpio-leds";
34+
user_led1_green: user_led1_green {
35+
gpios = <&gpioa_h 11 GPIO_ACTIVE_LOW>;
36+
label = "User RGB LED1 GREEN";
37+
};
38+
user_led1_blue: user_led1_blue {
39+
gpios = <&gpioe_l 12 GPIO_ACTIVE_LOW>;
40+
label = "User RGB LED1 BLUE";
41+
};
42+
user_led1_red: user_led1_red {
43+
gpios = <&gpioe_l 14 GPIO_ACTIVE_LOW>;
44+
label = "User RGB LED1 RED";
45+
};
46+
};
47+
48+
gpio_keys {
49+
compatible = "gpio-keys";
50+
user_button_1: button_0 {
51+
label = "User SW1";
52+
gpios = <&gpiod_l 15 GPIO_ACTIVE_HIGH>;
53+
};
54+
user_button_2: button_1 {
55+
label = "User SW2";
56+
gpios = <&gpioa_h 9 GPIO_ACTIVE_HIGH>;
57+
};
58+
};
2159
};
2260

2361
&flash0 {
@@ -37,3 +75,21 @@
3775
};
3876
};
3977
};
78+
79+
&gpioa_h {
80+
status = "okay";
81+
};
82+
83+
&gpioe_l {
84+
status = "okay";
85+
};
86+
87+
&gpiod_l {
88+
status = "okay";
89+
};
90+
91+
&eirq0 {
92+
pinctrl-0 = <&eirq0_default>;
93+
pinctrl-names = "default";
94+
status = "okay";
95+
};

boards/arm/mr_canhubk3/mr_canhubk3.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ ram: 1024
99
flash: 1024
1010
toolchain:
1111
- zephyr
12+
supported:
13+
- gpio

dts/arm/nxp/nxp_s32k344_m7.dtsi

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,212 @@
8080
#clock-cells = <1>;
8181
status = "okay";
8282
};
83+
84+
siul2: siul2@40290000 {
85+
reg = <0x40290000 0x10000>;
86+
#address-cells = <1>;
87+
#size-cells = <1>;
88+
89+
eirq0: eirq@40290010 {
90+
compatible = "nxp,s32-siul2-eirq";
91+
reg = <0x40290010 0x04>, <0x40290018 0x04>;
92+
reg-names = "disr0", "direr0";
93+
interrupts = <53 0>, <54 0>, <55 0>, <56 0>;
94+
interrupt-names = "0_7", "8_15", "16_23", "24_31";
95+
interrupt-controller;
96+
#interrupt-cells = <2>;
97+
status = "disabled";
98+
};
99+
100+
gpioa_l: gpio@40291702 {
101+
compatible = "nxp,s32-gpio";
102+
reg = <0x40291702 0x02>, <0x40290240 0x40>;
103+
reg-names = "pgpdo", "mscr";
104+
interrupt-parent = <&eirq0>;
105+
interrupts = <0 0>, <1 1>, <2 2>, <3 3>, <4 4>,
106+
<5 5>, <6 6>, <7 7>, <8 16>, <9 17>,
107+
<10 18>, <11 19>, <12 20>, <13 21>,
108+
<14 22>, <15 23>;
109+
gpio-controller;
110+
#gpio-cells = <2>;
111+
ngpios = <16>;
112+
status = "disabled";
113+
};
114+
115+
gpioa_h: gpio@40291700 {
116+
compatible = "nxp,s32-gpio";
117+
reg = <0x40291700 0x02>, <0x40290280 0x40>;
118+
reg-names = "pgpdo", "mscr";
119+
interrupt-parent = <&eirq0>;
120+
interrupts = <0 4>, <2 0>, <3 1>, <4 2>,
121+
<5 3>, <9 5>, <12 6>, <14 7>;
122+
gpio-controller;
123+
#gpio-cells = <2>;
124+
ngpios = <16>;
125+
status = "disabled";
126+
};
127+
128+
gpiob_l: gpio@40291706 {
129+
compatible = "nxp,s32-gpio";
130+
reg = <0x40291706 0x02>, <0x402902c0 0x40>;
131+
reg-names = "pgpdo", "mscr";
132+
interrupt-parent = <&eirq0>;
133+
interrupts = <0 8>, <1 9>, <2 10>, <3 11>, <4 12>,
134+
<5 13>, <8 14>, <9 15>, <10 24>, <11 25>,
135+
<12 26>, <13 27>, <14 28>, <15 29>;
136+
gpio-controller;
137+
#gpio-cells = <2>;
138+
ngpios = <16>;
139+
gpio-reserved-ranges = <6 2>;
140+
status = "disabled";
141+
};
142+
143+
gpiob_h: gpio@40291704 {
144+
compatible = "nxp,s32-gpio";
145+
reg = <0x40291704 0x02>, <0x40290300 0x40>;
146+
reg-names = "pgpdo", "mscr";
147+
interrupt-parent = <&eirq0>;
148+
interrupts = <0 30>, <1 31>, <5 8>, <6 9>, <7 10>,
149+
<8 11>, <9 12>, <10 13>, <12 14>, <15 15>;
150+
gpio-controller;
151+
#gpio-cells = <2>;
152+
ngpios = <16>;
153+
status = "disabled";
154+
};
155+
156+
gpioc_l: gpio@4029170a {
157+
compatible = "nxp,s32-gpio";
158+
reg = <0x4029170a 0x02>, <0x40290340 0x40>;
159+
reg-names = "pgpdo", "mscr";
160+
interrupt-parent = <&eirq0>;
161+
interrupts = <0 1>, <1 1>, <2 2>, <3 3>, <4 4>,
162+
<5 5>, <6 6>, <7 7>, <8 16>, <9 17>,
163+
<10 18>, <11 19>, <12 20>, <13 21>,
164+
<14 22>, <15 23>;
165+
gpio-controller;
166+
#gpio-cells = <2>;
167+
ngpios = <16>;
168+
status = "disabled";
169+
};
170+
171+
gpioc_h: gpio@40291708 {
172+
compatible = "nxp,s32-gpio";
173+
reg = <0x40291708 0x02>, <0x40290380 0x40>;
174+
reg-names = "pgpdo", "mscr";
175+
interrupt-parent = <&eirq0>;
176+
interrupts = <4 16>, <5 17>, <7 18>, <8 19>,
177+
<9 20>, <10 21>, <11 22>, <13 23>;
178+
gpio-controller;
179+
#gpio-cells = <2>;
180+
ngpios = <16>;
181+
status = "disabled";
182+
};
183+
184+
gpiod_l: gpio@4029170e {
185+
compatible = "nxp,s32-gpio";
186+
reg = <0x4029170e 0x02>, <0x402903c0 0x40>;
187+
reg-names = "pgpdo", "mscr";
188+
interrupt-parent = <&eirq0>;
189+
interrupts = <0 8>, <1 9>, <2 10>, <3 11>, <4 12>,
190+
<5 13>, <6 14>, <7 15>, <8 24>,
191+
<9 25>, <10 26>, <11 27>, <12 28>,
192+
<13 29>, <14 30>, <15 31>;
193+
gpio-controller;
194+
#gpio-cells = <2>;
195+
ngpios = <16>;
196+
status = "disabled";
197+
};
198+
199+
gpiod_h: gpio@4029170c {
200+
compatible = "nxp,s32-gpio";
201+
reg = <0x4029170c 0x02>, <0x40290400 0x40>;
202+
reg-names = "pgpdo", "mscr";
203+
interrupt-parent = <&eirq0>;
204+
interrupts = <1 24>, <4 25>, <5 26>, <6 27>,
205+
<7 28>, <8 29>, <11 30>, <12 31>;
206+
gpio-controller;
207+
#gpio-cells = <2>;
208+
ngpios = <16>;
209+
status = "disabled";
210+
};
211+
212+
gpioe_l: gpio@40291712 {
213+
compatible = "nxp,s32-gpio";
214+
reg = <0x40291712 0x02>, <0x40290440 0x40>;
215+
reg-names = "pgpdo", "mscr";
216+
interrupt-parent = <&eirq0>;
217+
interrupts = <0 0>, <1 1>, <2 2>, <3 3>,
218+
<4 4>, <5 5>, <6 6>, <8 7>,
219+
<9 8>, <10 9>, <11 10>, <12 11>,
220+
<13 12>, <14 13>, <15 14>;
221+
gpio-controller;
222+
#gpio-cells = <2>;
223+
ngpios = <16>;
224+
status = "disabled";
225+
};
226+
227+
gpioe_h: gpio@40291710 {
228+
compatible = "nxp,s32-gpio";
229+
reg = <0x40291710 0x02>, <0x40290480 0x40>;
230+
reg-names = "pgpdo", "mscr";
231+
interrupt-parent = <&eirq0>;
232+
interrupts = <0 15>;
233+
gpio-controller;
234+
#gpio-cells = <2>;
235+
ngpios = <16>;
236+
status = "disabled";
237+
};
238+
239+
gpiof_l: gpio@40291716 {
240+
compatible = "nxp,s32-gpio";
241+
reg = <0x40291716 0x02>, <0x402904c0 0x40>;
242+
reg-names = "pgpdo", "mscr";
243+
interrupt-parent = <&eirq0>;
244+
interrupts = <0 0>, <1 1>, <2 2>, <3 3>,
245+
<4 4>, <5 5>, <6 6>, <7 7>,
246+
<8 16>, <9 17>, <10 18>, <11 19>,
247+
<12 20>, <13 21>, <14 22>, <15 23>;
248+
gpio-controller;
249+
#gpio-cells = <2>;
250+
ngpios = <16>;
251+
status = "disabled";
252+
};
253+
254+
gpiof_h: gpio@40291714 {
255+
compatible = "nxp,s32-gpio";
256+
reg = <0x40291714 0x02>, <0x40290500 0x40>;
257+
reg-names = "pgpdo", "mscr";
258+
gpio-controller;
259+
#gpio-cells = <2>;
260+
ngpios = <16>;
261+
status = "disabled";
262+
};
263+
264+
gpiog_l: gpio@4029171a {
265+
compatible = "nxp,s32-gpio";
266+
reg = <0x4029171a 0x02>, <0x40290540 0x40>;
267+
reg-names = "pgpdo", "mscr";
268+
interrupt-parent = <&eirq0>;
269+
interrupts = <0 8>, <1 9>, <2 10>, <3 11>,
270+
<4 12>, <5 13>, <6 14>, <7 15>,
271+
<8 24>, <9 25>, <10 26>, <11 27>,
272+
<12 28>, <13 29>, <14 30>, <15 31>;
273+
gpio-controller;
274+
#gpio-cells = <2>;
275+
ngpios = <16>;
276+
status = "disabled";
277+
};
278+
279+
gpiog_h: gpio@40291718 {
280+
compatible = "nxp,s32-gpio";
281+
reg = <0x40291718 0x02>, <0x40290580 0x40>;
282+
reg-names = "pgpdo", "mscr";
283+
gpio-controller;
284+
#gpio-cells = <2>;
285+
ngpios = <16>;
286+
status = "disabled";
287+
};
288+
};
83289
};
84290
};
85291

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright 2023 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
aliases {
9+
/* Use the blue LED pin for this test because it supports interrupts */
10+
led0 = &user_led1_blue;
11+
};
12+
};
13+
14+
&eirq0_default {
15+
group2 {
16+
pinmux = <PTE12_EIRQ11>;
17+
input-enable;
18+
};
19+
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright 2023 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
resources {
9+
compatible = "test-gpio-basic-api";
10+
/* Use LPSPI1 MISO/MOSI pins which are also used for spi_loopback test */
11+
out-gpios = <&gpioa_h 13 0>;
12+
in-gpios = <&gpioa_h 14 0>;
13+
};
14+
};
15+
16+
&eirq0_default {
17+
group2 {
18+
pinmux = <PTA30_EIRQ7>;
19+
input-enable;
20+
};
21+
};

0 commit comments

Comments
 (0)