Skip to contentSkip to conversation

serial: bfin-uart: Enable hardware automatic CTS only when CTS pin is available.

PATCH New Sonic Zhang 1 participant 2 messages Dec 13, 2011 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 serial: bfin-uart: Enable hardware automatic CTS only when CTS pin is available.

From: Sonic Zhang <[email protected]>

---
 drivers/tty/serial/bfin_uart.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
drivers/tty/serial/bfin_uart.c +10 -9
index abac237..dedd9ab 100644
@@ -726,16 +726,17 @@ static int bfin_serial_startup(struct uart_port *port)
 	}
 #endif
 #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
-	if (uart->cts_pin >= 0 && request_irq(uart->status_irq,
-		bfin_serial_mctrl_cts_int,
-		0, "BFIN_UART_MODEM_STATUS", uart)) {
-		uart->cts_pin = -1;
-		pr_info("Unable to attach BlackFin UART Modem Status interrupt.\n");
-	}
+	if (uart->cts_pin >= 0) {
+		if (request_irq(uart->status_irq, bfin_serial_mctrl_cts_int,
+			IRQF_DISABLED, "BFIN_UART_MODEM_STATUS", uart)) {
+			uart->cts_pin = -1;
+			dev_info(port->dev, "Unable to attach BlackFin UART Modem Status interrupt.\n");
+		}
 
-	/* CTS RTS PINs are negative assertive. */
-	UART_PUT_MCR(uart, ACTS);
-	UART_SET_IER(uart, EDSSI);
+		/* CTS RTS PINs are negative assertive. */
+		UART_PUT_MCR(uart, ACTS);
+		UART_SET_IER(uart, EDSSI);
+	}
 #endif
 
 	UART_SET_IER(uart, ERBFI);
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v3 2/2 serial: bfin-uart: Remove ASYNC_CTS_FLOW flag for hardware automatic CTS.

From: Sonic Zhang <[email protected]>

Blackfin uart supports automatic CTS trigger when hardware flow control is enabled. No need to start and top tx in CTS interrupt. So, remote ASYNC_CTS_FLOW flag.

---
 drivers/tty/serial/bfin_uart.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)
drivers/tty/serial/bfin_uart.c +14 -3
index dedd9ab..26953bf 100644
@@ -116,11 +116,20 @@ static void bfin_serial_set_mctrl(struct uart_port *port, unsigned int mctrl)
 static irqreturn_t bfin_serial_mctrl_cts_int(int irq, void *dev_id)
 {
 	struct bfin_serial_port *uart = dev_id;
-	unsigned int status;
-
-	status = bfin_serial_get_mctrl(&uart->port);
+	unsigned int status = bfin_serial_get_mctrl(&uart->port);
 #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
+	struct tty_struct *tty = uart->port.state->port.tty;
+
 	UART_CLEAR_SCTS(uart);
+	if (tty->hw_stopped) {
+		if (status) {
+			tty->hw_stopped = 0;
+			uart_write_wakeup(&uart->port);
+		}
+	} else {
+		if (!status)
+			tty->hw_stopped = 1;
+	}
 #endif
 	uart_handle_cts_change(&uart->port, status & TIOCM_CTS);
 
@@ -1358,7 +1367,9 @@ static int bfin_serial_probe(struct platform_device *pdev)
 			uart->cts_pin = -1;
 		else {
 			uart->cts_pin = res->start;
+#ifdef CONFIG_SERIAL_BFIN_CTSRTS
 			uart->port.flags |= ASYNC_CTS_FLOW;
+#endif
 		}
 
 		res = platform_get_resource(pdev, IORESOURCE_IO, 1);
Signature · 1 line
1.7.0.4