Skip to content

Commit bb0b8ae

Browse files
Russell King (Oracle)davem330
authored andcommitted
net: pcs: xpcs: move Wangxun VR_XS_PCS_DIG_CTRL1 configuration
According to commits 2a22b7a ("net: pcs: xpcs: adapt Wangxun NICs for SGMII mode") and 2deea43 ("net: pcs: xpcs: add 1000BASE-X AN interrupt support"), Wangxun devices need special VR_XS_PCS_DIG_CTRL1 settings for SGMII and 1000BASE-X. Both SGMII and 1000BASE-X use the same settings. Rather than placing these in the individual xpcs_config_*() functions, move it to where we already test for the Wangxun devices in xpcs_do_config(). Signed-off-by: Russell King (Oracle) <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5ba5619 commit bb0b8ae

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

drivers/net/pcs/pcs-xpcs.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -636,9 +636,6 @@ static int xpcs_config_aneg_c37_sgmii(struct dw_xpcs *xpcs,
636636
int ret, mdio_ctrl, tx_conf;
637637
u16 mask, val;
638638

639-
if (xpcs->info.pma == WX_TXGBE_XPCS_PMA_10G_ID)
640-
xpcs_write_vpcs(xpcs, DW_VR_XS_PCS_DIG_CTRL1, DW_CL37_BP | DW_EN_VSMMD1);
641-
642639
/* For AN for C37 SGMII mode, the settings are :-
643640
* 1) VR_MII_MMD_CTRL Bit(12) [AN_ENABLE] = 0b (Disable SGMII AN in case
644641
it is already enabled)
@@ -714,9 +711,6 @@ static int xpcs_config_aneg_c37_1000basex(struct dw_xpcs *xpcs,
714711
bool changed = 0;
715712
u16 mask, val;
716713

717-
if (xpcs->info.pma == WX_TXGBE_XPCS_PMA_10G_ID)
718-
xpcs_write_vpcs(xpcs, DW_VR_XS_PCS_DIG_CTRL1, DW_CL37_BP | DW_EN_VSMMD1);
719-
720714
/* According to Chap 7.12, to set 1000BASE-X C37 AN, AN must
721715
* be disabled first:-
722716
* 1) VR_MII_MMD_CTRL Bit(12)[AN_ENABLE] = 0b
@@ -806,6 +800,14 @@ static int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface,
806800
ret = txgbe_xpcs_switch_mode(xpcs, interface);
807801
if (ret)
808802
return ret;
803+
804+
/* Wangxun devices need backplane CL37 AN enabled for
805+
* SGMII and 1000base-X
806+
*/
807+
if (interface == PHY_INTERFACE_MODE_SGMII ||
808+
interface == PHY_INTERFACE_MODE_1000BASEX)
809+
xpcs_write_vpcs(xpcs, DW_VR_XS_PCS_DIG_CTRL1,
810+
DW_CL37_BP | DW_EN_VSMMD1);
809811
}
810812

811813
switch (compat->an_mode) {

0 commit comments

Comments
 (0)