amba-pl011 driver: bug in RS485 mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Bests
Jochen



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux