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>
This commit is contained in:
Christian Marangi
2024-10-10 16:02:20 -06:00
committed by Tom Rini
parent 9e3d83301e
commit 30f6ea5138
2 changed files with 74 additions and 0 deletions
+33
View File
@@ -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;