Skip to content

Commit 5c71729

Browse files
vladimirolteankuba-moo
authored andcommitted
net: pcs: xpcs: fix DW_VR_MII_DIG_CTRL1_2G5_EN bit being set for 1G SGMII w/o inband
On a port with SGMII fixed-link at SPEED_1000, DW_VR_MII_DIG_CTRL1 gets set to 0x2404. This is incorrect, because bit 2 (DW_VR_MII_DIG_CTRL1_2G5_EN) is set. It comes from the previous write to DW_VR_MII_AN_CTRL, because the "val" variable is reused and is dirty. Actually, its value is 0x4, aka FIELD_PREP(DW_VR_MII_PCS_MODE_MASK, DW_VR_MII_PCS_MODE_C37_SGMII). Resolve the issue by clearing "val" to 0 when writing to a new register. After the fix, the register value is 0x2400. Prior to the blamed commit, when the read-modify-write was open-coded, the code saved the content of the DW_VR_MII_DIG_CTRL1 register in the "ret" variable. Fixes: ce8d608 ("net: pcs: xpcs: add _modify() accessors") Signed-off-by: Vladimir Oltean <[email protected]> Reviewed-by: Maxime Chevallier <[email protected]> Reviewed-by: Russell King (Oracle) <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 0a5b8ff commit 5c71729

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/pcs/pcs-xpcs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,7 @@ static int xpcs_config_aneg_c37_sgmii(struct dw_xpcs *xpcs,
684684
if (ret < 0)
685685
return ret;
686686

687+
val = 0;
687688
mask = DW_VR_MII_DIG_CTRL1_MAC_AUTO_SW;
688689
if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED)
689690
val = DW_VR_MII_DIG_CTRL1_MAC_AUTO_SW;

0 commit comments

Comments
 (0)