Currently, the bind callback of the driver namely am65_cpsw_nuss_bind()
registers all ethernet ports including the ones that have been disabled
in the device-tree. Since the ports that have been disabled are ought to
be ignored, fix the implementation to register only the enabled ports as
indicated by their 'status' in their respective device-tree node.

Fixes: 3943531a5468 ("net: ti: am65-cpsw-nuss: Define bind method for CPSW 
driver")
Reported-by: Wadim Egorov <[email protected]>
Closes: https://patch.msgid.link/[email protected]
Signed-off-by: Siddharth Vadapalli <[email protected]>
---

Hello,

This patch is based on commit
2bc0715b558 Merge tag 'u-boot-ufs-20251119' of 
https://source.denx.de/u-boot/custodians/u-boot-ufs
of the master branch of U-Boot.

Patch has been tested on the AM625-SK which has two Ethernet ports of
which only one is enabled in U-Boot. Test logs:
https://gist.github.com/Siddharth-Vadapalli-at-TI/1f0ae4fec659784f6d99fd159b380644

Regards,
Siddharth.

 drivers/net/ti/am65-cpsw-nuss.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ti/am65-cpsw-nuss.c b/drivers/net/ti/am65-cpsw-nuss.c
index 7a88f76fd09..840029280e7 100644
--- a/drivers/net/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ti/am65-cpsw-nuss.c
@@ -819,6 +819,10 @@ static int am65_cpsw_nuss_bind(struct udevice *dev)
        ofnode_for_each_subnode(node, ports_np) {
                const char *node_name;
 
+               /* Ignore disabled ports */
+               if (!ofnode_is_enabled(node))
+                       continue;
+
                node_name = ofnode_get_name(node);
 
                ret = device_bind_driver_to_node(dev, "am65_cpsw_nuss_port", 
node_name, node,
-- 
2.51.1

Reply via email to