From: Jose Abreu Date: Fri, 28 Jun 2019 07:25:07 +0000 (+0200) Subject: net: stmmac: Fix case when PHY handle is not present X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=42e87024f72708291e2b79d3365ba6a50827d0a4;p=openwrt%2Fstaging%2Fblogic.git net: stmmac: Fix case when PHY handle is not present Some DT bindings do not have the PHY handle. Let's fallback to manually discovery in case phylink_of_phy_connect() fails. Changes from v1: - Fixup comment style (Sergei) Fixes: 74371272f97f ("net: stmmac: Convert to phylink and remove phylib logic") Reported-by: Katsuhiro Suzuki Tested-by: Katsuhiro Suzuki Signed-off-by: Jose Abreu Cc: Joao Pinto Cc: David S. Miller Cc: Giuseppe Cavallaro Cc: Alexandre Torgue Cc: Sergei Shtylyov Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 8f5ebd51859e..91f24b63ea16 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -953,9 +953,13 @@ static int stmmac_init_phy(struct net_device *dev) node = priv->plat->phylink_node; - if (node) { + if (node) ret = phylink_of_phy_connect(priv->phylink, node, 0); - } else { + + /* Some DT bindings do not set-up the PHY handle. Let's try to + * manually parse it + */ + if (!node || ret) { int addr = priv->plat->phy_addr; struct phy_device *phydev;