aboutsummaryrefslogtreecommitdiffstats
path: root/common/fdt_wrappers.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/fdt_wrappers.c')
-rw-r--r--common/fdt_wrappers.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/common/fdt_wrappers.c b/common/fdt_wrappers.c
index 842d71339..2c4b9c353 100644
--- a/common/fdt_wrappers.c
+++ b/common/fdt_wrappers.c
@@ -276,3 +276,21 @@ int fdt_get_reg_props_by_index(const void *dtb, int node, int index,
return 0;
}
+
+/*******************************************************************************
+ * This function fills reg node info (base & size) with an index found by
+ * checking the reg-names node.
+ * Returns 0 on success and a negative FDT error code on failure.
+ ******************************************************************************/
+int fdt_get_reg_props_by_name(const void *dtb, int node, const char *name,
+ uintptr_t *base, size_t *size)
+{
+ int index;
+
+ index = fdt_stringlist_search(dtb, node, "reg-names", name);
+ if (index < 0) {
+ return index;
+ }
+
+ return fdt_get_reg_props_by_index(dtb, node, index, base, size);
+}