[PATCH] net: stmmac: get phydev->interface from mac for mdio phy init

Guan Wentao guanwentao at uniontech.com
Wed Feb 8 04:40:25 PST 2023


The phy->interface from mdiobus_get_phy is default from phy_device_create.
In some phy devices like at803x, use phy->interface to init rgmii delay.
Use plat->phy_interface to init if know from stmmac_probe_config_dt.

Fixes: 74371272f97f ("net: stmmac: Convert to phylink and remove phylib logic")
Signed-off-by: Guan Wentao <guanwentao at uniontech.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 1a5b8dab5e9b..debfcb045c22 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1162,6 +1162,12 @@ static int stmmac_init_phy(struct net_device *dev)
 			return -ENODEV;
 		}
 
+		/* If we know the interface, it defines which PHY interface */
+		if (priv->plat->phy_interface > 0) {
+			phydev->interface = priv->plat->phy_interface;
+			netdev_dbg(priv->dev, "Override default phy interface\n");
+		}
+
 		ret = phylink_connect_phy(priv->phylink, phydev);
 	}
 
-- 
2.20.1




More information about the linux-arm-kernel mailing list