diff options
author | Tom Rini | 2022-01-20 12:40:20 -0500 |
---|---|---|
committer | Tom Rini | 2022-01-20 12:40:20 -0500 |
commit | 2d7a463e82daeba4f6a7fb59bac0fe94d6f6d3a2 (patch) | |
tree | 96e28ce689933dd4ebd120309a9caa2e02897d48 /common/fdt_support.c | |
parent | 3918376e91dac7711cf04bd06f8de80e797edfea (diff) | |
parent | 8f880c3d89432e9988b23bb7099d6360c14a206f (diff) |
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell
- fdt_support: Add fdt_for_each_node_by_compatible() helper macro
(Marek)
- turris_omnia: Fixup SATA or PCIe nodes at runtime in DT blob (Pali)
- pci_mvebu: Add support for Kirkwood PCIe controllers (Pali)
- SPL: More verifications for kwbimage in SPL (Pali)
- mvebu: Remove comphy_update_map() (Pali)
- Minor misc stuff
Diffstat (limited to 'common/fdt_support.c')
-rw-r--r-- | common/fdt_support.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/common/fdt_support.c b/common/fdt_support.c index efbd900e1f4..daa24d4c10b 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -371,12 +371,9 @@ void do_fixup_by_compat(void *fdt, const char *compat, debug(" %.2x", *(u8*)(val+i)); debug("\n"); #endif - off = fdt_node_offset_by_compatible(fdt, -1, compat); - while (off != -FDT_ERR_NOTFOUND) { + fdt_for_each_node_by_compatible(off, fdt, -1, compat) if (create || (fdt_get_property(fdt, off, prop, NULL) != NULL)) fdt_setprop(fdt, off, prop, val, len); - off = fdt_node_offset_by_compatible(fdt, off, compat); - } } void do_fixup_by_compat_u32(void *fdt, const char *compat, @@ -996,10 +993,9 @@ void fdt_fixup_mtdparts(void *blob, const struct node_info *node_info, for (i = 0; i < node_info_size; i++) { idx = 0; - noff = -1; - while ((noff = fdt_node_offset_by_compatible(blob, noff, - node_info[i].compat)) >= 0) { + fdt_for_each_node_by_compatible(noff, blob, -1, + node_info[i].compat) { const char *prop; prop = fdt_getprop(blob, noff, "status", NULL); @@ -1473,14 +1469,12 @@ out: int fdt_node_offset_by_compat_reg(void *blob, const char *compat, phys_addr_t compat_off) { - int len, off = fdt_node_offset_by_compatible(blob, -1, compat); - while (off != -FDT_ERR_NOTFOUND) { + int len, off; + + fdt_for_each_node_by_compatible(off, blob, -1, compat) { const fdt32_t *reg = fdt_getprop(blob, off, "reg", &len); - if (reg) { - if (compat_off == fdt_translate_address(blob, off, reg)) - return off; - } - off = fdt_node_offset_by_compatible(blob, off, compat); + if (reg && compat_off == fdt_translate_address(blob, off, reg)) + return off; } return -FDT_ERR_NOTFOUND; |