diff options
author | Tom Rini <trini@konsulko.com> | 2017-07-29 11:43:51 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2017-07-29 11:43:51 -0400 |
commit | 211aaf309cde193918f9a19b0b010acebfd80a82 (patch) | |
tree | 2c4ee988b53b504a64ebe286ebb6a113603056de /include/dm/read.h | |
parent | 32ca40bf8b95fa1312de52109b84f888e2ea3642 (diff) | |
parent | b108d8a0de3ddc6fe8aae55bc54e3edc69b4778b (diff) | |
download | u-boot-211aaf309cde193918f9a19b0b010acebfd80a82.tar.gz |
Merge git://git.denx.de/u-boot-usb
Diffstat (limited to 'include/dm/read.h')
-rw-r--r-- | include/dm/read.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/dm/read.h b/include/dm/read.h index c2ca7ae34d..c3a4a5611a 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -199,6 +199,24 @@ int dev_read_phandle_with_args(struct udevice *dev, const char *list_name, struct ofnode_phandle_args *out_args); /** + * dev_count_phandle_with_args() - Return phandle number in a list + * + * This function is usefull to get phandle number contained in a property list. + * For example, this allows to allocate the right amount of memory to keep + * clock's reference contained into the "clocks" property. + * + * + * @dev: device whose node containing a list + * @list_name: property name that contains a list + * @cells_name: property name that specifies phandles' arguments count + * @Returns number of phandle found on success, on error returns appropriate + * errno value. + */ + +int dev_count_phandle_with_args(struct udevice *dev, const char *list_name, + const char *cells_name); + +/** * dev_read_addr_cells() - Get the number of address cells for a device's node * * This walks back up the tree to find the closest #address-cells property @@ -416,6 +434,13 @@ static inline int dev_read_phandle_with_args(struct udevice *dev, out_args); } +static inline int dev_count_phandle_with_args(struct udevice *dev, + const char *list_name, const char *cells_name) +{ + return ofnode_count_phandle_with_args(dev_ofnode(dev), list_name, + cells_name); +} + static inline int dev_read_addr_cells(struct udevice *dev) { /* NOTE: this call should walk up the parent stack */ |