aboutsummaryrefslogtreecommitdiff
path: root/drivers/core/ofnode.c
diff options
context:
space:
mode:
authorSimon Glass2022-09-06 20:27:22 -0600
committerTom Rini2022-09-29 22:43:43 -0400
commit928d267aeea9406497c8060c03d3a0a78a8cbaa9 (patch)
tree443df55e9b11f345966d076f6877e4f7ddcbc7dd /drivers/core/ofnode.c
parent085d59411ca7cde4ca5c70beeab4fdcea209aed6 (diff)
dm: core: Add a way to look up a phandle in an oftree
When we have multiple trees, the ofnode logic needs to be told which one to use. Create a new function which takes an oftree argument, along with a helper to obtain the FDT pointer from an oftree. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/ofnode.c')
-rw-r--r--drivers/core/ofnode.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 48d4dec1ccb..012cb8cddaa 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -410,6 +410,20 @@ ofnode ofnode_get_by_phandle(uint phandle)
return node;
}
+ofnode oftree_get_by_phandle(oftree tree, uint phandle)
+{
+ ofnode node;
+
+ if (of_live_active())
+ node = np_to_ofnode(of_find_node_by_phandle(tree.np, phandle));
+ else
+ node.of_offset =
+ fdt_node_offset_by_phandle(oftree_lookup_fdt(tree),
+ phandle);
+
+ return node;
+}
+
static fdt_addr_t __ofnode_get_addr_size_index(ofnode node, int index,
fdt_size_t *size, bool translate)
{