Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1311056

[PATCH v5 04/11] of: earlycon: Add options string handling

From Peter Hurley <peter@hurleysoftware.com>
Newsgroups linux.kernel
Subject [PATCH v5 04/11] of: earlycon: Add options string handling
Date 2016-01-16 22:50 +0100
Message-ID <qRGTo-1Ej-13@gated-at.bofh.it> (permalink)
References <qQd74-5xe-7@gated-at.bofh.it> <qRGJI-1Au-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Pass-through any options string in the 'stdout-path' property to the
earlycon "driver" setup.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/of/fdt.c              | 11 ++++++-----
 drivers/tty/serial/earlycon.c |  9 +++++++--
 include/linux/serial_core.h   |  3 ++-
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index ec14595..cfd3b35 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -800,7 +800,7 @@ static inline void early_init_dt_check_for_initrd(unsigned long node)
 static int __init early_init_dt_scan_chosen_serial(void)
 {
 	int offset;
-	const char *p;
+	const char *p, *q, *options = NULL;
 	int l;
 	const struct earlycon_id *match;
 	const void *fdt = initial_boot_params;
@@ -817,11 +817,12 @@ static int __init early_init_dt_scan_chosen_serial(void)
 	if (!p || !l)
 		return -ENOENT;
 
-	/* Remove console options if present */
-	l = strchrnul(p, ':') - p;
+	q = strchrnul(p, ':');
+	if (*q != '\0')
+		options = q + 1;
 
 	/* Get the node specified by stdout-path */
-	offset = fdt_path_offset_namelen(fdt, p, l);
+	offset = fdt_path_offset_namelen(fdt, p, q - p);
 	if (offset < 0)
 		return -ENODEV;
 
@@ -838,7 +839,7 @@ static int __init early_init_dt_scan_chosen_serial(void)
 		if (addr == OF_BAD_ADDR)
 			return -ENXIO;
 
-		of_setup_earlycon(addr, match);
+		of_setup_earlycon(addr, match, options);
 		return 0;
 	}
 	return -ENODEV;
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index f4b5490..d50ed78 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -216,7 +216,8 @@ static int __init param_setup_earlycon(char *buf)
 early_param("earlycon", param_setup_earlycon);
 
 int __init of_setup_earlycon(unsigned long addr,
-			     const struct earlycon_id *match)
+			     const struct earlycon_id *match,
+			     const char *options)
 {
 	int err;
 	struct uart_port *port = &early_console_dev.port;
@@ -227,8 +228,12 @@ int __init of_setup_earlycon(unsigned long addr,
 	port->uartclk = BASE_BAUD * 16;
 	port->membase = earlycon_map(addr, SZ_4K);
 
+	if (options) {
+		strlcpy(early_console_dev.options, options,
+			sizeof(early_console_dev.options));
+	}
 	earlycon_init(&early_console_dev, match->name);
-	err = match->setup(&early_console_dev, NULL);
+	err = match->setup(&early_console_dev, options);
 	if (err < 0)
 		return err;
 	if (!early_console_dev.con->write)
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 63fdb55..62a4df0 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -359,7 +359,8 @@ extern const struct earlycon_id __earlycon_table_end[];
 #define EARLYCON_DECLARE(_name, fn)	OF_EARLYCON_DECLARE(_name, "", fn)
 
 extern int setup_earlycon(char *buf);
-extern int of_setup_earlycon(unsigned long addr, const struct earlycon_id *match);
+extern int of_setup_earlycon(unsigned long addr, const struct earlycon_id *match,
+			     const char *options);
 
 struct uart_port *uart_get_console(struct uart_port *ports, int nr,
 				   struct console *c);
-- 
2.7.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v5 00/11] Earlycon cleanup Peter Hurley <peter@hurleysoftware.com> - 2016-01-16 22:40 +0100
  [PATCH v5 11/11] serial: 8250_omap: Add omap8250 earlycon Peter Hurley <peter@hurleysoftware.com> - 2016-01-16 22:40 +0100
  [PATCH v5 06/11] of: earlycon: Move address translation to of_setup_earlycon() Peter Hurley <peter@hurleysoftware.com> - 2016-01-16 22:40 +0100
    Re: [PATCH v5 06/11] of: earlycon: Move address translation to  of_setup_earlycon() kbuild test robot <lkp@intel.com> - 2016-01-16 23:10 +0100
  [PATCH v5 07/11] serial: earlycon: Common log banner for command line and DT Peter Hurley <peter@hurleysoftware.com> - 2016-01-16 22:40 +0100
  [PATCH v5 01/11] earlycon: Use common framework for earlycon declarations Peter Hurley <peter@hurleysoftware.com> - 2016-01-16 22:50 +0100
  [PATCH v5 05/11] of: earlycon: Initialize port fields from DT properties Peter Hurley <peter@hurleysoftware.com> - 2016-01-16 22:50 +0100
    Re: [PATCH v5 05/11] of: earlycon: Initialize port fields from DT  properties kbuild test robot <lkp@intel.com> - 2016-01-16 23:00 +0100
  [PATCH v5 02/11] serial: earlycon: Fixup earlycon console name and index Peter Hurley <peter@hurleysoftware.com> - 2016-01-16 22:50 +0100
  [PATCH v5 03/11] of: earlycon: Fixup earlycon console name and index Peter Hurley <peter@hurleysoftware.com> - 2016-01-16 22:50 +0100
  [PATCH v5 04/11] of: earlycon: Add options string handling Peter Hurley <peter@hurleysoftware.com> - 2016-01-16 22:50 +0100
  [PATCH v5 09/11] serial: 8250_early: Use port->regshift Peter Hurley <peter@hurleysoftware.com> - 2016-01-16 22:50 +0100
  [PATCH v5 08/11] serial: earlycon: Show the earlycon "driver" in banner Peter Hurley <peter@hurleysoftware.com> - 2016-01-16 22:50 +0100
  [PATCH v5 10/11] of: earlycon: Log more helpful message if stdout-path node not found Peter Hurley <peter@hurleysoftware.com> - 2016-01-16 22:50 +0100
  [PATCH v6 11/12] of: earlycon: Log more helpful message if stdout-path node not found Peter Hurley <peter@hurleysoftware.com> - 2016-01-17 00:30 +0100
  [PATCH v6 05/12] of: earlycon: Add options string handling Peter Hurley <peter@hurleysoftware.com> - 2016-01-17 00:30 +0100
  [PATCH v6 04/12] of: earlycon: Fixup earlycon console name and index Peter Hurley <peter@hurleysoftware.com> - 2016-01-17 00:30 +0100
  [PATCH v6 09/12] serial: earlycon: Show the earlycon "driver" in banner Peter Hurley <peter@hurleysoftware.com> - 2016-01-17 00:30 +0100
  [PATCH v6 00/12] Earlycon cleanup Peter Hurley <peter@hurleysoftware.com> - 2016-01-17 00:30 +0100
    [PATCH v6 02/12] earlycon: Use common framework for earlycon declarations Peter Hurley <peter@hurleysoftware.com> - 2016-01-17 00:30 +0100
    [PATCH v6 10/12] serial: 8250_early: Use port->regshift Peter Hurley <peter@hurleysoftware.com> - 2016-01-17 00:30 +0100
    [PATCH v6 07/12] of: earlycon: Move address translation to of_setup_earlycon() Peter Hurley <peter@hurleysoftware.com> - 2016-01-17 00:30 +0100
    [PATCH v6 01/12] of: earlycon: of_setup_earlycon() requires CONFIG_OF_EARLY_FLATTREE Peter Hurley <peter@hurleysoftware.com> - 2016-01-17 00:30 +0100
    [PATCH v6 03/12] serial: earlycon: Fixup earlycon console name and index Peter Hurley <peter@hurleysoftware.com> - 2016-01-17 00:30 +0100
    [PATCH v6 08/12] serial: earlycon: Common log banner for command line and DT Peter Hurley <peter@hurleysoftware.com> - 2016-01-17 00:30 +0100
    [PATCH v6 06/12] of: earlycon: Initialize port fields from DT properties Peter Hurley <peter@hurleysoftware.com> - 2016-01-17 00:30 +0100
    [PATCH v6 12/12] serial: 8250_omap: Add omap8250 earlycon Peter Hurley <peter@hurleysoftware.com> - 2016-01-17 00:30 +0100

csiph-web