Skip to content

Commit 08ce9a1

Browse files
zonquegregkh
authored andcommitted
serial: sc16is7xx: address RX timeout interrupt errata
This device has a silicon bug that makes it report a timeout interrupt but no data in the FIFO. The datasheet states the following in the errata section 18.1.4: "If the host reads the receive FIFO at the same time as a time-out interrupt condition happens, the host might read 0xCC (time-out) in the Interrupt Indication Register (IIR), but bit 0 of the Line Status Register (LSR) is not set (means there is no data in the receive FIFO)." The errata description seems to indicate it concerns only polled mode of operation when reading bit 0 of the LSR register. However, tests have shown and NXP has confirmed that the RXLVL register also yields 0 when the bug is triggered, and hence the IRQ driven implementation in this driver is equally affected. This bug has hit us on production units and when it does, sc16is7xx_irq() would spin forever because sc16is7xx_port_irq() keeps seeing an interrupt in the IIR register that is not cleared because the driver does not call into sc16is7xx_handle_rx() unless the RXLVL register reports at least one byte in the FIFO. Fix this by always reading one byte from the FIFO when this condition is detected in order to clear the interrupt. This approach was confirmed to be correct by NXP through their support channels. Tested by: Hugo Villeneuve <[email protected]> Signed-off-by: Daniel Mack <[email protected]> Co-Developed-by: Maxim Popov <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8973ab7 commit 08ce9a1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/tty/serial/sc16is7xx.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,18 @@ static bool sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno)
766766
case SC16IS7XX_IIR_RTOI_SRC:
767767
case SC16IS7XX_IIR_XOFFI_SRC:
768768
rxlen = sc16is7xx_port_read(port, SC16IS7XX_RXLVL_REG);
769+
770+
/*
771+
* There is a silicon bug that makes the chip report a
772+
* time-out interrupt but no data in the FIFO. This is
773+
* described in errata section 18.1.4.
774+
*
775+
* When this happens, read one byte from the FIFO to
776+
* clear the interrupt.
777+
*/
778+
if (iir == SC16IS7XX_IIR_RTOI_SRC && !rxlen)
779+
rxlen = 1;
780+
769781
if (rxlen)
770782
sc16is7xx_handle_rx(port, rxlen, iir);
771783
break;

0 commit comments

Comments
 (0)