]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
tty: serial: fsl_lpuart: fix lpuart32_poll_get_char
authorPeng Fan <peng.fan@nxp.com>
Tue, 29 Sep 2020 09:55:09 +0000 (17:55 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 30 Oct 2020 09:38:32 +0000 (10:38 +0100)
commit 29788ab1d2bf26c130de8f44f9553ee78a27e8d5 upstream.

The watermark is set to 1, so we need to input two chars to trigger RDRF
using the original logic. With the new logic, we could always get the
char when there is data in FIFO.

Suggested-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20200929095509.21680-1-peng.fan@nxp.com
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/fsl_lpuart.c

index 2daccb10ae2f3542e7938b2612756f63d06dfbbc..4b9f422694779ad0fb91bd3c663de4b1055f8dbc 100644 (file)
@@ -563,7 +563,7 @@ static void lpuart32_poll_put_char(struct uart_port *port, unsigned char c)
 
 static int lpuart32_poll_get_char(struct uart_port *port)
 {
-       if (!(lpuart32_read(port, UARTSTAT) & UARTSTAT_RDRF))
+       if (!(lpuart32_read(port, UARTWATER) >> UARTWATER_RXCNT_OFF))
                return NO_POLL_CHAR;
 
        return lpuart32_read(port, UARTDATA);