linux/of.h: Add of_read_number()

Update #3277.
This commit is contained in:
Sebastian Huber
2018-01-17 14:14:10 +01:00
parent 26ce2ac428
commit 44fca38058
2 changed files with 18 additions and 0 deletions

View File

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

View File

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