devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scripts/dtc: Allow ports to have a single port@0 child
@ 2023-10-13  8:54 Aradhya Bhatia
  2023-10-25 19:31 ` Rob Herring
  0 siblings, 1 reply; 3+ messages in thread
From: Aradhya Bhatia @ 2023-10-13  8:54 UTC (permalink / raw)
  To: Rob Herring, Frank Rowand
  Cc: Devicetree List, Linux Kernel List, Andrew Davis, Nishanth Menon,
	Vignesh Raghavendra, Devarsh Thakkar, Jai Luthra,
	Jayesh Choudhary, Aradhya Bhatia

Exempt 'ports' from the rule which asserts that nodes with single child
node having reg = 0, should not have the '#size-cells' and
'#address-cells' properties.

Ports of certain hardware do need to be described as only having a
single child node 'port@0', especially when hardware has multiple ports,
and the other ports 'port@x' are planned to be added subsequently. In
such cases, just using 'port', would be an inaccurate hardware
description.

For example, Texas Instruments' DSS (display-subsystem), which has 2 or
4 video ports depending on the SoC. Describing the first video port with
just 'port' under ports would be inaccurate and even slightly
misleading. Simply using port@0 (when other ports are not added)
produces the following warning, while making dtbs with W=1 flag set[0].

code-block ::

	Warning (graph_child_address): /bus@100000/dss@4a00000/ports:
	graph node has single child node 'port@0',
	#address-cells/#size-cells are not necessary

Signed-off-by: Aradhya Bhatia <a-bhatia1@ti.com>

[0]: https://lore.kernel.org/all/570903b6-8239-d44a-5fac-71700804cb5d@ti.com/
---
 scripts/dtc/checks.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c
index 9f31d2607182..705aa0fbcfa2 100644
--- a/scripts/dtc/checks.c
+++ b/scripts/dtc/checks.c
@@ -1797,9 +1797,18 @@ static void check_graph_child_address(struct check *c, struct dt_info *dti,
 		cnt++;
 	}
 
-	if (cnt == 1 && node->addr_cells != -1)
+	if (cnt == 1 && node->addr_cells != -1) {
+		/*
+		 * The graph node "ports" are exempt from this rule, because
+		 * certain hardware do need to be described as only having a
+		 * signle port with reg = 0.
+		 */
+		if (!strcmp(node->name, "ports"))
+			return;
+
 		FAIL(c, dti, node, "graph node has single child node '%s', #address-cells/#size-cells are not necessary",
 		     node->children->name);
+	}
 }
 WARNING(graph_child_address, check_graph_child_address, NULL, &graph_nodes);
 

base-commit: e3b18f7200f45d66f7141136c25554ac1e82009b
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-31 16:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-13  8:54 [PATCH] scripts/dtc: Allow ports to have a single port@0 child Aradhya Bhatia
2023-10-25 19:31 ` Rob Herring
2023-10-31 16:38   ` Aradhya Bhatia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).