diff options
author | Tom Rini <trini@konsulko.com> | 2019-02-11 19:15:34 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-02-11 19:15:34 +0300 |
commit | f94fa0e94f36c740d3c7aa314c89a750c742185b (patch) | |
tree | 42077386d60386628bed02011566ddf990913eb8 /drivers/core | |
parent | f49929772c5ea22e4af987bfb1e5ae13e9895093 (diff) | |
parent | c4bd12a7dad43ed9de3070c7c5e8b690d8c03a79 (diff) | |
download | u-boot-f94fa0e94f36c740d3c7aa314c89a750c742185b.tar.xz |
Merge branch 'master' of git://git.denx.de/u-boot-i2c
- DM I2C improvements
Diffstat (limited to 'drivers/core')
-rw-r--r-- | drivers/core/of_access.c | 18 | ||||
-rw-r--r-- | drivers/core/read.c | 8 |
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/core/of_access.c b/drivers/core/of_access.c index 14c020a687..945b81448c 100644 --- a/drivers/core/of_access.c +++ b/drivers/core/of_access.c @@ -812,6 +812,24 @@ int of_alias_get_id(const struct device_node *np, const char *stem) return id; } +int of_alias_get_highest_id(const char *stem) +{ + struct alias_prop *app; + int id = -1; + + mutex_lock(&of_mutex); + list_for_each_entry(app, &aliases_lookup, link) { + if (strcmp(app->stem, stem) != 0) + continue; + + if (app->id > id) + id = app->id; + } + mutex_unlock(&of_mutex); + + return id; +} + struct device_node *of_get_stdout(void) { return of_stdout; diff --git a/drivers/core/read.c b/drivers/core/read.c index 3c46b3674e..6bda077a34 100644 --- a/drivers/core/read.c +++ b/drivers/core/read.c @@ -264,3 +264,11 @@ u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr) { return ofnode_translate_address(dev_ofnode(dev), in_addr); } + +int dev_read_alias_highest_id(const char *stem) +{ + if (of_live_active()) + return of_alias_get_highest_id(stem); + + return fdtdec_get_alias_highest_id(gd->fdt_blob, stem); +} |