[U-Boot] [PATCH 07/22] dm: Build a live tree after relocation

Simon Glass sjg at chromium.org
Wed Jan 18 06:51:43 CET 2017


If enabled, build a live device tree after relocation. This can then be
used by driver model.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 common/board_r.c   | 12 ++++++++++++
 include/livetree.h |  2 ++
 2 files changed, 14 insertions(+)

diff --git a/common/board_r.c b/common/board_r.c
index a3733526c69..3c865720036 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -33,6 +33,7 @@
 #if defined(CONFIG_CMD_KGDB)
 #include <kgdb.h>
 #endif
+#include <livetree.h>
 #include <logbuff.h>
 #include <malloc.h>
 #include <mapmem.h>
@@ -314,6 +315,14 @@ static int initr_noncached(void)
 }
 #endif
 
+#ifdef CONFIG_OF_LIVE
+static int initr_livetree(void)
+{
+	return livetree_build(gd->fdt_blob,
+			      (struct device_node **)&gd->of_root);
+}
+#endif
+
 #ifdef CONFIG_DM
 static int initr_dm(void)
 {
@@ -781,6 +790,9 @@ init_fnc_t init_sequence_r[] = {
 	initr_noncached,
 #endif
 	bootstage_relocate,
+#ifdef CONFIG_OF_LIVE
+	initr_livetree,
+#endif
 #ifdef CONFIG_DM
 	initr_dm,
 #endif
diff --git a/include/livetree.h b/include/livetree.h
index aa0a8687c1b..8f8fee73114 100644
--- a/include/livetree.h
+++ b/include/livetree.h
@@ -10,6 +10,8 @@
 #ifndef _LIVETREE_H
 #define _LIVETREE_H
 
+struct device_node;
+
 /**
  * livetree_build() - build a live (hierarchical) tree from a flat DT
  *
-- 
2.11.0.483.g087da7b7c-goog



More information about the U-Boot mailing list