Skip to content
Permalink
Browse files

drivers: serial: uart_mcux_lpuart: add support for LPUARTs with two IRQs

Add support for NXP MCUX LPUART devices with separate IRQ lines for
transmit and receive status interrupts (e.g. the Kinetis KE1xF SoC
series).

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
  • Loading branch information...
henrikbrixandersen authored and MaureenHelm committed May 6, 2019
1 parent 168e129 commit 56dfb62e409a8927188f1579a13eaddc4f8307e5
Showing with 52 additions and 20 deletions.
  1. +44 −12 drivers/serial/uart_mcux_lpuart.c
  2. +6 −6 soc/arm/nxp_imx/rt/dts_fixup.h
  3. +2 −2 soc/arm/nxp_kinetis/kwx/dts_fixup.h
@@ -310,11 +310,19 @@ DEVICE_AND_API_INIT(uart_0, DT_UART_MCUX_LPUART_0_NAME,
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
static void mcux_lpuart_config_func_0(struct device *dev)
{
IRQ_CONNECT(DT_UART_MCUX_LPUART_0_IRQ,
DT_UART_MCUX_LPUART_0_IRQ_PRI,
IRQ_CONNECT(DT_UART_MCUX_LPUART_0_IRQ_0,
DT_UART_MCUX_LPUART_0_IRQ_0_PRI,
mcux_lpuart_isr, DEVICE_GET(uart_0), 0);

irq_enable(DT_UART_MCUX_LPUART_0_IRQ);
irq_enable(DT_UART_MCUX_LPUART_0_IRQ_0);

#ifdef DT_UART_MCUX_LPUART_0_IRQ_1
IRQ_CONNECT(DT_UART_MCUX_LPUART_0_IRQ_1,
DT_UART_MCUX_LPUART_0_IRQ_1_PRI,
mcux_lpuart_isr, DEVICE_GET(uart_0), 0);

irq_enable(DT_UART_MCUX_LPUART_0_IRQ_1);
#endif /* DT_UART_MCUX_LPUART_0_IRQ_1 */
}
#endif

@@ -348,11 +356,19 @@ DEVICE_AND_API_INIT(uart_1, DT_UART_MCUX_LPUART_1_NAME,
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
static void mcux_lpuart_config_func_1(struct device *dev)
{
IRQ_CONNECT(DT_UART_MCUX_LPUART_1_IRQ,
DT_UART_MCUX_LPUART_1_IRQ_PRI,
IRQ_CONNECT(DT_UART_MCUX_LPUART_1_IRQ_0,
DT_UART_MCUX_LPUART_1_IRQ_0_PRI,
mcux_lpuart_isr, DEVICE_GET(uart_1), 0);

irq_enable(DT_UART_MCUX_LPUART_1_IRQ_0);

#ifdef DT_UART_MCUX_LPUART_1_IRQ_1
IRQ_CONNECT(DT_UART_MCUX_LPUART_1_IRQ_1,
DT_UART_MCUX_LPUART_1_IRQ_1_PRI,
mcux_lpuart_isr, DEVICE_GET(uart_1), 0);

irq_enable(DT_UART_MCUX_LPUART_1_IRQ);
irq_enable(DT_UART_MCUX_LPUART_1_IRQ_1);
#endif /* DT_UART_MCUX_LPUART_1_IRQ_1 */
}
#endif

@@ -386,11 +402,19 @@ DEVICE_AND_API_INIT(uart_2, DT_UART_MCUX_LPUART_2_NAME,
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
static void mcux_lpuart_config_func_2(struct device *dev)
{
IRQ_CONNECT(DT_UART_MCUX_LPUART_2_IRQ,
DT_UART_MCUX_LPUART_2_IRQ_PRI,
IRQ_CONNECT(DT_UART_MCUX_LPUART_2_IRQ_0,
DT_UART_MCUX_LPUART_2_IRQ_0_PRI,
mcux_lpuart_isr, DEVICE_GET(uart_2), 0);

irq_enable(DT_UART_MCUX_LPUART_2_IRQ);
irq_enable(DT_UART_MCUX_LPUART_2_IRQ_0);

#ifdef DT_UART_MCUX_LPUART_2_IRQ_1
IRQ_CONNECT(DT_UART_MCUX_LPUART_2_IRQ_1,
DT_UART_MCUX_LPUART_2_IRQ_1_PRI,
mcux_lpuart_isr, DEVICE_GET(uart_2), 0);

irq_enable(DT_UART_MCUX_LPUART_2_IRQ_1);
#endif /* DT_UART_MCUX_LPUART_2_IRQ_1 */
}
#endif

@@ -424,11 +448,19 @@ DEVICE_AND_API_INIT(uart_3, DT_UART_MCUX_LPUART_3_NAME,
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
static void mcux_lpuart_config_func_3(struct device *dev)
{
IRQ_CONNECT(DT_UART_MCUX_LPUART_3_IRQ,
DT_UART_MCUX_LPUART_3_IRQ_PRI,
IRQ_CONNECT(DT_UART_MCUX_LPUART_3_IRQ_0,
DT_UART_MCUX_LPUART_3_IRQ_0_PRI,
mcux_lpuart_isr, DEVICE_GET(uart_3), 0);

irq_enable(DT_UART_MCUX_LPUART_3_IRQ_0);

#ifdef DT_UART_MCUX_LPUART_3_IRQ_1
IRQ_CONNECT(DT_UART_MCUX_LPUART_3_IRQ_1,
DT_UART_MCUX_LPUART_3_IRQ_1_PRI,
mcux_lpuart_isr, DEVICE_GET(uart_3), 0);

irq_enable(DT_UART_MCUX_LPUART_3_IRQ);
irq_enable(DT_UART_MCUX_LPUART_3_IRQ_1);
#endif /* DT_UART_MCUX_LPUART_3_IRQ_1 */
}
#endif

@@ -80,24 +80,24 @@

#define DT_UART_MCUX_LPUART_1_BASE_ADDRESS DT_NXP_KINETIS_LPUART_40184000_BASE_ADDRESS
#define DT_UART_MCUX_LPUART_1_NAME DT_NXP_KINETIS_LPUART_40184000_LABEL
#define DT_UART_MCUX_LPUART_1_IRQ DT_NXP_KINETIS_LPUART_40184000_IRQ_0
#define DT_UART_MCUX_LPUART_1_IRQ_PRI DT_NXP_KINETIS_LPUART_40184000_IRQ_0_PRIORITY
#define DT_UART_MCUX_LPUART_1_IRQ_0 DT_NXP_KINETIS_LPUART_40184000_IRQ_0
#define DT_UART_MCUX_LPUART_1_IRQ_0_PRI DT_NXP_KINETIS_LPUART_40184000_IRQ_0_PRIORITY
#define DT_UART_MCUX_LPUART_1_BAUD_RATE DT_NXP_KINETIS_LPUART_40184000_CURRENT_SPEED
#define DT_UART_MCUX_LPUART_1_CLOCK_NAME DT_NXP_KINETIS_LPUART_40184000_CLOCK_CONTROLLER
#define DT_UART_MCUX_LPUART_1_CLOCK_SUBSYS DT_NXP_KINETIS_LPUART_40184000_CLOCK_NAME

#define DT_UART_MCUX_LPUART_2_BASE_ADDRESS DT_NXP_KINETIS_LPUART_40188000_BASE_ADDRESS
#define DT_UART_MCUX_LPUART_2_NAME DT_NXP_KINETIS_LPUART_40188000_LABEL
#define DT_UART_MCUX_LPUART_2_IRQ DT_NXP_KINETIS_LPUART_40188000_IRQ_0
#define DT_UART_MCUX_LPUART_2_IRQ_PRI DT_NXP_KINETIS_LPUART_40188000_IRQ_0_PRIORITY
#define DT_UART_MCUX_LPUART_2_IRQ_0 DT_NXP_KINETIS_LPUART_40188000_IRQ_0
#define DT_UART_MCUX_LPUART_2_IRQ_0_PRI DT_NXP_KINETIS_LPUART_40188000_IRQ_0_PRIORITY
#define DT_UART_MCUX_LPUART_2_BAUD_RATE DT_NXP_KINETIS_LPUART_40188000_CURRENT_SPEED
#define DT_UART_MCUX_LPUART_2_CLOCK_NAME DT_NXP_KINETIS_LPUART_40188000_CLOCK_CONTROLLER
#define DT_UART_MCUX_LPUART_2_CLOCK_SUBSYS DT_NXP_KINETIS_LPUART_40188000_CLOCK_NAME

#define DT_UART_MCUX_LPUART_3_BASE_ADDRESS DT_NXP_KINETIS_LPUART_4018C000_BASE_ADDRESS
#define DT_UART_MCUX_LPUART_3_NAME DT_NXP_KINETIS_LPUART_4018C000_LABEL
#define DT_UART_MCUX_LPUART_3_IRQ DT_NXP_KINETIS_LPUART_4018C000_IRQ_0
#define DT_UART_MCUX_LPUART_3_IRQ_PRI DT_NXP_KINETIS_LPUART_4018C000_IRQ_0_PRIORITY
#define DT_UART_MCUX_LPUART_3_IRQ_0 DT_NXP_KINETIS_LPUART_4018C000_IRQ_0
#define DT_UART_MCUX_LPUART_3_IRQ_0_PRI DT_NXP_KINETIS_LPUART_4018C000_IRQ_0_PRIORITY
#define DT_UART_MCUX_LPUART_3_BAUD_RATE DT_NXP_KINETIS_LPUART_4018C000_CURRENT_SPEED
#define DT_UART_MCUX_LPUART_3_CLOCK_NAME DT_NXP_KINETIS_LPUART_4018C000_CLOCK_CONTROLLER
#define DT_UART_MCUX_LPUART_3_CLOCK_SUBSYS DT_NXP_KINETIS_LPUART_4018C000_CLOCK_NAME
@@ -118,8 +118,8 @@
#define DT_NUM_IRQ_PRIO_BITS DT_ARM_V6M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS

#define DT_UART_MCUX_LPUART_0_BAUD_RATE DT_NXP_KINETIS_LPUART_40054000_CURRENT_SPEED
#define DT_UART_MCUX_LPUART_0_IRQ DT_NXP_KINETIS_LPUART_40054000_IRQ_0
#define DT_UART_MCUX_LPUART_0_IRQ_PRI DT_NXP_KINETIS_LPUART_40054000_IRQ_0_PRIORITY
#define DT_UART_MCUX_LPUART_0_IRQ_0 DT_NXP_KINETIS_LPUART_40054000_IRQ_0
#define DT_UART_MCUX_LPUART_0_IRQ_0_PRI DT_NXP_KINETIS_LPUART_40054000_IRQ_0_PRIORITY
#define DT_UART_MCUX_LPUART_0_NAME DT_NXP_KINETIS_LPUART_40054000_LABEL
#define DT_UART_MCUX_LPUART_0_CLOCK_NAME DT_NXP_KINETIS_LPUART_40054000_CLOCK_CONTROLLER
#define DT_UART_MCUX_LPUART_0_CLOCK_SUBSYS DT_NXP_KINETIS_LPUART_40054000_CLOCK_NAME

0 comments on commit 56dfb62

Please sign in to comment.
You can’t perform that action at this time.