[PATCH v2 1/2] dm: core: Add size operations on device tree references

chenguanqiao chenguanqiao at kuaishou.com
Fri Apr 2 08:28:20 CEST 2021


Add functions to add size of addresses in the device tree using ofnode
references.

Signed-off-by: Chen Guanqiao <chenguanqiao at kuaishou.com>
---
 drivers/core/ofnode.c |  9 +++++++++
 include/dm/ofnode.h   | 10 ++++++++++
 2 files changed, 19 insertions(+)

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index fa0bd2a9c4..952c3cf9dd 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -347,6 +347,15 @@ fdt_addr_t ofnode_get_addr(ofnode node)
 	return ofnode_get_addr_index(node, 0);
 }
 
+fdt_size_t ofnode_get_size(ofnode node)
+{
+	fdt_size_t size;
+
+	ofnode_get_addr_size_index(node, 0, &size);
+
+	return size;
+}
+
 int ofnode_stringlist_search(ofnode node, const char *property,
 			     const char *string)
 {
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 2c0597c407..e91f81282b 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -510,6 +510,16 @@ phys_addr_t ofnode_get_addr_index(ofnode node, int index);
  */
 phys_addr_t ofnode_get_addr(ofnode node);
 
+/**
+ * ofnode_get_size() - get size from a node
+ *
+ * This reads the register size from a node
+ *
+ * @node: node to read from
+ * @return size of the address
+ */
+fdt_size_t ofnode_get_size(ofnode node);
+
 /**
  * ofnode_stringlist_search() - find a string in a string list and return index
  *
-- 
2.25.1



More information about the U-Boot mailing list