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

Teresa Gámez t.gamez at phytec.de
Fri Oct 10 02:14:29 PDT 2014


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 at phytec.de>
---
 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




More information about the barebox mailing list