[PATCH v2] net: cpsw: fix probe with fixed-link

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

 



While cpsw is probe dt, it accepts only slaves nodes with "phy_id" property.
In case of fixed-link there are no "phy_id" property and probe would be failed.
This patch avoid the failure due to missing "phy_id" in case of fixed-link.

Signed-off-by: Andreas Schmidt <mail@xxxxxxxxxxxxxxxxxx>
---

Changes since v1:
  - rework after "[PATCH] net: cpsw: remove unnecessary mdiobus_scan()" patch was committed.

---
 drivers/net/cpsw.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index 928b97774..3d3939cfa 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -1089,11 +1089,13 @@ static int cpsw_probe_dt(struct cpsw_priv *priv)
 
 		if (i < priv->num_slaves && !strncmp(child->name, "slave", 5)) {
 			struct cpsw_slave *slave = &priv->slaves[i];
-			uint32_t phy_id[2];
+			uint32_t phy_id[2] = {-1, -1};
 
-			ret = of_property_read_u32_array(child, "phy_id", phy_id, 2);
-			if (ret)
-				return ret;
+			if (!of_find_node_by_name(child, "fixed-link")) {
+				ret = of_property_read_u32_array(child, "phy_id", phy_id, 2);
+				if (ret)
+					return ret;
+			}
 
 			slave->dev.device_node = child;
 			slave->phy_id = phy_id[1];
-- 
2.14.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