Skip to contentSkip to conversation

serial: of-serial: fetch line number from DT

PATCH RESEND New Lucas Stach 2 participants 2 messages Nov 25, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 serial: of-serial: fetch line number from DT

The general agreed way to specify a fixed line number for a serial console is to provide a "serial" alias in the devicetree. Start parsing this property in of_serial.

---
As 3.16-rc6 landed the fix to avoid the regression that this patch was causing on Tegra it should be safe to reapply it.

---
 drivers/tty/serial/of_serial.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/tty/serial/of_serial.c +4 -0
index 8bc2563..920a831 100644
@@ -101,6 +101,10 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
 	if (of_property_read_u32(np, "fifo-size", &prop) == 0)
 		port->fifosize = prop;
 
+	/* Check for a fixed line number */
+	if ((ret = of_alias_get_id(np, "serial")) >= 0)
+		port->line = ret;
+
 	port->irq = irq_of_parse_and_map(np, 0);
 	port->iotype = UPIO_MEM;
 	if (of_property_read_u32(np, "reg-io-width", &prop) == 0) {
Signature · 1 line
2.1.0
#1 lore raw

PATCH RESEND 1/1 serial: of-serial: fetch line number from DT

Hello.

Quoted 19 lines · Lucas Stach

The general agreed way to specify a fixed line number for a serial console is to provide a "serial" alias in the devicetree. Start parsing this property in of_serial.

---
As 3.16-rc6 landed the fix to avoid the regression that this patch was causing on Tegra it should be safe to reapply it.

---
  drivers/tty/serial/of_serial.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/tty/serial/of_serial.c +0 -0
index 8bc2563..920a831 100644

drivers/tty/serial/of_serial.c static int of_platform_serial_setup(struct platform_device *ofdev, · line 105

Quoted 5 lines
drivers/tty/serial/of_serial.c +2 -0
@@ -101,6 +101,10 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
  	if (of_property_read_u32(np, "fifo-size", &prop) == 0)
  		port->fifosize = prop;
 
+	/* Check for a fixed line number */
+	if ((ret = of_alias_get_id(np, "serial")) >= 0)

Don't use assignment in the *if* statement. If you would have ran your
patch thru scripts/checkpatch.pl, it would have complained about that.

drivers/tty/serial/of_serial.c static int of_platform_serial_setup(struct platform_device *ofdev, · line 107

Quoted 2 lines
drivers/tty/serial/of_serial.c +2 -0
+		port->line = ret;
+

WBR, Sergei