summaryrefslogtreecommitdiff
path: root/drivers/core
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/core')
-rw-r--r--drivers/core/of_access.c18
-rw-r--r--drivers/core/read.c8
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/core/of_access.c b/drivers/core/of_access.c
index 14c020a687b..945b81448cc 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 3c46b3674ed..6bda077a34b 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);
+}