From 27326c7ee269ff351bba8c2461e19f29d66b6a3a Mon Sep 17 00:00:00 2001 From: Heiko Stübner Date: Sat, 18 Feb 2017 19:46:21 +0100 Subject: dm: allow limiting pre-reloc markings to spl or tpl Right now the u-boot,dm-pre-reloc flag will make each marked node always appear in both spl and tpl. But systems needing an additional tpl might have special constraints for each, like the spl needing to be very tiny. So introduce two additional flags to mark nodes for only spl or tpl environments and introduce a function dm_fdt_pre_reloc to automate the necessary checks in code instances checking for pre-relocation flags. The behaviour of the original flag stays untouched and still marks a node for both spl and tpl. Signed-off-by: Heiko Stuebner Reviewed-by: Simon Glass Tested-by: Kever Yang --- 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 e01dd06d28..bd4de7acd6 100644 --- a/drivers/core/util.c +++ b/drivers/core/util.c @@ -5,6 +5,7 @@ */ #include +#include #include 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; +} -- cgit v1.2.3