]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: stmmac: qcom-ethqos: move qcom_ethqos_set_sgmii_loopback() up
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Mon, 23 Feb 2026 09:34:31 +0000 (09:34 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 25 Feb 2026 01:43:22 +0000 (17:43 -0800)
ethqos_set_func_clk_en() configures both SGMII loopback and the RGMII
functional clock setting. qcom_ethqos_set_sgmii_loopback() is only
called from within ethqos_set_func_clk_en(), and checks for
PHY_INTERFACE_MODE_2500BASEX.

Move qcom_ethqos_set_sgmii_loopback() to the callers of
ethqos_set_func_clk_en() except for ethqos_configure_rgmii() where we
know that ethqos->phy_mode will not be PHY_INTERFACE_MODE_2500BASEX.

Reviewed-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
Tested-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1vuSKl-0000000ASc1-18ka@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c

index 168f0fed68c0d216a9e52861602de17becd75dd0..964eca46a6535b4d384ebde541941a1a2fee28b5 100644 (file)
@@ -204,7 +204,6 @@ qcom_ethqos_set_sgmii_loopback(struct qcom_ethqos *ethqos, bool enable)
 
 static void ethqos_set_func_clk_en(struct qcom_ethqos *ethqos)
 {
-       qcom_ethqos_set_sgmii_loopback(ethqos, true);
        rgmii_setmask(ethqos, RGMII_CONFIG_FUNC_CLK_EN, RGMII_IO_MACRO_CONFIG);
 }
 
@@ -532,6 +531,7 @@ static void ethqos_configure_rgmii(struct qcom_ethqos *ethqos, int speed)
        for (i = 0; i < ethqos->num_rgmii_por; i++)
                rgmii_writel(ethqos, ethqos->rgmii_por[i].value,
                             ethqos->rgmii_por[i].offset);
+
        ethqos_set_func_clk_en(ethqos);
 
        /* Initialize the DLL first */
@@ -701,6 +701,7 @@ static int ethqos_clks_config(void *priv, bool enabled)
                 * cycled. The actual configuration will be adjusted once
                 * ethqos_fix_mac_speed() is invoked.
                 */
+               qcom_ethqos_set_sgmii_loopback(ethqos, true);
                ethqos_set_func_clk_en(ethqos);
        } else {
                clk_disable_unprepare(ethqos->link_clk);
@@ -809,6 +810,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
 
        ethqos->serdes_speed = SPEED_1000;
        ethqos_update_link_clk(ethqos, SPEED_1000);
+
+       qcom_ethqos_set_sgmii_loopback(ethqos, true);
        ethqos_set_func_clk_en(ethqos);
 
        plat_dat->bsp_priv = ethqos;