]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: stmmac: Update default_an_inband before passing value to phylink_config
authorKhaiWenTan <khai.wen.tan@linux.intel.com>
Thu, 16 Apr 2026 10:26:09 +0000 (18:26 +0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 18 Apr 2026 19:10:16 +0000 (12:10 -0700)
get_interfaces() will update both the plat->phy_interfaces and
mdio_bus_data->default_an_inband based on reading a SERDES register. As
get_interfaces() will be called after default_an_inband had already been
read, dwmac-intel regressed as a result with incorrect default_an_inband
value in phylink_config.

Therefore, we moved the priv->plat->get_interfaces() to be executed first
before assigning priv->plat->default_an_inband to config->default_an_inband
to ensure default_an_inband is in correct value.

Fixes: d3836052fe09 ("net: stmmac: intel: convert speed_mode_2500() to get_interfaces()")
Signed-off-by: KhaiWenTan <khai.wen.tan@linux.intel.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/20260416102609.7953-1-khai.wen.tan@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index 01a983001ab45e2aece539a3551700bdd946e8c5..ca68248dbc781a63af6622f7e458979892e7f09d 100644 (file)
@@ -1410,8 +1410,6 @@ static int stmmac_phylink_setup(struct stmmac_priv *priv)
        priv->tx_lpi_clk_stop = priv->plat->flags &
                                STMMAC_FLAG_EN_TX_LPI_CLOCKGATING;
 
-       config->default_an_inband = priv->plat->default_an_inband;
-
        /* Get the PHY interface modes (at the PHY end of the link) that
         * are supported by the platform.
         */
@@ -1419,6 +1417,8 @@ static int stmmac_phylink_setup(struct stmmac_priv *priv)
                priv->plat->get_interfaces(priv, priv->plat->bsp_priv,
                                           config->supported_interfaces);
 
+       config->default_an_inband = priv->plat->default_an_inband;
+
        /* Set the platform/firmware specified interface mode if the
         * supported interfaces have not already been provided using
         * phy_interface as a last resort.