Skip to content
  • Philippe Gerum's avatar
    drivers/serial: imx: fix transmit interrupt handling · 22d28f61
    Philippe Gerum authored and Jan Kiszka's avatar Jan Kiszka committed
    
    
    We may receive TRDY when the TX-FIFO is not entirely empty, which
    breaks the logic in rt_imx_uart_tx_chars(), as we may break early from
    the transmit loop when the TXFULL condition is detected, skipping
    decrement of ctx->out_npend although a byte was sent.
    
    Because of this, we may end up with ghost bytes in the output buffer
    which were actually sent to the UART, but still erroneously counted in
    ctx->out_npend. As a result, incorrect output can be observed later on
    as bytes from the software FIFO are unduly sent, or such FIFO may
    overflow indefinitely due to accumulated errors.
    
    Fix this by testing TXFULL before sending the next byte to the UART.
    At this chance, drop the count limit on the FIFO depth: testing TXFULL
    is sufficient and robust.
    
    Signed-off-by: default avatarPhilippe Gerum <rpm@xenomai.org>
    Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
    22d28f61