9
0
Fork 0

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>
This commit is contained in:
Sascha Hauer 2013-03-03 11:46:57 +01:00
parent b26b7ef0f0
commit 43327fe374
1 changed files with 11 additions and 0 deletions

View File

@ -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);