serial: mvebu-uart: uart2 error bits clearing
authorNarendra Hadke <nhadke@marvell.com>
Tue, 26 Jul 2022 09:12:21 +0000 (11:12 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Jul 2022 08:36:00 +0000 (10:36 +0200)
For mvebu uart2, error bits are not cleared on buffer read.
This causes interrupt loop and system hang.

Cc: stable@vger.kernel.org
Reviewed-by: Yi Guo <yi.guo@cavium.com>
Reviewed-by: Nadav Haklai <nadavh@marvell.com>
Signed-off-by: Narendra Hadke <nhadke@marvell.com>
Signed-off-by: Pali Rohár <pali@kernel.org>
Link: https://lore.kernel.org/r/20220726091221.12358-1-pali@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/mvebu-uart.c

index 0429c2a5429024bc964703de1592a557460bd202..ff61a8d00014c1cf008180b80b7d2c0823268dfb 100644 (file)
@@ -265,6 +265,7 @@ static void mvebu_uart_rx_chars(struct uart_port *port, unsigned int status)
        struct tty_port *tport = &port->state->port;
        unsigned char ch = 0;
        char flag = 0;
+       int ret;
 
        do {
                if (status & STAT_RX_RDY(port)) {
@@ -277,6 +278,16 @@ static void mvebu_uart_rx_chars(struct uart_port *port, unsigned int status)
                                port->icount.parity++;
                }
 
+               /*
+                * For UART2, error bits are not cleared on buffer read.
+                * This causes interrupt loop and system hang.
+                */
+               if (IS_EXTENDED(port) && (status & STAT_BRK_ERR)) {
+                       ret = readl(port->membase + UART_STAT);
+                       ret |= STAT_BRK_ERR;
+                       writel(ret, port->membase + UART_STAT);
+               }
+
                if (status & STAT_BRK_DET) {
                        port->icount.brk++;
                        status &= ~(STAT_FRM_ERR | STAT_PAR_ERR);