[PATCH 2/6] net: cpsw: Fix probe for one port ethernet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If only one port is pinned out, probe fails
as the second port phy_id is not found.

Signed-off-by: Teresa Gámez <t.gamez@xxxxxxxxx>
---
 drivers/net/cpsw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index 167b2dd..9c8cff3 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -1071,7 +1071,7 @@ static int cpsw_probe_dt(struct cpsw_priv *priv)
 				return ret;
 		}
 
-		if (!strncmp(child->name, "slave", 5)) {
+		if (i < priv->num_slaves && !strncmp(child->name, "slave", 5)) {
 			struct cpsw_slave *slave = &priv->slaves[i];
 			uint32_t phy_id[2];
 
@@ -1088,7 +1088,7 @@ static int cpsw_probe_dt(struct cpsw_priv *priv)
 		}
 	}
 
-	for (i = 0; i < 2; i++) {
+	for (i = 0; i < priv->num_slaves; i++) {
 		struct cpsw_slave *slave = &priv->slaves[i];
 
 		cpsw_gmii_sel_am335x(slave);
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux