Skip to content

Commit 84d9588

Browse files
gmarullgalak
authored andcommitted
boards: nrf52840dk_nrf52840: add pinctrl support for uart
This patch changes old pin based configuration to the state based pinctrl configuration. All pin selection and GPIO configuration are now described in devicetree. Signed-off-by: Gerard Marull-Paretas <[email protected]>
1 parent 1bb86a1 commit 84d9588

File tree

3 files changed

+38
-9
lines changed

3 files changed

+38
-9
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
&pinctrl {
2+
/* UART0 */
3+
uart0_default: uart0_default {
4+
pincfg = <PINCTRL_NRF(0, 6, OUT, IDISC, PN, UART_TX)
5+
PINCTRL_NRF(0, 8, INP, ICONN, PU, UART_RX)
6+
PINCTRL_NRF(0, 5, OUT, IDISC, PN, UART_RTS)
7+
PINCTRL_NRF(0, 7, INP, ICONN, PU, UART_CTS)>;
8+
};
9+
10+
uart0_sleep: uart0_sleep {
11+
pincfg = <PINCTRL_NRF(0, 6, INP, IDISC, PN, UART_TX)
12+
PINCTRL_NRF(0, 8, INP, IDISC, PN, UART_RX)
13+
PINCTRL_NRF(0, 5, INP, IDISC, PN, UART_RTS)
14+
PINCTRL_NRF(0, 7, INP, IDISC, PN, UART_CTS)>;
15+
};
16+
17+
/* UART1 */
18+
uart1_default: uart1_default {
19+
pincfg = <PINCTRL_NRF(1, 2, OUT, IDISC, PN, UART_TX)
20+
PINCTRL_NRF(1, 1, INP, ICONN, PU, UART_RX)>;
21+
};
22+
23+
uart1_sleep: uart1_sleep {
24+
pincfg = <PINCTRL_NRF(1, 2, INP, IDISC, PN, UART_TX)
25+
PINCTRL_NRF(1, 1, INP, IDISC, PN, UART_RX)>;
26+
};
27+
};

boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
/dts-v1/;
88
#include <nordic/nrf52840_qiaa.dtsi>
9+
#include "nrf52840dk_nrf52840-pinctrl.dtsi"
910

1011
/ {
1112
model = "Nordic nRF52840 DK NRF52840";
@@ -144,20 +145,19 @@
144145
compatible = "nordic,nrf-uarte";
145146
status = "okay";
146147
current-speed = <115200>;
147-
tx-pin = <6>;
148-
rx-pin = <8>;
149-
rx-pull-up;
150-
rts-pin = <5>;
151-
cts-pin = <7>;
152-
cts-pull-up;
148+
149+
pinctrl-0 = <&uart0_default>;
150+
pinctrl-1 = <&uart0_sleep>;
151+
pinctrl-names = "default", "sleep";
153152
};
154153

155154
arduino_serial: &uart1 {
156155
status = "okay";
157156
current-speed = <115200>;
158-
rx-pin = <33>;
159-
rx-pull-up;
160-
tx-pin = <34>;
157+
158+
pinctrl-0 = <&uart1_default>;
159+
pinctrl-1 = <&uart1_sleep>;
160+
pinctrl-names = "default", "sleep";
161161
};
162162

163163
arduino_i2c: &i2c0 {

boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ CONFIG_UART_CONSOLE=y
2525

2626
# additional board options
2727
CONFIG_GPIO_AS_PINRESET=y
28+
29+
CONFIG_PINCTRL=y

0 commit comments

Comments
 (0)