[PATCH v2 1/2] dm: event: add EVT_DM_POST_INIT_R event type

Chanho Park chanho61.park at samsung.com
Fri Aug 18 07:11:02 CEST 2023


This patch introduces EVT_DM_POST_INIT_R event type for handling hooks
after relocation.

Fixes: 55171aedda88 ("dm: Emit the arch_cpu_init_dm() even only before relocation")
Suggested-by: Simon Glass <sjg at chromium.org>
Cc: Bin Meng <bmeng.cn at gmail.com>
Signed-off-by: Chanho Park <chanho61.park at samsung.com>
---
 drivers/core/root.c | 6 ++++--
 include/event.h     | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/core/root.c b/drivers/core/root.c
index 6775fb0b6575..79d871ab291a 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -436,8 +436,10 @@ int dm_init_and_scan(bool pre_reloc_only)
 			return ret;
 		}
 	}
-	if (CONFIG_IS_ENABLED(DM_EVENT) && !(gd->flags & GD_FLG_RELOC)) {
-		ret = event_notify_null(EVT_DM_POST_INIT_F);
+	if (CONFIG_IS_ENABLED(DM_EVENT)) {
+		ret = event_notify_null(gd->flags & GD_FLG_RELOC ?
+					EVT_DM_POST_INIT_R :
+					EVT_DM_POST_INIT_F);
 		if (ret)
 			return log_msg_ret("ev", ret);
 	}
diff --git a/include/event.h b/include/event.h
index daf44bf8a83b..bb38ba98e73b 100644
--- a/include/event.h
+++ b/include/event.h
@@ -24,6 +24,7 @@ enum event_t {
 
 	/* Events related to driver model */
 	EVT_DM_POST_INIT_F,
+	EVT_DM_POST_INIT_R,
 	EVT_DM_PRE_PROBE,
 	EVT_DM_POST_PROBE,
 	EVT_DM_PRE_REMOVE,
-- 
2.39.2



More information about the U-Boot mailing list