[U-Boot] [PATCH 04/10] fdt: Add fdt_sizecell & fdt_addrcell helpers

Kumar Gala galak at kernel.crashing.org
Thu Oct 23 08:26:42 CEST 2008


Add helper functions to return top level #size-cell and #address-cell info

Signed-off-by: Kumar Gala <galak at kernel.crashing.org>
---
 include/fdt_support.h |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/include/fdt_support.h b/include/fdt_support.h
index ceaadc2..aa9d86b 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -28,6 +28,24 @@
 
 #include <fdt.h>
 
+static inline int fdt_addrcell(void *blob) {
+	const u32 *addrcell = fdt_getprop(blob, 0, "#address-cells", NULL);
+
+	if (addrcell)
+		return *addrcell;
+	else
+		return 1;
+}
+
+static inline int fdt_sizecell(void *blob) {
+	const u32 *sizecell = fdt_getprop(blob, 0, "#size-cells", NULL);
+
+	if (sizecell)
+		return *sizecell;
+	else
+		return 1;
+}
+
 int fdt_chosen(void *fdt, int force);
 int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force);
 void do_fixup_by_path(void *fdt, const char *path, const char *prop,
-- 
1.5.5.1



More information about the U-Boot mailing list