Skip to content

Commit 62f676f

Browse files
jmadesgregkh
authored andcommitted
serial: pl011: Fix incorrect rs485 RTS polarity on set_mctrl
Commit 8d47923 ("serial: amba-pl011: add RS485 support") sought to keep RTS deasserted on set_mctrl if rs485 is enabled. However it did so only if deasserted RTS polarity is high. Fix it in case it's low. Fixes: 8d47923 ("serial: amba-pl011: add RS485 support") Cc: [email protected] # v5.15+ Cc: Lino Sanfilippo <[email protected]> Signed-off-by: Jochen Mades <[email protected]> [lukas: copyedit commit message, add stable designation] Signed-off-by: Lukas Wunner <[email protected]> Link: https://lore.kernel.org/r/85fa3323ba8c307943969b7343e23f34c3e652ba.1642909284.git.lukas@wunner.de Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 037b91e commit 62f676f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/tty/serial/amba-pl011.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,8 +1582,12 @@ static void pl011_set_mctrl(struct uart_port *port, unsigned int mctrl)
15821582
container_of(port, struct uart_amba_port, port);
15831583
unsigned int cr;
15841584

1585-
if (port->rs485.flags & SER_RS485_ENABLED)
1586-
mctrl &= ~TIOCM_RTS;
1585+
if (port->rs485.flags & SER_RS485_ENABLED) {
1586+
if (port->rs485.flags & SER_RS485_RTS_AFTER_SEND)
1587+
mctrl &= ~TIOCM_RTS;
1588+
else
1589+
mctrl |= TIOCM_RTS;
1590+
}
15871591

15881592
cr = pl011_read(uap, REG_CR);
15891593

0 commit comments

Comments
 (0)