Skip to content

Commit 9425914

Browse files
SherrySun5gregkh
authored andcommitted
tty: serial: fsl_lpuart: avoid checking for transfer complete when UARTCTRL_SBK is asserted in lpuart32_tx_empty
According to LPUART RM, Transmission Complete Flag becomes 0 if queuing a break character by writing 1 to CTRL[SBK], so here need to avoid checking for transmission complete when UARTCTRL_SBK is asserted, otherwise the lpuart32_tx_empty may never get TIOCSER_TEMT. Commit 2411fd9("tty: serial: fsl_lpuart: skip waiting for transmission complete when UARTCTRL_SBK is asserted") only fix it in lpuart32_set_termios(), here also fix it in lpuart32_tx_empty(). Fixes: 380c966 ("tty: serial: fsl_lpuart: add 32-bit register interface support") Cc: stable <stable@kernel.org> Signed-off-by: Sherry Sun <sherry.sun@nxp.com> Link: https://lore.kernel.org/r/20230323054415.20363-1-sherry.sun@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 90b8596 commit 9425914

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/tty/serial/fsl_lpuart.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,11 +858,17 @@ static unsigned int lpuart32_tx_empty(struct uart_port *port)
858858
struct lpuart_port, port);
859859
unsigned long stat = lpuart32_read(port, UARTSTAT);
860860
unsigned long sfifo = lpuart32_read(port, UARTFIFO);
861+
unsigned long ctrl = lpuart32_read(port, UARTCTRL);
861862

862863
if (sport->dma_tx_in_progress)
863864
return 0;
864865

865-
if (stat & UARTSTAT_TC && sfifo & UARTFIFO_TXEMPT)
866+
/*
867+
* LPUART Transmission Complete Flag may never be set while queuing a break
868+
* character, so avoid checking for transmission complete when UARTCTRL_SBK
869+
* is asserted.
870+
*/
871+
if ((stat & UARTSTAT_TC && sfifo & UARTFIFO_TXEMPT) || ctrl & UARTCTRL_SBK)
866872
return TIOCSER_TEMT;
867873

868874
return 0;

0 commit comments

Comments
 (0)