diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/Kconfig | 4 | ||||
-rw-r--r-- | common/Makefile | 1 | ||||
-rw-r--r-- | common/console.c | 20 | ||||
-rw-r--r-- | common/deep-probe.c | 39 |
4 files changed, 54 insertions, 10 deletions
diff --git a/common/Kconfig b/common/Kconfig index 8b8f80bbb3..1ece3f7318 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1466,6 +1466,10 @@ config DEBUG_INITCALLS help If enabled this will print initcall traces. +config DEBUG_PROBES + bool "Trace driver probes" + help + If enabled this will print driver probe traces. config PBL_BREAK bool "Execute software break on pbl start" diff --git a/common/Makefile b/common/Makefile index 382a4f661f..daa022ff54 100644 --- a/common/Makefile +++ b/common/Makefile @@ -3,6 +3,7 @@ obj-y += memory_display.o pbl-$(CONFIG_PBL_CONSOLE) += memory_display.o obj-y += clock.o obj-y += console_common.o +obj-y += deep-probe.o obj-y += startup.o obj-y += misc.o obj-pbl-y += memsize.o 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) diff --git a/common/deep-probe.c b/common/deep-probe.c new file mode 100644 index 0000000000..1020ad93b7 --- /dev/null +++ b/common/deep-probe.c @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include <common.h> +#include <deep-probe.h> +#include <of.h> + +enum deep_probe_state { + DEEP_PROBE_UNKONWN = -1, + DEEP_PROBE_NOT_SUPPORTED, + DEEP_PROBE_SUPPORTED +}; + +static enum deep_probe_state boardstate = DEEP_PROBE_UNKONWN; + +bool deep_probe_is_supported(void) +{ + struct deep_probe_entry *board; + + if (boardstate > DEEP_PROBE_UNKONWN) + return boardstate; + + /* determine boardstate */ + for (board = &__barebox_deep_probe_start; + board != &__barebox_deep_probe_end; board++) { + const struct of_device_id *matches = board->device_id; + + for (; matches->compatible; matches++) { + if (of_machine_is_compatible(matches->compatible)) { + boardstate = DEEP_PROBE_SUPPORTED; + printk("Deep probe supported due to %s\n", matches->compatible); + return true; + } + } + } + + boardstate = DEEP_PROBE_NOT_SUPPORTED; + return false; +} +EXPORT_SYMBOL_GPL(deep_probe_is_supported); |