summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-10-14 12:46:52 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-10-14 12:46:52 +0200
commitbee1da7fcc005edab18fde60fd2ce956d12c5e18 (patch)
tree77d02747d657192acb10500f979b83e20d0447a3 /include
parentc29ce8d93f9403c3ce6ccc5e82fb7a7be41d6659 (diff)
parent765ecaf52b834278a2449fcb097754a3aae9aa96 (diff)
downloadbarebox-bee1da7fcc005edab18fde60fd2ce956d12c5e18.tar.gz
barebox-bee1da7fcc005edab18fde60fd2ce956d12c5e18.tar.xz
Merge branch 'for-next/sandbox' into master
Diffstat (limited to 'include')
-rw-r--r--include/of.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/of.h b/include/of.h
index f27a0b8ccd..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);
@@ -254,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);
@@ -467,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)
{
@@ -879,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;