summaryrefslogtreecommitdiff
path: root/drivers/core/ofnode.c
diff options
context:
space:
mode:
authorChristian Marangi <ansuelsmth@gmail.com>2024-10-01 14:24:35 +0200
committerTom Rini <trini@konsulko.com>2024-10-10 16:02:20 -0600
commit30f6ea513859f240f12d0399f22ce459d0c856c3 (patch)
tree6ace899ec630218022373a48a115c498785b6c52 /drivers/core/ofnode.c
parent9e3d83301e4f34064e09376bb6f2e199f21411de (diff)
dm: core: implement ofnode_options helpers
Implement ofnode_options helpers to read options in /options/u-boot to adapt to the new way to declare options as described in [1]. [1] dtschema/schemas/options/u-boot.yaml Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/ofnode.c')
-rw-r--r--drivers/core/ofnode.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 7e3b3719d18..677d51ef938 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -1735,6 +1735,39 @@ const char *ofnode_conf_read_str(const char *prop_name)
return ofnode_read_string(node, prop_name);
}
+bool ofnode_options_read_bool(const char *prop_name)
+{
+ ofnode uboot;
+
+ uboot = ofnode_path("/options/u-boot");
+ if (!ofnode_valid(uboot))
+ return false;
+
+ return ofnode_read_bool(uboot, prop_name);
+}
+
+int ofnode_options_read_int(const char *prop_name, int default_val)
+{
+ ofnode uboot;
+
+ uboot = ofnode_path("/options/u-boot");
+ if (!ofnode_valid(uboot))
+ return default_val;
+
+ return ofnode_read_u32_default(uboot, prop_name, default_val);
+}
+
+const char *ofnode_options_read_str(const char *prop_name)
+{
+ ofnode uboot;
+
+ uboot = ofnode_path("/options/u-boot");
+ if (!ofnode_valid(uboot))
+ return NULL;
+
+ return ofnode_read_string(uboot, prop_name);
+}
+
int ofnode_read_bootscript_address(u64 *bootscr_address, u64 *bootscr_offset)
{
int ret;