summaryrefslogtreecommitdiff
path: root/include/dm/ofnode.h
diff options
context:
space:
mode:
authorStefan Herbrechtsmeier <[email protected]>2022-06-14 15:21:30 +0200
committerTom Rini <[email protected]>2022-09-14 15:23:03 -0400
commitb471bdc47b2acabe0b5fcb0fb40a0b1c0602d3b3 (patch)
tree63a7b1e3e0d0db6be0aaeea90c57a7a0a8a3d7f9 /include/dm/ofnode.h
parent7a0d88076b9cd8ccc88d41383f92ac2494d4168e (diff)
dm: core: Add functions to read 8/16-bit integers
Add functions to read 8/16-bit integers like the existing functions for 32/64-bit to simplify read of 8/16-bit integers from device tree properties. Signed-off-by: Stefan Herbrechtsmeier <[email protected]> Reviewed-by: Marek Vasut <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Simon Glass <[email protected]>
Diffstat (limited to 'include/dm/ofnode.h')
-rw-r--r--include/dm/ofnode.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 7ce1e4c6d91..f6085231bbd 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -222,6 +222,46 @@ static inline oftree oftree_default(void)
bool ofnode_name_eq(ofnode node, const char *name);
/**
+ * ofnode_read_u8() - Read a 8-bit integer from a property
+ *
+ * @node: valid node reference to read property from
+ * @propname: name of the property to read from
+ * @outp: place to put value (if found)
+ * Return: 0 if OK, -ve on error
+ */
+int ofnode_read_u8(ofnode node, const char *propname, u8 *outp);
+
+/**
+ * ofnode_read_u8_default() - Read a 8-bit integer from a property
+ *
+ * @node: valid node reference to read property from
+ * @propname: name of the property to read from
+ * @def: default value to return if the property has no value
+ * Return: property value, or @def if not found
+ */
+u8 ofnode_read_u8_default(ofnode node, const char *propname, u8 def);
+
+/**
+ * ofnode_read_u16() - Read a 16-bit integer from a property
+ *
+ * @node: valid node reference to read property from
+ * @propname: name of the property to read from
+ * @outp: place to put value (if found)
+ * Return: 0 if OK, -ve on error
+ */
+int ofnode_read_u16(ofnode node, const char *propname, u16 *outp);
+
+/**
+ * ofnode_read_u16_default() - Read a 16-bit integer from a property
+ *
+ * @node: valid node reference to read property from
+ * @propname: name of the property to read from
+ * @def: default value to return if the property has no value
+ * Return: property value, or @def if not found
+ */
+u16 ofnode_read_u16_default(ofnode node, const char *propname, u16 def);
+
+/**
* ofnode_read_u32() - Read a 32-bit integer from a property
*
* @node: valid node reference to read property from