]> Git Repo - J-u-boot.git/commitdiff
net: mediatek: use correct register field for SGMII speed selection
authorWeijie Gao <[email protected]>
Tue, 17 Dec 2024 08:39:23 +0000 (16:39 +0800)
committerTom Rini <[email protected]>
Tue, 31 Dec 2024 16:58:52 +0000 (10:58 -0600)
The register field for SGMII speed selection is a 2-bit field with
value 0 for 1Gbps and 1 for 2.5Gbps (2/3 are reserved).
So it's necessary to set both bits instead of just setting/clearing
only the lower bit.

Signed-off-by: Weijie Gao <[email protected]>
drivers/net/mtk_eth.c
drivers/net/mtk_eth.h

index 5098afef8a874b79b32b262cabf772e814654af4..5af406edad19c5ce901beaa15ed05b03b7a5b192 100644 (file)
@@ -835,8 +835,8 @@ static int mt7531_port_sgmii_init(struct mtk_eth_priv *priv,
        }
 
        /* Set SGMII GEN2 speed(2.5G) */
-       mt753x_reg_rmw(priv, MT7531_PHYA_CTRL_SIGNAL3(port),
-                      SGMSYS_SPEED_2500, SGMSYS_SPEED_2500);
+       mt753x_reg_rmw(priv, MT7531_PHYA_CTRL_SIGNAL3(port), SGMSYS_SPEED_MASK,
+                      FIELD_PREP(SGMSYS_SPEED_MASK, SGMSYS_SPEED_2500));
 
        /* Disable SGMII AN */
        mt753x_reg_rmw(priv, MT7531_PCS_CONTROL_1(port),
@@ -1281,8 +1281,7 @@ static int mtk_phy_probe(struct udevice *dev)
 static void mtk_sgmii_an_init(struct mtk_eth_priv *priv)
 {
        /* Set SGMII GEN1 speed(1G) */
-       clrsetbits_le32(priv->sgmii_base + priv->soc->ana_rgc3,
-                       SGMSYS_SPEED_2500, 0);
+       clrbits_le32(priv->sgmii_base + priv->soc->ana_rgc3, SGMSYS_SPEED_MASK);
 
        /* Enable SGMII AN */
        setbits_le32(priv->sgmii_base + SGMSYS_PCS_CONTROL_1,
@@ -1305,8 +1304,9 @@ static void mtk_sgmii_an_init(struct mtk_eth_priv *priv)
 static void mtk_sgmii_force_init(struct mtk_eth_priv *priv)
 {
        /* Set SGMII GEN2 speed(2.5G) */
-       setbits_le32(priv->sgmii_base + priv->soc->ana_rgc3,
-                    SGMSYS_SPEED_2500);
+       clrsetbits_le32(priv->sgmii_base + priv->soc->ana_rgc3,
+                       SGMSYS_SPEED_MASK,
+                       FIELD_PREP(SGMSYS_SPEED_MASK, SGMSYS_SPEED_2500));
 
        /* Disable SGMII AN */
        clrsetbits_le32(priv->sgmii_base + SGMSYS_PCS_CONTROL_1,
index fd31c782c7f2a3b9e0811818aca3537e92e8373a..4f9ae52f973e4687fc4cd42358fc5074f4b7769e 100644 (file)
@@ -108,7 +108,8 @@ enum mkt_eth_capabilities {
 
 #define SGMSYS_GEN2_SPEED              0x2028
 #define SGMSYS_GEN2_SPEED_V2           0x128
-#define SGMSYS_SPEED_2500              BIT(2)
+#define SGMSYS_SPEED_MASK              GENMASK(3, 2)
+#define SGMSYS_SPEED_2500              1
 
 /* USXGMII subsystem config registers */
 /* Register to control USXGMII XFI PLL digital */
This page took 0.040658 seconds and 4 git commands to generate.