From bfaf027dded4bf980f978138755e63a2f01acfe2 Mon Sep 17 00:00:00 2001 From: Gerson Fernando Budke Date: Thu, 10 Mar 2022 22:16:26 -0300 Subject: [PATCH] drivers: serial: Update sam drivers to use pinctrl This update Atmel sam serial drivers to use pinctrl driver and API. It updates all boards with new pinctrl groups format. Signed-off-by: Gerson Fernando Budke --- .../arm/arduino_due/arduino_due-pinctrl.dtsi | 42 +++++++++++ boards/arm/arduino_due/arduino_due.dts | 6 +- boards/arm/sam4e_xpro/sam4e_xpro-pinctrl.dtsi | 32 ++++++++ boards/arm/sam4e_xpro/sam4e_xpro.dts | 17 ++++- boards/arm/sam4l_ek/sam4l_ek-pinctrl.dtsi | 32 ++++++++ boards/arm/sam4l_ek/sam4l_ek.dts | 7 +- .../sam4s_xplained-pinctrl.dtsi | 27 +++++++ boards/arm/sam4s_xplained/sam4s_xplained.dts | 11 ++- .../sam_e70_xplained-common.dtsi | 7 +- .../sam_e70_xplained-pinctrl.dtsi | 74 +++++++++++++++++++ .../arm/sam_v71_xult/sam_v71_xult-common.dtsi | 15 +++- .../sam_v71_xult/sam_v71_xult-pinctrl.dtsi | 72 ++++++++++++++++++ .../esp_8266/boards/sam4e_xpro.overlay | 12 ++- drivers/serial/uart_sam.c | 14 ++-- drivers/serial/usart_sam.c | 14 ++-- dts/arm/atmel/sam3x.dtsi | 3 +- dts/arm/atmel/sam4e.dtsi | 6 +- dts/arm/atmel/sam4l.dtsi | 2 +- dts/arm/atmel/sam4s.dtsi | 6 +- dts/arm/atmel/same70.dtsi | 6 +- dts/bindings/serial/atmel,sam-uart.yaml | 17 +---- dts/bindings/serial/atmel,sam-usart.yaml | 17 +---- .../boards/atsamr21_xpro.overlay | 11 ++- 23 files changed, 379 insertions(+), 71 deletions(-) create mode 100644 boards/arm/arduino_due/arduino_due-pinctrl.dtsi create mode 100644 boards/arm/sam4e_xpro/sam4e_xpro-pinctrl.dtsi create mode 100644 boards/arm/sam4l_ek/sam4l_ek-pinctrl.dtsi create mode 100644 boards/arm/sam4s_xplained/sam4s_xplained-pinctrl.dtsi create mode 100644 boards/arm/sam_e70_xplained/sam_e70_xplained-pinctrl.dtsi create mode 100644 boards/arm/sam_v71_xult/sam_v71_xult-pinctrl.dtsi diff --git a/boards/arm/arduino_due/arduino_due-pinctrl.dtsi b/boards/arm/arduino_due/arduino_due-pinctrl.dtsi new file mode 100644 index 00000000000..1944577b99f --- /dev/null +++ b/boards/arm/arduino_due/arduino_due-pinctrl.dtsi @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2022, Gerson Fernando Budke + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&pinctrl { + uart_default: uart_default { + group1 { + pinmux = ; + bias-pull-up; + }; + group2 { + pinmux = ; + }; + }; + usart0_default: usart0_default { + group1 { + pinmux = , + ; + }; + }; + usart1_default: usart1_default { + group1 { + pinmux = , + ; + }; + }; + usart2_default: usart2_default { + group1 { + pinmux = , + ; + }; + }; + usart3_default: usart3_default { + group1 { + pinmux = , + ; + }; + }; +}; diff --git a/boards/arm/arduino_due/arduino_due.dts b/boards/arm/arduino_due/arduino_due.dts index 3927ffb3ffc..e1d431c67e0 100644 --- a/boards/arm/arduino_due/arduino_due.dts +++ b/boards/arm/arduino_due/arduino_due.dts @@ -3,6 +3,7 @@ /dts-v1/; #include +#include "arduino_due-pinctrl.dtsi" / { model = "Arduino Due with an Atmel SAM3X8E SoC"; @@ -51,10 +52,9 @@ &uart { status = "okay"; current-speed = <115200>; -}; -&pa8a_uart_urxd { - bias-pull-up; + pinctrl-0 = <&uart_default>; + pinctrl-names = "default"; }; arduino_i2c: &twi1 { }; diff --git a/boards/arm/sam4e_xpro/sam4e_xpro-pinctrl.dtsi b/boards/arm/sam4e_xpro/sam4e_xpro-pinctrl.dtsi new file mode 100644 index 00000000000..bf961692a6e --- /dev/null +++ b/boards/arm/sam4e_xpro/sam4e_xpro-pinctrl.dtsi @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2022, Gerson Fernando Budke + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&pinctrl { + uart0_default: uart0_default { + group1 { + pinmux = , + ; + }; + }; + uart1_default: uart1_default { + group1 { + pinmux = , + ; + }; + }; + usart1_default: usart1_default { + group1 { + pinmux = , + ; + bias-pull-up; + }; + group1 { + pinmux = , + ; + }; + }; +}; diff --git a/boards/arm/sam4e_xpro/sam4e_xpro.dts b/boards/arm/sam4e_xpro/sam4e_xpro.dts index a14d6f51411..94ca006bd69 100644 --- a/boards/arm/sam4e_xpro/sam4e_xpro.dts +++ b/boards/arm/sam4e_xpro/sam4e_xpro.dts @@ -7,6 +7,7 @@ /dts-v1/; #include +#include "sam4e_xpro-pinctrl.dtsi" / { model = "Atmel SAM4E Xplained Pro Board with an Atmel SAM4E16E SoC"; @@ -135,14 +136,24 @@ }; &uart0 { - current-speed = <115200>; status = "okay"; + current-speed = <115200>; + + pinctrl-0 = <&uart0_default>; + pinctrl-names = "default"; +}; + +&uart1 { + pinctrl-0 = <&uart1_default>; + pinctrl-names = "default"; }; &usart1 { - pinctrl-0 = <&pa21a_usart1_rxd1 &pa22a_usart1_txd1>; - current-speed = <115200>; status = "okay"; + current-speed = <115200>; + + pinctrl-0 = <&usart1_default>; + pinctrl-names = "default"; }; &gmac { diff --git a/boards/arm/sam4l_ek/sam4l_ek-pinctrl.dtsi b/boards/arm/sam4l_ek/sam4l_ek-pinctrl.dtsi new file mode 100644 index 00000000000..acd8bb81bce --- /dev/null +++ b/boards/arm/sam4l_ek/sam4l_ek-pinctrl.dtsi @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2022, Gerson Fernando Budke + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&pinctrl { + usart0_default: usart0_default { + group1 { + pinmux = , + ; + }; + }; + usart0_hw_ctrl_flow: usart0_hw_ctrl_flow { + group1 { + pinmux = , + ; + bias-pull-up; + }; + group1 { + pinmux = , + ; + }; + }; + usart2_default: usart2_default { + group1 { + pinmux = , + ; + }; + }; +}; diff --git a/boards/arm/sam4l_ek/sam4l_ek.dts b/boards/arm/sam4l_ek/sam4l_ek.dts index 4479e975420..b128a7a8fa1 100644 --- a/boards/arm/sam4l_ek/sam4l_ek.dts +++ b/boards/arm/sam4l_ek/sam4l_ek.dts @@ -6,6 +6,7 @@ /dts-v1/; #include +#include "sam4l_ek-pinctrl.dtsi" / { model = "Atmel SAM4L-EK Board with an Atmel SAM4LC4C SoC"; @@ -46,9 +47,11 @@ }; &usart2 { - current-speed = <115200>; - pinctrl-0 = <&pc11b_usart2_rxd2 &pc12b_usart2_txd2>; status = "okay"; + current-speed = <115200>; + + pinctrl-0 = <&usart2_default>; + pinctrl-names = "default"; }; &spi0 { diff --git a/boards/arm/sam4s_xplained/sam4s_xplained-pinctrl.dtsi b/boards/arm/sam4s_xplained/sam4s_xplained-pinctrl.dtsi new file mode 100644 index 00000000000..dc2342eebd0 --- /dev/null +++ b/boards/arm/sam4s_xplained/sam4s_xplained-pinctrl.dtsi @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2022, Gerson Fernando Budke + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&pinctrl { + uart0_default: uart0_default { + group1 { + pinmux = , + ; + }; + }; + uart1_default: uart1_default { + group1 { + pinmux = , + ; + }; + }; + usart1_default: usart1_default { + group1 { + pinmux = , + ; + }; + }; +}; diff --git a/boards/arm/sam4s_xplained/sam4s_xplained.dts b/boards/arm/sam4s_xplained/sam4s_xplained.dts index 05ff92f84bb..9b878dbc736 100644 --- a/boards/arm/sam4s_xplained/sam4s_xplained.dts +++ b/boards/arm/sam4s_xplained/sam4s_xplained.dts @@ -6,6 +6,7 @@ /dts-v1/; #include +#include "sam4s_xplained-pinctrl.dtsi" / { model = "Atmel SAM4S Xplained Board with an Atmel SAM4S16C SoC"; @@ -135,13 +136,19 @@ }; &uart0 { - current-speed = <115200>; status = "okay"; + current-speed = <115200>; + + pinctrl-0 = <&uart0_default>; + pinctrl-names = "default"; }; &uart1 { - current-speed = <115200>; status = "okay"; + current-speed = <115200>; + + pinctrl-0 = <&uart1_default>; + pinctrl-names = "default"; }; &wdt { diff --git a/boards/arm/sam_e70_xplained/sam_e70_xplained-common.dtsi b/boards/arm/sam_e70_xplained/sam_e70_xplained-common.dtsi index b5866b633b8..6fabcd05f69 100644 --- a/boards/arm/sam_e70_xplained/sam_e70_xplained-common.dtsi +++ b/boards/arm/sam_e70_xplained/sam_e70_xplained-common.dtsi @@ -7,6 +7,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include "sam_e70_xplained-pinctrl.dtsi" + / { aliases { i2c-0 = &twihs0; @@ -76,8 +78,11 @@ }; &usart1 { - current-speed = <115200>; status = "okay"; + current-speed = <115200>; + + pinctrl-0 = <&usart1_default>; + pinctrl-names = "default"; }; &wdt { diff --git a/boards/arm/sam_e70_xplained/sam_e70_xplained-pinctrl.dtsi b/boards/arm/sam_e70_xplained/sam_e70_xplained-pinctrl.dtsi new file mode 100644 index 00000000000..050f87c7f0e --- /dev/null +++ b/boards/arm/sam_e70_xplained/sam_e70_xplained-pinctrl.dtsi @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2022, Gerson Fernando Budke + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&pinctrl { + uart3_default: uart3_default { + group1 { + pinmux = , + ; + }; + }; + uart4_default: uart4_default { + group1 { + pinmux = , + ; + }; + }; + usart0_default: usart0_default { + group1 { + pinmux = , + ; + }; + }; + usart0_hw_ctrl_flow_clk: usart0_hw_ctrl_flow_clk { + group1 { + pinmux = , + ; + bias-pull-up; + }; + group1 { + pinmux = , + , + ; + }; + }; + usart1_default: usart1_default { + group1 { + pinmux = , + ; + }; + }; + usart1_hw_ctrl_flow: usart1_hw_ctrl_flow { + group1 { + pinmux = , + ; + bias-pull-up; + }; + group1 { + pinmux = , + ; + }; + }; + usart2_default: usart2_default { + group1 { + pinmux = , + ; + }; + }; + usart2_hw_ctrl_flow_clk: usart2_hw_ctrl_flow_clk { + group1 { + pinmux = , + ; + bias-pull-up; + }; + group1 { + pinmux = , + , + ; + }; + }; +}; diff --git a/boards/arm/sam_v71_xult/sam_v71_xult-common.dtsi b/boards/arm/sam_v71_xult/sam_v71_xult-common.dtsi index dba7e86e07c..70b3c8cfde6 100644 --- a/boards/arm/sam_v71_xult/sam_v71_xult-common.dtsi +++ b/boards/arm/sam_v71_xult/sam_v71_xult-common.dtsi @@ -1,12 +1,14 @@ /* * Copyright (c) 2017 Piotr Mienkowski * Copyright (c) 2017 Justin Watson - * Copyright (c) 2019-2020 Gerson Fernando Budke * Copyright (c) 2020 Stephanos Ioannidis + * Copyright (c) 2019-2022 Gerson Fernando Budke * * SPDX-License-Identifier: Apache-2.0 */ +#include "sam_v71_xult-pinctrl.dtsi" + / { aliases { i2c-0 = &twihs0; @@ -183,15 +185,20 @@ }; &usart1 { - current-speed = <115200>; status = "okay"; + current-speed = <115200>; + + pinctrl-0 = <&usart1_default>; + pinctrl-names = "default"; }; &uart3 { status = "okay"; - - pinctrl-0 = <&pd28a_uart3_urxd3 &pd30a_uart3_utxd3>; current-speed = <115200>; + + + pinctrl-0 = <&uart3_default>; + pinctrl-names = "default"; }; &wdt { diff --git a/boards/arm/sam_v71_xult/sam_v71_xult-pinctrl.dtsi b/boards/arm/sam_v71_xult/sam_v71_xult-pinctrl.dtsi new file mode 100644 index 00000000000..ac85dbc4b8a --- /dev/null +++ b/boards/arm/sam_v71_xult/sam_v71_xult-pinctrl.dtsi @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2022, Gerson Fernando Budke + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&pinctrl { + uart3_default: uart3_default { + group1 { + pinmux = , + ; + }; + }; + uart4_default: uart4_default { + group1 { + pinmux = , + ; + }; + }; + usart0_default: usart0_default { + group1 { + pinmux = , + ; + }; + }; + usart0_hw_ctrl_flow: usart0_hw_ctrl_flow { + group1 { + pinmux = , + ; + bias-pull-up; + }; + group1 { + pinmux = , + ; + }; + }; + usart1_default: usart1_default { + group1 { + pinmux = , + ; + }; + }; + usart1_hw_ctrl_flow: usart1_hw_ctrl_flow { + group1 { + pinmux = , + ; + bias-pull-up; + }; + group1 { + pinmux = , + ; + }; + }; + usart2_default: usart2_default { + group1 { + pinmux = , + ; + }; + }; + usart2_hw_ctrl_flow: usart2_hw_ctrl_flow_clk { + group1 { + pinmux = , + ; + bias-pull-up; + }; + group1 { + pinmux = , + ; + }; + }; +}; diff --git a/boards/shields/esp_8266/boards/sam4e_xpro.overlay b/boards/shields/esp_8266/boards/sam4e_xpro.overlay index 710cfc11052..f2cb3cdbd74 100644 --- a/boards/shields/esp_8266/boards/sam4e_xpro.overlay +++ b/boards/shields/esp_8266/boards/sam4e_xpro.overlay @@ -4,11 +4,21 @@ * SPDX-License-Identifier: Apache-2.0 */ +&pinctrl { + usart1_esp_wifi: usart1_esp_wifi { + group1 { + pinmux = , + ; + }; + }; +}; + &usart1 { status = "okay"; current-speed = <115200>; - pinctrl-0 = <&pa21a_usart1_rxd1 &pa22a_usart1_txd1>; + pinctrl-0 = <&usart1_esp_wifi>; + pinctrl-names = "default"; esp8266 { compatible = "espressif,esp-at"; diff --git a/drivers/serial/uart_sam.c b/drivers/serial/uart_sam.c index 3a736e012f5..f329dca2252 100644 --- a/drivers/serial/uart_sam.c +++ b/drivers/serial/uart_sam.c @@ -20,13 +20,13 @@ #include #include #include +#include /* Device constant configuration parameters */ struct uart_sam_dev_cfg { Uart *regs; uint32_t periph_id; - struct soc_gpio_pin pin_rx; - struct soc_gpio_pin pin_tx; + const struct pinctrl_dev_config *pcfg; #ifdef CONFIG_UART_INTERRUPT_DRIVEN uart_irq_config_func_t irq_config_func; @@ -58,8 +58,10 @@ static int uart_sam_init(const struct device *dev) soc_pmc_peripheral_enable(cfg->periph_id); /* Connect pins to the peripheral */ - soc_gpio_configure(&cfg->pin_rx); - soc_gpio_configure(&cfg->pin_tx); + retval = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT); + if (retval < 0) { + return retval; + } /* Reset and disable UART */ uart->UART_CR = UART_CR_RSTRX | UART_CR_RSTTX @@ -356,8 +358,7 @@ static const struct uart_driver_api uart_sam_driver_api = { .regs = (Uart *)DT_INST_REG_ADDR(n), \ .periph_id = DT_INST_PROP(n, peripheral_id), \ \ - .pin_rx = ATMEL_SAM_DT_INST_PIN(n, 0), \ - .pin_tx = ATMEL_SAM_DT_INST_PIN(n, 1), \ + .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ \ IRQ_FUNC_INIT \ } @@ -384,6 +385,7 @@ static const struct uart_driver_api uart_sam_driver_api = { #endif #define UART_SAM_INIT(n) \ + PINCTRL_DT_INST_DEFINE(n); \ static struct uart_sam_dev_data uart##n##_sam_data = { \ .baud_rate = DT_INST_PROP(n, current_speed), \ }; \ diff --git a/drivers/serial/usart_sam.c b/drivers/serial/usart_sam.c index ff4e279fe80..42ad245e95a 100644 --- a/drivers/serial/usart_sam.c +++ b/drivers/serial/usart_sam.c @@ -20,13 +20,13 @@ #include #include #include +#include /* Device constant configuration parameters */ struct usart_sam_dev_cfg { Usart *regs; uint32_t periph_id; - struct soc_gpio_pin pin_rx; - struct soc_gpio_pin pin_tx; + const struct pinctrl_dev_config *pcfg; #ifdef CONFIG_UART_INTERRUPT_DRIVEN uart_irq_config_func_t irq_config_func; @@ -58,8 +58,10 @@ static int usart_sam_init(const struct device *dev) soc_pmc_peripheral_enable(cfg->periph_id); /* Connect pins to the peripheral */ - soc_gpio_configure(&cfg->pin_rx); - soc_gpio_configure(&cfg->pin_tx); + retval = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT); + if (retval < 0) { + return retval; + } /* Reset and disable USART */ usart->US_CR = US_CR_RSTRX | US_CR_RSTTX @@ -357,8 +359,7 @@ static const struct uart_driver_api usart_sam_driver_api = { .regs = (Usart *)DT_INST_REG_ADDR(n), \ .periph_id = DT_INST_PROP(n, peripheral_id), \ \ - .pin_rx = ATMEL_SAM_DT_INST_PIN(n, 0), \ - .pin_tx = ATMEL_SAM_DT_INST_PIN(n, 1), \ + .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ \ IRQ_FUNC_INIT \ } @@ -385,6 +386,7 @@ static const struct uart_driver_api usart_sam_driver_api = { #endif #define USART_SAM_INIT(n) \ + PINCTRL_DT_INST_DEFINE(n); \ static struct usart_sam_dev_data usart##n##_sam_data = { \ .baud_rate = DT_INST_PROP(n, current_speed), \ }; \ diff --git a/dts/arm/atmel/sam3x.dtsi b/dts/arm/atmel/sam3x.dtsi index 73df5caac2f..7430dd1b2b8 100644 --- a/dts/arm/atmel/sam3x.dtsi +++ b/dts/arm/atmel/sam3x.dtsi @@ -96,7 +96,6 @@ peripheral-id = <8>; status = "disabled"; label = "UART_0"; - pinctrl-0 = <&pa8a_uart_urxd &pa9a_uart_utxd>; }; usart0: usart@40098000 { @@ -135,7 +134,7 @@ label = "USART_3"; }; - pinctrl@400e0e00 { + pinctrl: pinctrl@400e0e00 { compatible = "atmel,sam-pinctrl"; #address-cells = <1>; #size-cells = <1>; diff --git a/dts/arm/atmel/sam4e.dtsi b/dts/arm/atmel/sam4e.dtsi index 621b4247f54..d6406b71d1c 100644 --- a/dts/arm/atmel/sam4e.dtsi +++ b/dts/arm/atmel/sam4e.dtsi @@ -115,7 +115,6 @@ peripheral-id = <7>; status = "disabled"; label = "UART_0"; - pinctrl-0 = <&pa9a_uart0_urxd0 &pa10a_uart0_utxd0>; }; uart1: uart@40060600 { @@ -125,7 +124,6 @@ peripheral-id = <45>; status = "disabled"; label = "UART_1"; - pinctrl-0 = <&pa5c_uart1_urxd1 &pa6c_uart1_utxd1>; }; usart0: usart@400a0000 { @@ -174,11 +172,13 @@ }; }; - pinctrl@400e0e00 { + pinctrl: pinctrl@400e0e00 { compatible = "atmel,sam-pinctrl"; #address-cells = <1>; #size-cells = <1>; ranges = <0x400e0e00 0x400e0e00 0xa00>; + status = "okay"; + label = "PINCTRL"; pioa: gpio@400e0e00 { compatible = "atmel,sam-gpio"; diff --git a/dts/arm/atmel/sam4l.dtsi b/dts/arm/atmel/sam4l.dtsi index 772435e6193..d78d9a96b77 100644 --- a/dts/arm/atmel/sam4l.dtsi +++ b/dts/arm/atmel/sam4l.dtsi @@ -177,7 +177,7 @@ pinctrl-0 = <&pa25a_usbc_dm &pa26a_usbc_dp>; }; - pinctrl@400e1000 { + pinctrl: pinctrl@400e1000 { compatible = "atmel,sam-pinctrl"; #address-cells = <1>; #size-cells = <1>; diff --git a/dts/arm/atmel/sam4s.dtsi b/dts/arm/atmel/sam4s.dtsi index 044793267a3..1d77d5c89b9 100644 --- a/dts/arm/atmel/sam4s.dtsi +++ b/dts/arm/atmel/sam4s.dtsi @@ -116,7 +116,6 @@ peripheral-id = <8>; status = "disabled"; label = "UART_0"; - pinctrl-0 = <&pa9a_uart0_urxd0 &pa10a_uart0_utxd0>; }; uart1: uart@400e0800 { @@ -126,7 +125,6 @@ peripheral-id = <9>; status = "disabled"; label = "UART_1"; - pinctrl-0 = <&pb2a_uart1_urxd1 &pb3a_uart1_utxd1>; }; usart0: usart@40024000 { @@ -147,11 +145,13 @@ label = "USART_1"; }; - pinctrl@400e0e00 { + pinctrl: pinctrl@400e0e00 { compatible = "atmel,sam-pinctrl"; #address-cells = <1>; #size-cells = <1>; ranges = <0x400e0e00 0x400e0e00 0x600>; + status = "okay"; + label = "PINCTRL"; pioa: gpio@400e0e00 { compatible = "atmel,sam-gpio"; diff --git a/dts/arm/atmel/same70.dtsi b/dts/arm/atmel/same70.dtsi index 7d247b093f2..e59342ee2ed 100644 --- a/dts/arm/atmel/same70.dtsi +++ b/dts/arm/atmel/same70.dtsi @@ -147,7 +147,6 @@ peripheral-id = <7>; status = "disabled"; label = "UART_0"; - pinctrl-0 = <&pa9a_uart0_urxd0 &pa10a_uart0_utxd0>; }; uart1: uart@400e0a00 { @@ -193,7 +192,6 @@ peripheral-id = <13>; status = "disabled"; label = "USART_0"; - pinctrl-0 = <&pb0c_usart0_rxd0 &pb1c_usart0_txd0>; }; usart1: usart@40028000 { @@ -203,7 +201,6 @@ peripheral-id = <14>; status = "disabled"; label = "USART_1"; - pinctrl-0 = <&pa21a_usart1_rxd1 &pb4d_usart1_txd1>; }; usart2: usart@4002c000 { @@ -213,7 +210,6 @@ peripheral-id = <15>; status = "disabled"; label = "USART_2"; - pinctrl-0 = <&pd15b_usart2_rxd2 &pd16b_usart2_txd2>; }; afec0: adc@4003c000 { @@ -248,7 +244,7 @@ #io-channel-cells = <1>; }; - pinctrl@400e0e00 { + pinctrl: pinctrl@400e0e00 { compatible = "atmel,sam-pinctrl"; #address-cells = <1>; #size-cells = <1>; diff --git a/dts/bindings/serial/atmel,sam-uart.yaml b/dts/bindings/serial/atmel,sam-uart.yaml index 35f8c247830..9d3a2426753 100644 --- a/dts/bindings/serial/atmel,sam-uart.yaml +++ b/dts/bindings/serial/atmel,sam-uart.yaml @@ -2,7 +2,9 @@ description: SAM family UART compatible: "atmel,sam-uart" -include: uart-controller.yaml +include: + - name: uart-controller.yaml + - name: pinctrl-device.yaml properties: reg: @@ -15,16 +17,3 @@ properties: type: int description: peripheral ID required: true - - pinctrl-0: - type: phandles - description: | - PIO pin configuration for URXD & UTRD signals. We expect that - the phandles will reference pinctrl nodes. These nodes will - have a nodelabel that matches the Atmel SoC HAL defines and - be of the form p__. - - For example the UART on SAM3x would be - pinctrl-0 = <&pa8a_uart_urxd &pa9a_uart_utxd>; - - required: true diff --git a/dts/bindings/serial/atmel,sam-usart.yaml b/dts/bindings/serial/atmel,sam-usart.yaml index 74f3a41517e..91c6f0b8f56 100644 --- a/dts/bindings/serial/atmel,sam-usart.yaml +++ b/dts/bindings/serial/atmel,sam-usart.yaml @@ -2,7 +2,9 @@ description: Atmel SAM family USART compatible: "atmel,sam-usart" -include: uart-controller.yaml +include: + - name: uart-controller.yaml + - name: pinctrl-device.yaml properties: reg: @@ -15,16 +17,3 @@ properties: type: int description: peripheral ID required: true - - pinctrl-0: - type: phandles - description: | - PIO pin configuration for RXD & TRD signals. We expect that - the phandles will reference pinctrl nodes. These nodes will - have a nodelabel that matches the Atmel SoC HAL defines and - be of the form p__. - - For example the USART0 on SAME7x would be - pinctrl-0 = <&pb0c_usart0_rxd0 &pb1c_usart0_txd0>; - - required: true diff --git a/tests/drivers/uart/uart_async_api/boards/atsamr21_xpro.overlay b/tests/drivers/uart/uart_async_api/boards/atsamr21_xpro.overlay index 26f0a1cca08..cc6af1714e7 100644 --- a/tests/drivers/uart/uart_async_api/boards/atsamr21_xpro.overlay +++ b/tests/drivers/uart/uart_async_api/boards/atsamr21_xpro.overlay @@ -1,5 +1,13 @@ /* SPDX-License-Identifier: Apache-2.0 */ +&pinctrl { + sercom3_loopback: sercom3_loopback { + group1 { + pinmux = ; + }; + }; +}; + &dmac { status = "okay"; }; @@ -20,7 +28,8 @@ txpo = <0>; /* PAD0 must be configured to allow working loop-back */ - pinctrl-0 = <&pa16d_sercom3_pad0>; + pinctrl-0 = <&sercom3_loopback>; + pinctrl-names = "default"; /* Configure DMA channels for async operation */ dmas = <&dmac 10 7>, <&dmac 11 8>;