OSDN Git Service

tty: serial: fsl_lpuart: Enable Receiver Idle Empty function for LPUART
authorSherry Sun <sherry.sun@nxp.com>
Mon, 30 Jan 2023 06:44:47 +0000 (14:44 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 31 Jan 2023 09:53:39 +0000 (10:53 +0100)
With the growth of rx watermark, it's useful to enable the Receiver Idle
Empty function, it can assert the RDRF(Receive Data Register Full Flag)
when the receiver is idle for a number of idle characters and the FIFO
is not empty. It will generate a DMA request or interrupt, which can
avoid receive data being trapped in the RX FIFO since the number of
words received is less than the watermark.

Here set the RXIDEN as 0x3 which enable the RDRF assertion due to
partially filled FIFO when receiver is idle for 4 characters.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Link: https://lore.kernel.org/r/20230130064449.9564-5-sherry.sun@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/fsl_lpuart.c

index ba6ade7..2789749 100644 (file)
 #define UARTFIFO_RXUF          0x00010000
 #define UARTFIFO_TXFLUSH       0x00008000
 #define UARTFIFO_RXFLUSH       0x00004000
+#define UARTFIFO_RXIDEN        GENMASK(12, 10)
 #define UARTFIFO_TXOFE         0x00000200
 #define UARTFIFO_RXUFE         0x00000100
 #define UARTFIFO_TXFE          0x00000080
@@ -1562,6 +1563,7 @@ static void lpuart32_setup_watermark(struct lpuart_port *sport)
        val = lpuart32_read(&sport->port, UARTFIFO);
        val |= UARTFIFO_TXFE | UARTFIFO_RXFE;
        val |= UARTFIFO_TXFLUSH | UARTFIFO_RXFLUSH;
+       val |= FIELD_PREP(UARTFIFO_RXIDEN, 0x3);
        lpuart32_write(&sport->port, val, UARTFIFO);
 
        /* set the watermark */