diff --git a/drivers/serial/Kconfig.mcux_lpuart b/drivers/serial/Kconfig.mcux_lpuart index bd1010aa7e7..62a9cee46ac 100644 --- a/drivers/serial/Kconfig.mcux_lpuart +++ b/drivers/serial/Kconfig.mcux_lpuart @@ -22,4 +22,10 @@ menuconfig UART_MCUX_LPUART_0 help Enable UART 0. +menuconfig UART_MCUX_LPUART_1 + bool "UART 1" + default n + help + Enable UART 1. + endif # UART_MCUX_LPUART diff --git a/drivers/serial/uart_mcux_lpuart.c b/drivers/serial/uart_mcux_lpuart.c index 163459a5167..763b4092f27 100644 --- a/drivers/serial/uart_mcux_lpuart.c +++ b/drivers/serial/uart_mcux_lpuart.c @@ -318,3 +318,41 @@ static void mcux_lpuart_config_func_0(struct device *dev) #endif #endif /* CONFIG_UART_MCUX_LPUART_0 */ + +#ifdef CONFIG_UART_MCUX_LPUART_1 + +#ifdef CONFIG_UART_INTERRUPT_DRIVEN +static void mcux_lpuart_config_func_1(struct device *dev); +#endif + +static const struct mcux_lpuart_config mcux_lpuart_1_config = { + .base = (LPUART_Type *) CONFIG_UART_MCUX_LPUART_1_BASE_ADDRESS, + .clock_name = CONFIG_UART_MCUX_LPUART_1_CLOCK_NAME, + .clock_subsys = + (clock_control_subsys_t)CONFIG_UART_MCUX_LPUART_1_CLOCK_SUBSYS, + .baud_rate = CONFIG_UART_MCUX_LPUART_1_BAUD_RATE, +#ifdef CONFIG_UART_INTERRUPT_DRIVEN + .irq_config_func = mcux_lpuart_config_func_1, +#endif +}; + +static struct mcux_lpuart_data mcux_lpuart_1_data; + +DEVICE_AND_API_INIT(uart_1, CONFIG_UART_MCUX_LPUART_1_NAME, + &mcux_lpuart_init, + &mcux_lpuart_1_data, &mcux_lpuart_1_config, + PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, + &mcux_lpuart_driver_api); + +#ifdef CONFIG_UART_INTERRUPT_DRIVEN +static void mcux_lpuart_config_func_1(struct device *dev) +{ + IRQ_CONNECT(CONFIG_UART_MCUX_LPUART_1_IRQ, + CONFIG_UART_MCUX_LPUART_1_IRQ_PRI, + mcux_lpuart_isr, DEVICE_GET(uart_1), 0); + + irq_enable(CONFIG_UART_MCUX_LPUART_1_IRQ); +} +#endif + +#endif /* CONFIG_UART_MCUX_LPUART_1 */