diff options
| author | Maxime Chevallier <maxime.chevallier@bootlin.com> | 2026-03-24 12:20:59 +0300 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-03-27 04:19:42 +0300 |
| commit | adf1536f79a5699b2fbece74d175af43320ec404 (patch) | |
| tree | f50c69cf0842207896471debba21b38f5889c727 | |
| parent | 9b04ecdfb8768a754db4bdb4a9073d0a650c0b53 (diff) | |
| download | linux-adf1536f79a5699b2fbece74d175af43320ec404.tar.xz | |
net: stmmac: dwmac-socfpga: get the phy_mode with the dedicated helper
We enable/disable the sgmii_adapter in the .fix_mac_speed() ops based on
the phy_mode used in the plat_data. We currently get it with :
socfpga_dwmac
->dev
->drv_data
->netdev
->priv
->stmmac_priv
->plat
->phy_interface
where we can get it with :
socfpga_dwmac
->plat_data
->phy_interface (done by socfpga_get_plat_phymode)
Use that helper here.
Note that we are also being passed a phy_interface_t from the
.fix_mac_speed() callback, provided by phylink.
We can handle that in the future when dynamic interface selection is
supported. We'd need to guarantee that we have a Lynx PCS to handle it.
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/20260324092102.687082-5-maxime.chevallier@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
| -rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c index 629074dbbc15..ae40de2ed8eb 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c @@ -89,9 +89,9 @@ static void socfpga_dwmac_fix_mac_speed(void *bsp_priv, unsigned int mode) { struct socfpga_dwmac *dwmac = (struct socfpga_dwmac *)bsp_priv; - struct stmmac_priv *priv = netdev_priv(dev_get_drvdata(dwmac->dev)); - void __iomem *splitter_base = dwmac->splitter_base; void __iomem *sgmii_adapter_base = dwmac->sgmii_adapter_base; + phy_interface_t phymode = socfpga_get_plat_phymode(dwmac); + void __iomem *splitter_base = dwmac->splitter_base; u32 val; if (sgmii_adapter_base) @@ -117,9 +117,8 @@ static void socfpga_dwmac_fix_mac_speed(void *bsp_priv, writel(val, splitter_base + EMAC_SPLITTER_CTRL_REG); } - if ((priv->plat->phy_interface == PHY_INTERFACE_MODE_SGMII || - priv->plat->phy_interface == PHY_INTERFACE_MODE_1000BASEX) && - sgmii_adapter_base) + if ((phymode == PHY_INTERFACE_MODE_SGMII || + phymode == PHY_INTERFACE_MODE_1000BASEX) && sgmii_adapter_base) socfpga_sgmii_config(dwmac, true); } |
