diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2022-10-17 09:09:55 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-10-27 11:13:29 +0200 |
commit | 1c33083a1542db3ea596481781170123f0d0510f (patch) | |
tree | 343fb3b2c38f2567604c6b2da06e6f342af207e6 /common/restart.c | |
parent | 21dda946e7aa86246bf7ca22fb1a1609407c4bb9 (diff) | |
download | barebox-1c33083a1542db3ea596481781170123f0d0510f.tar.gz barebox-1c33083a1542db3ea596481781170123f0d0510f.tar.xz |
restart: add reset -w for warm bootrom reset
We currently support reboot mode communication with BootROMs of the
i.MX6Q/DL, i.MX8MM and STM32MP15x. For each of these, the user must
take care to use the correct reset as the highest priority reset often
clears the non-volatile register mapped by the syscon holding the reboot
mode. As we only have one BootROM, we can improve usability by adding a
global flag that describes whether a restart handler is suitable for
use after a bootrom reboot mode write. Add a flag bit describing this
and allow populating it from the device tree as well as from drivers.
Existing i.MX/STM32 drivers will be moved onto this in follow-up
commits.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20221017071000.1458292-4-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/restart.c')
-rw-r--r-- | common/restart.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/common/restart.c b/common/restart.c index 9e988838bc..0294b36ecc 100644 --- a/common/restart.c +++ b/common/restart.c @@ -30,6 +30,9 @@ int restart_handler_register(struct restart_handler *rst) if (rst->of_node) { of_property_read_u32(rst->of_node, "restart-priority", &rst->priority); + if (of_property_read_bool(rst->of_node, + "barebox,restart-warm-bootrom")) + rst->flags |= RESTART_FLAG_WARM_BOOTROM; } list_add_tail(&rst->list, &restart_handler_list); @@ -73,7 +76,7 @@ int restart_handler_register_fn(const char *name, /** * restart_handler_get_by_name() - reset the whole system */ -struct restart_handler *restart_handler_get_by_name(const char *name) +struct restart_handler *restart_handler_get_by_name(const char *name, int flags) { struct restart_handler *rst = NULL, *tmp; unsigned int priority = 0; @@ -81,6 +84,8 @@ struct restart_handler *restart_handler_get_by_name(const char *name) list_for_each_entry(tmp, &restart_handler_list, list) { if (name && tmp->name && strcmp(name, tmp->name)) continue; + if (flags && (tmp->flags & flags) != flags) + continue; if (tmp->priority > priority) { priority = tmp->priority; rst = tmp; @@ -97,7 +102,7 @@ void __noreturn restart_machine(void) { struct restart_handler *rst; - rst = restart_handler_get_by_name(NULL); + rst = restart_handler_get_by_name(NULL, 0); if (rst) { pr_debug("%s: using restart handler %s\n", __func__, rst->name); console_flush(); @@ -114,6 +119,10 @@ void restart_handlers_print(void) { struct restart_handler *tmp; - list_for_each_entry(tmp, &restart_handler_list, list) - printf("%-20s %6d\n", tmp->name, tmp->priority); + list_for_each_entry(tmp, &restart_handler_list, list) { + printf("%-20s %6d ", tmp->name, tmp->priority); + if (tmp->flags & RESTART_FLAG_WARM_BOOTROM) + putchar('W'); + putchar('\n'); + } } |