From 42fdcebf859f93139d58defd5abef44dedb9b17a Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 4 Mar 2022 08:43:04 -0700 Subject: event: Convert misc_init_f() to use events This hook can be implmented using events, for the three boards that actually use it. Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we can just use CONFIG_EVENT to control this. Since sandbox always enables CONFIG_EVENT, we can drop the defconfig lines there too. Signed-off-by: Simon Glass --- common/Kconfig | 6 ------ common/board_f.c | 7 +++++-- common/event.c | 3 +++ 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'common') diff --git a/common/Kconfig b/common/Kconfig index cabc24f..24c83f0 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -589,12 +589,6 @@ config LAST_STAGE_INIT U-Boot calls last_stage_init() before the command-line interpreter is started. -config MISC_INIT_F - bool "Execute pre-relocation misc init" - help - Enabling this option calls the 'misc_init_f' function in the init - sequence just before DRAM is inited. - config MISC_INIT_R bool "Execute Misc Init" default y if ARCH_KEYSTONE || ARCH_SUNXI || MPC85xx diff --git a/common/board_f.c b/common/board_f.c index e36bdbc..0ef34c7 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -818,6 +818,11 @@ __weak int clear_bss(void) return 0; } +static int misc_init_f(void) +{ + return event_notify_null(EVT_MISC_INIT_F); +} + static const init_fnc_t init_sequence_f[] = { setup_mon_len, #ifdef CONFIG_OF_CONTROL @@ -877,9 +882,7 @@ static const init_fnc_t init_sequence_f[] = { show_board_info, #endif INIT_FUNC_WATCHDOG_INIT -#if defined(CONFIG_MISC_INIT_F) misc_init_f, -#endif INIT_FUNC_WATCHDOG_RESET #if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) init_func_i2c, diff --git a/common/event.c b/common/event.c index 737d3ac..4270809 100644 --- a/common/event.c +++ b/common/event.c @@ -30,6 +30,9 @@ const char *const type_name[] = { "dm_post_probe", "dm_pre_remove", "dm_post_remove", + + /* init hooks */ + "misc_init_f", }; _Static_assert(ARRAY_SIZE(type_name) == EVT_COUNT, "event type_name size"); -- cgit v1.1