]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tty: serial: fsl_lpuart: avoid idle preamble pending if CTS is enabled
authorSherry Sun <sherry.sun@nxp.com>
Tue, 5 Mar 2024 01:57:06 +0000 (09:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2024 13:28:43 +0000 (15:28 +0200)
commit16eac1126d6a4ceb8df82aa3402f5badcd891e43
tree8ba03895f7ce0dc65da602b92eff8ee770b8d9d6
parentcc31dba9afa62dfd873a4b00a96f5a11c28fd0ee
tty: serial: fsl_lpuart: avoid idle preamble pending if CTS is enabled

commit 74cb7e0355fae9641f825afa389d3fba3b617714 upstream.

If the remote uart device is not connected or not enabled after booting
up, the CTS line is high by default. At this time, if we enable the flow
control when opening the device(for example, using “stty -F /dev/ttyLP4
crtscts” command), there will be a pending idle preamble(first writing 0
and then writing 1 to UARTCTRL_TE will queue an idle preamble) that
cannot be sent out, resulting in the uart port fail to close(waiting for
TX empty), so the user space stty will have to wait for a long time or
forever.

This is an LPUART IP bug(idle preamble has higher priority than CTS),
here add a workaround patch to enable TX CTS after enabling UARTCTRL_TE,
so that the idle preamble does not get stuck due to CTS is deasserted.

Fixes: 380c966c093e ("tty: serial: fsl_lpuart: add 32-bit register interface support")
Cc: stable <stable@kernel.org>
Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Link: https://lore.kernel.org/r/20240305015706.1050769-1-sherry.sun@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/fsl_lpuart.c