summaryrefslogtreecommitdiffstats
path: root/include/of.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/of.h')
-rw-r--r--include/of.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/include/of.h b/include/of.h
index d548e51789..08a02e1105 100644
--- a/include/of.h
+++ b/include/of.h
@@ -201,6 +201,11 @@ extern int of_property_read_u32_array(const struct device_node *np,
extern int of_property_read_u64(const struct device_node *np,
const char *propname, u64 *out_value);
+extern int of_property_read_variable_u64_array(const struct device_node *np,
+ const char *propname,
+ u64 *out_values,
+ size_t sz);
+
extern int of_property_read_string(struct device_node *np,
const char *propname,
const char **out_string);
@@ -231,6 +236,8 @@ extern int of_property_write_u64_array(struct device_node *np,
size_t sz);
extern int of_property_write_string(struct device_node *np, const char *propname,
const char *value);
+extern int of_property_write_strings(struct device_node *np, const char *propname,
+ ...) __attribute__((__sentinel__));
extern struct device_node *of_parse_phandle(const struct device_node *np,
const char *phandle_name,
@@ -252,6 +259,8 @@ extern int of_modalias_node(struct device_node *node, char *modalias, int len);
extern struct device_node *of_get_root_node(void);
extern int of_set_root_node(struct device_node *node);
+extern void barebox_register_of(struct device_node *root);
+extern void barebox_register_fdt(const void *dtb);
extern struct device_d *of_platform_device_create(struct device_node *np,
struct device_d *parent);
@@ -465,6 +474,14 @@ static inline int of_property_read_u64(const struct device_node *np,
return -ENOSYS;
}
+static inline int of_property_read_variable_u64_array(const struct device_node *np,
+ const char *propname,
+ u64 *out_values,
+ size_t sz)
+{
+ return -ENOSYS;
+}
+
static inline int of_property_read_string(struct device_node *np,
const char *propname, const char **out_string)
{
@@ -732,6 +749,8 @@ static inline int of_autoenable_i2c_by_component(char *path)
#endif
+#define for_each_property_of_node(dn, pp) \
+ list_for_each_entry(pp, &dn->properties, list)
#define for_each_node_by_name(dn, name) \
for (dn = of_find_node_by_name(NULL, name); dn; \
dn = of_find_node_by_name(dn, name))
@@ -875,6 +894,34 @@ static inline int of_property_read_u32(const struct device_node *np,
return of_property_read_u32_array(np, propname, out_value, 1);
}
+/**
+ * of_property_read_u64_array - Find and read an array of 64 bit integers
+ * from a property.
+ *
+ * @np: device node from which the property value is to be read.
+ * @propname: name of the property to be searched.
+ * @out_values: pointer to return value, modified only if return value is 0.
+ * @sz: number of array elements to read
+ *
+ * Search for a property in a device node and read 64-bit value(s) from
+ * it. Returns 0 on success, -EINVAL if the property does not exist,
+ * -ENODATA if property does not have a value, and -EOVERFLOW if the
+ * property data isn't large enough.
+ *
+ * The out_values is modified only if a valid u64 value can be decoded.
+ */
+static inline int of_property_read_u64_array(const struct device_node *np,
+ const char *propname,
+ u64 *out_values, size_t sz)
+{
+ int ret = of_property_read_variable_u64_array(np, propname, out_values,
+ sz);
+ if (ret >= 0)
+ return 0;
+ else
+ return ret;
+}
+
/*
* struct property *prop;
* const __be32 *p;