]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: stmmac: qcom-ethqos: move loopback decision next to reg update
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Fri, 27 Mar 2026 08:44:29 +0000 (08:44 +0000)
committerJakub Kicinski <kuba@kernel.org>
Tue, 31 Mar 2026 00:36:46 +0000 (17:36 -0700)
Move the loopback decision next to the register update, and make the
local variable unsigned. As a result, there is now no need for the
comment referring to the programming being later.

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

index 580deec1dc30245b9b6db4f57ac06731591c5cc4..9dae40c27903d283e00474bf0c00d71e82df7d48 100644 (file)
@@ -374,9 +374,8 @@ static int ethqos_dll_configure(struct qcom_ethqos *ethqos)
 static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos, int speed)
 {
        struct device *dev = &ethqos->pdev->dev;
-       unsigned int prg_rclk_dly;
+       unsigned int prg_rclk_dly, loopback;
        int phase_shift;
-       int loopback;
 
        /* Determine if the PHY adds a 2 ns TX delay or the MAC handles it */
        if (ethqos->phy_mode == PHY_INTERFACE_MODE_RGMII_ID ||
@@ -389,12 +388,6 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos, int speed)
        rgmii_clrmask(ethqos, RGMII_CONFIG2_TX_TO_RX_LOOPBACK_EN,
                      RGMII_IO_MACRO_CONFIG2);
 
-       /* Determine if this platform wants loopback enabled after programming */
-       if (ethqos->rgmii_config_loopback_en)
-               loopback = RGMII_CONFIG_LOOPBACK_EN;
-       else
-               loopback = 0;
-
        /* Select RGMII, write 0 to interface select */
        rgmii_clrmask(ethqos, RGMII_CONFIG_INTF_SEL, RGMII_IO_MACRO_CONFIG);
 
@@ -476,6 +469,11 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos, int speed)
                              SDCC_HC_REG_DDR_CONFIG);
        }
 
+       if (ethqos->rgmii_config_loopback_en)
+               loopback = RGMII_CONFIG_LOOPBACK_EN;
+       else
+               loopback = 0;
+
        rgmii_updatel(ethqos, RGMII_CONFIG_LOOPBACK_EN, loopback,
                      RGMII_IO_MACRO_CONFIG);