Skip to content

Commit

Permalink
arch/arm64/src/imx9: Add a more capable uart driver
Browse files Browse the repository at this point in the history
Add an uart driver supporting LPUART1-8, dma, flow control, tc etc.

Signed-off-by: Jukka Laitinen <[email protected]>
  • Loading branch information
jlaitine authored and xiaoxiang781216 committed Apr 16, 2024
1 parent f4bbe27 commit 58f0ee6
Show file tree
Hide file tree
Showing 10 changed files with 3,641 additions and 848 deletions.
85 changes: 82 additions & 3 deletions arch/arm64/src/imx9/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,89 @@ config IMX9_FLEXIO_PWM
default n

menu "i.MX9 Peripheral Selection"
config IMX9_UART1
bool "UART1"

menu "LPUART"

config IMX9_LPUART
bool
default n
select ARCH_HAVE_SERIAL_TERMIOS

config IMX9_LPUART1
bool "LPUART1"
default n
select IMX9_LPUART
select LPUART1_SERIALDRIVER

config IMX9_LPUART2
bool "LPUART2"
default n
select IMX9_LPUART
select LPUART2_SERIALDRIVER

config IMX9_LPUART3
bool "LPUART3"
default n
select IMX9_LPUART
select LPUART3_SERIALDRIVER

config IMX9_LPUART4
bool "LPUART4"
default n
select IMX9_LPUART
select LPUART4_SERIALDRIVER

config IMX9_LPUART5
bool "LPUART5"
default n
select IMX9_LPUART
select LPUART5_SERIALDRIVER

config IMX9_LPUART6
bool "LPUART6"
default n
select UART1_SERIALDRIVER
select IMX9_LPUART
select LPUART6_SERIALDRIVER

config IMX9_LPUART7
bool "LPUART7"
default n
select IMX9_LPUART
select LPUART7_SERIALDRIVER

config IMX9_LPUART8
bool "LPUART8"
default n
select IMX9_LPUART
select LPUART8_SERIALDRIVER

menu "LPUART Configuration"
depends on IMX9_LPUART

config IMX9_LPUART_INVERT
bool "Signal Invert Support"
default n

config IMX9_LPUART_SINGLEWIRE
bool "Signal Wire Support"
default n

config IMX9_SERIAL_RXDMA_BUFFER_SIZE
int "RX DMA buffer size"
default 64
depends on LPUART1_RXDMA || LPUART2_RXDMA || LPUART3_RXDMA || LPUART4_RXDMA || \
LPUART5_RXDMA || LPUART6_RXDMA || LPUART7_RXDMA || LPUART8_RXDMA
---help---
The DMA buffer size when using RX DMA to emulate a FIFO.

When streaming data, the generic serial layer will be called
every time the FIFO receives half this number of bytes.

Value given here will be rounded up to next multiple of 64 bytes.

endmenu # LPUART Configuration

endmenu # LPUART

config IMX9_FLEXIO1_PWM
depends on PWM
Expand Down
5 changes: 1 addition & 4 deletions arch/arm64/src/imx9/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ include common/Make.defs
CHIP_CSRCS = imx9_boot.c imx9_ccm.c imx9_clockconfig.c imx9_gpio.c imx9_iomuxc.c

ifeq ($(CONFIG_ARCH_CHIP_IMX93),y)
CHIP_CSRCS += imx9_lpuart.c
ifeq ($(CONFIG_ARCH_EARLY_PRINT),y)
CHIP_ASRCS = imx93_lowputc.S
endif
CHIP_CSRCS += imx9_lpuart.c imx9_lowputc.c
endif

ifeq ($(CONFIG_IMX9_GPIO_IRQ),y)
Expand Down
403 changes: 279 additions & 124 deletions arch/arm64/src/imx9/hardware/imx9_lpuart.h

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions arch/arm64/src/imx9/imx9_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "arm64_mmu.h"
#include "imx9_boot.h"
#include "imx9_serial.h"
#include "imx9_lowputc.h"

/****************************************************************************
* Private Data
Expand Down Expand Up @@ -96,6 +97,12 @@ void arm64_chip_boot(void)

arm64_mmu_init(true);

/* Do UART early initialization & pin muxing */

#ifdef CONFIG_IMX9_LPUART
imx9_lowsetup();
#endif

/* Perform board-specific device initialization. This would include
* configuration of board specific resources such as GPIOs, LEDs, etc.
*/
Expand Down
Loading

0 comments on commit 58f0ee6

Please sign in to comment.