]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
tty: serial: fsl_lpuart: Clear the error flags by writing 1 for lpuart32 platforms
authorSherry Sun <sherry.sun@nxp.com>
Tue, 1 Aug 2023 02:23:04 +0000 (10:23 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 30 Oct 2023 11:00:16 +0000 (12:00 +0100)
BugLink: https://bugs.launchpad.net/bugs/2039110
commit 282069845af388b08d622ad192b831dcd0549c62 upstream.

Do not read the data register to clear the error flags for lpuart32
platforms, the additional read may cause the receive FIFO underflow
since the DMA has already read the data register.
Actually all lpuart32 platforms support write 1 to clear those error
bits, let's use this method to better clear the error flags.

Fixes: 42b68768e51b ("serial: fsl_lpuart: DMA support for 32-bit variant")
Cc: stable <stable@kernel.org>
Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Link: https://lore.kernel.org/r/20230801022304.24251-1-sherry.sun@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/tty/serial/fsl_lpuart.c

index 97b7d6b8bf62c5ab1466cf1250787ac4caae8a0a..daa9571ab31446cce59e9d0ab303ff8f4470f8aa 100644 (file)
@@ -1119,8 +1119,8 @@ static void lpuart_copy_rx_to_tty(struct lpuart_port *sport)
                unsigned long sr = lpuart32_read(&sport->port, UARTSTAT);
 
                if (sr & (UARTSTAT_PE | UARTSTAT_FE)) {
-                       /* Read DR to clear the error flags */
-                       lpuart32_read(&sport->port, UARTDATA);
+                       /* Clear the error flags */
+                       lpuart32_write(&sport->port, sr, UARTSTAT);
 
                        if (sr & UARTSTAT_PE)
                                sport->port.icount.parity++;