[PATCH] uboot-mediatek: initialized the watchdog subsystem later
Enrico Mioso
mrkiko.rs at gmail.com
Wed Oct 23 10:35:28 PDT 2024
Initialize the watchdog subsystem later during initialization, to allow for
the gpio-wdt driver to work.
Signed-off-by: Enrico Mioso <mrkiko.rs at gmail.com>
---
This change was motivated due to the need of getting the gpio_wdt.c driver
working, as stated in the commit message. I also tried the bootph- flags
approach, with no success. The objective of this patch, if not accepted, is to
try to have a discussion about how this particular case may be covered.
With this patch applied, my device works as intended. I tried to leave wdt init
as early as I could while getting it working.
I imagined the following alternatives to this approach:
1. Implement a two-phase init for watchdog drivers: adding a flag to some of
so that they get initialized later. Possibly this can be indicated via DT.
2. Work on the pinctrl driver side to have it initialized earlier.
For now, I would stick to this solution until sufficient interest emerges to
determine with certainty wether we can make the bootph- approach work.
---
common/board_r.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/common/board_r.c b/common/board_r.c
index e6eab553e5..d5fe9a0d43 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -651,19 +651,13 @@ static init_fnc_t init_sequence_r[] = {
serial_initialize,
initr_announce,
dm_announce,
-#if CONFIG_IS_ENABLED(WDT)
- initr_watchdog,
-#endif
- INIT_FUNC_WATCHDOG_RESET
arch_initr_trap,
#if defined(CONFIG_BOARD_EARLY_INIT_R)
board_early_init_r,
#endif
- INIT_FUNC_WATCHDOG_RESET
#ifdef CONFIG_POST
post_output_backlog,
#endif
- INIT_FUNC_WATCHDOG_RESET
#if defined(CONFIG_PCI_INIT_R) && defined(CONFIG_SYS_EARLY_PCI_INIT)
/*
* Do early PCI configuration _before_ the flash gets initialised,
@@ -678,7 +672,6 @@ static init_fnc_t init_sequence_r[] = {
#ifdef CONFIG_MTD_NOR_FLASH
initr_flash,
#endif
- INIT_FUNC_WATCHDOG_RESET
#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_X86)
/* initialize higher level parts of CPU like time base and timers */
cpu_init_r,
@@ -707,6 +700,10 @@ static init_fnc_t init_sequence_r[] = {
#ifdef CONFIG_PVBLOCK
initr_pvblock,
#endif
+#if CONFIG_IS_ENABLED(WDT)
+ initr_watchdog,
+#endif
+ INIT_FUNC_WATCHDOG_RESET
initr_env,
#ifdef CONFIG_SYS_MALLOC_BOOTPARAMS
initr_malloc_bootparams,
--
2.46.2
More information about the openwrt-devel
mailing list