linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2 v2] serial: bfin-uart: Enable hardware automatic CTS only when CTS pin is available.
@ 2011-12-12  6:59 Sonic Zhang
  2011-12-12  6:59 ` [PATCH 2/2 v2] serial: bfin-uart: Remove ASYNC_CTS_FLOW flag for hardware automatic CTS Sonic Zhang
  2011-12-13  0:03 ` [PATCH 1/2 v2] serial: bfin-uart: Enable hardware automatic CTS only when CTS pin is available Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Sonic Zhang @ 2011-12-12  6:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-serial; +Cc: LKML, uclinux-dist-devel, Sonic Zhang

From: Sonic Zhang <sonic.zhang@analog.com>

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
---
 drivers/tty/serial/bfin_uart.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c
index abac237..a6c1c08 100644
--- a/drivers/tty/serial/bfin_uart.c
+++ b/drivers/tty/serial/bfin_uart.c
@@ -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;
+			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);
-- 
1.7.0.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2 v2] serial: bfin-uart: Remove ASYNC_CTS_FLOW flag for hardware automatic CTS.
  2011-12-12  6:59 [PATCH 1/2 v2] serial: bfin-uart: Enable hardware automatic CTS only when CTS pin is available Sonic Zhang
@ 2011-12-12  6:59 ` Sonic Zhang
  2011-12-13  0:03 ` [PATCH 1/2 v2] serial: bfin-uart: Enable hardware automatic CTS only when CTS pin is available Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Sonic Zhang @ 2011-12-12  6:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-serial; +Cc: LKML, uclinux-dist-devel, Sonic Zhang

From: Sonic Zhang <sonic.zhang@analog.com>

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.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
---
 drivers/tty/serial/bfin_uart.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c
index a6c1c08..6bb3698 100644
--- a/drivers/tty/serial/bfin_uart.c
+++ b/drivers/tty/serial/bfin_uart.c
@@ -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);
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2 v2] serial: bfin-uart: Enable hardware automatic CTS only when CTS pin is available.
  2011-12-12  6:59 [PATCH 1/2 v2] serial: bfin-uart: Enable hardware automatic CTS only when CTS pin is available Sonic Zhang
  2011-12-12  6:59 ` [PATCH 2/2 v2] serial: bfin-uart: Remove ASYNC_CTS_FLOW flag for hardware automatic CTS Sonic Zhang
@ 2011-12-13  0:03 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2011-12-13  0:03 UTC (permalink / raw)
  To: Sonic Zhang
  Cc: Greg Kroah-Hartman, linux-serial, LKML, uclinux-dist-devel,
	Sonic Zhang

On Mon, Dec 12, 2011 at 02:59:50PM +0800, Sonic Zhang wrote:
> From: Sonic Zhang <sonic.zhang@analog.com>
> 
> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
> ---
>  drivers/tty/serial/bfin_uart.c |   19 ++++++++++---------
>  1 files changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c
> index abac237..a6c1c08 100644
> --- a/drivers/tty/serial/bfin_uart.c
> +++ b/drivers/tty/serial/bfin_uart.c
> @@ -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;
> +			pr_info("Unable to attach BlackFin UART Modem Status interrupt.\n");

Please use dev_info() here instead, that properly identifies the exact
device you are having problems with.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-13  0:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-12  6:59 [PATCH 1/2 v2] serial: bfin-uart: Enable hardware automatic CTS only when CTS pin is available Sonic Zhang
2011-12-12  6:59 ` [PATCH 2/2 v2] serial: bfin-uart: Remove ASYNC_CTS_FLOW flag for hardware automatic CTS Sonic Zhang
2011-12-13  0:03 ` [PATCH 1/2 v2] serial: bfin-uart: Enable hardware automatic CTS only when CTS pin is available Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).