From e601ab1bb69901420ba2c55d2f2d194a38739182 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Wed, 10 Oct 2018 22:06:57 -0700 Subject: dm: util: Add a livetree equivalent API of dm_fdt_pre_reloc() This adds a new API dm_ofnode_pre_reloc(), a livetree equivalent API of dm_fdt_pre_reloc(). Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- drivers/core/util.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'drivers/core/util.c') diff --git a/drivers/core/util.c b/drivers/core/util.c index 451d4766d0..27a6848703 100644 --- a/drivers/core/util.c +++ b/drivers/core/util.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include @@ -53,3 +54,27 @@ bool dm_fdt_pre_reloc(const void *blob, int offset) return false; } + +bool dm_ofnode_pre_reloc(ofnode node) +{ + if (ofnode_read_bool(node, "u-boot,dm-pre-reloc")) + return true; + +#ifdef CONFIG_TPL_BUILD + if (ofnode_read_bool(node, "u-boot,dm-tpl")) + return true; +#elif defined(CONFIG_SPL_BUILD) + if (ofnode_read_bool(node, "u-boot,dm-spl")) + return true; +#else + /* + * In regular builds individual spl and tpl handling both + * count as handled pre-relocation for later second init. + */ + if (ofnode_read_bool(node, "u-boot,dm-spl") || + ofnode_read_bool(node, "u-boot,dm-tpl")) + return true; +#endif + + return false; +} -- cgit v1.2.1