Skip to content

Commit

Permalink
serial: mvebu-uart: clear state register before IRQ request
Browse files Browse the repository at this point in the history
When receiving data on RX pin before ->uart_startup() is called, some
error bits in the state register could be set up (like BRK_DET).

This is harmless when using only the standard UART (error bits are
read-only), but may procude an endless loop once in the extended UART
RX interrupt handler (error bits must be cleared).

Clear the status register in ->uart_startup() to avoid this situation.

Signed-off-by: Allen Yan <yanwei@marvell.com>
Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Allen Yan authored and Greg Kroah-Hartman committed Oct 20, 2017
1 parent 68a0db1 commit 2ff23c4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/tty/serial/mvebu-uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,12 @@ static int mvebu_uart_startup(struct uart_port *port)
writel(CTRL_TXFIFO_RST | CTRL_RXFIFO_RST,
port->membase + UART_CTRL(port));
udelay(1);

/* Clear the error bits of state register before IRQ request */
ret = readl(port->membase + UART_STAT);
ret |= STAT_BRK_ERR;
writel(ret, port->membase + UART_STAT);

writel(CTRL_BRK_INT, port->membase + UART_CTRL(port));

ctl = readl(port->membase + UART_INTR(port));
Expand Down

0 comments on commit 2ff23c4

Please sign in to comment.