From 9ef2c08930f545f3c0fa2fdc317742c5784e5f4a Mon Sep 17 00:00:00 2001 From: Andreas Schmidt Date: Thu, 22 Feb 2018 23:16:27 +0100 Subject: net: cpsw: fix probe with fixed-link 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 Signed-off-by: Sascha Hauer --- drivers/net/cpsw.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c index 928b97774b..3d3939cfae 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]; -- cgit v1.2.3