[PATCH 6/9] serial: sc16is7xx: add support for rs485 RTS delays in microseconds

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

 



Read struct serial_rs485's flag SER_RS485_DELAY_IN_USEC and apply the delay
accordingly.

Signed-off-by: Martin Kepplinger <martin.kepplinger@xxxxxxxxxxxxx>
---
 drivers/tty/serial/sc16is7xx.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 635178cf3eed..b0e00b9fb177 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -743,7 +743,13 @@ static void sc16is7xx_tx_proc(struct kthread_work *ws)
 	struct uart_port *port = &(to_sc16is7xx_one(ws, tx_work)->port);
 
 	if ((port->rs485.flags & SER_RS485_ENABLED) &&
-	    (port->rs485.delay_rts_before_send > 0))
+	    (port->rs485.delay_rts_before_send > 0) &&
+	    (port->rs485.flags & SER_RS485_DELAY_IN_USEC))
+		usleep_range(port->rs485.delay_rts_before_send,
+			     port->rs485.delay_rts_before_send);
+	else if ((port->rs485.flags & SER_RS485_ENABLED) &&
+		 (port->rs485.delay_rts_before_send > 0) &&
+		 !(port->rs485.flags & SER_RS485_DELAY_IN_USEC))
 		msleep(port->rs485.delay_rts_before_send);
 
 	sc16is7xx_handle_tx(port);
-- 
2.20.1

Attachment: smime.p7s
Description: S/MIME cryptographic signature


[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