summaryrefslogtreecommitdiff
path: root/include/dm/ofnode.h
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-04-17 11:08:08 -0400
committerTom Rini <trini@konsulko.com>2020-04-17 11:17:29 -0400
commit8d5d3bcf3c53d798bd7f3fe7092e994593bcc41c (patch)
treedd145ccf787512306926b0e5f327046ccfbee33c /include/dm/ofnode.h
parent0f238dab6d17caabe4f9781d23aaa6087139f2bd (diff)
parent65c141ebbd68b70d6934b4fb965f3219d0e99817 (diff)
Merge branch '2020-04-16-master-imports'
- DM GPIO improvements - BTRFS fixes - Corrections around gd->new_bootstage alignment - Start documentation improvements to support 'make refcheckdocs'
Diffstat (limited to 'include/dm/ofnode.h')
-rw-r--r--include/dm/ofnode.h63
1 files changed, 62 insertions, 1 deletions
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index ce5e366c06..618fc10390 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -59,6 +59,31 @@ struct ofnode_phandle_args {
};
/**
+ * ofprop - reference to a property of a device tree node
+ *
+ * This struct hold the reference on one property of one node,
+ * using struct ofnode and an offset within the flat device tree or either
+ * a pointer to a struct property in the live device tree.
+ *
+ * Thus we can reference arguments in both the live tree and the flat tree.
+ *
+ * The property reference can also hold a null reference. This corresponds to
+ * a struct property NULL pointer or an offset of -1.
+ *
+ * @node: Pointer to device node
+ * @offset: Pointer into flat device tree, used for flat tree.
+ * @prop: Pointer to property, used for live treee.
+ */
+
+struct ofprop {
+ ofnode node;
+ union {
+ int offset;
+ const struct property *prop;
+ };
+};
+
+/**
* _ofnode_to_np() - convert an ofnode to a live DT node pointer
*
* This cannot be called if the reference contains an offset.
@@ -595,7 +620,7 @@ int ofnode_decode_display_timing(ofnode node, int index,
struct display_timing *config);
/**
- * ofnode_get_property()- - get a pointer to the value of a node property
+ * ofnode_get_property() - get a pointer to the value of a node property
*
* @node: node to read
* @propname: property to read
@@ -605,6 +630,42 @@ int ofnode_decode_display_timing(ofnode node, int index,
const void *ofnode_get_property(ofnode node, const char *propname, int *lenp);
/**
+ * ofnode_get_first_property()- get the reference of the first property
+ *
+ * Get reference to the first property of the node, it is used to iterate
+ * and read all the property with ofnode_get_property_by_prop().
+ *
+ * @node: node to read
+ * @prop: place to put argument reference
+ * @return 0 if OK, -ve on error. -FDT_ERR_NOTFOUND if not found
+ */
+int ofnode_get_first_property(ofnode node, struct ofprop *prop);
+
+/**
+ * ofnode_get_next_property() - get the reference of the next property
+ *
+ * Get reference to the next property of the node, it is used to iterate
+ * and read all the property with ofnode_get_property_by_prop().
+ *
+ * @prop: reference of current argument and place to put reference of next one
+ * @return 0 if OK, -ve on error. -FDT_ERR_NOTFOUND if not found
+ */
+int ofnode_get_next_property(struct ofprop *prop);
+
+/**
+ * ofnode_get_property_by_prop() - get a pointer to the value of a property
+ *
+ * Get value for the property identified by the provided reference.
+ *
+ * @prop: reference on property
+ * @propname: If non-NULL, place to property name on success,
+ * @lenp: If non-NULL, place to put length on success
+ * @return 0 if OK, -ve on error. -FDT_ERR_NOTFOUND if not found
+ */
+const void *ofnode_get_property_by_prop(const struct ofprop *prop,
+ const char **propname, int *lenp);
+
+/**
* ofnode_is_available() - check if a node is marked available
*
* @node: node to check