]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: stmmac: qcom-ethqos: add ethqos_pcs_set_inband()
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Thu, 12 Jun 2025 16:16:30 +0000 (17:16 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 14 Jun 2025 18:27:45 +0000 (11:27 -0700)
Add ethqos_pcs_set_inband() to improve readability, and to allow future
changes when phylink PCS support is properly merged.

Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Tested-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> # sa8775p-ride-r3
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/E1uPkbO-004EyA-EU@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c

index e30bdf72331ac3b5d9d1631742130b92a27895a4..2e398574c7a70a54a16a5d09a73d8eeb968bee9e 100644 (file)
@@ -622,6 +622,11 @@ static void ethqos_set_serdes_speed(struct qcom_ethqos *ethqos, int speed)
        }
 }
 
+static void ethqos_pcs_set_inband(struct stmmac_priv *priv, bool enable)
+{
+       stmmac_pcs_ctrl_ane(priv, priv->ioaddr, enable, 0, 0);
+}
+
 /* On interface toggle MAC registers gets reset.
  * Configure MAC block for SGMII on ethernet phy link up
  */
@@ -640,7 +645,7 @@ static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos, int speed)
                              RGMII_CONFIG2_RGMII_CLK_SEL_CFG,
                              RGMII_IO_MACRO_CONFIG2);
                ethqos_set_serdes_speed(ethqos, SPEED_2500);
-               stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 0, 0, 0);
+               ethqos_pcs_set_inband(priv, false);
                break;
        case SPEED_1000:
                val &= ~ETHQOS_MAC_CTRL_PORT_SEL;
@@ -648,12 +653,12 @@ static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos, int speed)
                              RGMII_CONFIG2_RGMII_CLK_SEL_CFG,
                              RGMII_IO_MACRO_CONFIG2);
                ethqos_set_serdes_speed(ethqos, SPEED_1000);
-               stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0);
+               ethqos_pcs_set_inband(priv, true);
                break;
        case SPEED_100:
                val |= ETHQOS_MAC_CTRL_PORT_SEL | ETHQOS_MAC_CTRL_SPEED_MODE;
                ethqos_set_serdes_speed(ethqos, SPEED_1000);
-               stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0);
+               ethqos_pcs_set_inband(priv, true);
                break;
        case SPEED_10:
                val |= ETHQOS_MAC_CTRL_PORT_SEL;
@@ -663,7 +668,7 @@ static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos, int speed)
                                         SGMII_10M_RX_CLK_DVDR),
                              RGMII_IO_MACRO_CONFIG);
                ethqos_set_serdes_speed(ethqos, SPEED_1000);
-               stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0);
+               ethqos_pcs_set_inband(priv, true);
                break;
        }