diff options
author | Michal Simek <michal.simek@xilinx.com> | 2019-01-31 16:30:59 +0100 |
---|---|---|
committer | Heiko Schocher <hs@denx.de> | 2019-02-08 06:25:32 +0100 |
commit | 83e4c7e9ffa57fe4116967999c223c952a46a78a (patch) | |
tree | e02bb6b75e64b116d0d9011a1762e033000004ea /include | |
parent | 003c9dc89176cacc9996f737d08490805e29582e (diff) | |
download | u-boot-83e4c7e9ffa57fe4116967999c223c952a46a78a.zip u-boot-83e4c7e9ffa57fe4116967999c223c952a46a78a.tar.gz u-boot-83e4c7e9ffa57fe4116967999c223c952a46a78a.tar.bz2 |
dm: core: Introduce dev_read_alias_highest_id()
It is wrapper for calling of_alias_get_highest_id() when live tree is
enabled and fdtdec_get_alias_highest_id() if not.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/dm/read.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/dm/read.h b/include/dm/read.h index 389e30e..60b727c 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -510,6 +510,17 @@ int dev_read_resource_byname(struct udevice *dev, const char *name, * @return the translated address; OF_BAD_ADDR on error */ u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr); + +/** + * dev_read_alias_highest_id - Get highest alias id for the given stem + * @stem: Alias stem to be examined + * + * The function travels the lookup table to get the highest alias id for the + * given alias stem. + * @return alias ID, if found, else -1 + */ +int dev_read_alias_highest_id(const char *stem); + #else /* CONFIG_DM_DEV_READ_INLINE is enabled */ static inline int dev_read_u32(struct udevice *dev, @@ -740,6 +751,11 @@ static inline u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_a return ofnode_translate_address(dev_ofnode(dev), in_addr); } +static inline int dev_read_alias_highest_id(const char *stem) +{ + return fdtdec_get_alias_highest_id(gd->fdt_blob, stem); +} + #endif /* CONFIG_DM_DEV_READ_INLINE */ /** |