[PATCH] event: add an event for livetree fixups
Caleb Connolly
caleb.connolly at linaro.org
Fri Apr 12 21:04:02 CEST 2024
Introduce a new EVT_OF_LIVE event to allow for the livetree to be
modified before dm_init_and_scan(). Boards can perform fixups here to
handle incompatibilities between U-Boot drivers and upstream DT.
This will be used by Qualcomm platforms in future patches to enable
setting the dr_mode property if the board doesn't provide one. This has to be
set before dm_init_and_scan() is called as this property effects the binding of
drivers.
Signed-off-by: Caleb Connolly <caleb.connolly at linaro.org>
---
common/board_r.c | 1 +
common/event.c | 2 ++
include/event.h | 12 ++++++++++++
3 files changed, 15 insertions(+)
diff --git a/common/board_r.c b/common/board_r.c
index da0b80f24ff0..7d2da51193ab 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -217,8 +217,9 @@ static int initr_of_live(void)
(struct device_node **)gd_of_root_ptr());
bootstage_accum(BOOTSTAGE_ID_ACCUM_OF_LIVE);
if (ret)
return ret;
+ event_notify_null(EVT_OF_LIVE);
}
return 0;
}
diff --git a/common/event.c b/common/event.c
index 16c2ba6cc921..db32ea0d06f8 100644
--- a/common/event.c
+++ b/common/event.c
@@ -45,8 +45,10 @@ const char *const type_name[] = {
/* fdt hooks */
"ft_fixup",
+ "of_live",
+
/* main loop events */
"main_loop",
};
diff --git a/include/event.h b/include/event.h
index a8f046da3c32..c6436c07d16f 100644
--- a/include/event.h
+++ b/include/event.h
@@ -144,8 +144,20 @@ enum event_t {
* images fail.
*/
EVT_FT_FIXUP,
+ /**
+ * @EVT_OF_LIVE:
+ * This event is triggered when using CONFIG_OF_LIVE immediately after
+ * the live tree has been created. It has no parameters, the live tree
+ * can be accessed from gd->of_root, or using the of_* helpers.
+ *
+ * This is intended to be used for performing board specific fixups
+ * on the tree before it is used by U-Boot. It is much more efficient
+ * to access and modify than the FDT.
+ */
+ EVT_OF_LIVE,
+
/**
* @EVT_MAIN_LOOP:
* This event is triggered immediately before calling main_loop() which
* is the entry point of the command line. Its parameter is NULL.
--
2.44.0
More information about the U-Boot
mailing list