s32k1xx:serial Add EDMA

This commit is contained in:
David Sidrane 2022-12-09 05:15:02 -08:00 committed by Xiang Xiao
parent 8a412ba59b
commit 9bb1226b04
3 changed files with 1045 additions and 151 deletions

View File

@ -772,6 +772,22 @@ config LPI2C1_SLAVE_BUS
endmenu # LPI2C1 Slave Configuration
endmenu # LPI2C Configuration
menu "LPUART Configuration"
comment "LP Uart Driver Configuration"
config S32K1XX_LPUART_RXDMA_BUFFER_SIZE
int "Rx DMA buffer size"
default 64
depends on LPUART0_RXDMA || LPUART1_RXDMA || LPUART2_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.
endmenu # LPUART Configuration
menu "Ethernet Configuration"
depends on S32K1XX_ENET

File diff suppressed because it is too large Load Diff

View File

@ -34,6 +34,115 @@
* Pre-processor Definitions
****************************************************************************/
#if defined(CONFIG_S32K1XX_LPUART0) || defined(CONFIG_S32K1XX_LPUART1) || \
defined(CONFIG_S32K1XX_LPUART2)
# define HAVE_UART 1
#endif
/* Assume DMA is not used on the console UART */
#undef SERIAL_HAVE_CONSOLE_RXDMA
#undef SERIAL_HAVE_CONSOLE_TXDMA
#if !defined(HAVE_UART) || !defined(CONFIG_ARCH_DMA)
# undef CONFIG_LPUART0_RXDMA
# undef CONFIG_LPUART0_TXDMA
# undef CONFIG_LPUART1_RXDMA
# undef CONFIG_LPUART1_TXDMA
# undef CONFIG_LPUART2_RXDMA
# undef CONFIG_LPUART2_TXDMA
#endif
/* Disable the DMA configuration on all unused LPUARTs */
#ifndef CONFIG_S32K1XX_LPUART0
# undef CONFIG_LPUART0_RXDMA
# undef CONFIG_LPUART0_TXDMA
#endif
#ifndef CONFIG_S32K1XX_LPUART1
# undef CONFIG_LPUART1_RXDMA
# undef CONFIG_LPUART1_TXDMA
#endif
#ifndef CONFIG_S32K1XX_LPUART2
# undef CONFIG_LPUART2_RXDMA
# undef CONFIG_LPUART2_TXDMA
#endif
/* Is RX DMA available on any (enabled) LPUART? */
#undef SERIAL_HAVE_RXDMA
#if defined(CONFIG_LPUART0_RXDMA) || defined(CONFIG_LPUART1_RXDMA) || \
defined(CONFIG_LPUART2_RXDMA)
# define SERIAL_HAVE_RXDMA 1
#endif
/* Is TX DMA available on any (enabled) LPUART? */
#undef SERIAL_HAVE_TXDMA
#if defined(CONFIG_LPUART0_TXDMA) || defined(CONFIG_LPUART1_TXDMA) || \
defined(CONFIG_LPUART2_TXDMA)
# define SERIAL_HAVE_TXDMA 1
#endif
/* Is RX DMA used on all (enabled) LPUARTs */
#define SERIAL_HAVE_ONLY_RXDMA 1
#if defined(CONFIG_S32K1XX_LPUART0) && !defined(CONFIG_LPUART0_RXDMA)
# undef SERIAL_HAVE_ONLY_RXDMA
#elif defined(CONFIG_S32K1XX_LPUART1) && !defined(CONFIG_LPUART1_RXDMA)
# undef SERIAL_HAVE_ONLY_RXDMA
#elif defined(CONFIG_S32K1XX_LPUART2) && !defined(CONFIG_LPUART2_RXDMA)
# undef SERIAL_HAVE_ONLY_RXDMA
#endif
/* Is TX DMA used on all (enabled) LPUARTs */
#define SERIAL_HAVE_ONLY_TXDMA 1
#if defined(CONFIG_S32K1XX_LPUART0) && !defined(CONFIG_LPUART0_TXDMA)
# undef SERIAL_HAVE_ONLY_TXDMA
#elif defined(CONFIG_S32K1XX_LPUART1) && !defined(CONFIG_LPUART1_TXDMA)
# undef SERIAL_HAVE_ONLY_TXDMA
#elif defined(CONFIG_S32K1XX_LPUART2) && !defined(CONFIG_LPUART2_TXDMA)
# undef SERIAL_HAVE_ONLY_TXDMA
#endif
#undef SERIAL_HAVE_ONLY_DMA
#if defined(SERIAL_HAVE_ONLY_RXDMA) && defined(SERIAL_HAVE_ONLY_TXDMA)
#define SERIAL_HAVE_ONLY_DMA
#endif
/* Verify that DMA has been enabled and the DMA channel has been defined.
*/
# if defined(SERIAL_HAVE_TXDMA) || defined(SERIAL_HAVE_RXDMA)
# ifndef CONFIG_S32K1XX_EDMA
# error S32K1XX LPUART receive or transmit DMA requires CONFIG_S32K1XX_EDMA
# endif
# endif
#if defined(SERIAL_HAVE_RXDMA)
/* Currently RS-485 support cannot be enabled when RXDMA is in use due to
* lack of testing.
*/
# if (defined(CONFIG_LPUART0_RXDMA) && defined(CONFIG_LPUART0_RS485)) || \
(defined(CONFIG_LPUART1_RXDMA) && defined(CONFIG_LPUART1_RS485)) || \
(defined(CONFIG_LPUART2_RXDMA) && defined(CONFIG_LPUART2_RS485))
# error "RXDMA and RS-485 cannot be enabled at the same time for the same LPUART"
# endif
#endif /* SERIAL_HAVE_RXDMA */
/* Currently RS-485 support cannot be enabled when TXDMA is in use due to
* lack of testing.
*/
#if (defined(CONFIG_LPUART0_TXDMA) && defined(CONFIG_LPUART0_RS485)) || \
(defined(CONFIG_LPUART1_TXDMA) && defined(CONFIG_LPUART1_RS485)) || \
(defined(CONFIG_LPUART2_TXDMA) && defined(CONFIG_LPUART2_RS485))
# error "TXDMA and RS-485 cannot be enabled at the same time for the same LPUART"
#endif
/****************************************************************************
* Public Types
****************************************************************************/