summaryrefslogtreecommitdiff
path: root/lib/fdtdec.c
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2014-04-17 14:33:25 -0400
committerTom Rini <trini@ti.com>2014-04-17 14:33:25 -0400
commit0f507779ca00d90cdd4bcc8252630370339b7ea6 (patch)
treea91a89ac67dcbd42c8a4357501d155a129fa1e5a /lib/fdtdec.c
parent0f605c1501f6e82553e9affc6e17876a85db408c (diff)
parentece0d370144fdecb6f3ed5738ffe96f5b12f9e96 (diff)
Merge branch 'next'
Diffstat (limited to 'lib/fdtdec.c')
-rw-r--r--lib/fdtdec.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 33265ecfb2..8ecb80f162 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -3,6 +3,7 @@
* SPDX-License-Identifier: GPL-2.0+
*/
+#ifndef USE_HOSTCC
#include <common.h>
#include <serial.h>
#include <libfdt.h>
@@ -645,3 +646,22 @@ int fdtdec_read_fmap_entry(const void *blob, int node, const char *name,
return 0;
}
+#else
+#include "libfdt.h"
+#include "fdt_support.h"
+
+int fdtdec_get_int(const void *blob, int node, const char *prop_name,
+ int default_val)
+{
+ const int *cell;
+ int len;
+
+ cell = fdt_getprop_w((void *)blob, node, prop_name, &len);
+ if (cell && len >= sizeof(int)) {
+ int val = fdt32_to_cpu(cell[0]);
+
+ return val;
+ }
+ return default_val;
+}
+#endif