Skip to contentSkip to conversation

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

PATCH Superseded Sonic Zhang 4 participants 6 messages Dec 9, 2011 – Dec 12, 2011 TTY layer and serial drivers

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 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 21bfa9a..57747c4 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,
-		IRQF_DISABLED, "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;
+			pr_info("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 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 57747c4..929dd11 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
#2 lore raw

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

drivers/tty/serial/bfin_uart.c static int bfin_serial_probe(struct platform_device *pdev) · line 1372

Quoted 3 lines
drivers/tty/serial/bfin_uart.c +2 -0
+#ifdef CONFIG_SERIAL_BFIN_CTSRTS
 			uart->port.flags |= ASYNC_CTS_FLOW;
+#endif

As an aside could the cts/hard cts etc be passed as properties to the platform device rather than ifdeffed ?

Alan

#3 lore raw

Re: [uclinux-dist-devel] [PATCH 2/2] serial: bfin-uart: Remove ASYNC_CTS_FLOW flag for hardware automatic CTS.

Quoted 8 lines · On Friday 09 December 2011 06:12:05 Alan Cox wrote:

drivers/tty/serial/bfin_uart.c static int bfin_serial_probe(struct platform_device *pdev)

Quoted 5 lines
drivers/tty/serial/bfin_uart.c +2 -0
+#ifdef CONFIG_SERIAL_BFIN_CTSRTS
 
 			uart->port.flags |= ASYNC_CTS_FLOW;
 
+#endif

As an aside could the cts/hard cts etc be passed as properties to the platform device rather than ifdeffed ?

most platforms don't bother with flow control, so we made support in the driver optional to keep things smaller.
-mike

#5 lore raw
In reply to Sonic Zhang
Quoted 6 lines · Sonic Zhang

From: Sonic Zhang <[email protected]>

---
 drivers/tty/serial/bfin_uart.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

This patch does not apply on top of your other patches:

patching file drivers/tty/serial/bfin_uart.c
Hunk #1 FAILED at 726.
1 out of 1 hunk FAILED -- saving rejects to file drivers/tty/serial/bfin_uart.c.rej

Care to redo it on top of the next linux-next tree and resend both of these in the series?

thanks,

greg k-h

#4 lore raw

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

In reply to Alan Cox

Hi Alan,

Quoted 8 lines · Alan Cox
Quoted 3 lines

+#ifdef CONFIG_SERIAL_BFIN_CTSRTS uart->port.flags |= ASYNC_CTS_FLOW; +#endif

As an aside could the cts/hard cts etc be passed as properties to the platform device rather than ifdeffed ?

Alan

As Mike mentioned, these Macros are used to keep the code smaller when user doesn't want to enable UART flow control feature.

I will sent out V2 against the latest kernel next tree.

Sonic