@@ -1672,6 +1672,19 @@ static void pl011_put_poll_char(struct uart_port *port,
#endif /* CONFIG_CONSOLE_POLL */
+/*
+ * RXIS is asserted only when the RX FIFO transitions from below to
+ * above the trigger threshold. If the RX FIFO is already full to the
+ * threshold this can't happen and RXIS will now be stuck off.
+ * Unless polling the UART, use this function to drain the RX FIFO
+ * explicitly after clearing RXIS.
+ */
+static void pl011_drain_rx_fifo(struct uart_amba_port *uap)
+{
+ while (!(pl011_read(uap, REG_FR) & UART01x_FR_RXFE))
+ pl011_read(uap, REG_DR);
+}
+
static int pl011_hwinit(struct uart_port *port)
{
struct uart_amba_port *uap =
@@ -1695,6 +1708,8 @@ static int pl011_hwinit(struct uart_port *port)
UART011_FEIS | UART011_RTIS | UART011_RXIS,
uap, REG_ICR);
+ pl011_drain_rx_fifo(uap);
+
/*
* Save interrupts enable mask, and enable RX interrupts in case if
* the interrupt is used for NMI entry.
@@ -1751,6 +1766,8 @@ static void pl011_enable_interrupts(struct uart_amba_port *uap)
/* Clear out any spuriously appearing RX interrupts */
pl011_write(UART011_RTIS | UART011_RXIS, uap, REG_ICR);
+ pl011_drain_rx_fifo(uap);
+
uap->im = UART011_RTIM;
if (!pl011_dma_rx_running(uap))
uap->im |= UART011_RXIM;