diff options
author | Marek BehĂșn | 2022-01-20 01:04:42 +0100 |
---|---|---|
committer | Stefan Roese | 2022-01-20 11:35:29 +0100 |
commit | 3058e283b885d80fbaaaaed6f597a068188be948 (patch) | |
tree | 3acad866dc7b75435b3bf1972ab7323257b707cc /board/congatec | |
parent | 068415eadefbbc81f14d4ce61fcf7a7eb39650d4 (diff) |
fdt_support: Add fdt_for_each_node_by_compatible() helper macro
Add macro fdt_for_each_node_by_compatible() to allow iterating over
fdt nodes by compatible string.
Convert various usages of
off = fdt_node_offset_by_compatible(fdt, start, compat);
while (off > 0) {
code();
off = fdt_node_offset_by_compatible(fdt, off, compat);
}
and similar, to
fdt_for_each_node_by_compatible(off, fdt, start, compat)
code();
Signed-off-by: Marek BehĂșn <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'board/congatec')
-rw-r--r-- | board/congatec/cgtqmx8/spl.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/board/congatec/cgtqmx8/spl.c b/board/congatec/cgtqmx8/spl.c index 37b7221c52a..dea34e4dc63 100644 --- a/board/congatec/cgtqmx8/spl.c +++ b/board/congatec/cgtqmx8/spl.c @@ -6,6 +6,7 @@ #include <common.h> #include <dm.h> +#include <fdt_support.h> #include <init.h> #include <log.h> #include <spl.h> @@ -29,13 +30,10 @@ void spl_board_init(void) continue; } - offset = fdt_node_offset_by_compatible(gd->fdt_blob, -1, "nxp,imx8-pd"); - while (offset != -FDT_ERR_NOTFOUND) { + fdt_for_each_node_by_compatible(offset, gd->fdt_blob, -1, + "nxp,imx8-pd") lists_bind_fdt(gd->dm_root, offset_to_ofnode(offset), NULL, NULL, true); - offset = fdt_node_offset_by_compatible(gd->fdt_blob, offset, - "nxp,imx8-pd"); - } uclass_find_first_device(UCLASS_POWER_DOMAIN, &dev); |