summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarendra Hadke <nhadke@marvell.com>2022-07-26 11:12:21 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-07-28 10:36:00 +0200
commita7209541239e5dd44d981289e5f9059222d40fd1 (patch)
tree0e48d79c0e4f33650f9966f80778dcdc9280dd60
parent707f816f25590c20e056b3bd4a17ce69b03fe856 (diff)
downloadlinux-a7209541239e5dd44d981289e5f9059222d40fd1.tar.bz2
serial: mvebu-uart: uart2 error bits clearing
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>
-rw-r--r--drivers/tty/serial/mvebu-uart.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c
index 0429c2a54290..ff61a8d00014 100644
--- a/drivers/tty/serial/mvebu-uart.c
+++ b/drivers/tty/serial/mvebu-uart.c
@@ -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);