Linux Serial subsystem development
 help / color / mirror / Atom feed
* [PATCH] serial: omap: fix DeviceTree boot
From: Felipe Balbi @ 2012-09-07 18:10 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-serial, Tony Lindgren, Linux OMAP Mailing List,
	Linux ARM Kernel Mailing List, Felipe Balbi
In-Reply-To: <20120907175721.GD1303@atomide.com>

OMAP Architecture code, passes a few function
pointers for UART driver to use in order to
properly implement Power Management and Wakeup
capabilities.

The problem is that those function pointers,
which are passed (ab)using platform_data on
non-DT kernels, can't be passed down to drivers
through DT.

commit e5b57c0 (serial: omap: define helpers
for pdata function pointers) failed to take DT
kernels into consideration and caused a regression
to DT kernel boot.

Fix that by (re-)adding a check for valid pdata
pointer together with valid pdata->$FUNCTION
pointer.

Reported-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---

Tony, does this solve the issue ?

 drivers/tty/serial/omap-serial.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 0a6e78e..743e8e1 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -143,7 +143,7 @@ static int serial_omap_get_context_loss_count(struct uart_omap_port *up)
 {
 	struct omap_uart_port_info *pdata = up->dev->platform_data;
 
-	if (!pdata->get_context_loss_count)
+	if (!pdata || !pdata->get_context_loss_count)
 		return 0;
 
 	return pdata->get_context_loss_count(up->dev);
@@ -153,24 +153,30 @@ static void serial_omap_set_forceidle(struct uart_omap_port *up)
 {
 	struct omap_uart_port_info *pdata = up->dev->platform_data;
 
-	if (pdata->set_forceidle)
-		pdata->set_forceidle(up->dev);
+	if (!pdata || !pdata->set_forceidle)
+		return;
+
+	pdata->set_forceidle(up->dev);
 }
 
 static void serial_omap_set_noidle(struct uart_omap_port *up)
 {
 	struct omap_uart_port_info *pdata = up->dev->platform_data;
 
-	if (pdata->set_noidle)
-		pdata->set_noidle(up->dev);
+	if (!pdata || !pdata->set_noidle)
+		return;
+
+	pdata->set_noidle(up->dev);
 }
 
 static void serial_omap_enable_wakeup(struct uart_omap_port *up, bool enable)
 {
 	struct omap_uart_port_info *pdata = up->dev->platform_data;
 
-	if (pdata->enable_wakeup)
-		pdata->enable_wakeup(up->dev, enable);
+	if (!pdata || !pdata->enable_wakeup)
+		return;
+
+	pdata->enable_wakeup(up->dev, enable);
 }
 
 /*
-- 
1.7.12.rc3


^ permalink raw reply related

* [PATCH v3 2/2] 8250: blacklist Winbond CIR port
From: Sean Young @ 2012-09-07 18:06 UTC (permalink / raw)
  To: Alan Cox, Greg Kroah-Hartman, linux-serial
  Cc: David Härdeman, Mauro Carvalho Chehab
In-Reply-To: <cover.1347029782.git.sean@mess.org>

The legacy serial driver will detect the Winbond CIR device as a serial
port, since it looks exactly like a serial port unless you know what
it is from the PNP ID.

Here we track this port as a special PORT_8250_CIR type, preventing the
legacy serial driver from probing it.

Signed-off-by: Sean Young <sean@mess.org>
---
 drivers/tty/serial/8250/8250.c     |   16 ++++++++++++++--
 drivers/tty/serial/8250/8250_pnp.c |   20 +++++++++++++++-----
 include/linux/serial_core.h        |    3 ++-
 3 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c
index bc25874..5eaa6ba 100644
--- a/drivers/tty/serial/8250/8250.c
+++ b/drivers/tty/serial/8250/8250.c
@@ -290,6 +290,9 @@ static const struct serial8250_config uart_config[] = {
 				  UART_FCR_R_TRIG_00 | UART_FCR_T_TRIG_00,
 		.flags		= UART_CAP_FIFO,
 	},
+	[PORT_8250_CIR] = {
+		.name		= "CIR port"
+	}
 };
 
 /* Uart divisor latch read */
@@ -1897,6 +1900,9 @@ static int serial8250_startup(struct uart_port *port)
 	unsigned char lsr, iir;
 	int retval;
 
+	if (port->type == PORT_8250_CIR)
+		return -ENODEV;
+
 	port->fifosize = uart_config[up->port.type].fifo_size;
 	up->tx_loadsz = uart_config[up->port.type].tx_loadsz;
 	up->capabilities = uart_config[up->port.type].flags;
@@ -2554,7 +2560,10 @@ static int serial8250_request_port(struct uart_port *port)
 {
 	struct uart_8250_port *up =
 		container_of(port, struct uart_8250_port, port);
-	int ret = 0;
+	int ret;
+
+	if (port->type == PORT_8250_CIR)
+		return -ENODEV;
 
 	ret = serial8250_request_std_resource(up);
 	if (ret == 0 && port->type == PORT_RSA) {
@@ -2573,6 +2582,9 @@ static void serial8250_config_port(struct uart_port *port, int flags)
 	int probeflags = PROBE_ANY;
 	int ret;
 
+	if (port->type == PORT_8250_CIR)
+		return;
+
 	/*
 	 * Find the region that we can probe for.  This in turn
 	 * tells us whether we can probe for the type of port.
@@ -3144,7 +3156,7 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
 	mutex_lock(&serial_mutex);
 
 	uart = serial8250_find_match_or_unused(&up->port);
-	if (uart) {
+	if (uart && uart->port.type != PORT_8250_CIR) {
 		if (uart->port.dev)
 			uart_remove_one_port(&serial8250_reg, &uart->port);
 
diff --git a/drivers/tty/serial/8250/8250_pnp.c b/drivers/tty/serial/8250/8250_pnp.c
index 28bf830..f8ee250 100644
--- a/drivers/tty/serial/8250/8250_pnp.c
+++ b/drivers/tty/serial/8250/8250_pnp.c
@@ -25,7 +25,7 @@
 #include "8250.h"
 
 #define UNKNOWN_DEV 0x3000
-
+#define CIR_PORT	0x0800
 
 static const struct pnp_device_id pnp_dev_table[] = {
 	/* Archtek America Corp. */
@@ -362,6 +362,9 @@ static const struct pnp_device_id pnp_dev_table[] = {
 	{	"PNPCXXX",		UNKNOWN_DEV	},
 	/* More unknown PnP modems */
 	{	"PNPDXXX",		UNKNOWN_DEV	},
+	/* Winbond CIR port, should not be probed. We should keep track
+	   of it to prevent the legacy serial driver from probing it */
+	{	"WEC1022",		CIR_PORT	},
 	{	"",			0	}
 };
 
@@ -409,7 +412,7 @@ static int __devinit check_resources(struct pnp_dev *dev)
  * PnP modems, alternatively we must hardcode all modems in pnp_devices[]
  * table.
  */
-static int __devinit serial_pnp_guess_board(struct pnp_dev *dev, int *flags)
+static int __devinit serial_pnp_guess_board(struct pnp_dev *dev)
 {
 	if (!(check_name(pnp_dev_name(dev)) ||
 		(dev->card && check_name(dev->card->name))))
@@ -428,7 +431,7 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
 	int ret, line, flags = dev_id->driver_data;
 
 	if (flags & UNKNOWN_DEV) {
-		ret = serial_pnp_guess_board(dev, &flags);
+		ret = serial_pnp_guess_board(dev);
 		if (ret < 0)
 			return ret;
 	}
@@ -436,7 +439,10 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
 	memset(&uart, 0, sizeof(uart));
 	if (pnp_irq_valid(dev, 0))
 		uart.port.irq = pnp_irq(dev, 0);
-	if (pnp_port_valid(dev, 0)) {
+	if ((flags & CIR_PORT) && pnp_port_valid(dev, 2)) {
+		uart.port.iobase = pnp_port_start(dev, 2);
+		uart.port.iotype = UPIO_PORT;
+	} else if (pnp_port_valid(dev, 0)) {
 		uart.port.iobase = pnp_port_start(dev, 0);
 		uart.port.iotype = UPIO_PORT;
 	} else if (pnp_mem_valid(dev, 0)) {
@@ -451,6 +457,10 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
 		"Setup PNP port: port %x, mem 0x%lx, irq %d, type %d\n",
 		       uart.port.iobase, uart.port.mapbase, uart.port.irq, uart.port.iotype);
 #endif
+	if (flags & CIR_PORT) {
+		uart.port.flags |= UPF_FIXED_PORT | UPF_FIXED_TYPE;
+		uart.port.type = PORT_8250_CIR;
+	}
 
 	uart.port.flags |= UPF_SKIP_TEST | UPF_BOOT_AUTOCONF;
 	if (pnp_irq_flags(dev, 0) & IORESOURCE_IRQ_SHAREABLE)
@@ -459,7 +469,7 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
 	uart.port.dev = &dev->dev;
 
 	line = serial8250_register_8250_port(&uart);
-	if (line < 0)
+	if (line < 0 || (flags & CIR_PORT))
 		return -ENODEV;
 
 	pnp_set_drvdata(dev, (void *)((long)line + 1));
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 7cf0b68..bb01003 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -48,7 +48,8 @@
 #define PORT_TEGRA	20	/* NVIDIA Tegra internal UART */
 #define PORT_XR17D15X	21	/* Exar XR17D15x UART */
 #define PORT_LPC3220	22	/* NXP LPC32xx SoC "Standard" UART */
-#define PORT_MAX_8250	22	/* max port ID */
+#define PORT_8250_CIR	23	/* CIR infrared port, has its own driver */
+#define PORT_MAX_8250	23	/* max port ID */
 
 /*
  * ARM specific type numbers.  These are not currently guaranteed
-- 
1.7.2.5


^ permalink raw reply related

* [PATCH v3 0/2] winbond-cir: Fix initialization
From: Sean Young @ 2012-09-07 18:06 UTC (permalink / raw)
  To: Alan Cox, Greg Kroah-Hartman, linux-serial
  Cc: David Härdeman, Mauro Carvalho Chehab

The serial driver will detect the winbond cir device as a serial port,
since it looks exactly like a serial port unless you know what it is
from the PNP ID.

v2:
Alan Cox pointed out[1] that the pnp serial probe should be done before
the legacy probe and we should keep track of any IR ports during the
pnp scan. This is an implementation of that idea.

[1] http://www.spinics.net/lists/linux-serial/msg06757.html

v3:
 - Removed IrDA entries
 - Renamed PORT_IR to PORT_8250_CIR
 - commit message rewording

Diffed against tty-next.

Sean Young (2):
  8250_pnp: do pnp probe before legacy probe
  8250: blacklist Winbond CIR port

 drivers/tty/serial/8250/8250.c     |   47 ++++++++++++++++++++++++-----------
 drivers/tty/serial/8250/8250.h     |    9 +++++++
 drivers/tty/serial/8250/8250_pnp.c |   31 +++++++++++++----------
 drivers/tty/serial/8250/Kconfig    |   16 ++++++------
 drivers/tty/serial/8250/Makefile   |    5 ++-
 include/linux/serial_core.h        |    3 +-
 6 files changed, 72 insertions(+), 39 deletions(-)

-- 
1.7.2.5


^ permalink raw reply

* [PATCH v3 1/2] 8250_pnp: do pnp probe before legacy probe
From: Sean Young @ 2012-09-07 18:06 UTC (permalink / raw)
  To: Alan Cox, Greg Kroah-Hartman, linux-serial
  Cc: David Härdeman, Mauro Carvalho Chehab
In-Reply-To: <cover.1347029782.git.sean@mess.org>

We first probe the legacy serial ports and then check pnp. If there
is a non-standard configuration then this might not work, also this
change is needed so we can blacklist Winbond CIR based on PNP ID.

For this to work the 8250_pnp driver must be merged into the 8250
module.

Signed-off-by: Sean Young <sean@mess.org>
---
 drivers/tty/serial/8250/8250.c     |   31 ++++++++++++++++++-------------
 drivers/tty/serial/8250/8250.h     |    9 +++++++++
 drivers/tty/serial/8250/8250_pnp.c |   11 +++--------
 drivers/tty/serial/8250/Kconfig    |   16 ++++++++--------
 drivers/tty/serial/8250/Makefile   |    5 +++--
 5 files changed, 41 insertions(+), 31 deletions(-)

diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c
index 44f52c6..bc25874 100644
--- a/drivers/tty/serial/8250/8250.c
+++ b/drivers/tty/serial/8250/8250.c
@@ -2672,6 +2672,9 @@ static void __init serial8250_isa_init_ports(void)
 		return;
 	first = 0;
 
+	if (nr_uarts > UART_NR)
+		nr_uarts = UART_NR;
+
 	for (i = 0; i < nr_uarts; i++) {
 		struct uart_8250_port *up = &serial8250_ports[i];
 		struct uart_port *port = &up->port;
@@ -2681,6 +2684,7 @@ static void __init serial8250_isa_init_ports(void)
 
 		init_timer(&up->timer);
 		up->timer.function = serial8250_timeout;
+		up->cur_iotype = 0xFF;
 
 		/*
 		 * ALPHA_KLUDGE_MCR needs to be killed.
@@ -2732,13 +2736,9 @@ serial8250_register_ports(struct uart_driver *drv, struct device *dev)
 
 	for (i = 0; i < nr_uarts; i++) {
 		struct uart_8250_port *up = &serial8250_ports[i];
-		up->cur_iotype = 0xFF;
-	}
 
-	serial8250_isa_init_ports();
-
-	for (i = 0; i < nr_uarts; i++) {
-		struct uart_8250_port *up = &serial8250_ports[i];
+		if (up->port.dev)
+			continue;
 
 		up->port.dev = dev;
 
@@ -2863,9 +2863,6 @@ static struct console serial8250_console = {
 
 static int __init serial8250_console_init(void)
 {
-	if (nr_uarts > UART_NR)
-		nr_uarts = UART_NR;
-
 	serial8250_isa_init_ports();
 	register_console(&serial8250_console);
 	return 0;
@@ -3148,7 +3145,8 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
 
 	uart = serial8250_find_match_or_unused(&up->port);
 	if (uart) {
-		uart_remove_one_port(&serial8250_reg, &uart->port);
+		if (uart->port.dev)
+			uart_remove_one_port(&serial8250_reg, &uart->port);
 
 		uart->port.iobase       = up->port.iobase;
 		uart->port.membase      = up->port.membase;
@@ -3232,8 +3230,7 @@ static int __init serial8250_init(void)
 {
 	int ret;
 
-	if (nr_uarts > UART_NR)
-		nr_uarts = UART_NR;
+	serial8250_isa_init_ports();
 
 	printk(KERN_INFO "Serial: 8250/16550 driver, "
 		"%d ports, IRQ sharing %sabled\n", nr_uarts,
@@ -3248,11 +3245,15 @@ static int __init serial8250_init(void)
 	if (ret)
 		goto out;
 
+	ret = serial8250_pnp_init();
+	if (ret)
+		goto unreg_uart_drv;
+
 	serial8250_isa_devs = platform_device_alloc("serial8250",
 						    PLAT8250_DEV_LEGACY);
 	if (!serial8250_isa_devs) {
 		ret = -ENOMEM;
-		goto unreg_uart_drv;
+		goto unreg_pnp;
 	}
 
 	ret = platform_device_add(serial8250_isa_devs);
@@ -3268,6 +3269,8 @@ static int __init serial8250_init(void)
 	platform_device_del(serial8250_isa_devs);
 put_dev:
 	platform_device_put(serial8250_isa_devs);
+unreg_pnp:
+	serial8250_pnp_exit();
 unreg_uart_drv:
 #ifdef CONFIG_SPARC
 	sunserial_unregister_minors(&serial8250_reg, UART_NR);
@@ -3292,6 +3295,8 @@ static void __exit serial8250_exit(void)
 	platform_driver_unregister(&serial8250_isa_driver);
 	platform_device_unregister(isa_dev);
 
+	serial8250_pnp_exit();
+
 #ifdef CONFIG_SPARC
 	sunserial_unregister_minors(&serial8250_reg, UART_NR);
 #else
diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h
index 0c5e908..5a76f9c 100644
--- a/drivers/tty/serial/8250/8250.h
+++ b/drivers/tty/serial/8250/8250.h
@@ -97,3 +97,12 @@ static inline void serial_dl_write(struct uart_8250_port *up, int value)
 #else
 #define ALPHA_KLUDGE_MCR 0
 #endif
+
+#ifdef CONFIG_SERIAL_8250_PNP
+int serial8250_pnp_init(void);
+void serial8250_pnp_exit(void);
+#else
+static inline int serial8250_pnp_init(void) { return 0; }
+static inline void serial8250_pnp_exit(void) { }
+#endif
+
diff --git a/drivers/tty/serial/8250/8250_pnp.c b/drivers/tty/serial/8250/8250_pnp.c
index fde5aa6..28bf830 100644
--- a/drivers/tty/serial/8250/8250_pnp.c
+++ b/drivers/tty/serial/8250/8250_pnp.c
@@ -1,5 +1,5 @@
 /*
- *  Probe module for 8250/16550-type ISAPNP serial ports.
+ *  Probe for 8250/16550-type ISAPNP serial ports.
  *
  *  Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
  *
@@ -507,18 +507,13 @@ static struct pnp_driver serial_pnp_driver = {
 	.id_table	= pnp_dev_table,
 };
 
-static int __init serial8250_pnp_init(void)
+int serial8250_pnp_init(void)
 {
 	return pnp_register_driver(&serial_pnp_driver);
 }
 
-static void __exit serial8250_pnp_exit(void)
+void serial8250_pnp_exit(void)
 {
 	pnp_unregister_driver(&serial_pnp_driver);
 }
 
-module_init(serial8250_pnp_init);
-module_exit(serial8250_pnp_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Generic 8250/16x50 PnP serial driver");
diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig
index a27dd05..f3d283f 100644
--- a/drivers/tty/serial/8250/Kconfig
+++ b/drivers/tty/serial/8250/Kconfig
@@ -33,6 +33,14 @@ config SERIAL_8250
 	  Most people will say Y or M here, so that they can use serial mice,
 	  modems and similar devices connecting to the standard serial ports.
 
+config SERIAL_8250_PNP
+	bool "8250/16550 PNP device support" if EXPERT
+	depends on SERIAL_8250 && PNP
+	default y
+	---help---
+	  This builds standard PNP serial support. You may be able to
+	  disable this feature if you only need legacy serial support.
+
 config SERIAL_8250_CONSOLE
 	bool "Console on 8250/16550 and compatible serial port"
 	depends on SERIAL_8250=y
@@ -85,14 +93,6 @@ config SERIAL_8250_PCI
 	  disable this feature if you only need legacy serial support.
 	  Saves about 9K.
 
-config SERIAL_8250_PNP
-	tristate "8250/16550 PNP device support" if EXPERT
-	depends on SERIAL_8250 && PNP
-	default SERIAL_8250
-	help
-	  This builds standard PNP serial support. You may be able to
-	  disable this feature if you only need legacy serial support.
-
 config SERIAL_8250_HP300
 	tristate
 	depends on SERIAL_8250 && HP300
diff --git a/drivers/tty/serial/8250/Makefile b/drivers/tty/serial/8250/Makefile
index d7533c7..108fe7f 100644
--- a/drivers/tty/serial/8250/Makefile
+++ b/drivers/tty/serial/8250/Makefile
@@ -2,8 +2,9 @@
 # Makefile for the 8250 serial device drivers.
 #
 
-obj-$(CONFIG_SERIAL_8250)		+= 8250.o
-obj-$(CONFIG_SERIAL_8250_PNP)		+= 8250_pnp.o
+obj-$(CONFIG_SERIAL_8250)		+= 8250_core.o
+8250_core-y				:= 8250.o
+8250_core-$(CONFIG_SERIAL_8250_PNP)	+= 8250_pnp.o
 obj-$(CONFIG_SERIAL_8250_GSC)		+= 8250_gsc.o
 obj-$(CONFIG_SERIAL_8250_PCI)		+= 8250_pci.o
 obj-$(CONFIG_SERIAL_8250_HP300)		+= 8250_hp300.o
-- 
1.7.2.5


^ permalink raw reply related

* Re: [PATCH 5/5] omap-serial: Request pins using pinctrl framework
From: Tony Lindgren @ 2012-09-07 18:03 UTC (permalink / raw)
  To: AnilKumar, Chimata
  Cc: linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman,
	linux-omap@vger.kernel.org, linux-serial@vger.kernel.org
In-Reply-To: <20120907172809.GB1303@atomide.com>

* Tony Lindgren <tony@atomide.com> [120907 10:29]:
> * AnilKumar, Chimata <anilkumar@ti.com> [120906 20:27]:
> > > @@ -1570,6 +1578,8 @@ static int serial_omap_remove(struct platform_device *dev)
> > >  		pm_runtime_disable(&up->pdev->dev);
> > >  		uart_remove_one_port(&serial_omap_reg, &up->port);
> > >  		pm_qos_remove_request(&up->pm_qos_request);
> > > +		if (up->pins)
> > > +			pinctrl_put(up->pins);
> > 
> > I think this can be removed if we use devm_pinctrl_get_select_default()
> > above.
> 
> Yeah will do, I was initially thinking that would cause issues remuxing
> pins back to safe mode on unload, but we can still do that in
> serial_omap_remove().

Sent now as a separate patch with subject "[PATCH] serial: omap: Request
pins using pinctrl framework".

Regards,

Tony

^ permalink raw reply

* [PATCH] serial: omap: Request pins using pinctrl framework
From: Tony Lindgren @ 2012-09-07 17:59 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-serial, linux-omap, linux-arm-kernel

Request pins using pinctrl framework. Only show a warning
on error as some boards set the pins in the bootloader
even if CONFIG_PINCTRL is enabled.

Signed-off-by: Tony Lindgren <tony@atomide.com>

---

Note that this has only so far been tested with the legacy
non-devicetree boot as devicetree boot now has a regression
issue with omap-serial.

--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -40,6 +40,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/of.h>
 #include <linux/gpio.h>
+#include <linux/pinctrl/consumer.h>
 
 #include <plat/omap-serial.h>
 
@@ -108,6 +109,7 @@ struct uart_omap_port {
 	u32			latency;
 	u32			calc_latency;
 	struct work_struct	qos_work;
+	struct pinctrl		*pins;
 };
 
 #define to_uart_omap_port(p)	((container_of((p), struct uart_omap_port, port)))
@@ -1371,6 +1373,13 @@ static int __devinit serial_omap_probe(struct platform_device *pdev)
 		goto err_port_line;
 	}
 
+	up->pins = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(up->pins)) {
+		dev_warn(&pdev->dev, "did not get pins for uart%i error: %li\n",
+			 up->port.line, PTR_ERR(up->pins));
+		up->pins = NULL;
+	}
+
 	sprintf(up->name, "OMAP UART%d", up->port.line);
 	up->port.mapbase = mem->start;
 	up->port.membase = devm_ioremap(&pdev->dev, mem->start,

^ permalink raw reply

* Re: [PATCH] serial: omap: fix compile breakage
From: Tony Lindgren @ 2012-09-07 17:57 UTC (permalink / raw)
  To: Greg KH
  Cc: Felipe Balbi, alan, Kevin Hilman, Linux OMAP Mailing List,
	Linux ARM Kernel Mailing List, linux-serial,
	Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
	Sourav Poddar
In-Reply-To: <20120907154008.GA21216@kroah.com>

* Greg KH <gregkh@linuxfoundation.org> [120907 08:43]:
> On Fri, Sep 07, 2012 at 06:34:19PM +0300, Felipe Balbi wrote:
> > when rebasing patches on top of Greg's tty-next,
> > it looks like automerge broke a few things which
> > I didn't catch (for whatever reason I didn't
> > have OMAP Serial enabled on .config) so I ended
> > up breaking the build on Greg's tty-next branch.
> > 
> > Fix the breakage by re-adding the three missing
> > members on struct uart_omap_port.
> > 
> > Reported-by: Tony Lindgren <tony@atomide.com>
> > Signed-off-by: Felipe Balbi <balbi@ti.com>
> > ---
> > 
> > Hi Greg,
> > 
> > I just fetched your tree again and rebased again just to
> > make sure. Everything is fine here, let me know if it
> > still applies with fuzz.
> 
> That worked, thanks.

Something is still wrong with omap-serial in tty-next. It now
compiles and works for the legacy non-devicetree case, but with
device tree booting there's now regression during boot:

[    5.200836] Freeing init memory: 332K
[    6.881744] Unable to handle kernel NULL pointer dereference at virtual address 00000030
[    6.890258] pgd = ee664000
[    6.893096] [00000030] *pgd=ae64f831, *pte=00000000, *ppte=00000000
[    6.899688] Internal error: Oops: 17 [#1] SMP ARM
[    6.904632] Modules linked in:
[    6.907836] CPU: 1    Not tainted  (3.6.0-rc4-00207-gc893c8c-dirty #485)
[    6.914916] PC is at serial_omap_start_tx+0x60/0x98
[    6.920043] LR is at serial_omap_start_tx+0x44/0x98
[    6.925140] pc : [<c0316978>]    lr : [<c031695c>]    psr: 60000193
[    6.925140] sp : ee661e80  ip : 00000060  fp : a0000113
[    6.937194] r10: ef3c0010  r9 : ee798800  r8 : 00000072
[    6.942687] r7 : ef3d7472  r6 : 00000002  r5 : 00000007  r4 : ef3c0010
[    6.949523] r3 : 00000000  r2 : 00000004  r1 : 00000007  r0 : ef0da008
[    6.956390] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment user
[    6.963958] Control: 10c53c7d  Table: ae66404a  DAC: 00000015
[    6.970001] Process modprobe (pid: 715, stack limit = 0xee6602f8)
[    6.976379] Stack: (0xee661e80 to 0xee662000)
[    6.980957] 1e80: ee798800 ef3c0010 20000113 c030fcb4 00000000 ef3eead0 00000000 c0310544
[    6.989562] 1ea0: ef3eead0 ee798800 00000fff 00000073 ee798d94 ef3d7400 ee660000 ee7989b8
[    6.998138] 1ec0: ef3d7400 c02fa090 00000073 ef3d7400 ee798800 ee798800 ef0ccdc0 c02fb8e4
[    7.006713] 1ee0: beaa07bc ee798a2c beaa07bc 00000000 ef38aa00 c00778a0 ee798a4c ee798a4c
[    7.015319] 1f00: ee798d4c ef0ccdc0 00000073 00000073 ee798800 b6f19000 ee660000 00000400
[    7.023895] 1f20: 00000000 c02f775c c02fb7a8 ef1f6840 ee661f80 ef0ccdc0 00000000 ef0ccdc0
[    7.032470] 1f40: 00000073 b6f19000 ee661f80 00000073 ee660000 00000000 beaa07bc c010b580
[    7.041046] 1f60: ef38aa00 00000001 00000000 00000000 ef0ccdc0 b6f19000 00000073 c010b6e4
[    7.049652] 1f80: 00000000 00000000 beaa0888 00000000 00000073 beaa0888 00000073 00000004
[    7.058227] 1fa0: c0014308 c0014160 00000073 beaa0888 00000000 b6f19000 00000073 00000000
[    7.066802] 1fc0: 00000073 beaa0888 00000073 00000004 b6f19000 00000000 b6ee271d beaa07bc
[    7.075408] 1fe0: 00000000 beaa01c0 b6e2c874 b6e8015c 60000110 00000000 aaaaaaaa aaeaaaaa
[    7.083984] [<c0316978>] (serial_omap_start_tx+0x60/0x98) from [<c030fcb4>] (uart_start+0x68/0x6c)
[    7.093414] [<c030fcb4>] (uart_start+0x68/0x6c) from [<c0310544>] (uart_write+0xcc/0xf4)
[    7.101928] [<c0310544>] (uart_write+0xcc/0xf4) from [<c02fa090>] (process_output_block+0xc0/0x17c)
[    7.111419] [<c02fa090>] (process_output_block+0xc0/0x17c) from [<c02fb8e4>] (n_tty_write+0x13c/0x2ac)
[    7.121215] [<c02fb8e4>] (n_tty_write+0x13c/0x2ac) from [<c02f775c>] (tty_write+0x13c/0x228)
[    7.130065] [<c02f775c>] (tty_write+0x13c/0x228) from [<c010b580>] (vfs_write+0xb0/0x144)
[    7.138671] [<c010b580>] (vfs_write+0xb0/0x144) from [<c010b6e4>] (sys_write+0x40/0x70)
[    7.147094] [<c010b6e4>] (sys_write+0x40/0x70) from [<c0014160>] (ret_fast_syscall+0x0/0x3c)
[    7.155944] Code: e6ff1075 e18310b2 e5940180 e5903084 (e5933030) 
[    7.162353] ---[ end trace 8cfe94e3de797bda ]---

^ permalink raw reply

* Re: [PATCH 5/5] omap-serial: Request pins using pinctrl framework
From: Tony Lindgren @ 2012-09-07 17:28 UTC (permalink / raw)
  To: AnilKumar, Chimata
  Cc: linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman,
	linux-omap@vger.kernel.org, linux-serial@vger.kernel.org
In-Reply-To: <331ABD5ECB02734CA317220B2BBEABC13EA291F9@DBDE01.ent.ti.com>

* AnilKumar, Chimata <anilkumar@ti.com> [120906 20:27]:
> Hi Tony,
> 
> On Fri, Sep 07, 2012 at 00:28:32, Tony Lindgren wrote:
> > Request pins using pinctrl framework. Only show a warning
> > on error as some boards set the pins in the bootloader
> > even if CONFIG_PINCTRL is enabled.
> > 
> > Cc: linux-serial@vger.kernel.org
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > ---
> >  arch/arm/plat-omap/include/plat/omap-serial.h |    1 +
> >  drivers/tty/serial/omap-serial.c              |   10 ++++++++++
> >  2 files changed, 11 insertions(+)
> > 
> > diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h
> > index 1a52725..0f4de14 100644
> > --- a/arch/arm/plat-omap/include/plat/omap-serial.h
> > +++ b/arch/arm/plat-omap/include/plat/omap-serial.h
> > @@ -106,6 +106,7 @@ struct uart_omap_port {
> >  	struct uart_port	port;
> >  	struct uart_omap_dma	uart_dma;
> >  	struct platform_device	*pdev;
> > +	struct pinctrl		*pins;
> >  
> >  	unsigned char		ier;
> >  	unsigned char		lcr;
> > diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
> > index d3cda0c..068e88c 100644
> > --- a/drivers/tty/serial/omap-serial.c
> > +++ b/drivers/tty/serial/omap-serial.c
> > @@ -39,6 +39,7 @@
> >  #include <linux/irq.h>
> >  #include <linux/pm_runtime.h>
> >  #include <linux/of.h>
> > +#include <linux/pinctrl/consumer.h>
> >  
> >  #include <plat/dma.h>
> >  #include <plat/dmtimer.h>
> > @@ -1492,6 +1493,13 @@ static int serial_omap_probe(struct platform_device *pdev)
> >  		goto err_port_line;
> >  	}
> >  
> > +	up->pins = pinctrl_get_select_default(&pdev->dev);
> > +	if (IS_ERR(up->pins)) {
> > +		dev_warn(&pdev->dev, "did not get pins for uart%i error: %li\n",
> > +			 up->port.line, PTR_ERR(up->pins));
> > +		up->pins = NULL;
> > +	}
> > +
> >  	sprintf(up->name, "OMAP UART%d", up->port.line);
> >  	up->port.mapbase = mem->start;
> >  	up->port.membase = devm_ioremap(&pdev->dev, mem->start,
> > @@ -1570,6 +1578,8 @@ static int serial_omap_remove(struct platform_device *dev)
> >  		pm_runtime_disable(&up->pdev->dev);
> >  		uart_remove_one_port(&serial_omap_reg, &up->port);
> >  		pm_qos_remove_request(&up->pm_qos_request);
> > +		if (up->pins)
> > +			pinctrl_put(up->pins);
> 
> I think this can be removed if we use devm_pinctrl_get_select_default()
> above.

Yeah will do, I was initially thinking that would cause issues remuxing
pins back to safe mode on unload, but we can still do that in
serial_omap_remove().

Regards,

Tony

^ permalink raw reply

* Re: [PATCH] serial: omap: fix compile breakage
From: Greg KH @ 2012-09-07 15:40 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: alan, Tony Lindgren, Kevin Hilman, Linux OMAP Mailing List,
	Linux ARM Kernel Mailing List, linux-serial,
	Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
	Sourav Poddar
In-Reply-To: <1347032059-8901-1-git-send-email-balbi@ti.com>

On Fri, Sep 07, 2012 at 06:34:19PM +0300, Felipe Balbi wrote:
> when rebasing patches on top of Greg's tty-next,
> it looks like automerge broke a few things which
> I didn't catch (for whatever reason I didn't
> have OMAP Serial enabled on .config) so I ended
> up breaking the build on Greg's tty-next branch.
> 
> Fix the breakage by re-adding the three missing
> members on struct uart_omap_port.
> 
> Reported-by: Tony Lindgren <tony@atomide.com>
> Signed-off-by: Felipe Balbi <balbi@ti.com>
> ---
> 
> Hi Greg,
> 
> I just fetched your tree again and rebased again just to
> make sure. Everything is fine here, let me know if it
> still applies with fuzz.

That worked, thanks.

greg k-h

^ permalink raw reply

* [PATCH] serial: omap: fix compile breakage
From: Felipe Balbi @ 2012-09-07 15:34 UTC (permalink / raw)
  To: Greg KH
  Cc: alan, Tony Lindgren, Kevin Hilman, Linux OMAP Mailing List,
	Linux ARM Kernel Mailing List, linux-serial,
	Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
	Sourav Poddar, Felipe Balbi
In-Reply-To: <20120907153136.GA8634@kroah.com>

when rebasing patches on top of Greg's tty-next,
it looks like automerge broke a few things which
I didn't catch (for whatever reason I didn't
have OMAP Serial enabled on .config) so I ended
up breaking the build on Greg's tty-next branch.

Fix the breakage by re-adding the three missing
members on struct uart_omap_port.

Reported-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---

Hi Greg,

I just fetched your tree again and rebased again just to
make sure. Everything is fine here, let me know if it
still applies with fuzz.

cheers

 arch/arm/plat-omap/include/plat/omap-serial.h | 4 ----
 drivers/tty/serial/omap-serial.c              | 4 ++++
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h
index 3c9fd3e..a531149 100644
--- a/arch/arm/plat-omap/include/plat/omap-serial.h
+++ b/arch/arm/plat-omap/include/plat/omap-serial.h
@@ -105,8 +105,4 @@ struct uart_omap_dma {
 	unsigned int		rx_timeout;
 };
 
-
-	int			DTR_gpio;
-	int			DTR_inverted;
-	int			DTR_active;
 #endif /* __OMAP_SERIAL_H__ */
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index cfd2094..0a6e78e 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -100,6 +100,10 @@ struct uart_omap_port {
 	u8			wakeups_enabled;
 	unsigned int		irq_pending:1;
 
+	int			DTR_gpio;
+	int			DTR_inverted;
+	int			DTR_active;
+
 	struct pm_qos_request	pm_qos_request;
 	u32			latency;
 	u32			calc_latency;
-- 
1.7.12.rc3


^ permalink raw reply related

* Re: [PATCH v2] serial: omap: fix compile breakage
From: Greg KH @ 2012-09-07 15:31 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: linux-serial, Tony Lindgren, Linux OMAP Mailing List,
	Linux ARM Kernel Mailing List
In-Reply-To: <1346995531-3197-1-git-send-email-balbi@ti.com>

On Fri, Sep 07, 2012 at 08:25:31AM +0300, Felipe Balbi wrote:
> when rebasing patches on top of Greg's tty-next,
> it looks like automerge broke a few things which
> I didn't catch (for whatever reason I didn't
> have OMAP Serial enabled on .config) so I ended
> up breaking the build on Greg's tty-next branch.
> 
> Fix the breakage by re-adding the three missing
> members on struct uart_omap_port.
> 
> Reported-by: Tony Lindgren <tony@atomide.com>
> Signed-off-by: Felipe Balbi <balbi@ti.com>
> ---
> 
> Changes since v1:
> 	. remove the fields from <plat/omap-serial.h>
> 
>  arch/arm/plat-omap/include/plat/omap-serial.h | 4 ----
>  drivers/tty/serial/omap-serial.c              | 4 ++++
>  2 files changed, 4 insertions(+), 4 deletions(-)

This applies with fuzz, what tree did you make it against?

patching file arch/arm/plat-omap/include/plat/omap-serial.h
Hunk #1 succeeded at 105 with fuzz 1 (offset 26 lines).
patching file drivers/tty/serial/omap-serial.c
Hunk #1 succeeded at 100 (offset -23 lines).

Should I still apply it?

greg k-h

^ permalink raw reply

* Re: [PATCH 2/2] 8250: blacklist IR ports
From: Sean Young @ 2012-09-07 11:37 UTC (permalink / raw)
  To: Alan Cox
  Cc: Alan Cox, Greg Kroah-Hartman, linux-serial, David Härdeman,
	Mauro Carvalho Chehab
In-Reply-To: <20120907112510.3c2eb62f@pyramind.ukuu.org.uk>

On Fri, Sep 07, 2012 at 11:25:10AM +0100, Alan Cox wrote:
> > At least for the nsc-ircc driver, user space must manually remove the
> > the uart driver and then load the nsc-ircc driver. This patch also 
> 
> The nsc can be driven in both SIR and FIR mode can it not. The serial
> driver should drive it in SIR mode if so which means we need to be a spot
> more careful.

Oops.

> > fixes that for nsc-ircc devices. It should work although I am unable to 
> > find the hardware to test it on yet, I used to have one of these. Testers 
> > would be appreciated. See:
> 
> Until it can be tested can we keep the nsc-ircc case separate. At most we
> might need two identifiers (PORT_8250_CIR PORT_8250_FIR etc)

Ok. I'll send out new patches over the weekend, after testing.

Thanks,
Sean

^ permalink raw reply

* Re: [PATCH 2/2] 8250: blacklist IR ports
From: Alan Cox @ 2012-09-07 10:25 UTC (permalink / raw)
  To: Sean Young
  Cc: Alan Cox, Greg Kroah-Hartman, linux-serial, David Härdeman,
	Mauro Carvalho Chehab
In-Reply-To: <20120907093020.GA26788@pequod.mess.org>

> At least for the nsc-ircc driver, user space must manually remove the
> the uart driver and then load the nsc-ircc driver. This patch also 

The nsc can be driven in both SIR and FIR mode can it not. The serial
driver should drive it in SIR mode if so which means we need to be a spot
more careful.

> fixes that for nsc-ircc devices. It should work although I am unable to 
> find the hardware to test it on yet, I used to have one of these. Testers 
> would be appreciated. See:

Until it can be tested can we keep the nsc-ircc case separate. At most we
might need two identifiers (PORT_8250_CIR PORT_8250_FIR etc)

Alan

^ permalink raw reply

* Re: [PATCH 1/2] serial: pl011: delete dangling bug flag
From: Lee Jones @ 2012-09-07  9:58 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Greg Kroah-Hartman, linux-serial, linux-arm-kernel, Anmar Oueja,
	Linus Walleij, Rajanikanth H.V
In-Reply-To: <1347004956-15294-1-git-send-email-linus.walleij@stericsson.com>

On Fri, Sep 07, 2012 at 10:02:36AM +0200, Linus Walleij wrote:
> From: Linus Walleij <linus.walleij@linaro.org>
> 
> The bug flag .interrupt_may_hang is not used since commit
> 4fd0690bb0c3955983560bb2767ee82e2b197f9b
> "serial: pl011: implement workaround for CTS clear event issue"
> so delete it.
> 
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Rajanikanth H.V <rajanikanth.hv@stericsson.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Acked-by: Lee Jones <lee.jones@linaro.org>

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 2/2] serial: pl011: delete reset callback
From: Lee Jones @ 2012-09-07  9:55 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Greg Kroah-Hartman, linux-serial, linux-arm-kernel, Anmar Oueja,
	Linus Walleij, Rajanikanth H.V
In-Reply-To: <1347004968-15329-1-git-send-email-linus.walleij@stericsson.com>

On Fri, Sep 07, 2012 at 10:02:48AM +0200, Linus Walleij wrote:
> From: Linus Walleij <linus.walleij@linaro.org>
> 
> Since commit 4fd0690bb0c3955983560bb2767ee82e2b197f9b
> "serial: pl011: implement workaround for CTS clear event issue"
> the PL011 UART is no longer at risk to hang up, so get rid
> of the callback altogether.
> 
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Rajanikanth H.V <rajanikanth.hv@stericsson.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  arch/arm/mach-ux500/board-mop500.c | 21 ---------------------
>  include/linux/amba/serial.h        |  1 -
>  2 files changed, 22 deletions(-)

Glad to see the back off this:

Acked-by: Lee Jones <lee.jones@linaro.org>

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 2/2] 8250: blacklist IR ports
From: Sean Young @ 2012-09-07  9:30 UTC (permalink / raw)
  To: Alan Cox
  Cc: Alan Cox, Greg Kroah-Hartman, linux-serial, David Härdeman,
	Mauro Carvalho Chehab
In-Reply-To: <20120907010135.6a4d0a20@pyramind.ukuu.org.uk>

On Fri, Sep 07, 2012 at 01:01:35AM +0100, Alan Cox wrote:
> On Thu,  6 Sep 2012 23:20:32 +0100
> Sean Young <sean@mess.org> wrote:
> 
> > These ports should not be probed, but we need to keep track of them so we
> > can prevent the legacy (non-PNP) probe of serial ports from touching them
> > too.
> 
> I want to have a think about getting the ordering right so we don't
> shuffle the ports on existing boxes for the first half. For the second
> part

If pnp lists serial devices in a different order than the legacy devices 
or a singular one which is not the same as ttyS0, things probably will look 
different. Not sure what can be done or anything needs to be done.

> > Signed-off-by: Sean Young <sean@mess.org>
> > ---
> >  drivers/tty/serial/8250/8250.c     | 16 ++++++++++++++--
> >  drivers/tty/serial/8250/8250_pnp.c | 23 ++++++++++++++++++-----
> >  include/linux/serial_core.h        |  3 ++-
> >  3 files changed, 34 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c
> > index bc25874..ea9166b 100644
> > --- a/drivers/tty/serial/8250/8250.c
> > +++ b/drivers/tty/serial/8250/8250.c
> > @@ -290,6 +290,9 @@ static const struct serial8250_config uart_config[] = {
> >  				  UART_FCR_R_TRIG_00 | UART_FCR_T_TRIG_00,
> >  		.flags		= UART_CAP_FIFO,
> >  	},
> > +	[PORT_IR] = {
> > +		.name		= "IR port"
> 
> Please use "CIR port". We have SIR and FIR serial ports (IrDA) too that we
> do drive via tty. PORT_8250_CIR for the type might be best too - it means
> the tools know what they are looking at and can report it sensibly.

At least for the nsc-ircc driver, user space must manually remove the
the uart driver and then load the nsc-ircc driver. This patch also 
fixes that for nsc-ircc devices. It should work although I am unable to 
find the hardware to test it on yet, I used to have one of these. Testers 
would be appreciated. See:

> diff --git a/drivers/tty/serial/8250/8250_pnp.c b/drivers/tty/serial/8250/8250_pnp.c
> index 28bf830..6ab2ce1 100644
> --- a/drivers/tty/serial/8250/8250_pnp.c
> +++ b/drivers/tty/serial/8250/8250_pnp.c
> @@ -362,6 +362,12 @@ static const struct pnp_device_id pnp_dev_table[] = {
>  	{	"PNPCXXX",		UNKNOWN_DEV	},
>  	/* More unknown PnP modems */
>  	{	"PNPDXXX",		UNKNOWN_DEV	},
> +	/* IR ports -- should not be probed. We should keep track of them
> +	   to prevent the legacy serial driver from probing */
> +	{	"WEC1022",		IR_PORT	},

Winbond CIR

> +	{	"NSC6001",		IR_PORT },
> +	{	"HWPC224",		IR_PORT },
> +	{	"IBM0071",		IR_PORT },

nsc-ircc IRDA

>  	{	"",			0	}
>  };

I should have been more explicit about this, possibly in comments. For now 
I am happy to remove those and rename the port PORT_8250_CIR if you prefer.


Sean

^ permalink raw reply

* Re: [PATCH 2/2] serial: pl011: delete reset callback
From: Lee Jones @ 2012-09-07  8:08 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Greg Kroah-Hartman, linux-serial, linux-arm-kernel, Anmar Oueja,
	Linus Walleij, Rajanikanth H.V
In-Reply-To: <1347004968-15329-1-git-send-email-linus.walleij@stericsson.com>

On Fri, Sep 07, 2012 at 10:02:48AM +0200, Linus Walleij wrote:
> From: Linus Walleij <linus.walleij@linaro.org>
> 
> Since commit 4fd0690bb0c3955983560bb2767ee82e2b197f9b
> "serial: pl011: implement workaround for CTS clear event issue"
> the PL011 UART is no longer at risk to hang up, so get rid
> of the callback altogether.
> 
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Rajanikanth H.V <rajanikanth.hv@stericsson.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Didn't you send these already? Have they changed since?

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH 2/2] serial: pl011: delete reset callback
From: Linus Walleij @ 2012-09-07  8:02 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-serial
  Cc: Anmar Oueja, Linus Walleij, Lee Jones, Rajanikanth H.V,
	linux-arm-kernel

From: Linus Walleij <linus.walleij@linaro.org>

Since commit 4fd0690bb0c3955983560bb2767ee82e2b197f9b
"serial: pl011: implement workaround for CTS clear event issue"
the PL011 UART is no longer at risk to hang up, so get rid
of the callback altogether.

Cc: Lee Jones <lee.jones@linaro.org>
Cc: Rajanikanth H.V <rajanikanth.hv@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/mach-ux500/board-mop500.c | 21 ---------------------
 include/linux/amba/serial.h        |  1 -
 2 files changed, 22 deletions(-)

diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index dd629b7..c8922bc 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -542,33 +542,12 @@ static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
 };
 #endif
 
-#define PRCC_K_SOFTRST_SET      0x18
-#define PRCC_K_SOFTRST_CLEAR    0x1C
-static void ux500_uart0_reset(void)
-{
-	void __iomem *prcc_rst_set, *prcc_rst_clr;
-
-	prcc_rst_set = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE +
-			PRCC_K_SOFTRST_SET);
-	prcc_rst_clr = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE +
-			PRCC_K_SOFTRST_CLEAR);
-
-	/* Activate soft reset PRCC_K_SOFTRST_CLEAR */
-	writel((readl(prcc_rst_clr) | 0x1), prcc_rst_clr);
-	udelay(1);
-
-	/* Release soft reset PRCC_K_SOFTRST_SET */
-	writel((readl(prcc_rst_set) | 0x1), prcc_rst_set);
-	udelay(1);
-}
-
 static struct amba_pl011_data uart0_plat = {
 #ifdef CONFIG_STE_DMA40
 	.dma_filter = stedma40_filter,
 	.dma_rx_param = &uart0_dma_cfg_rx,
 	.dma_tx_param = &uart0_dma_cfg_tx,
 #endif
-	.reset = ux500_uart0_reset,
 };
 
 static struct amba_pl011_data uart1_plat = {
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
index d117b29..f612c78 100644
--- a/include/linux/amba/serial.h
+++ b/include/linux/amba/serial.h
@@ -205,7 +205,6 @@ struct amba_pl011_data {
 	void *dma_tx_param;
         void (*init) (void);
 	void (*exit) (void);
-	void (*reset) (void);
 };
 #endif
 
-- 
1.7.11.3

^ permalink raw reply related

* [PATCH 1/2] serial: pl011: delete dangling bug flag
From: Linus Walleij @ 2012-09-07  8:02 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-serial
  Cc: Anmar Oueja, Linus Walleij, Lee Jones, Rajanikanth H.V,
	linux-arm-kernel

From: Linus Walleij <linus.walleij@linaro.org>

The bug flag .interrupt_may_hang is not used since commit
4fd0690bb0c3955983560bb2767ee82e2b197f9b
"serial: pl011: implement workaround for CTS clear event issue"
so delete it.

Cc: Lee Jones <lee.jones@linaro.org>
Cc: Rajanikanth H.V <rajanikanth.hv@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/tty/serial/amba-pl011.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 05c15ec..cede938 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -77,7 +77,6 @@ struct vendor_data {
 	unsigned int		lcrh_tx;
 	unsigned int		lcrh_rx;
 	bool			oversampling;
-	bool			interrupt_may_hang;   /* vendor-specific */
 	bool			dma_threshold;
 	bool			cts_event_workaround;
 };
@@ -98,7 +97,6 @@ static struct vendor_data vendor_st = {
 	.lcrh_tx		= ST_UART011_LCRH_TX,
 	.lcrh_rx		= ST_UART011_LCRH_RX,
 	.oversampling		= true,
-	.interrupt_may_hang	= true,
 	.dma_threshold		= true,
 	.cts_event_workaround	= true,
 };
@@ -149,7 +147,6 @@ struct uart_amba_port {
 	unsigned int		old_cr;		/* state during shutdown */
 	bool			autorts;
 	char			type[12];
-	bool			interrupt_may_hang; /* vendor-specific */
 #ifdef CONFIG_DMA_ENGINE
 	/* DMA stuff */
 	bool			using_tx_dma;
@@ -1952,7 +1949,6 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
 	uap->lcrh_tx = vendor->lcrh_tx;
 	uap->old_cr = 0;
 	uap->fifosize = vendor->fifosize;
-	uap->interrupt_may_hang = vendor->interrupt_may_hang;
 	uap->port.dev = &dev->dev;
 	uap->port.mapbase = dev->res.start;
 	uap->port.membase = base;
-- 
1.7.11.3

^ permalink raw reply related

* [PATCH] TTY: serial: move the dereference below the NULL test
From: Wei Yongjun @ 2012-09-07  6:53 UTC (permalink / raw)
  To: alan, gregkh; +Cc: yongjun_wei, linux-serial

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

The dereference should be moved below the NULL test.

spatch with a semantic match is used to found this.
(http://coccinelle.lip6.fr/)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/tty/serial/ioc4_serial.c | 3 ++-
 drivers/tty/serial/ioc3_serial.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/ioc4_serial.c b/drivers/tty/serial/ioc4_serial.c
index e16894f..1eb5234 100644
--- a/drivers/tty/serial/ioc4_serial.c
+++ b/drivers/tty/serial/ioc4_serial.c
@@ -2069,13 +2069,14 @@ static inline int do_read(struct uart_port *the_port, unsigned char *buf,
 	struct ioc4_port *port = get_ioc4_port(the_port, 0);
 	struct ring *inring;
 	struct ring_entry *entry;
-	struct hooks *hooks = port->ip_hooks;
+	struct hooks *hooks;
 	int byte_num;
 	char *sc;
 	int loop_counter;
 
 	BUG_ON(!(len >= 0));
 	BUG_ON(!port);
+	hooks = port->ip_hooks;
 
 	/* There is a nasty timing issue in the IOC4. When the rx_timer
 	 * expires or the rx_high condition arises, we take an interrupt.

diff --git a/drivers/tty/serial/ioc3_serial.c b/drivers/tty/serial/ioc3_serial.c
index 758ff310..5ac5289 100644
--- a/drivers/tty/serial/ioc3_serial.c
+++ b/drivers/tty/serial/ioc3_serial.c
@@ -1120,13 +1120,14 @@ static inline int do_read(struct uart_port *the_port, char *buf, int len)
 	struct ioc3_port *port = get_ioc3_port(the_port);
 	struct ring *inring;
 	struct ring_entry *entry;
-	struct port_hooks *hooks = port->ip_hooks;
+	struct port_hooks *hooks;
 	int byte_num;
 	char *sc;
 	int loop_counter;
 
 	BUG_ON(!(len >= 0));
 	BUG_ON(!port);
+	hooks = port->ip_hooks;
 
 	/* There is a nasty timing issue in the IOC3. When the rx_timer
 	 * expires or the rx_high condition arises, we take an interrupt.



^ permalink raw reply related

* [patch] serial: clear entire struct in uart_get_info()
From: Dan Carpenter @ 2012-09-07  6:46 UTC (permalink / raw)
  To: Alan Cox; +Cc: Greg Kroah-Hartman, linux-serial, kernel-janitors

There is a typo here, sizeof(retinfo) should be sizeof(*retinfo) to
clear the struct.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Only needed in linux-next.

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 137b25c..19993d8 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -640,7 +640,7 @@ static void uart_get_info(struct tty_port *port,
 {
 	struct uart_port *uport = state->uart_port;
 
-	memset(retinfo, 0, sizeof(retinfo));
+	memset(retinfo, 0, sizeof(*retinfo));
 
 	retinfo->type	    = uport->type;
 	retinfo->line	    = uport->line;

^ permalink raw reply related

* Re: [PATCH v4 00/21] OMAP UART Patches
From: Felipe Balbi @ 2012-09-07  5:49 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: Felipe Balbi, Greg KH, Tony Lindgren, Linux Kernel Mailing List,
	Santosh Shilimkar, linux-serial, Sourav Poddar,
	Linux OMAP Mailing List, Shubhrajyoti Datta,
	Linux ARM Kernel Mailing List, alan
In-Reply-To: <87harahiv6.fsf@deeprootsystems.com>

[-- Attachment #1: Type: text/plain, Size: 3639 bytes --]

Hi,

On Thu, Sep 06, 2012 at 03:44:13PM -0700, Kevin Hilman wrote:
> Felipe Balbi <balbi@ti.com> writes:
> 
> > Hi guys,
> >
> > here's v4 of the omap uart patchset. No changes other than a rebase on top of
> > Greg's tty-next branch and Tony's Acked-by being added to a couple patches
> >
> > Note: I'm resending the series with Vikram's Software Flow Control fix anyway
> > as it can just be ignored if it's decided it needs to go into this merge
> > window.
> 
> Sorry to be late to the party... just getting back from some time off.
> 
> I'm assuming that this was not tested with PM, so decided I better do it

you assumed wrong. See the previous versions of the series and you'll
see I mention all the basic pm testing I did.

> myself seeing that Greg is has already merge it.  To test, I merged
> Greg's tty-next branch with v3.6-rc4 and did some PM testing.
> 
> The bad news is that it doesn't even compile (see reply to [PATCH v4
> 20/21]).  

yeah, that was an automerge issue when rebasing on greg's tty-next
branch, plus me assuming omap serial was already enabled on my .config
and not checking the compile output. Sent a patch now.

> Also, there is a big WARNING on boot[1], which seems to be triggered by
> a new check added for v3.6-rc3[2].  This appears to be introduced by
> $SUBJECT series, because I don't see it on vanilla v3.6-rc4.
> 
> The good news is that after hacking to fix up the compile problems,
> basic PM testing seems to be fine: idle to retention and off as well as
> suspend to retention and off work fine on 3430/n900, 3530/Overo,
> 3730/OveroSTORM, 3730/Beagle-xM.
> 
> Kevin
> 
> 
> [1]
> [    8.745666] WARNING: at /work/kernel/omap/pm/drivers/tty/tty_io.c:1420 tty_init_dev+0x14c/0x17c()
> [    8.755218] tty_init_dev: ttyO driver does not set tty->port. This will crash the kernel later. Fix the driver!
> [    8.765991] Modules linked in:
> [    8.769287] [<c0013d90>] (unwind_backtrace+0x0/0xf0) from [<c0036eec>] (warn_slowpath_common+0x4c/0x64)
> [    8.779327] [<c0036eec>] (warn_slowpath_common+0x4c/0x64) from [<c0036f98>] (warn_slowpath_fmt+0x30/0x40)
> [    8.789550] [<c0036f98>] (warn_slowpath_fmt+0x30/0x40) from [<c02c626c>] (tty_init_dev+0x14c/0x17c)
> [    8.799224] [<c02c626c>] (tty_init_dev+0x14c/0x17c) from [<c02c68a4>] (tty_open+0x11c/0x52c)
> [    8.808258] [<c02c68a4>] (tty_open+0x11c/0x52c) from [<c00f86ac>] (chrdev_open+0x90/0x15c)
> [    8.817108] [<c00f86ac>] (chrdev_open+0x90/0x15c) from [<c00f2b74>] (do_dentry_open+0x1e8/0x270)
> [    8.826507] [<c00f2b74>] (do_dentry_open+0x1e8/0x270) from [<c00f2c30>] (finish_open+0x34/0x4c)
> [    8.835784] [<c00f2c30>] (finish_open+0x34/0x4c) from [<c0102028>] (do_last.isra.21+0x5b0/0xbbc)
> [    8.845184] [<c0102028>] (do_last.isra.21+0x5b0/0xbbc) from [<c01026dc>] (path_openat+0xa8/0x44c)
> [    8.854675] [<c01026dc>] (path_openat+0xa8/0x44c) from [<c0102d34>] (do_filp_open+0x2c/0x80)
> [    8.863708] [<c0102d34>] (do_filp_open+0x2c/0x80) from [<c00f3b6c>] (do_sys_open+0xe8/0x184)
> [    8.872711] [<c00f3b6c>] (do_sys_open+0xe8/0x184) from [<c000db20>] (ret_fast_syscall+0x0/0x3c)
> [    8.882019] ---[ end trace e9bf408c37051346 ]---

This doesn't seem to be caused by $SUBJECT at all. See that we are
calling uart_add_one_port() which will call tty_port_register_device()
which, in turn, will call tty_port_link_device() and that will set
driver->ports[index] correctly.

Have you checked if this doesn't happen without my series before waving
your blame hammer ? FWIW, that part of the code wasn't change by
$SUBJECT at all.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* [PATCH v2] serial: omap: fix compile breakage
From: Felipe Balbi @ 2012-09-07  5:25 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-serial, Tony Lindgren, Linux OMAP Mailing List,
	Linux ARM Kernel Mailing List, Felipe Balbi
In-Reply-To: <1346995312-2872-1-git-send-email-balbi@ti.com>

when rebasing patches on top of Greg's tty-next,
it looks like automerge broke a few things which
I didn't catch (for whatever reason I didn't
have OMAP Serial enabled on .config) so I ended
up breaking the build on Greg's tty-next branch.

Fix the breakage by re-adding the three missing
members on struct uart_omap_port.

Reported-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---

Changes since v1:
	. remove the fields from <plat/omap-serial.h>

 arch/arm/plat-omap/include/plat/omap-serial.h | 4 ----
 drivers/tty/serial/omap-serial.c              | 4 ++++
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h
index 57ff78c..74caddc 100644
--- a/arch/arm/plat-omap/include/plat/omap-serial.h
+++ b/arch/arm/plat-omap/include/plat/omap-serial.h
@@ -79,8 +79,4 @@ struct omap_uart_port_info {
 	void (*enable_wakeup)(struct device *, bool);
 };
 
-
-	int			DTR_gpio;
-	int			DTR_inverted;
-	int			DTR_active;
 #endif /* __OMAP_SERIAL_H__ */
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index e31d291..8e4a7aa 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -123,6 +123,10 @@ struct uart_omap_port {
 	u8			wakeups_enabled;
 	unsigned int		irq_pending:1;
 
+	int			DTR_gpio;
+	int			DTR_inverted;
+	int			DTR_active;
+
 	struct pm_qos_request	pm_qos_request;
 	u32			latency;
 	u32			calc_latency;
-- 
1.7.12.rc3


^ permalink raw reply related

* [PATCH] serial: omap: fix compile breakage
From: Felipe Balbi @ 2012-09-07  5:21 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-serial, Tony Lindgren, Linux OMAP Mailing List,
	Linux ARM Kernel Mailing List, Felipe Balbi

when rebasing patches on top of Greg's tty-next,
it looks like automerge broke a few things which
I didn't catch (for whatever reason I didn't
have OMAP Serial enabled on .config) so I ended
up breaking the build on Greg's tty-next branch.

Fix the breakage by re-adding the three missing
members on struct uart_omap_port.

Reported-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/tty/serial/omap-serial.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index e31d291..8e4a7aa 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -123,6 +123,10 @@ struct uart_omap_port {
 	u8			wakeups_enabled;
 	unsigned int		irq_pending:1;
 
+	int			DTR_gpio;
+	int			DTR_inverted;
+	int			DTR_active;
+
 	struct pm_qos_request	pm_qos_request;
 	u32			latency;
 	u32			calc_latency;
-- 
1.7.12.rc3


^ permalink raw reply related

* Re: [PATCH 5/5] omap-serial: Request pins using pinctrl framework
From: Felipe Balbi @ 2012-09-07  5:26 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Felipe Balbi, linux-arm-kernel, Greg Kroah-Hartman, linux-omap,
	linux-serial
In-Reply-To: <20120906211725.GQ1303@atomide.com>

[-- Attachment #1: Type: text/plain, Size: 1680 bytes --]

Hi,

On Thu, Sep 06, 2012 at 02:17:26PM -0700, Tony Lindgren wrote:
> * Felipe Balbi <balbi@ti.com> [120906 13:01]:
> > Hi,
> > 
> > On Thu, Sep 06, 2012 at 11:58:32AM -0700, Tony Lindgren wrote:
> > > Request pins using pinctrl framework. Only show a warning
> > > on error as some boards set the pins in the bootloader
> > > even if CONFIG_PINCTRL is enabled.
> > > 
> > > Cc: linux-serial@vger.kernel.org
> > > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > > ---
> > >  arch/arm/plat-omap/include/plat/omap-serial.h |    1 +
> > >  drivers/tty/serial/omap-serial.c              |   10 ++++++++++
> > >  2 files changed, 11 insertions(+)
> > > 
> > > diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h
> > > index 1a52725..0f4de14 100644
> > > --- a/arch/arm/plat-omap/include/plat/omap-serial.h
> > > +++ b/arch/arm/plat-omap/include/plat/omap-serial.h
> > > @@ -106,6 +106,7 @@ struct uart_omap_port {
> > >  	struct uart_port	port;
> > >  	struct uart_omap_dma	uart_dma;
> > >  	struct platform_device	*pdev;
> > > +	struct pinctrl		*pins;
> > 
> > this won't apply to Greg's tty-next as I moved this structure to the C
> > file :-s
> 
> Hmm the tty-next fails to build right now for omaps:
> 
> drivers/tty/serial/omap-serial.c: In function ‘serial_omap_set_mctrl’:
> drivers/tty/serial/omap-serial.c:514: error: ‘struct uart_omap_port’ has no member named ‘DTR_gpio’
> 
> Maybe check how you want to fix that first? I can then update
> my patch for tty-next.

oops, my bad. Patch sent.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox