From 12fa6308442612fc5616980f8033ec70683069bd Mon Sep 17 00:00:00 2001 From: Andrei-Edward Popa Date: Tue, 22 Mar 2022 02:25:39 +0200 Subject: [PATCH] drivers: serial: rpi_pico: added reset support for UART devices added reset controller for Raspberry Pi Pico UART devices Signed-off-by: Andrei-Edward Popa --- drivers/serial/Kconfig.rpi_pico | 1 + drivers/serial/uart_rpi_pico.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/serial/Kconfig.rpi_pico b/drivers/serial/Kconfig.rpi_pico index 33e0c27c4d1..0b01f5420b3 100644 --- a/drivers/serial/Kconfig.rpi_pico +++ b/drivers/serial/Kconfig.rpi_pico @@ -10,3 +10,4 @@ config UART_RPI_PICO select SERIAL_HAS_DRIVER select PICOSDK_USE_UART select SERIAL_SUPPORT_INTERRUPT + depends on RESET diff --git a/drivers/serial/uart_rpi_pico.c b/drivers/serial/uart_rpi_pico.c index 88693e3c79d..7e0869512bc 100644 --- a/drivers/serial/uart_rpi_pico.c +++ b/drivers/serial/uart_rpi_pico.c @@ -6,6 +6,7 @@ */ #include +#include #include /* pico-sdk includes */ @@ -17,6 +18,7 @@ struct uart_rpi_config { uart_inst_t *const uart_dev; uart_hw_t *const uart_regs; const struct pinctrl_dev_config *pcfg; + const struct reset_dt_spec reset; #ifdef CONFIG_UART_INTERRUPT_DRIVEN uart_irq_config_func_t irq_config_func; #endif /* CONFIG_UART_INTERRUPT_DRIVEN */ @@ -70,7 +72,7 @@ static int uart_rpi_init(const struct device *dev) /* * uart_init() may be replaced by register based API once rpi-pico platform - * has a clock controller driver and a reset controller driver + * has a clock controller driver */ baudrate = uart_init(uart_inst, data->baudrate); /* Check if baudrate adjustment returned by 'uart_init' function is a positive value */ @@ -302,6 +304,7 @@ static const struct uart_driver_api uart_rpi_driver_api = { .uart_dev = uart##idx, \ .uart_regs = (uart_hw_t *)uart##idx, \ .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(idx), \ + .reset = RESET_DT_SPEC_INST_GET(idx), \ RPI_UART_IRQ_CONFIG_INIT(idx), \ }; \ \