Skip to contentSkip to conversation

core: ofnode: add of_graph parsing helpers

PATCH Superseded Svyatoslav Ryhel 1 participant 3 messages Feb 16, 2025

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover core: ofnode: add of_graph parsing helpers

Add a mostly complete list of ofnode analogs of of_graph parsing helpers.

---
Changes in v2:
- added tests
---

Svyatoslav Ryhel (2):
core: ofnode: add of_graph parsing helpers
test: dm: add ofnode_graph tests

 arch/sandbox/dts/test.dts   |  53 +++++++++
 drivers/core/Makefile       |   2 +-
 drivers/core/ofnode_graph.c | 217 ++++++++++++++++++++++++++++++++++++
 include/dm/ofnode_graph.h   |  90 +++++++++++++++
 test/dm/ofnode.c            |  54 +++++++++
 5 files changed, 415 insertions(+), 1 deletion(-)
 create mode 100644 drivers/core/ofnode_graph.c
 create mode 100644 include/dm/ofnode_graph.h
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 1/2 core: ofnode: add of_graph parsing helpers

Add a mostly complete list of ofnode analogs of of_graph parsing helpers.

---
 drivers/core/Makefile       |   2 +-
 drivers/core/ofnode_graph.c | 217 ++++++++++++++++++++++++++++++++++++
 include/dm/ofnode_graph.h   |  90 +++++++++++++++
 3 files changed, 308 insertions(+), 1 deletion(-)
 create mode 100644 drivers/core/ofnode_graph.c
 create mode 100644 include/dm/ofnode_graph.h
drivers/core/Makefile +1 -1
index 9ea57911f89..657e589c286 100644
@@ -16,6 +16,6 @@ ifndef CONFIG_DM_DEV_READ_INLINE
 obj-$(CONFIG_OF_CONTROL) += read.o
 endif
 obj-$(CONFIG_$(XPL_)OF_PLATDATA) += read.o
-obj-$(CONFIG_OF_CONTROL) += of_extra.o ofnode.o read_extra.o
+obj-$(CONFIG_OF_CONTROL) += of_extra.o ofnode.o read_extra.o ofnode_graph.o
 
 ccflags-$(CONFIG_DM_DEBUG) += -DDEBUG
drivers/core/ofnode_graph.c new file +217 -0

217 lines not on this page · raw message

include/dm/ofnode_graph.h new file +90 -0

90 lines not on this page · raw message

Signature · 1 line
2.43.0
#2 lore raw

PATCH v2 2/2 test: dm: add ofnode_graph tests

In reply to Svyatoslav Ryhel

Test suit for of_graph parsing helpers.

---
 arch/sandbox/dts/test.dts | 53 ++++++++++++++++++++++++++++++++++++++
 test/dm/ofnode.c          | 54 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 107 insertions(+)
arch/sandbox/dts/test.dts +53 -0
index b8f3012873e..22c0d5388a8 100644
@@ -2048,6 +2048,59 @@
 			sandbox,err-step-size = <512>;
 		};
 	};
+
+	graph1 {
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				reg = <0>;
+
+				endpoint@0 {
+					reg = <0>;
+				};
+
+				endpoint@1 {
+					reg = <1>;
+				};
+			};
+
+			port@1 {
+				endpoint {
+					test-property-0;
+				};
+			};
+
+			port@2 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				reg = <2>;
+
+				graph2_link: endpoint@0 {
+					reg = <0>;
+					test-property-1;
+					remote-endpoint = <&graph1_link>;
+				};
+
+				endpoint@1 {
+					reg = <1>;
+				};
+			};
+		};
+	};
+
+	graph2 {
+		port {
+			graph1_link: endpoint {
+				remote-endpoint = <&graph2_link>;
+			};
+		};
+	};
 };
 
 #include "sandbox_pmic.dtsi"
test/dm/ofnode.c +54 -0

63 lines not on this page · raw message

Signature · 1 line
2.43.0