summaryrefslogtreecommitdiff
path: root/drivers/core/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/core/util.c')
-rw-r--r--drivers/core/util.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/core/util.c b/drivers/core/util.c
index e01dd06..bd4de7a 100644
--- a/drivers/core/util.c
+++ b/drivers/core/util.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <libfdt.h>
#include <vsprintf.h>
void dm_warn(const char *fmt, ...)
@@ -35,3 +36,27 @@ int list_count_items(struct list_head *head)
return count;
}
+
+int dm_fdt_pre_reloc(const void *blob, int offset)
+{
+ if (fdt_getprop(blob, offset, "u-boot,dm-pre-reloc", NULL))
+ return 1;
+
+#ifdef CONFIG_TPL_BUILD
+ if (fdt_getprop(blob, offset, "u-boot,dm-tpl", NULL))
+ return 1;
+#elif defined(CONFIG_SPL_BUILD)
+ if (fdt_getprop(blob, offset, "u-boot,dm-spl", NULL))
+ return 1;
+#else
+ /*
+ * In regular builds individual spl and tpl handling both
+ * count as handled pre-relocation for later second init.
+ */
+ if (fdt_getprop(blob, offset, "u-boot,dm-spl", NULL) ||
+ fdt_getprop(blob, offset, "u-boot,dm-tpl", NULL))
+ return 1;
+#endif
+
+ return 0;
+}