Skip to content

Commit

Permalink
serial: pl011: Fix incorrect rs485 RTS polarity on set_mctrl
Browse files Browse the repository at this point in the history
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: stable@vger.kernel.org # v5.15+
Cc: Lino Sanfilippo <LinoSanfilippo@gmx.de>
Signed-off-by: Jochen Mades <jochen@mades.net>
[lukas: copyedit commit message, add stable designation]
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Link: https://lore.kernel.org/r/85fa3323ba8c307943969b7343e23f34c3e652ba.1642909284.git.lukas@wunner.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Jochen Mades authored and Greg Kroah-Hartman committed Jan 26, 2022
1 parent 037b91e commit 62f676f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/tty/serial/amba-pl011.c
Original file line number Diff line number Diff line change
Expand Up @@ -1582,8 +1582,12 @@ static void pl011_set_mctrl(struct uart_port *port, unsigned int mctrl)
container_of(port, struct uart_amba_port, port);
unsigned int cr;

if (port->rs485.flags & SER_RS485_ENABLED)
mctrl &= ~TIOCM_RTS;
if (port->rs485.flags & SER_RS485_ENABLED) {
if (port->rs485.flags & SER_RS485_RTS_AFTER_SEND)
mctrl &= ~TIOCM_RTS;
else
mctrl |= TIOCM_RTS;
}

cr = pl011_read(uap, REG_CR);

Expand Down

0 comments on commit 62f676f

Please sign in to comment.