提交 4d118c9a 编写于 作者: P Peter Hurley 提交者: Greg Kroah-Hartman

of: earlycon: Add options string handling

Pass-through any options string in the 'stdout-path' property to the
earlycon "driver" setup.
Acked-by: NRob Herring <robh@kernel.org>
Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 05d96132
...@@ -800,7 +800,7 @@ static inline void early_init_dt_check_for_initrd(unsigned long node) ...@@ -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) static int __init early_init_dt_scan_chosen_serial(void)
{ {
int offset; int offset;
const char *p; const char *p, *q, *options = NULL;
int l; int l;
const struct earlycon_id *match; const struct earlycon_id *match;
const void *fdt = initial_boot_params; const void *fdt = initial_boot_params;
...@@ -817,11 +817,12 @@ static int __init early_init_dt_scan_chosen_serial(void) ...@@ -817,11 +817,12 @@ static int __init early_init_dt_scan_chosen_serial(void)
if (!p || !l) if (!p || !l)
return -ENOENT; return -ENOENT;
/* Remove console options if present */ q = strchrnul(p, ':');
l = strchrnul(p, ':') - p; if (*q != '\0')
options = q + 1;
/* Get the node specified by stdout-path */ /* 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) if (offset < 0)
return -ENODEV; return -ENODEV;
...@@ -838,7 +839,7 @@ static int __init early_init_dt_scan_chosen_serial(void) ...@@ -838,7 +839,7 @@ static int __init early_init_dt_scan_chosen_serial(void)
if (addr == OF_BAD_ADDR) if (addr == OF_BAD_ADDR)
return -ENXIO; return -ENXIO;
of_setup_earlycon(addr, match); of_setup_earlycon(addr, match, options);
return 0; return 0;
} }
return -ENODEV; return -ENODEV;
......
...@@ -218,7 +218,8 @@ early_param("earlycon", param_setup_earlycon); ...@@ -218,7 +218,8 @@ early_param("earlycon", param_setup_earlycon);
#ifdef CONFIG_OF_EARLY_FLATTREE #ifdef CONFIG_OF_EARLY_FLATTREE
int __init of_setup_earlycon(unsigned long addr, int __init of_setup_earlycon(unsigned long addr,
const struct earlycon_id *match) const struct earlycon_id *match,
const char *options)
{ {
int err; int err;
struct uart_port *port = &early_console_dev.port; struct uart_port *port = &early_console_dev.port;
...@@ -229,8 +230,12 @@ int __init of_setup_earlycon(unsigned long addr, ...@@ -229,8 +230,12 @@ int __init of_setup_earlycon(unsigned long addr,
port->uartclk = BASE_BAUD * 16; port->uartclk = BASE_BAUD * 16;
port->membase = earlycon_map(addr, SZ_4K); 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); earlycon_init(&early_console_dev, match->name);
err = match->setup(&early_console_dev, NULL); err = match->setup(&early_console_dev, options);
if (err < 0) if (err < 0)
return err; return err;
if (!early_console_dev.con->write) if (!early_console_dev.con->write)
......
...@@ -359,7 +359,8 @@ extern const struct earlycon_id __earlycon_table_end[]; ...@@ -359,7 +359,8 @@ extern const struct earlycon_id __earlycon_table_end[];
#define EARLYCON_DECLARE(_name, fn) OF_EARLYCON_DECLARE(_name, "", fn) #define EARLYCON_DECLARE(_name, fn) OF_EARLYCON_DECLARE(_name, "", fn)
extern int setup_earlycon(char *buf); 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 uart_port *uart_get_console(struct uart_port *ports, int nr,
struct console *c); struct console *c);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册