Skip to contentSkip to conversation

serial: mvebu-uart: uart2 error bits clearing

PATCH New Pali Rohár 1 participant 1 message Jul 26, 2022

Subsystems (2)
lore
Share & tools
lore

Pali Rohár

author maintainer
#0 lore raw

PATCH 1/1 serial: mvebu-uart: uart2 error bits clearing

From: Narendra Hadke <[email protected]>

For mvebu uart2, error bits are not cleared on buffer read. This causes interrupt loop and system hang.

---
 drivers/tty/serial/mvebu-uart.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/tty/serial/mvebu-uart.c +11 -0
index 0429c2a54290..ff61a8d00014 100644
@@ -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);
Signature · 1 line
2.20.1