diff options
Diffstat (limited to 'common/console.c')
-rw-r--r-- | common/console.c | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/common/console.c b/common/console.c index c442c2dde1..73b4c4d4db 100644 --- a/common/console.c +++ b/common/console.c @@ -227,15 +227,15 @@ static void console_add_earlycon_param(struct console_device *cdev, unsigned bau if (!cdev->linux_earlycon_name) return; - str = basprintf("earlycon=%s,0x%lx,%dn8", cdev->linux_earlycon_name, - (ulong)cdev->phys_base, baudrate); + str = basprintf("earlycon=%s,0x%lx", cdev->linux_earlycon_name, + (ulong)cdev->phys_base); dev_add_param_fixed(&cdev->class_dev, "linux.bootargs.earlycon", str); free(str); } -static void console_set_stdoutpath(struct console_device *cdev, unsigned baudrate) +void console_set_stdoutpath(struct console_device *cdev, unsigned baudrate) { int id; char *str; @@ -243,7 +243,7 @@ static void console_set_stdoutpath(struct console_device *cdev, unsigned baudrat if (!cdev->linux_console_name) return; - id = of_alias_get_id(cdev->dev->device_node, "serial"); + id = of_alias_get_id(cdev->dev->of_node, "serial"); if (id < 0) return; @@ -254,14 +254,34 @@ static void console_set_stdoutpath(struct console_device *cdev, unsigned baudrat free(str); } +struct console_device *of_console_by_stdout_path(void) +{ + struct console_device *console; + struct device_node *stdout_np; + + stdout_np = of_get_stdoutpath(NULL); + if (!stdout_np) + return NULL; + + for_each_console(console) { + if (dev_of_node(console->dev) == stdout_np) + return console; + } + + return NULL; +} + static int __console_puts(struct console_device *cdev, const char *s, size_t nbytes) { size_t i; for (i = 0; i < nbytes; i++) { - if (*s == '\n') + if (*s == '\n') { cdev->putc(cdev, '\r'); + if (IS_ENABLED(CONFIG_CONSOLE_FLUSH_LINE_BREAK) && cdev->flush) + cdev->flush(cdev); + } cdev->putc(cdev, *s); s++; @@ -309,7 +329,7 @@ static ssize_t fops_write(struct cdev* dev, const void* buf, size_t count, int console_register(struct console_device *newcdev) { struct device_node *serdev_node = console_is_serdev_node(newcdev); - struct device_d *dev = &newcdev->class_dev; + struct device *dev = &newcdev->class_dev; int activate = 0, ret; unsigned baudrate = CONFIG_BAUDRATE; @@ -406,7 +426,7 @@ EXPORT_SYMBOL(console_register); int console_unregister(struct console_device *cdev) { - struct device_d *dev = &cdev->class_dev; + struct device *dev = &cdev->class_dev; int status; /* @@ -608,7 +628,7 @@ int ctrlc(void) if (ctrlc_abort) return 1; -#ifdef ARCH_HAS_CTRLC +#ifdef CONFIG_ARCH_HAS_CTRLC ret = arch_ctrlc(); #else if (tstc() && getchar() == 3) |