[PATCH 06/20] linux/of.h: Add of_read_number()
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Jan 19 13:53:56 UTC 2018
---
rtemsbsd/powerpc/include/linux/of.h | 2 ++
rtemsbsd/sys/powerpc/compat.c | 16 ++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/rtemsbsd/powerpc/include/linux/of.h b/rtemsbsd/powerpc/include/linux/of.h
index 5ab543142..8ef046975 100644
--- a/rtemsbsd/powerpc/include/linux/of.h
+++ b/rtemsbsd/powerpc/include/linux/of.h
@@ -76,6 +76,8 @@ of_property_read_u32(const struct device_node *dn, const char *name, u32 *val)
return (of_property_read_u32_array(dn, name, val, 1));
}
+uint64_t of_read_number(const uint32_t *cell, int size);
+
struct device_node *of_parse_phandle(struct device_node *dns,
struct device_node *dn, const char *phandle_name, int index);
diff --git a/rtemsbsd/sys/powerpc/compat.c b/rtemsbsd/sys/powerpc/compat.c
index 2ff85f450..400eac578 100644
--- a/rtemsbsd/sys/powerpc/compat.c
+++ b/rtemsbsd/sys/powerpc/compat.c
@@ -121,6 +121,22 @@ of_find_compatible_node(struct device_node *dns, const struct device_node *dn,
}
}
+uint64_t
+of_read_number(const uint32_t *cell, int size)
+{
+ uint64_t number;
+
+ number = 0;
+
+ while (size > 0) {
+ number = (number << 32) | fdt32_to_cpu(*cell);
+ ++cell;
+ --size;
+ }
+
+ return (number);
+}
+
struct device_node *
of_parse_phandle(struct device_node *dns, struct device_node *dn,
const char *phandle_name, int index)
--
2.12.3
More information about the devel
mailing list