netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: stmmac: get phydev->interface from mac for mdio phy init
@ 2023-02-08 12:40 Guan Wentao
  2023-02-08 13:11 ` Simon Horman
  2023-02-08 13:32 ` Russell King (Oracle)
  0 siblings, 2 replies; 6+ messages in thread
From: Guan Wentao @ 2023-02-08 12:40 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, joabreu
  Cc: davem, edumazet, kuba, pabeni, mcoquelin.stm32, netdev,
	linux-stm32, linux-arm-kernel, Guan Wentao

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@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


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [PATCH] net: stmmac: get phydev->interface from mac for mdio phy init
@ 2023-02-08 11:20 Guan Wentao
  2023-02-08 13:27 ` Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: Guan Wentao @ 2023-02-08 11:20 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, joabreu
  Cc: davem, edumazet, kuba, pabeni, mcoquelin.stm32, netdev,
	linux-stm32, linux-arm-kernel, Guan Wentao

The phy->interface from mdiobus_get_phy is default from phy_device_create.
In some phy devices like at803x, we need the correct value to init delay.
Use priv->plat->interface to init if we know.

Fixes: 74371272f97f ("net: stmmac: Convert to phylink and remove phylib logic")
Signed-off-by: Guan Wentao <guanwentao@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..1dc9c7f3d714 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->interface > 0) {
+			phydev->interface = priv->plat->interface;
+			netdev_dbg(priv->dev, "Override default phy interface\n");
+		}
+
 		ret = phylink_connect_phy(priv->phylink, phydev);
 	}
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-02-08 13:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-08 12:40 [PATCH] net: stmmac: get phydev->interface from mac for mdio phy init Guan Wentao
2023-02-08 13:11 ` Simon Horman
2023-02-08 13:29   ` Andrew Lunn
2023-02-08 13:32 ` Russell King (Oracle)
  -- strict thread matches above, loose matches on Subject: below --
2023-02-08 11:20 Guan Wentao
2023-02-08 13:27 ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).