summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/8250
diff options
context:
space:
mode:
authorVignesh Raghavendra <vigneshr@ti.com>2021-05-11 20:49:55 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-20 17:16:55 +0200
commit31fae7c8b18c3f8029a2a5dce97a3182c1a167a0 (patch)
treebc4e8a7216e6de1eedde30285a382ac025ca2ccc /drivers/tty/serial/8250
parent1f06f5713f5278b7768031150ceb43d1127b9ad6 (diff)
serial: 8250: 8250_omap: Fix possible interrupt storm
It is possible that RX TIMEOUT is signalled after RX FIFO has been drained, in which case a dummy read of RX FIFO is required to clear RX TIMEOUT condition. Otherwise, RX TIMEOUT condition is not cleared leading to an interrupt storm Cc: stable@vger.kernel.org Reported-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com> Link: https://lore.kernel.org/r/20210511151955.28071-1-vigneshr@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/8250')
-rw-r--r--drivers/tty/serial/8250/8250_omap.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index 8ac11eaeca51..c71bd766fa56 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -104,6 +104,9 @@
#define UART_OMAP_EFR2 0x23
#define UART_OMAP_EFR2_TIMEOUT_BEHAVE BIT(6)
+/* RX FIFO occupancy indicator */
+#define UART_OMAP_RX_LVL 0x64
+
struct omap8250_priv {
int line;
u8 habit;
@@ -625,6 +628,15 @@ static irqreturn_t omap8250_irq(int irq, void *dev_id)
serial8250_rpm_get(up);
iir = serial_port_in(port, UART_IIR);
ret = serial8250_handle_irq(port, iir);
+ /*
+ * It is possible that RX TIMEOUT is signalled after FIFO
+ * has been drained, in which case a dummy read of RX FIFO is
+ * required to clear RX TIMEOUT condition.
+ */
+ if ((iir & UART_IIR_RX_TIMEOUT) == UART_IIR_RX_TIMEOUT) {
+ if (serial_port_in(port, UART_OMAP_RX_LVL) == 0)
+ serial_port_in(port, UART_RX);
+ }
serial8250_rpm_put(up);
return IRQ_RETVAL(ret);