mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-17 02:15:02 +00:00
dm: core: implement phandle ofnode_options helper
Implement ofnode_options phandle helper to get an ofnode from a phandle option in /options/u-boot. This helper can be useful since new DT yaml usually require to link a phandle of a node instead of referencing it by name or other indirect way. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
2c19bd15ea
commit
cab275c446
2 changed files with 30 additions and 0 deletions
|
@ -1871,6 +1871,21 @@ const char *ofnode_options_read_str(const char *prop_name)
|
|||
return ofnode_read_string(uboot, prop_name);
|
||||
}
|
||||
|
||||
int ofnode_options_get_by_phandle(const char *prop_name, ofnode *nodep)
|
||||
{
|
||||
ofnode uboot;
|
||||
|
||||
uboot = ofnode_path("/options/u-boot");
|
||||
if (!ofnode_valid(uboot))
|
||||
return -EINVAL;
|
||||
|
||||
*nodep = ofnode_parse_phandle(uboot, prop_name, 0);
|
||||
if (!ofnode_valid(*nodep))
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ofnode_read_bootscript_address(u64 *bootscr_address, u64 *bootscr_offset)
|
||||
{
|
||||
int ret;
|
||||
|
|
|
@ -1720,6 +1720,21 @@ int ofnode_options_read_int(const char *prop_name, int default_val);
|
|||
*/
|
||||
const char *ofnode_options_read_str(const char *prop_name);
|
||||
|
||||
/**
|
||||
* ofnode_options_get_by_phandle() - Get a ofnode from phandle from the U-Boot options
|
||||
*
|
||||
* This reads a property from the /options/u-boot/ node of the devicetree.
|
||||
*
|
||||
* This only works with the control FDT.
|
||||
*
|
||||
* See dtschema/schemas/options/u-boot.yaml in dt-schema project for bindings
|
||||
*
|
||||
* @prop_name: property name to look up
|
||||
* @nodep: pointer to ofnode where node is stored
|
||||
* Return: 0, if found, or negative error if not
|
||||
*/
|
||||
int ofnode_options_get_by_phandle(const char *prop_name, ofnode *nodep);
|
||||
|
||||
/**
|
||||
* ofnode_read_bootscript_address() - Read bootscr-address or bootscr-ram-offset
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue