summaryrefslogtreecommitdiffstats
path: root/lib/fdtdec.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2014-07-23 06:55:16 -0600
committerSimon Glass <sjg@chromium.org>2014-07-23 14:07:26 +0100
commit3234aa4babd79bf92239409145db4fda2f505051 (patch)
tree61691075181b112acc3326a982026f01ea2770c5 /lib/fdtdec.c
parentc910e2e2da49036496a5b8b34425043675218d51 (diff)
downloadblackbird-obmc-uboot-3234aa4babd79bf92239409145db4fda2f505051.tar.gz
blackbird-obmc-uboot-3234aa4babd79bf92239409145db4fda2f505051.zip
fdt: Add a function to get the node offset of an alias
This simple function returns the node offset of a named alias. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/fdtdec.c')
-rw-r--r--lib/fdtdec.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 1b4ae9f417..eb5aa20526 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -365,6 +365,21 @@ int fdtdec_get_alias_seq(const void *blob, const char *base, int offset,
return -ENOENT;
}
+int fdtdec_get_alias_node(const void *blob, const char *name)
+{
+ const char *prop;
+ int alias_node;
+ int len;
+
+ if (!blob)
+ return -FDT_ERR_NOTFOUND;
+ alias_node = fdt_path_offset(blob, "/aliases");
+ prop = fdt_getprop(blob, alias_node, name, &len);
+ if (!prop)
+ return -FDT_ERR_NOTFOUND;
+ return fdt_path_offset(blob, prop);
+}
+
int fdtdec_check_fdt(void)
{
/*
OpenPOWER on IntegriCloud