summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2021-06-28 07:19:34 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-06-28 14:50:24 +0200
commit560b8961e43cab7951a10dc06380d8038f8c3794 (patch)
tree5601c3379d0dcc58ad950836e7168ff43fdba30b /common
parent5eb71097bf476954a0da4279b496997ae27e60fa (diff)
downloadbarebox-560b8961e43cab7951a10dc06380d8038f8c3794.tar.gz
barebox-560b8961e43cab7951a10dc06380d8038f8c3794.tar.xz
console: respect baudrate specified in device-tree stdout-path
stdout-path in the device tree can have a suffix indicating line settings. The baud rate contained within was so far ignored by barebox. Change this so barebox first consults the stdout-path alias before falling back to CONFIG_BAUDRATE. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210628051934.9604-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/console.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/common/console.c b/common/console.c
index 8a0af75a1f..ad1a6aaab2 100644
--- a/common/console.c
+++ b/common/console.c
@@ -220,7 +220,7 @@ static void console_init_early(void)
initialized = CONSOLE_INITIALIZED_BUFFER;
}
-static void console_set_stdoutpath(struct console_device *cdev)
+static void console_set_stdoutpath(struct console_device *cdev, unsigned baudrate)
{
int id;
char *str;
@@ -232,8 +232,7 @@ static void console_set_stdoutpath(struct console_device *cdev)
if (id < 0)
return;
- str = basprintf("console=%s%d,%dn8", cdev->linux_console_name, id,
- cdev->baudrate);
+ str = basprintf("console=%s%d,%dn8", cdev->linux_console_name, id, baudrate);
globalvar_add_simple("linux.bootargs.console", str);
@@ -297,6 +296,7 @@ int console_register(struct console_device *newcdev)
struct device_node *serdev_node = console_is_serdev_node(newcdev);
struct device_d *dev = &newcdev->class_dev;
int activate = 0, ret;
+ unsigned baudrate = CONFIG_BAUDRATE;
if (!serdev_node && initialized == CONSOLE_UNINITIALIZED)
console_init_early();
@@ -327,11 +327,16 @@ int console_register(struct console_device *newcdev)
if (serdev_node)
return of_platform_populate(serdev_node, NULL, dev);
+ if (newcdev->dev && of_device_is_stdout_path(newcdev->dev, &baudrate)) {
+ activate = 1;
+ console_set_stdoutpath(newcdev, baudrate);
+ }
+
if (newcdev->setbrg) {
- ret = newcdev->setbrg(newcdev, CONFIG_BAUDRATE);
+ ret = newcdev->setbrg(newcdev, baudrate);
if (ret)
return ret;
- newcdev->baudrate_param = newcdev->baudrate = CONFIG_BAUDRATE;
+ newcdev->baudrate_param = newcdev->baudrate = baudrate;
dev_add_param_uint32(dev, "baudrate", console_baudrate_set,
NULL, &newcdev->baudrate_param, "%u", newcdev);
}
@@ -349,11 +354,6 @@ int console_register(struct console_device *newcdev)
activate = 1;
}
- if (newcdev->dev && of_device_is_stdout_path(newcdev->dev)) {
- activate = 1;
- console_set_stdoutpath(newcdev);
- }
-
list_add_tail(&newcdev->list, &console_list);
if (activate)