diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-03-03 11:46:57 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-03-06 11:41:28 +0100 |
commit | 43327fe3745bc044dee8b88b1d3593c53e721b4a (patch) | |
tree | a42a22ee618b39978505a48f1777dfbad9267ce5 /include | |
parent | b26b7ef0f04d823e70f57684c8ee01277ade572a (diff) | |
download | barebox-43327fe3745bc044dee8b88b1d3593c53e721b4a.tar.gz barebox-43327fe3745bc044dee8b88b1d3593c53e721b4a.tar.xz |
of: Add of_write_number helper
The counterpart to of_read_number: Write a 32bit or 64bit
number to a devicetree.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/of.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/of.h b/include/of.h index 63c99b21fe..6154490eb5 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); |