[PATCH] net: ti: cpsw: Skip disabled ports in switch binding

"Markus Schneider-Pargmann (TI)" <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <20260827-v2026-10-next-topic-am45-ofupstream-cpsw-fix-ports-v1-1-764e97251ef9@baylibre.com>
cpsw_eth_of_to_plat_switch() tries to parse ethernet-ports that are
marked disabled which breaks because phy-handle on some boards is not
set for disabled ports.

Skip disabled ports instead.

Fixes: 5bb7ae8921ee ("net: cpsw: Support new cpsw-switch DT bindings")
Signed-off-by: Markus Schneider-Pargmann (TI) <[email protected]>
---
 drivers/net/ti/cpsw.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ti/cpsw.c b/drivers/net/ti/cpsw.c
index 7a7cb83bd984..6b1f7764e0d3 100644
--- a/drivers/net/ti/cpsw.c
+++ b/drivers/net/ti/cpsw.c
@@ -1220,9 +1220,13 @@ static int cpsw_eth_of_to_plat_switch(struct udevice *dev,
 	data->mac_control = GMII_EN;
 
 	eth_ports_node = ofnode_find_subnode(dev_ofnode(dev), "ethernet-ports");
-	data->slaves = ofnode_get_child_count(eth_ports_node);
+
+	data->slaves = 0;
+	ofnode_for_each_subnode(subnode, eth_ports_node)
+		if (ofnode_is_enabled(subnode))
+			data->slaves++;
 	if (!data->slaves) {
-		pr_err("cpsw: No ethernet-ports defined\n");
+		pr_err("cpsw: No enabled ethernet-ports defined\n");
 		return -EINVAL;
 	}
 
@@ -1234,6 +1238,9 @@ static int cpsw_eth_of_to_plat_switch(struct udevice *dev,
 		struct ofnode_phandle_args args;
 		u32 port_id;
 
+		if (!ofnode_is_enabled(subnode))
+			continue;
+
 		ret = ofnode_read_u32(subnode, "reg", &port_id);
 		if (ret || !port_id || port_id > data->slaves) {
 			pr_err("cpsw: invalid or missing reg in port node\n");

---
base-commit: d3e8597e46b635ec556a057bc42f0b0859654bdf
change-id: 20260827-v2026-10-next-topic-am45-ofupstream-cpsw-fix-ports-c8c85066f569

Best regards,
--  
Markus Schneider-Pargmann (TI) <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.