diff --git a/drivers/serial/uart_stm32.c b/drivers/serial/uart_stm32.c index a808c36c67b..0a9d5c08809 100644 --- a/drivers/serial/uart_stm32.c +++ b/drivers/serial/uart_stm32.c @@ -20,8 +20,6 @@ #include #include #include -#include -#include #include #include @@ -1507,9 +1505,7 @@ static int uart_stm32_init(const struct device *dev) } /* Configure dt provided device signals when available */ - err = stm32_dt_pinctrl_configure(config->pinctrl_list, - config->pinctrl_list_size, - (uint32_t)UART_STRUCT(dev)); + err = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); if (err < 0) { return err; } @@ -1657,8 +1653,7 @@ static void uart_stm32_irq_config_func_##index(const struct device *dev) \ #define STM32_UART_INIT(index) \ STM32_UART_IRQ_HANDLER_DECL(index) \ \ -static const struct soc_gpio_pinctrl uart_pins_##index[] = \ - ST_STM32_DT_INST_PINCTRL(index, 0); \ +PINCTRL_DT_INST_DEFINE(index) \ \ static const struct uart_stm32_config uart_stm32_cfg_##index = { \ .uconf = { \ @@ -1670,9 +1665,8 @@ static const struct uart_stm32_config uart_stm32_cfg_##index = { \ }, \ .hw_flow_control = DT_INST_PROP(index, hw_flow_control), \ .parity = DT_INST_ENUM_IDX_OR(index, parity, UART_CFG_PARITY_NONE), \ + .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(index), \ STM32_UART_POLL_IRQ_HANDLER_FUNC(index) \ - .pinctrl_list = uart_pins_##index, \ - .pinctrl_list_size = ARRAY_SIZE(uart_pins_##index), \ }; \ \ static struct uart_stm32_data uart_stm32_data_##index = { \ diff --git a/drivers/serial/uart_stm32.h b/drivers/serial/uart_stm32.h index aa22070c83a..aab48c29e28 100644 --- a/drivers/serial/uart_stm32.h +++ b/drivers/serial/uart_stm32.h @@ -12,7 +12,7 @@ #ifndef ZEPHYR_DRIVERS_SERIAL_UART_STM32_H_ #define ZEPHYR_DRIVERS_SERIAL_UART_STM32_H_ -#include +#include /* device config */ struct uart_stm32_config { @@ -23,8 +23,7 @@ struct uart_stm32_config { bool hw_flow_control; /* initial parity, 0 for none, 1 for odd, 2 for even */ int parity; - const struct soc_gpio_pinctrl *pinctrl_list; - size_t pinctrl_list_size; + const struct pinctrl_dev_config *pcfg; #if defined(CONFIG_PM) \ && !defined(CONFIG_UART_INTERRUPT_DRIVEN) \ && !defined(CONFIG_UART_ASYNC_API) diff --git a/dts/bindings/serial/st,stm32-lpuart.yaml b/dts/bindings/serial/st,stm32-lpuart.yaml index b2a44520a49..bbf29037516 100644 --- a/dts/bindings/serial/st,stm32-lpuart.yaml +++ b/dts/bindings/serial/st,stm32-lpuart.yaml @@ -2,7 +2,7 @@ description: STM32 LPUART compatible: "st,stm32-lpuart" -include: uart-controller.yaml +include: [uart-controller.yaml, pinctrl-device.yaml] properties: reg: @@ -13,13 +13,3 @@ properties: clocks: required: true - - pinctrl-0: - type: phandles - required: false - description: | - GPIO pin configuration for serial signals (RX, TX, RTS, CTS). We expect - that the phandles will reference pinctrl nodes. - - For example the USART1 would be - pinctrl-0 = <&usart1_tx_pb6 &usart1_rx_pb7>; diff --git a/dts/bindings/serial/st,stm32-uart.yaml b/dts/bindings/serial/st,stm32-uart.yaml index e7f77f0e468..2816fd3e867 100644 --- a/dts/bindings/serial/st,stm32-uart.yaml +++ b/dts/bindings/serial/st,stm32-uart.yaml @@ -2,7 +2,7 @@ description: STM32 UART compatible: "st,stm32-uart" -include: uart-controller.yaml +include: [uart-controller.yaml, pinctrl-device.yaml] properties: reg: @@ -10,13 +10,3 @@ properties: interrupts: required: true - - pinctrl-0: - type: phandles - required: false - description: | - GPIO pin configuration for serial signals (RX, TX, RTS, CTS). We expect - that the phandles will reference pinctrl nodes. - - For example the USART1 would be - pinctrl-0 = <&usart1_tx_pb6 &usart1_rx_pb7>; diff --git a/dts/bindings/serial/st,stm32-usart.yaml b/dts/bindings/serial/st,stm32-usart.yaml index ba514cdc5f9..971815349a4 100644 --- a/dts/bindings/serial/st,stm32-usart.yaml +++ b/dts/bindings/serial/st,stm32-usart.yaml @@ -2,7 +2,7 @@ description: STM32 USART compatible: "st,stm32-usart" -include: uart-controller.yaml +include: [uart-controller.yaml, pinctrl-device.yaml] properties: reg: @@ -10,13 +10,3 @@ properties: interrupts: required: true - - pinctrl-0: - type: phandles - required: false - description: | - GPIO pin configuration for serial signals (RX, TX, RTS, CTS). We expect - that the phandles will reference pinctrl nodes. - - For example the USART1 would be - pinctrl-0 = <&usart1_tx_pb6 &usart1_rx_pb7>;