summaryrefslogtreecommitdiffstats
path: root/lib/fdtdec_common.c
diff options
context:
space:
mode:
authorChin Liang See <clsee@altera.com>2015-10-17 08:30:32 -0500
committerMarek Vasut <marex@denx.de>2015-11-05 02:34:14 +0100
commitbfa3e55b440e120739d2b4dd4cb57e6b40752113 (patch)
tree0c4f2127712b1f0f2cee3dbc43c90203d584c5f5 /lib/fdtdec_common.c
parentc624d07f3ff7ae7d29672bab189d2aeb99c63a95 (diff)
downloadtalos-obmc-uboot-bfa3e55b440e120739d2b4dd4cb57e6b40752113.tar.gz
talos-obmc-uboot-bfa3e55b440e120739d2b4dd4cb57e6b40752113.zip
lib, fdt: Adding fdtdec_get_uint function
Adding fdtdec_get_uint function which is the unsigned version for fdtdec_get_int Signed-off-by: Chin Liang See <clsee@altera.com> Cc: Dinh Nguyen <dinguyen@opensource.altera.com> Cc: Dinh Nguyen <dinh.linux@gmail.com> Cc: Marek Vasut <marex@denx.de> Cc: Stefan Roese <sr@denx.de> Cc: Vikas Manocha <vikas.manocha@st.com> Cc: Jagannadh Teki <jteki@openedev.com> Cc: Pavel Machek <pavel@denx.de> Cc: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'lib/fdtdec_common.c')
-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;
+}
OpenPOWER on IntegriCloud