2022-12-14 03:37:34

by Sherry Sun

[permalink] [raw]
Subject: [PATCH 0/3] tty: serial: fsl_lpuart/imx: improve the TX break settings

This patch set improve the TX break settings for lpuart and imx uart driver.
Add workaround patch for a LPUART IP bug about sending break signal.
Also disable the break in .shutdown() for lpuart and imx uart like other uart
drivers.

This patch set has been verified on imx8mm(imx uart) and imx8ulp(lpuart).

Sherry Sun (3):
tty: serial: fsl_lpuart: disable the CTS when send break signal
tty: serial: fsl_lpuart: disable the break condition when shutdown the
uart port
tty: serial: imx: disable the break condition when shutdown the uart
port

drivers/tty/serial/fsl_lpuart.c | 28 ++++++++++++++++++++++++----
drivers/tty/serial/imx.c | 3 ++-
2 files changed, 26 insertions(+), 5 deletions(-)

--
2.17.1


2022-12-14 03:40:48

by Sherry Sun

[permalink] [raw]
Subject: [PATCH 2/3] tty: serial: fsl_lpuart: disable the break condition when shutdown the uart port

Need to disable the break condition for lpuart driver when closing
the uart port like other uart drivers do.

Signed-off-by: Sherry Sun <[email protected]>
---
drivers/tty/serial/fsl_lpuart.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index f487d3d2effe..584b26e0b947 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -1839,10 +1839,10 @@ static void lpuart32_shutdown(struct uart_port *port)
temp &= ~(UARTBAUD_TDMAE | UARTBAUD_RDMAE);
lpuart32_write(port, temp, UARTBAUD);

- /* disable Rx/Tx and interrupts */
+ /* disable Rx/Tx and interrupts and break condition */
temp = lpuart32_read(port, UARTCTRL);
temp &= ~(UARTCTRL_TE | UARTCTRL_RE | UARTCTRL_ILIE |
- UARTCTRL_TIE | UARTCTRL_TCIE | UARTCTRL_RIE);
+ UARTCTRL_TIE | UARTCTRL_TCIE | UARTCTRL_RIE | UARTCTRL_SBK);
lpuart32_write(port, temp, UARTCTRL);

spin_unlock_irqrestore(&port->lock, flags);
--
2.17.1

2022-12-14 03:41:48

by Sherry Sun

[permalink] [raw]
Subject: [PATCH 3/3] tty: serial: imx: disable the break condition when shutdown the uart port

The comment in imx_uart_shutdown() says to disable the break condition,
but it doesn't actually do that, here fix this by disabling UCR1_SNDBRK
when closing the uart port like other uart drivers do.

Signed-off-by: Sherry Sun <[email protected]>
---
drivers/tty/serial/imx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 757825edb0cd..74c9e68fc3bd 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1564,7 +1564,8 @@ static void imx_uart_shutdown(struct uart_port *port)
spin_lock_irqsave(&sport->port.lock, flags);

ucr1 = imx_uart_readl(sport, UCR1);
- ucr1 &= ~(UCR1_TRDYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_RXDMAEN | UCR1_ATDMAEN);
+ ucr1 &= ~(UCR1_TRDYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_RXDMAEN |
+ UCR1_ATDMAEN | UCR1_SNDBRK);
/* See SER_RS485_ENABLED/UTS_LOOP comment in imx_uart_probe() */
if (port->rs485.flags & SER_RS485_ENABLED &&
port->rs485.flags & SER_RS485_RTS_ON_SEND &&
--
2.17.1