[PATCH] sc16is7xx: implemented get_mctrl / set_mctrl

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

 



Add support for manual setting and getting the modem control lines.
Also fixed MSR bit definitions.
And use BIT() macro.

Signed-off-by: Maarten Brock <m.brock@xxxxxxxxxxxxx>
---
 drivers/tty/serial/sc16is7xx.c | 343 +++++++++++++++++++++--------------------
 1 file changed, 179 insertions(+), 164 deletions(-)

diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index edb5305..5a64186 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -76,72 +76,72 @@
 #define SC16IS7XX_XOFF2_REG		(0x07) /* Xoff2 word */
 
 /* IER register bits */
-#define SC16IS7XX_IER_RDI_BIT		(1 << 0) /* Enable RX data interrupt */
-#define SC16IS7XX_IER_THRI_BIT		(1 << 1) /* Enable TX holding register
-						  * interrupt */
-#define SC16IS7XX_IER_RLSI_BIT		(1 << 2) /* Enable RX line status
-						  * interrupt */
-#define SC16IS7XX_IER_MSI_BIT		(1 << 3) /* Enable Modem status
-						  * interrupt */
+#define SC16IS7XX_IER_RDI_BIT		BIT(0) /* Enable RX data interrupt */
+#define SC16IS7XX_IER_THRI_BIT		BIT(1) /* Enable TX holding register
+						* interrupt */
+#define SC16IS7XX_IER_RLSI_BIT		BIT(2) /* Enable RX line status
+						* interrupt */
+#define SC16IS7XX_IER_MSI_BIT		BIT(3) /* Enable Modem status
+						* interrupt */
 
 /* IER register bits - write only if (EFR[4] == 1) */
-#define SC16IS7XX_IER_SLEEP_BIT		(1 << 4) /* Enable Sleep mode */
-#define SC16IS7XX_IER_XOFFI_BIT		(1 << 5) /* Enable Xoff interrupt */
-#define SC16IS7XX_IER_RTSI_BIT		(1 << 6) /* Enable nRTS interrupt */
-#define SC16IS7XX_IER_CTSI_BIT		(1 << 7) /* Enable nCTS interrupt */
+#define SC16IS7XX_IER_SLEEP_BIT		BIT(4) /* Enable Sleep mode */
+#define SC16IS7XX_IER_XOFFI_BIT		BIT(5) /* Enable Xoff interrupt */
+#define SC16IS7XX_IER_RTSI_BIT		BIT(6) /* Enable nRTS interrupt */
+#define SC16IS7XX_IER_CTSI_BIT		BIT(7) /* Enable nCTS interrupt */
 
 /* FCR register bits */
-#define SC16IS7XX_FCR_FIFO_BIT		(1 << 0) /* Enable FIFO */
-#define SC16IS7XX_FCR_RXRESET_BIT	(1 << 1) /* Reset RX FIFO */
-#define SC16IS7XX_FCR_TXRESET_BIT	(1 << 2) /* Reset TX FIFO */
-#define SC16IS7XX_FCR_RXLVLL_BIT	(1 << 6) /* RX Trigger level LSB */
-#define SC16IS7XX_FCR_RXLVLH_BIT	(1 << 7) /* RX Trigger level MSB */
+#define SC16IS7XX_FCR_FIFO_BIT		BIT(0) /* Enable FIFO */
+#define SC16IS7XX_FCR_RXRESET_BIT	BIT(1) /* Reset RX FIFO */
+#define SC16IS7XX_FCR_TXRESET_BIT	BIT(2) /* Reset TX FIFO */
+#define SC16IS7XX_FCR_RXLVLL_BIT	BIT(6) /* RX Trigger level LSB */
+#define SC16IS7XX_FCR_RXLVLH_BIT	BIT(7) /* RX Trigger level MSB */
 
 /* FCR register bits - write only if (EFR[4] == 1) */
-#define SC16IS7XX_FCR_TXLVLL_BIT	(1 << 4) /* TX Trigger level LSB */
-#define SC16IS7XX_FCR_TXLVLH_BIT	(1 << 5) /* TX Trigger level MSB */
+#define SC16IS7XX_FCR_TXLVLL_BIT	BIT(4) /* TX Trigger level LSB */
+#define SC16IS7XX_FCR_TXLVLH_BIT	BIT(5) /* TX Trigger level MSB */
 
 /* IIR register bits */
-#define SC16IS7XX_IIR_NO_INT_BIT	(1 << 0) /* No interrupts pending */
-#define SC16IS7XX_IIR_ID_MASK		0x3e     /* Mask for the interrupt ID */
-#define SC16IS7XX_IIR_THRI_SRC		0x02     /* TX holding register empty */
-#define SC16IS7XX_IIR_RDI_SRC		0x04     /* RX data interrupt */
-#define SC16IS7XX_IIR_RLSE_SRC		0x06     /* RX line status error */
-#define SC16IS7XX_IIR_RTOI_SRC		0x0c     /* RX time-out interrupt */
-#define SC16IS7XX_IIR_MSI_SRC		0x00     /* Modem status interrupt
-						  * - only on 75x/76x
-						  */
-#define SC16IS7XX_IIR_INPIN_SRC		0x30     /* Input pin change of state
-						  * - only on 75x/76x
-						  */
-#define SC16IS7XX_IIR_XOFFI_SRC		0x10     /* Received Xoff */
-#define SC16IS7XX_IIR_CTSRTS_SRC	0x20     /* nCTS,nRTS change of state
-						  * from active (LOW)
-						  * to inactive (HIGH)
-						  */
+#define SC16IS7XX_IIR_NO_INT_BIT	BIT(0) /* No interrupts pending */
+#define SC16IS7XX_IIR_ID_MASK		0x3e   /* Mask for the interrupt ID */
+#define SC16IS7XX_IIR_THRI_SRC		0x02   /* TX holding register empty */
+#define SC16IS7XX_IIR_RDI_SRC		0x04   /* RX data interrupt */
+#define SC16IS7XX_IIR_RLSE_SRC		0x06   /* RX line status error */
+#define SC16IS7XX_IIR_RTOI_SRC		0x0c   /* RX time-out interrupt */
+#define SC16IS7XX_IIR_MSI_SRC		0x00   /* Modem status interrupt
+						* - only on 75x/76x
+						*/
+#define SC16IS7XX_IIR_INPIN_SRC		0x30   /* Input pin change of state
+						* - only on 75x/76x
+						*/
+#define SC16IS7XX_IIR_XOFFI_SRC		0x10   /* Received Xoff */
+#define SC16IS7XX_IIR_CTSRTS_SRC	0x20   /* nCTS,nRTS change of state
+						* from active (LOW)
+						* to inactive (HIGH)
+						*/
 /* LCR register bits */
-#define SC16IS7XX_LCR_LENGTH0_BIT	(1 << 0) /* Word length bit 0 */
-#define SC16IS7XX_LCR_LENGTH1_BIT	(1 << 1) /* Word length bit 1
-						  *
-						  * Word length bits table:
-						  * 00 -> 5 bit words
-						  * 01 -> 6 bit words
-						  * 10 -> 7 bit words
-						  * 11 -> 8 bit words
-						  */
-#define SC16IS7XX_LCR_STOPLEN_BIT	(1 << 2) /* STOP length bit
-						  *
-						  * STOP length bit table:
-						  * 0 -> 1 stop bit
-						  * 1 -> 1-1.5 stop bits if
-						  *      word length is 5,
-						  *      2 stop bits otherwise
-						  */
-#define SC16IS7XX_LCR_PARITY_BIT	(1 << 3) /* Parity bit enable */
-#define SC16IS7XX_LCR_EVENPARITY_BIT	(1 << 4) /* Even parity bit enable */
-#define SC16IS7XX_LCR_FORCEPARITY_BIT	(1 << 5) /* 9-bit multidrop parity */
-#define SC16IS7XX_LCR_TXBREAK_BIT	(1 << 6) /* TX break enable */
-#define SC16IS7XX_LCR_DLAB_BIT		(1 << 7) /* Divisor Latch enable */
+#define SC16IS7XX_LCR_LENGTH0_BIT	BIT(0) /* Word length bit 0 */
+#define SC16IS7XX_LCR_LENGTH1_BIT	BIT(1) /* Word length bit 1
+						*
+						* Word length bits table:
+						* 00 -> 5 bit words
+						* 01 -> 6 bit words
+						* 10 -> 7 bit words
+						* 11 -> 8 bit words
+						*/
+#define SC16IS7XX_LCR_STOPLEN_BIT	BIT(2) /* STOP length bit
+						*
+						* STOP length bit table:
+						* 0 -> 1 stop bit
+						* 1 -> 1-1.5 stop bits if
+						*      word length is 5,
+						*      2 stop bits otherwise
+						*/
+#define SC16IS7XX_LCR_PARITY_BIT	BIT(3) /* Parity bit enable */
+#define SC16IS7XX_LCR_EVENPARITY_BIT	BIT(4) /* Even parity bit enable */
+#define SC16IS7XX_LCR_FORCEPARITY_BIT	BIT(5) /* 9-bit multidrop parity */
+#define SC16IS7XX_LCR_TXBREAK_BIT	BIT(6) /* TX break enable */
+#define SC16IS7XX_LCR_DLAB_BIT		BIT(7) /* Divisor Latch enable */
 #define SC16IS7XX_LCR_WORD_LEN_5	(0x00)
 #define SC16IS7XX_LCR_WORD_LEN_6	(0x01)
 #define SC16IS7XX_LCR_WORD_LEN_7	(0x02)
@@ -152,60 +152,60 @@
 								* reg set */
 
 /* MCR register bits */
-#define SC16IS7XX_MCR_DTR_BIT		(1 << 0) /* DTR complement
-						  * - only on 75x/76x
-						  */
-#define SC16IS7XX_MCR_RTS_BIT		(1 << 1) /* RTS complement */
-#define SC16IS7XX_MCR_TCRTLR_BIT	(1 << 2) /* TCR/TLR register enable */
-#define SC16IS7XX_MCR_LOOP_BIT		(1 << 4) /* Enable loopback test mode */
-#define SC16IS7XX_MCR_XONANY_BIT	(1 << 5) /* Enable Xon Any
-						  * - write enabled
-						  * if (EFR[4] == 1)
-						  */
-#define SC16IS7XX_MCR_IRDA_BIT		(1 << 6) /* Enable IrDA mode
-						  * - write enabled
-						  * if (EFR[4] == 1)
-						  */
-#define SC16IS7XX_MCR_CLKSEL_BIT	(1 << 7) /* Divide clock by 4
-						  * - write enabled
-						  * if (EFR[4] == 1)
-						  */
+#define SC16IS7XX_MCR_DTR_BIT		BIT(0) /* DTR complement
+						* - only on 75x/76x
+						*/
+#define SC16IS7XX_MCR_RTS_BIT		BIT(1) /* RTS complement */
+#define SC16IS7XX_MCR_TCRTLR_BIT	BIT(2) /* TCR/TLR register enable */
+#define SC16IS7XX_MCR_LOOP_BIT		BIT(4) /* Enable loopback test mode */
+#define SC16IS7XX_MCR_XONANY_BIT	BIT(5) /* Enable Xon Any
+						* - write enabled
+						* if (EFR[4] == 1)
+						*/
+#define SC16IS7XX_MCR_IRDA_BIT		BIT(6) /* Enable IrDA mode
+						* - write enabled
+						* if (EFR[4] == 1)
+						*/
+#define SC16IS7XX_MCR_CLKSEL_BIT	BIT(7) /* Divide clock by 4
+						* - write enabled
+						* if (EFR[4] == 1)
+						*/
 
 /* LSR register bits */
-#define SC16IS7XX_LSR_DR_BIT		(1 << 0) /* Receiver data ready */
-#define SC16IS7XX_LSR_OE_BIT		(1 << 1) /* Overrun Error */
-#define SC16IS7XX_LSR_PE_BIT		(1 << 2) /* Parity Error */
-#define SC16IS7XX_LSR_FE_BIT		(1 << 3) /* Frame Error */
-#define SC16IS7XX_LSR_BI_BIT		(1 << 4) /* Break Interrupt */
-#define SC16IS7XX_LSR_BRK_ERROR_MASK	0x1E     /* BI, FE, PE, OE bits */
-#define SC16IS7XX_LSR_THRE_BIT		(1 << 5) /* TX holding register empty */
-#define SC16IS7XX_LSR_TEMT_BIT		(1 << 6) /* Transmitter empty */
-#define SC16IS7XX_LSR_FIFOE_BIT		(1 << 7) /* Fifo Error */
+#define SC16IS7XX_LSR_DR_BIT		BIT(0) /* Receiver data ready */
+#define SC16IS7XX_LSR_OE_BIT		BIT(1) /* Overrun Error */
+#define SC16IS7XX_LSR_PE_BIT		BIT(2) /* Parity Error */
+#define SC16IS7XX_LSR_FE_BIT		BIT(3) /* Frame Error */
+#define SC16IS7XX_LSR_BI_BIT		BIT(4) /* Break Interrupt */
+#define SC16IS7XX_LSR_BRK_ERROR_MASK	0x1E   /* BI, FE, PE, OE bits */
+#define SC16IS7XX_LSR_THRE_BIT		BIT(5) /* TX holding register empty */
+#define SC16IS7XX_LSR_TEMT_BIT		BIT(6) /* Transmitter empty */
+#define SC16IS7XX_LSR_FIFOE_BIT		BIT(7) /* Fifo Error */
 
 /* MSR register bits */
-#define SC16IS7XX_MSR_DCTS_BIT		(1 << 0) /* Delta CTS Clear To Send */
-#define SC16IS7XX_MSR_DDSR_BIT		(1 << 1) /* Delta DSR Data Set Ready
-						  * or (IO4)
-						  * - only on 75x/76x
-						  */
-#define SC16IS7XX_MSR_DRI_BIT		(1 << 2) /* Delta RI Ring Indicator
-						  * or (IO7)
-						  * - only on 75x/76x
-						  */
-#define SC16IS7XX_MSR_DCD_BIT		(1 << 3) /* Delta CD Carrier Detect
-						  * or (IO6)
-						  * - only on 75x/76x
-						  */
-#define SC16IS7XX_MSR_CTS_BIT		(1 << 0) /* CTS */
-#define SC16IS7XX_MSR_DSR_BIT		(1 << 1) /* DSR (IO4)
-						  * - only on 75x/76x
-						  */
-#define SC16IS7XX_MSR_RI_BIT		(1 << 2) /* RI (IO7)
-						  * - only on 75x/76x
-						  */
-#define SC16IS7XX_MSR_CD_BIT		(1 << 3) /* CD (IO6)
-						  * - only on 75x/76x
-						  */
+#define SC16IS7XX_MSR_DCTS_BIT		BIT(0) /* Delta CTS Clear To Send */
+#define SC16IS7XX_MSR_DDSR_BIT		BIT(1) /* Delta DSR Data Set Ready
+						* or (IO4)
+						* - only on 75x/76x
+						*/
+#define SC16IS7XX_MSR_DRI_BIT		BIT(2) /* Delta RI Ring Indicator
+						* or (IO7)
+						* - only on 75x/76x
+						*/
+#define SC16IS7XX_MSR_DCD_BIT		BIT(3) /* Delta CD Carrier Detect
+						* or (IO6)
+						* - only on 75x/76x
+						*/
+#define SC16IS7XX_MSR_CTS_BIT		BIT(4) /* CTS */
+#define SC16IS7XX_MSR_DSR_BIT		BIT(5) /* DSR (IO4)
+						* - only on 75x/76x
+						*/
+#define SC16IS7XX_MSR_RI_BIT		BIT(6) /* RI (IO7)
+						* - only on 75x/76x
+						*/
+#define SC16IS7XX_MSR_CD_BIT		BIT(7) /* CD (IO6)
+						* - only on 75x/76x
+						*/
 #define SC16IS7XX_MSR_DELTA_MASK	0x0F     /* Any of the delta bits! */
 
 /*
@@ -239,60 +239,60 @@
 #define SC16IS7XX_TLR_RX_TRIGGER(words)	((((words) / 4) & 0x0f) << 4)
 
 /* IOControl register bits (Only 750/760) */
-#define SC16IS7XX_IOCONTROL_LATCH_BIT	(1 << 0) /* Enable input latching */
-#define SC16IS7XX_IOCONTROL_GPIO_BIT	(1 << 1) /* Enable GPIO[7:4] */
-#define SC16IS7XX_IOCONTROL_SRESET_BIT	(1 << 3) /* Software Reset */
+#define SC16IS7XX_IOCONTROL_LATCH_BIT	BIT(0) /* Enable input latching */
+#define SC16IS7XX_IOCONTROL_GPIO_BIT	BIT(1) /* Enable GPIO[7:4] */
+#define SC16IS7XX_IOCONTROL_SRESET_BIT	BIT(3) /* Software Reset */
 
 /* EFCR register bits */
-#define SC16IS7XX_EFCR_9BIT_MODE_BIT	(1 << 0) /* Enable 9-bit or Multidrop
+#define SC16IS7XX_EFCR_9BIT_MODE_BIT	BIT(0) /* Enable 9-bit or Multidrop
 						  * mode (RS485) */
-#define SC16IS7XX_EFCR_RXDISABLE_BIT	(1 << 1) /* Disable receiver */
-#define SC16IS7XX_EFCR_TXDISABLE_BIT	(1 << 2) /* Disable transmitter */
-#define SC16IS7XX_EFCR_AUTO_RS485_BIT	(1 << 4) /* Auto RS485 RTS direction */
-#define SC16IS7XX_EFCR_RTS_INVERT_BIT	(1 << 5) /* RTS output inversion */
-#define SC16IS7XX_EFCR_IRDA_MODE_BIT	(1 << 7) /* IrDA mode
-						  * 0 = rate upto 115.2 kbit/s
-						  *   - Only 750/760
-						  * 1 = rate upto 1.152 Mbit/s
-						  *   - Only 760
-						  */
+#define SC16IS7XX_EFCR_RXDISABLE_BIT	BIT(1) /* Disable receiver */
+#define SC16IS7XX_EFCR_TXDISABLE_BIT	BIT(2) /* Disable transmitter */
+#define SC16IS7XX_EFCR_AUTO_RS485_BIT	BIT(4) /* Auto RS485 RTS direction */
+#define SC16IS7XX_EFCR_RTS_INVERT_BIT	BIT(5) /* RTS output inversion */
+#define SC16IS7XX_EFCR_IRDA_MODE_BIT	BIT(7) /* IrDA mode
+						* 0 = rate upto 115.2 kbit/s
+						*   - Only 750/760
+						* 1 = rate upto 1.152 Mbit/s
+						*   - Only 760
+						*/
 
 /* EFR register bits */
-#define SC16IS7XX_EFR_AUTORTS_BIT	(1 << 6) /* Auto RTS flow ctrl enable */
-#define SC16IS7XX_EFR_AUTOCTS_BIT	(1 << 7) /* Auto CTS flow ctrl enable */
-#define SC16IS7XX_EFR_XOFF2_DETECT_BIT	(1 << 5) /* Enable Xoff2 detection */
-#define SC16IS7XX_EFR_ENABLE_BIT	(1 << 4) /* Enable enhanced functions
-						  * and writing to IER[7:4],
-						  * FCR[5:4], MCR[7:5]
-						  */
-#define SC16IS7XX_EFR_SWFLOW3_BIT	(1 << 3) /* SWFLOW bit 3 */
-#define SC16IS7XX_EFR_SWFLOW2_BIT	(1 << 2) /* SWFLOW bit 2
-						  *
-						  * SWFLOW bits 3 & 2 table:
-						  * 00 -> no transmitter flow
-						  *       control
-						  * 01 -> transmitter generates
-						  *       XON2 and XOFF2
-						  * 10 -> transmitter generates
-						  *       XON1 and XOFF1
-						  * 11 -> transmitter generates
-						  *       XON1, XON2, XOFF1 and
-						  *       XOFF2
-						  */
-#define SC16IS7XX_EFR_SWFLOW1_BIT	(1 << 1) /* SWFLOW bit 2 */
-#define SC16IS7XX_EFR_SWFLOW0_BIT	(1 << 0) /* SWFLOW bit 3
-						  *
-						  * SWFLOW bits 3 & 2 table:
-						  * 00 -> no received flow
-						  *       control
-						  * 01 -> receiver compares
-						  *       XON2 and XOFF2
-						  * 10 -> receiver compares
-						  *       XON1 and XOFF1
-						  * 11 -> receiver compares
-						  *       XON1, XON2, XOFF1 and
-						  *       XOFF2
-						  */
+#define SC16IS7XX_EFR_AUTORTS_BIT	BIT(6) /* Auto RTS flow ctrl enable */
+#define SC16IS7XX_EFR_AUTOCTS_BIT	BIT(7) /* Auto CTS flow ctrl enable */
+#define SC16IS7XX_EFR_XOFF2_DETECT_BIT	BIT(5) /* Enable Xoff2 detection */
+#define SC16IS7XX_EFR_ENABLE_BIT	BIT(4) /* Enable enhanced functions
+						* and writing to IER[7:4],
+						* FCR[5:4], MCR[7:5]
+						*/
+#define SC16IS7XX_EFR_SWFLOW3_BIT	BIT(3) /* SWFLOW bit 3 */
+#define SC16IS7XX_EFR_SWFLOW2_BIT	BIT(2) /* SWFLOW bit 2
+						*
+						* SWFLOW bits 3 & 2 table:
+						* 00 -> no transmitter flow
+						*       control
+						* 01 -> transmitter generates
+						*       XON2 and XOFF2
+						* 10 -> transmitter generates
+						*       XON1 and XOFF1
+						* 11 -> transmitter generates
+						*       XON1, XON2, XOFF1 and
+						*       XOFF2
+						*/
+#define SC16IS7XX_EFR_SWFLOW1_BIT	BIT(1) /* SWFLOW bit 2 */
+#define SC16IS7XX_EFR_SWFLOW0_BIT	BIT(0) /* SWFLOW bit 3
+						*
+						* SWFLOW bits 3 & 2 table:
+						* 00 -> no received flow
+						*       control
+						* 01 -> receiver compares
+						*       XON2 and XOFF2
+						* 10 -> receiver compares
+						*       XON1 and XOFF1
+						* 11 -> receiver compares
+						*       XON1, XON2, XOFF1 and
+						*       XOFF2
+						*/
 
 /* Misc definitions */
 #define SC16IS7XX_FIFO_SIZE		(64)
@@ -304,9 +304,9 @@ struct sc16is7xx_devtype {
 	int	nr_uart;
 };
 
-#define SC16IS7XX_RECONF_MD		(1 << 0)
-#define SC16IS7XX_RECONF_IER		(1 << 1)
-#define SC16IS7XX_RECONF_RS485		(1 << 2)
+#define SC16IS7XX_RECONF_MD		BIT(0)
+#define SC16IS7XX_RECONF_IER		BIT(1)
+#define SC16IS7XX_RECONF_RS485		BIT(2)
 
 struct sc16is7xx_one_config {
 	unsigned int			flags;
@@ -748,11 +748,20 @@ static void sc16is7xx_reg_proc(struct kthread_work *ws)
 	memset(&one->config, 0, sizeof(one->config));
 	spin_unlock_irqrestore(&one->port.lock, irqflags);
 
-	if (config.flags & SC16IS7XX_RECONF_MD)
+	if (config.flags & SC16IS7XX_RECONF_MD) {
 		sc16is7xx_port_update(&one->port, SC16IS7XX_MCR_REG,
 				      SC16IS7XX_MCR_LOOP_BIT,
 				      (one->port.mctrl & TIOCM_LOOP) ?
 				      SC16IS7XX_MCR_LOOP_BIT : 0);
+		sc16is7xx_port_update(&one->port, SC16IS7XX_MCR_REG,
+				      SC16IS7XX_MCR_RTS_BIT,
+				      (one->port.mctrl & TIOCM_RTS) ?
+				      SC16IS7XX_MCR_RTS_BIT : 0);
+		sc16is7xx_port_update(&one->port, SC16IS7XX_MCR_REG,
+				      SC16IS7XX_MCR_DTR_BIT,
+				      (one->port.mctrl & TIOCM_DTR) ?
+				      SC16IS7XX_MCR_DTR_BIT : 0);
+	}
 
 	if (config.flags & SC16IS7XX_RECONF_IER)
 		sc16is7xx_port_update(&one->port, SC16IS7XX_IER_REG,
@@ -801,10 +810,16 @@ static unsigned int sc16is7xx_tx_empty(struct uart_port *port)
 
 static unsigned int sc16is7xx_get_mctrl(struct uart_port *port)
 {
-	/* DCD and DSR are not wired and CTS/RTS is handled automatically
-	 * so just indicate DSR and CAR asserted
-	 */
-	return TIOCM_DSR | TIOCM_CAR;
+	unsigned int msr;
+	unsigned int ret = 0;
+
+	msr = sc16is7xx_port_read(port, SC16IS7XX_MSR_REG);
+
+	ret |= (msr & SC16IS7XX_MSR_CTS_BIT) ? TIOCM_CTS : 0;
+	ret |= (msr & SC16IS7XX_MSR_DSR_BIT) ? TIOCM_DSR : 0;
+	ret |= (msr & SC16IS7XX_MSR_RI_BIT)  ? TIOCM_RNG : 0;
+	ret |= (msr & SC16IS7XX_MSR_CD_BIT)  ? TIOCM_CAR : 0;
+	return ret;
 }
 
 static void sc16is7xx_set_mctrl(struct uart_port *port, unsigned int mctrl)
-- 
1.8.3.1

--
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