1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-03 17:52:07 +02:00

dm: core: ofnode: Add ofnode_read_bootscript_address()

ofnode_read_bootscript_address() reads bootscript address from
/options/u-boot DT node. bootscr-address or bootscr-ram-offset properties
are read and values are filled. bootscr-address has higher priority than
bootscr-ram-offset and the only one should be described in DT.

Also add test to cover this new function.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/23be3838502efef61803c90ef6e8b32bbd6ede41.1693465140.git.michal.simek@amd.com
This commit is contained in:
Michal Simek
2023-08-31 08:59:05 +02:00
parent 99b46477e3
commit db5e349d3d
4 changed files with 72 additions and 0 deletions

View File

@@ -1593,6 +1593,31 @@ const char *ofnode_conf_read_str(const char *prop_name)
return ofnode_read_string(node, prop_name);
}
int ofnode_read_bootscript_address(u64 *bootscr_address, u64 *bootscr_offset)
{
int ret;
ofnode uboot;
*bootscr_address = 0;
*bootscr_offset = 0;
uboot = ofnode_path("/options/u-boot");
if (!ofnode_valid(uboot)) {
printf("%s: Missing /u-boot node\n", __func__);
return -EINVAL;
}
ret = ofnode_read_u64(uboot, "bootscr-address", bootscr_address);
if (ret) {
ret = ofnode_read_u64(uboot, "bootscr-ram-offset",
bootscr_offset);
if (ret)
return -EINVAL;
}
return 0;
}
ofnode ofnode_get_phy_node(ofnode node)
{
/* DT node properties that reference a PHY node */