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;
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;
if (addr == OF_BAD_ADDR)
return -ENXIO;
- of_setup_earlycon(addr, match);
+ of_setup_earlycon(addr, match, options);
return 0;
}
return -ENODEV;
#ifdef CONFIG_OF_EARLY_FLATTREE
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;
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)
#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);