[PATCH v2] net: cpsw: fix probe with fixed-link
Andreas Schmidt
mail at schmidt-andreas.de
Thu Feb 22 14:16:27 PST 2018
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 at schmidt-andreas.de>
---
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
More information about the barebox
mailing list