summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2015-11-05 07:46:28 -0500
committerTom Rini <trini@konsulko.com>2015-11-05 07:46:28 -0500
commit28824407f341fa424535e18e164ea94b5e2cfa8a (patch)
treee6b0e14c4845444645b28ae3a104deb3f6a8a809 /lib
parent8168ee38c26be586012743ded262145081d49d05 (diff)
parenta55f28624e97e1e43ac333c39713b8b9435fcbd3 (diff)
downloadu-boot-28824407f341fa424535e18e164ea94b5e2cfa8a.tar.gz
Merge git://git.denx.de/u-boot-socfpga
Diffstat (limited to 'lib')
-rw-r--r--lib/fdtdec_common.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/fdtdec_common.c b/lib/fdtdec_common.c
index 757931a9cb..63b704a3d7 100644
--- a/lib/fdtdec_common.c
+++ b/lib/fdtdec_common.c
@@ -36,3 +36,21 @@ int fdtdec_get_int(const void *blob, int node, const char *prop_name,
debug("(not found)\n");
return default_val;
}
+
+unsigned int fdtdec_get_uint(const void *blob, int node, const char *prop_name,
+ unsigned int default_val)
+{
+ const int *cell;
+ int len;
+
+ debug("%s: %s: ", __func__, prop_name);
+ cell = fdt_getprop(blob, node, prop_name, &len);
+ if (cell && len >= sizeof(unsigned int)) {
+ unsigned int val = fdt32_to_cpu(cell[0]);
+
+ debug("%#x (%d)\n", val, val);
+ return val;
+ }
+ debug("(not found)\n");
+ return default_val;
+}