[PATCH] sc16is7xx: remove RS-485 delay RTS handling

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

 



From: Jakub Kicinski <kubakici@xxxxx>

Users of RS-485 can request via ioctl that RTS signals should
be activated selected number of milliseconds before the actual
data transmission or stay active after the transmission is
finished.  In sc16is7xx, however, RTS signalling is handled by
the hardware and driver has no way of providing this feature.

Note: this change will make the driver return -EINVAL when the
      feature is requested (.delay_rts_*_send are set).

Signed-off-by: Jakub Kicinski <kubakici@xxxxx>
---
 drivers/tty/serial/sc16is7xx.c | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)

diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 20573d72715d..25c27c09b0d0 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -651,21 +651,6 @@ static void sc16is7xx_wq_proc(struct work_struct *ws)
 
 static void sc16is7xx_stop_tx(struct uart_port* port)
 {
-	struct sc16is7xx_one *one = to_sc16is7xx_one(port, port);
-	struct circ_buf *xmit = &one->port.state->xmit;
-
-	/* handle rs485 */
-	if (port->rs485.flags & SER_RS485_ENABLED) {
-		/* do nothing if current tx not yet completed */
-		int lsr = sc16is7xx_port_read(port, SC16IS7XX_LSR_REG);
-		if (!(lsr & SC16IS7XX_LSR_TEMT_BIT))
-			return;
-
-		if (uart_circ_empty(xmit) &&
-		    (port->rs485.delay_rts_after_send > 0))
-			mdelay(port->rs485.delay_rts_after_send);
-	}
-
 	sc16is7xx_port_update(port, SC16IS7XX_IER_REG,
 			      SC16IS7XX_IER_THRI_BIT,
 			      0);
@@ -685,12 +670,6 @@ static void sc16is7xx_start_tx(struct uart_port *port)
 {
 	struct sc16is7xx_one *one = to_sc16is7xx_one(port, port);
 
-	/* handle rs485 */
-	if ((port->rs485.flags & SER_RS485_ENABLED) &&
-	    (port->rs485.delay_rts_before_send > 0)) {
-		mdelay(port->rs485.delay_rts_before_send);
-	}
-
 	if (!work_pending(&one->tx_work))
 		schedule_work(&one->tx_work);
 }
@@ -849,6 +828,11 @@ static int sc16is7xx_config_rs485(struct uart_port *port,
 			efcr |= SC16IS7XX_EFCR_RTS_INVERT_BIT;
 		else
 			return -EINVAL;
+
+		/* RTS signal is handled by HW, timing can't be influenced */
+		if (rs485->delay_rts_after_send ||
+		    rs485->delay_rts_before_send)
+			return -EINVAL;
 	}
 
 	sc16is7xx_port_update(port, SC16IS7XX_EFCR_REG, mask, efcr);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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