The counterpart to of_read_number: Write a 32bit or 64bit
number to a devicetree.

Signed-off-by: Sascha Hauer <s.ha...@pengutronix.de>
---
 include/of.h |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/of.h b/include/of.h
index 63c99b2..6154490 100644
--- a/include/of.h
+++ b/include/of.h
@@ -96,6 +96,17 @@ static inline u64 of_read_number(const __be32 *cell, int 
size)
        return r;
 }
 
+/* Helper to write a big number; size is in cells (not bytes) */
+static inline void of_write_number(void *__cell, u64 val, int size)
+{
+       __be32 *cell = __cell;
+
+       while (size--) {
+               cell[size] = cpu_to_be32(val);
+               val >>= 32;
+       }
+}
+
 int of_property_read_u32_array(const struct device_node *np,
                               const char *propname, u32 *out_values,
                               size_t sz);
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to