@@ -548,6 +548,29 @@ const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
}
EXPORT_SYMBOL_GPL(of_prop_next_u32);
+const __be64 *of_prop_next_u64(struct property *prop, const __be64 *cur,
+ u64 *pu)
+{
+ const void *curv = cur;
+
+ if (!prop)
+ return NULL;
+
+ if (!cur) {
+ curv = prop->value;
+ goto out_val;
+ }
+
+ curv += sizeof(*cur);
+ if (curv >= prop->value + prop->length)
+ return NULL;
+
+out_val:
+ *pu = be64_to_cpup(curv);
+ return curv;
+}
+EXPORT_SYMBOL_GPL(of_prop_next_u64);
+
const char *of_prop_next_string(struct property *prop, const char *cur)
{
const void *curv = cur;
@@ -437,6 +437,16 @@ extern int of_detach_node(struct device_node *);
*/
const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
u32 *pu);
+
+/*
+ * u64 u;
+ *
+ * of_property_for_each_u64(np, "propname", u)
+ * printk("U64 value: %llx\n", u);
+ */
+const __be64 *of_prop_next_u64(struct property *prop, const __be64 *cur,
+ u64 *pu);
+
/*
* struct property *prop;
* const char *s;
@@ -832,6 +842,12 @@ static inline const __be32 *of_prop_next_u32(struct property *prop,
return NULL;
}
+static inline const __be64 *of_prop_next_u64(struct property *prop,
+ const __be64 *cur, u64 *pu)
+{
+ return NULL;
+}
+
static inline const char *of_prop_next_string(struct property *prop,
const char *cur)
{
@@ -1436,6 +1452,13 @@ static inline int of_property_read_s32(const struct device_node *np,
_it.item; \
_it.item = of_prop_next_u32(_it.prop, _it.item, &u))
+#define of_property_for_each_u64(np, propname, u) \
+ for (struct {struct property *prop; const __be64 *item; } _it = \
+ {of_find_property(np, propname, NULL), \
+ of_prop_next_u64(_it.prop, NULL, &u)}; \
+ _it.item; \
+ _it.item = of_prop_next_u64(_it.prop, _it.item, &u))
+
#define of_property_for_each_string(np, propname, prop, s) \
for (prop = of_find_property(np, propname, NULL), \
s = of_prop_next_string(prop, NULL); \