aboutsummaryrefslogtreecommitdiff
path: root/include/dm/ofnode.h
diff options
context:
space:
mode:
authorSimon Glass2020-11-28 17:50:07 -0700
committerSimon Glass2020-12-13 07:58:18 -0700
commitd0c20ce6bcb9af3d70ed6ada618607ca1099e811 (patch)
treebc04f32a35dfd54b571512fa792085130d228ed4 /include/dm/ofnode.h
parente80be7493412e0facbbf81f709dc44740e975dea (diff)
dm: core: Add an ofnode function to get the devicetree root
This is needed in at least one place. Avoid the conditional code in root.c by adding this inline function. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/dm/ofnode.h')
-rw-r--r--include/dm/ofnode.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index ee8c44a71ec..53f04ac91d0 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -218,6 +218,18 @@ static inline ofnode ofnode_null(void)
return node;
}
+static inline ofnode ofnode_root(void)
+{
+ ofnode node;
+
+ if (of_live_active())
+ node.np = gd_of_root();
+ else
+ node.of_offset = 0;
+
+ return node;
+}
+
/**
* ofnode_read_u32() - Read a 32-bit integer from a property
*