summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorArnab Basu <arnab.basu@freescale.com>2014-09-08 12:19:58 -0700
committerYork Sun <yorksun@freescale.com>2014-09-25 08:36:19 -0700
commit08df4a21c7d580770cabd7ba62591da035d9a545 (patch)
tree727980ab5b4e8a731550bd4c1b256edcc72fd0bb /include
parentbb5783224b9b12eecf406761f82e3de2a2ca9dae (diff)
downloadu-boot-imx-08df4a21c7d580770cabd7ba62591da035d9a545.zip
u-boot-imx-08df4a21c7d580770cabd7ba62591da035d9a545.tar.gz
u-boot-imx-08df4a21c7d580770cabd7ba62591da035d9a545.tar.bz2
fdt_support: Move of_read_number to fdt_support.h
This is being done so that it can be used outside 'fdt_support.c'. Making life more convenient when reading device node properties that can be 32 or 64 bits long. Signed-off-by: Arnab Basu <arnab.basu@freescale.com> Cc: Scott Wood <scottwood@freescale.com>
Diffstat (limited to 'include')
-rw-r--r--include/fdt_support.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 1bda686..649fbd6 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -133,6 +133,15 @@ static inline int fdt_status_fail_by_alias(void *fdt, const char *alias)
return fdt_set_status_by_alias(fdt, alias, FDT_STATUS_FAIL, 0);
}
+/* Helper to read a big number; size is in cells (not bytes) */
+static inline u64 of_read_number(const fdt32_t *cell, int size)
+{
+ u64 r = 0;
+ while (size--)
+ r = (r << 32) | fdt32_to_cpu(*(cell++));
+ return r;
+}
+
#endif /* ifdef CONFIG_OF_LIBFDT */
#ifdef USE_HOSTCC