linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] tty: bfin-sport-uart: Rx interrupt is not called always with irq disabled.
@ 2011-12-06  7:16 Sonic Zhang
  2011-12-06  7:16 ` [PATCH 2/2] serial: bfin-sport-uart: Request CTS GPIO PIN when the sport emulated serial device starts up Sonic Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: Sonic Zhang @ 2011-12-06  7:16 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-serial; +Cc: LKML, uclinux-dist-devel, Sonic Zhang

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

Replace local_irq_disable by local_irq_save.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
---
 drivers/tty/serial/bfin_sport_uart.h |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/bfin_sport_uart.h b/drivers/tty/serial/bfin_sport_uart.h
index 6d06ce1..e4510ea 100644
--- a/drivers/tty/serial/bfin_sport_uart.h
+++ b/drivers/tty/serial/bfin_sport_uart.h
@@ -45,11 +45,12 @@
 #define SPORT_GET_RX32(sport) \
 ({ \
 	unsigned int __ret; \
+	unsigned long flags; \
 	if (ANOMALY_05000473) \
-		local_irq_disable(); \
+		local_irq_save(flags); \
 	__ret = bfin_read32((sport)->port.membase + OFFSET_RX); \
 	if (ANOMALY_05000473) \
-		local_irq_enable(); \
+		local_irq_restore(flags); \
 	__ret; \
 })
 #define SPORT_GET_RCR1(sport)		bfin_read16(((sport)->port.membase + OFFSET_RCR1))
-- 
1.7.0.4



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

* [PATCH 2/2] serial: bfin-sport-uart: Request CTS GPIO PIN when the sport emulated serial device starts up.
  2011-12-06  7:16 [PATCH 1/2] tty: bfin-sport-uart: Rx interrupt is not called always with irq disabled Sonic Zhang
@ 2011-12-06  7:16 ` Sonic Zhang
  2011-12-06 11:36   ` Alan Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Sonic Zhang @ 2011-12-06  7:16 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-serial; +Cc: LKML, uclinux-dist-devel, Sonic Zhang

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

This patch is similar to that for bfin-uart hardware flow control.
Sport emulated serial device may be probed earlier before GPIOLIB is initialized.
Requesting and configuring CTS GPIO PIN fails in that early stage.

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

diff --git a/drivers/tty/serial/bfin_sport_uart.c b/drivers/tty/serial/bfin_sport_uart.c
index ee101c0..f650526 100644
--- a/drivers/tty/serial/bfin_sport_uart.c
+++ b/drivers/tty/serial/bfin_sport_uart.c
@@ -299,8 +299,13 @@ static int sport_startup(struct uart_port *port)
 			dev_info(port->dev, "Unable to attach BlackFin UART over SPORT CTS interrupt. So, disable it.\n");
 		}
 	}
-	if (up->rts_pin >= 0)
-		gpio_direction_output(up->rts_pin, 0);
+	if (up->rts_pin >= 0) {
+		if (gpio_request(up->rts_pin, DRV_NAME)) {
+			dev_info(port->dev, "fail to request RTS PIN at GPIO_%d\n", up->rts_pin);
+			up->rts_pin = -1;
+		} else
+			gpio_direction_output(up->rts_pin, 0);
+	}
 #endif
 
 	return 0;
@@ -445,6 +450,8 @@ static void sport_shutdown(struct uart_port *port)
 #ifdef CONFIG_SERIAL_BFIN_SPORT_CTSRTS
 	if (up->cts_pin >= 0)
 		free_irq(gpio_to_irq(up->cts_pin), up);
+	if (up->rts_pin >= 0)
+		gpio_free(up->rts_pin);
 #endif
 }
 
@@ -811,9 +818,6 @@ static int __devinit sport_uart_probe(struct platform_device *pdev)
 			sport->rts_pin = -1;
 		else
 			sport->rts_pin = res->start;
-
-		if (sport->rts_pin >= 0)
-			gpio_request(sport->rts_pin, DRV_NAME);
 #endif
 	}
 
@@ -853,10 +857,6 @@ static int __devexit sport_uart_remove(struct platform_device *pdev)
 
 	if (sport) {
 		uart_remove_one_port(&sport_uart_reg, &sport->port);
-#ifdef CONFIG_SERIAL_BFIN_CTSRTS
-		if (sport->rts_pin >= 0)
-			gpio_free(sport->rts_pin);
-#endif
 		iounmap(sport->port.membase);
 		peripheral_free_list(
 			(unsigned short *)pdev->dev.platform_data);
-- 
1.7.0.4



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

* Re: [PATCH 2/2] serial: bfin-sport-uart: Request CTS GPIO PIN when the sport emulated serial device starts up.
  2011-12-06  7:16 ` [PATCH 2/2] serial: bfin-sport-uart: Request CTS GPIO PIN when the sport emulated serial device starts up Sonic Zhang
@ 2011-12-06 11:36   ` Alan Cox
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Cox @ 2011-12-06 11:36 UTC (permalink / raw)
  To: Sonic Zhang
  Cc: Greg Kroah-Hartman, linux-serial, LKML, uclinux-dist-devel,
	Sonic Zhang

On Tue, 6 Dec 2011 15:16:34 +0800
Sonic Zhang <sonic.adi@gmail.com> wrote:

> From: Sonic Zhang <sonic.zhang@analog.com>
> 
> This patch is similar to that for bfin-uart hardware flow control.
> Sport emulated serial device may be probed earlier before GPIOLIB is initialized.
> Requesting and configuring CTS GPIO PIN fails in that early stage.
> 
> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

Acked-by: Alan Cox <alan@linux.intel.com>

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

end of thread, other threads:[~2011-12-06 11:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-06  7:16 [PATCH 1/2] tty: bfin-sport-uart: Rx interrupt is not called always with irq disabled Sonic Zhang
2011-12-06  7:16 ` [PATCH 2/2] serial: bfin-sport-uart: Request CTS GPIO PIN when the sport emulated serial device starts up Sonic Zhang
2011-12-06 11:36   ` Alan Cox

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