public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] serial: bfin-uart: Enable hardware automatic CTS only when CTS pin is available.
@ 2011-12-09  6:00 Sonic Zhang
  2011-12-09  6:00 ` [PATCH 2/2] serial: bfin-uart: Remove ASYNC_CTS_FLOW flag for hardware automatic CTS Sonic Zhang
  2011-12-10  3:09 ` [PATCH 1/2] serial: bfin-uart: Enable hardware automatic CTS only when CTS pin is available Greg KH
  0 siblings, 2 replies; 6+ messages in thread
From: Sonic Zhang @ 2011-12-09  6:00 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 21bfa9a..57747c4 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,
-		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);
-- 
1.7.0.4



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

* [PATCH 2/2] serial: bfin-uart: Remove ASYNC_CTS_FLOW flag for hardware automatic CTS.
  2011-12-09  6:00 [PATCH 1/2] serial: bfin-uart: Enable hardware automatic CTS only when CTS pin is available Sonic Zhang
@ 2011-12-09  6:00 ` Sonic Zhang
  2011-12-09 11:12   ` Alan Cox
  2011-12-10  3:09 ` [PATCH 1/2] serial: bfin-uart: Enable hardware automatic CTS only when CTS pin is available Greg KH
  1 sibling, 1 reply; 6+ messages in thread
From: Sonic Zhang @ 2011-12-09  6:00 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 57747c4..929dd11 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] 6+ messages in thread

* Re: [PATCH 2/2] serial: bfin-uart: Remove ASYNC_CTS_FLOW flag for hardware automatic CTS.
  2011-12-09  6:00 ` [PATCH 2/2] serial: bfin-uart: Remove ASYNC_CTS_FLOW flag for hardware automatic CTS Sonic Zhang
@ 2011-12-09 11:12   ` Alan Cox
  2011-12-09 17:17     ` [uclinux-dist-devel] " Mike Frysinger
  2011-12-12  5:20     ` Sonic Zhang
  0 siblings, 2 replies; 6+ messages in thread
From: Alan Cox @ 2011-12-09 11:12 UTC (permalink / raw)
  To: Sonic Zhang
  Cc: Greg Kroah-Hartman, linux-serial, LKML, uclinux-dist-devel,
	Sonic Zhang

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

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

* Re: [uclinux-dist-devel] [PATCH 2/2] serial: bfin-uart: Remove ASYNC_CTS_FLOW flag for hardware automatic CTS.
  2011-12-09 11:12   ` Alan Cox
@ 2011-12-09 17:17     ` Mike Frysinger
  2011-12-12  5:20     ` Sonic Zhang
  1 sibling, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2011-12-09 17:17 UTC (permalink / raw)
  To: uclinux-dist-devel
  Cc: Alan Cox, Sonic Zhang, Greg Kroah-Hartman, LKML, linux-serial

[-- Attachment #1: Type: Text/Plain, Size: 406 bytes --]

On Friday 09 December 2011 06:12:05 Alan Cox wrote:
> > +#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

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

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

On Fri, Dec 09, 2011 at 02:00:20PM +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(-)

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

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

* Re: [PATCH 2/2] serial: bfin-uart: Remove ASYNC_CTS_FLOW flag for hardware automatic CTS.
  2011-12-09 11:12   ` Alan Cox
  2011-12-09 17:17     ` [uclinux-dist-devel] " Mike Frysinger
@ 2011-12-12  5:20     ` Sonic Zhang
  1 sibling, 0 replies; 6+ messages in thread
From: Sonic Zhang @ 2011-12-12  5:20 UTC (permalink / raw)
  To: Alan Cox
  Cc: Greg Kroah-Hartman, linux-serial, LKML, uclinux-dist-devel,
	Sonic Zhang

Hi Alan,


On Fri, Dec 9, 2011 at 7:12 PM, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
>> +#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

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

end of thread, other threads:[~2011-12-12  5:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-09  6:00 [PATCH 1/2] serial: bfin-uart: Enable hardware automatic CTS only when CTS pin is available Sonic Zhang
2011-12-09  6:00 ` [PATCH 2/2] serial: bfin-uart: Remove ASYNC_CTS_FLOW flag for hardware automatic CTS Sonic Zhang
2011-12-09 11:12   ` Alan Cox
2011-12-09 17:17     ` [uclinux-dist-devel] " Mike Frysinger
2011-12-12  5:20     ` Sonic Zhang
2011-12-10  3:09 ` [PATCH 1/2] 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