summaryrefslogtreecommitdiffstats
path: root/common/console.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/console.c')
-rw-r--r--common/console.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/common/console.c b/common/console.c
index 8727b187cf..c442c2dde1 100644
--- a/common/console.c
+++ b/common/console.c
@@ -220,6 +220,21 @@ static void console_init_early(void)
initialized = CONSOLE_INITIALIZED_BUFFER;
}
+static void console_add_earlycon_param(struct console_device *cdev, unsigned baudrate)
+{
+ char *str;
+
+ if (!cdev->linux_earlycon_name)
+ return;
+
+ str = basprintf("earlycon=%s,0x%lx,%dn8", cdev->linux_earlycon_name,
+ (ulong)cdev->phys_base, baudrate);
+
+ dev_add_param_fixed(&cdev->class_dev, "linux.bootargs.earlycon", str);
+
+ free(str);
+}
+
static void console_set_stdoutpath(struct console_device *cdev, unsigned baudrate)
{
int id;
@@ -332,6 +347,8 @@ int console_register(struct console_device *newcdev)
console_set_stdoutpath(newcdev, baudrate);
}
+ console_add_earlycon_param(newcdev, baudrate);
+
if (newcdev->setbrg) {
ret = newcdev->setbrg(newcdev, baudrate);
if (ret)