From: Greg Kroah-Hartman Date: Mon, 20 Mar 2023 09:15:14 +0000 (+0100) Subject: 5.4-stable patches X-Git-Tag: v4.14.311~49 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=820fa438bc88a49ebddad344770ee5bd4fc8346c;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: tty-serial-fsl_lpuart-skip-waiting-for-transmission-complete-when-uartctrl_sbk-is-asserted.patch --- diff --git a/queue-5.4/series b/queue-5.4/series index f47dc89e91b..d1e71e451cf 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -42,3 +42,4 @@ ext4-fix-task-hung-in-ext4_xattr_delete_inode.patch drm-amdkfd-fix-an-illegal-memory-access.patch sh-intc-avoid-spurious-sizeof-pointer-div-warning.patch ext4-fix-possible-double-unlock-when-moving-a-directory.patch +tty-serial-fsl_lpuart-skip-waiting-for-transmission-complete-when-uartctrl_sbk-is-asserted.patch diff --git a/queue-5.4/tty-serial-fsl_lpuart-skip-waiting-for-transmission-complete-when-uartctrl_sbk-is-asserted.patch b/queue-5.4/tty-serial-fsl_lpuart-skip-waiting-for-transmission-complete-when-uartctrl_sbk-is-asserted.patch new file mode 100644 index 00000000000..37ff5729cf3 --- /dev/null +++ b/queue-5.4/tty-serial-fsl_lpuart-skip-waiting-for-transmission-complete-when-uartctrl_sbk-is-asserted.patch @@ -0,0 +1,46 @@ +From 2411fd94ceaa6e11326e95d6ebf876cbfed28d23 Mon Sep 17 00:00:00 2001 +From: Sherry Sun +Date: Thu, 23 Feb 2023 17:39:41 +0800 +Subject: tty: serial: fsl_lpuart: skip waiting for transmission complete when UARTCTRL_SBK is asserted + +From: Sherry Sun + +commit 2411fd94ceaa6e11326e95d6ebf876cbfed28d23 upstream. + +According to LPUART RM, Transmission Complete Flag becomes 0 if queuing +a break character by writing 1 to CTRL[SBK], so here need to skip +waiting for transmission complete when UARTCTRL_SBK is asserted, +otherwise the kernel may stuck here. +And actually set_termios() adds transmission completion waiting to avoid +data loss or data breakage when changing the baud rate, but we don't +need to worry about this when queuing break characters. + +Signed-off-by: Sherry Sun +Cc: stable +Link: https://lore.kernel.org/r/20230223093941.31790-1-sherry.sun@nxp.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/fsl_lpuart.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/drivers/tty/serial/fsl_lpuart.c ++++ b/drivers/tty/serial/fsl_lpuart.c +@@ -2002,9 +2002,15 @@ lpuart32_set_termios(struct uart_port *p + /* update the per-port timeout */ + uart_update_timeout(port, termios->c_cflag, baud); + +- /* wait transmit engin complete */ +- lpuart32_write(&sport->port, 0, UARTMODIR); +- lpuart32_wait_bit_set(&sport->port, UARTSTAT, UARTSTAT_TC); ++ /* ++ * LPUART Transmission Complete Flag may never be set while queuing a break ++ * character, so skip waiting for transmission complete when UARTCTRL_SBK is ++ * asserted. ++ */ ++ if (!(old_ctrl & UARTCTRL_SBK)) { ++ lpuart32_write(&sport->port, 0, UARTMODIR); ++ lpuart32_wait_bit_set(&sport->port, UARTSTAT, UARTSTAT_TC); ++ } + + /* disable transmit and receive */ + lpuart32_write(&sport->port, old_ctrl & ~(UARTCTRL_TE | UARTCTRL_RE),