Message ID | 572288095.547800.1640594185677@webmail.strato.com |
---|---|
State | New |
Headers | show |
Series | amba-pl011 driver: bug in RS485 mode | expand |
On Mon, Dec 27, 2021 at 09:36:25AM +0100, Jochen Mades wrote: > Hi, > > I tested the amba-pl011 driver from the current branch rpi-5.16.y in RS485 mode and found a bug. > > The current driver pulls-up RTS in function pl011_set_mctrl independent from the rs485-flags SER_RS485_RTS_AFTER_SEND. > This leads to problems if the driver is used as RS485 slave. > > In my opinion the patch should look like that (and was tested successfully by myself): > > diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c > index 537f37ac4..3b45beae8 100644 > --- a/drivers/tty/serial/amba-pl011.c > +++ b/drivers/tty/serial/amba-pl011.c > @@ -1647,7 +1647,12 @@ static void pl011_set_mctrl(struct uart_port *port, unsigned int mctrl) > unsigned int cr; > > if (port->rs485.flags & SER_RS485_ENABLED) > - mctrl &= ~TIOCM_RTS; > + { > + if (port->rs485.flags & SER_RS485_RTS_AFTER_SEND) > + mctrl &= ~TIOCM_RTS; > + else > + mctrl |= TIOCM_RTS; > + } > > cr = pl011_read(uap, REG_CR); > > > Please let me know, if I'm allowed to commit this change and let me know how to do that or if someone of you guys will do that better. Anyone is allowed to submit a change, please do so as per the Documentation/SubmittingPatches file describes and we will be glad to review it and apply it if it is ok. thanks, greg k-h
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 537f37ac4..3b45beae8 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -1647,7 +1647,12 @@ static void pl011_set_mctrl(struct uart_port *port, unsigned int mctrl) unsigned int cr; if (port->rs485.flags & SER_RS485_ENABLED) - mctrl &= ~TIOCM_RTS; + { + if (port->rs485.flags & SER_RS485_RTS_AFTER_SEND) + mctrl &= ~TIOCM_RTS; + else + mctrl |= TIOCM_RTS; + } cr = pl011_read(uap, REG_CR);