All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bugfix RTS line config in RS485 mode is overwritten in pl011_set_mctrl() function.
@ 2021-12-31 17:15 jmades
  2022-01-02 10:07 ` Lukas Wunner
  0 siblings, 1 reply; 10+ messages in thread
From: jmades @ 2021-12-31 17:15 UTC (permalink / raw)
  To: gregkh; +Cc: jochen, Russell King, Jiri Slaby, linux-serial, linux-kernel

Based on the "0001-serial-amba-pl011-add-RS485-support.patch" this change is necesarry otherwise the RTS-line will be pulled up in SER_RS485_RTS_BEFORE_SEND mode before sending data. This hinders the driver to receive data, f.ex. when the device is an RS485 slave device.

Signed-off-by: jmades <jochen@mades.net>
---
 drivers/tty/serial/amba-pl011.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 537f37ac4..1749c1498 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -1646,8 +1646,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);
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-01-23  4:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-31 17:15 [PATCH] Bugfix RTS line config in RS485 mode is overwritten in pl011_set_mctrl() function jmades
2022-01-02 10:07 ` Lukas Wunner
2022-01-02 15:06   ` Lino Sanfilippo
2022-01-02 18:28     ` Lukas Wunner
2022-01-03 13:44       ` Lino Sanfilippo
2022-01-11 10:00       ` Jochen Mades
2022-01-12  1:41         ` Lino Sanfilippo
2022-01-13 10:12   ` Jochen Mades
2022-01-13 10:20     ` Greg KH
2022-01-23  4:32     ` Lukas Wunner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.