FAILED: patch "[PATCH] tty: serial: fsl_lpuart: disable transmitter before changing" failed to apply to 5.10-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x f5cb528d6441eb860250a2f085773aac4f44085e
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025040331-drivable-partake-4157@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From f5cb528d6441eb860250a2f085773aac4f44085e Mon Sep 17 00:00:00 2001
From: Sherry Sun <[email protected]>
Date: Wed, 12 Mar 2025 10:25:03 +0800
Subject: [PATCH] tty: serial: fsl_lpuart: disable transmitter before changing
RS485 related registers
According to the LPUART reference manual, TXRTSE and TXRTSPOL of MODIR register only can be changed when the transmitter is disabled. So disable the transmitter before changing RS485 related registers and re-enable it after the change is done.
drivers/tty/serial/fsl_lpuart.c +17 -0
@@ -1484,6 +1484,19 @@ static int lpuart32_config_rs485(struct uart_port *port, struct ktermios *termiounsigned long modem =lpuart32_read (&sport->port,UARTMODIR ) & ~(UARTMODIR_TXRTSPOL |UARTMODIR_TXRTSE ); +u32 ctrl; + +/* TXRTSE and TXRTSPOL only can be changed when transmitter is disabled. */ + ctrl =lpuart32_read (&sport->port,UARTCTRL ); +if (ctrl &UARTCTRL_TE ) { +/* wait for the transmit engine to complete */ +lpuart32_wait_bit_set (&sport->port,UARTSTAT ,UARTSTAT_TC ); +lpuart32_write (&sport->port, ctrl & ~UARTCTRL_TE ,UARTCTRL ); + +while (lpuart32_read (&sport->port,UARTCTRL ) &UARTCTRL_TE ) +cpu_relax (); + } +lpuart32_write (&sport->port, modem,UARTMODIR );if (rs485->flags &SER_RS485_ENABLED ) {
@@ -1503,6 +1516,10 @@ static int lpuart32_config_rs485(struct uart_port *port, struct ktermios *termio }lpuart32_write (&sport->port, modem,UARTMODIR ); + +if (ctrl &UARTCTRL_TE ) +lpuart32_write (&sport->port, ctrl,UARTCTRL ); +return 0 ; }