[PATCH 5.19 056/155] serial: fsl_lpuart: RS485 RTS polariy is inverse

From: Greg Kroah-Hartman
Date: Tue Sep 06 2022 - 10:06:59 EST


From: Shenwei Wang <shenwei.wang@xxxxxxx>

commit 846651eca073e2e02e37490a4a52752415d84781 upstream.

The setting of RS485 RTS polarity is inverse in the current driver.

When the property of 'rs485-rts-active-low' is enabled in the dts node,
the RTS signal should be LOW during sending. Otherwise, if there is no
such a property, the RTS should be HIGH during sending.

Fixes: 03895cf41d18 ("tty: serial: fsl_lpuart: Add support for RS-485")
Cc: stable <stable@xxxxxxxxxx>
Signed-off-by: Nicolas Diaz <nicolas.diaz@xxxxxxx>
Signed-off-by: Shenwei Wang <shenwei.wang@xxxxxxx>
Link: https://lore.kernel.org/r/20220805144529.604856-1-shenwei.wang@xxxxxxx
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
drivers/tty/serial/fsl_lpuart.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -1381,9 +1381,9 @@ static int lpuart_config_rs485(struct ua
* Note: UART is assumed to be active high.
*/
if (rs485->flags & SER_RS485_RTS_ON_SEND)
- modem &= ~UARTMODEM_TXRTSPOL;
- else if (rs485->flags & SER_RS485_RTS_AFTER_SEND)
modem |= UARTMODEM_TXRTSPOL;
+ else if (rs485->flags & SER_RS485_RTS_AFTER_SEND)
+ modem &= ~UARTMODEM_TXRTSPOL;
}

writeb(modem, sport->port.membase + UARTMODEM);