summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/fsl_lpuart.c
diff options
context:
space:
mode:
authorSherry Sun <sherry.sun@nxp.com>2023-01-30 07:44:48 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-31 10:53:39 +0100
commitecba98f9ddf426af337fb8b63d7581c254fe6e87 (patch)
tree24f67b87cab8a2bc7dcae3a6b993c14b35dc7e95 /drivers/tty/serial/fsl_lpuart.c
parenttty: serial: fsl_lpuart: Enable Receiver Idle Empty function for LPUART (diff)
downloadlinux-ecba98f9ddf426af337fb8b63d7581c254fe6e87.tar.xz
linux-ecba98f9ddf426af337fb8b63d7581c254fe6e87.zip
tty: serial: fsl_lpuart: set RTS watermark for lpuart
Add RTS watermark support for LPUART. The RX RTS_B output negates when the number of empty words in the receive FIFO is greater or equal to RTSWATER. Here set the RTSWATER to half of the rxfifo_size. Signed-off-by: Sherry Sun <sherry.sun@nxp.com> Link: https://lore.kernel.org/r/20230130064449.9564-6-sherry.sun@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/fsl_lpuart.c')
-rw-r--r--drivers/tty/serial/fsl_lpuart.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 2789749d3d0d..c35e49a09bcc 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -201,6 +201,7 @@
#define UARTDATA_MASK 0x3ff
#define UARTMODIR_IREN 0x00020000
+#define UARTMODIR_RTSWATER GENMASK(10, 8)
#define UARTMODIR_TXCTSSRC 0x00000020
#define UARTMODIR_TXCTSC 0x00000010
#define UARTMODIR_RXRTSE 0x00000008
@@ -1573,6 +1574,13 @@ static void lpuart32_setup_watermark(struct lpuart_port *sport)
(0x0 << UARTWATER_TXWATER_OFF);
lpuart32_write(&sport->port, val, UARTWATER);
+ /* set RTS watermark */
+ if (!uart_console(&sport->port)) {
+ val = lpuart32_read(&sport->port, UARTMODIR);
+ val |= FIELD_PREP(UARTMODIR_RTSWATER, sport->rxfifo_size >> 1);
+ lpuart32_write(&sport->port, val, UARTMODIR);
+ }
+
/* Restore cr2 */
lpuart32_write(&sport->port, ctrl_saved, UARTCTRL);
}