mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-20 10:44:23 +08:00
bnx2x: KR2 disablement fix
Relocate bnx2x_disable_kr2 function, and use it to disable KR2 in case it is not configured in order to clear it's configuration, otherwise the link may come up at 20G instead of the requested 10G-KR. In addition, restart AN after disabling KR2 as part of the KR2 work-around. Signed-off-by: Yaniv Rosner <yanivr@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b6a9c1ef3d
commit
4e4b14c9f8
@ -3684,6 +3684,41 @@ static void bnx2x_warpcore_enable_AN_KR2(struct bnx2x_phy *phy,
|
||||
bnx2x_update_link_attr(params, vars->link_attr_sync);
|
||||
}
|
||||
|
||||
static void bnx2x_disable_kr2(struct link_params *params,
|
||||
struct link_vars *vars,
|
||||
struct bnx2x_phy *phy)
|
||||
{
|
||||
struct bnx2x *bp = params->bp;
|
||||
int i;
|
||||
static struct bnx2x_reg_set reg_set[] = {
|
||||
/* Step 1 - Program the TX/RX alignment markers */
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL5, 0x7690},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL7, 0xe647},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL6, 0xc4f0},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL9, 0x7690},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_RX_CTRL11, 0xe647},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_RX_CTRL10, 0xc4f0},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_CL73_USERB0_CTRL, 0x000c},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CTRL1, 0x6000},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CTRL3, 0x0000},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CODE_FIELD, 0x0002},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI1, 0x0000},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI2, 0x0af7},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI3, 0x0af7},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_LD_BAM_CODE, 0x0002},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_LD_UD_CODE, 0x0000}
|
||||
};
|
||||
DP(NETIF_MSG_LINK, "Disabling 20G-KR2\n");
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(reg_set); i++)
|
||||
bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg,
|
||||
reg_set[i].val);
|
||||
vars->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE;
|
||||
bnx2x_update_link_attr(params, vars->link_attr_sync);
|
||||
|
||||
vars->check_kr2_recovery_cnt = CHECK_KR2_RECOVERY_CNT;
|
||||
}
|
||||
|
||||
static void bnx2x_warpcore_set_lpi_passthrough(struct bnx2x_phy *phy,
|
||||
struct link_params *params)
|
||||
{
|
||||
@ -3829,6 +3864,8 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy,
|
||||
bnx2x_set_aer_mmd(params, phy);
|
||||
|
||||
bnx2x_warpcore_enable_AN_KR2(phy, params, vars);
|
||||
} else {
|
||||
bnx2x_disable_kr2(params, vars, phy);
|
||||
}
|
||||
|
||||
/* Enable Autoneg: only on the main lane */
|
||||
@ -13416,43 +13453,6 @@ static void bnx2x_sfp_tx_fault_detection(struct bnx2x_phy *phy,
|
||||
}
|
||||
}
|
||||
}
|
||||
static void bnx2x_disable_kr2(struct link_params *params,
|
||||
struct link_vars *vars,
|
||||
struct bnx2x_phy *phy)
|
||||
{
|
||||
struct bnx2x *bp = params->bp;
|
||||
int i;
|
||||
static struct bnx2x_reg_set reg_set[] = {
|
||||
/* Step 1 - Program the TX/RX alignment markers */
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL5, 0x7690},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL7, 0xe647},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL6, 0xc4f0},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL9, 0x7690},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_RX_CTRL11, 0xe647},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_RX_CTRL10, 0xc4f0},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_CL73_USERB0_CTRL, 0x000c},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CTRL1, 0x6000},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CTRL3, 0x0000},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CODE_FIELD, 0x0002},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI1, 0x0000},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI2, 0x0af7},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI3, 0x0af7},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_LD_BAM_CODE, 0x0002},
|
||||
{MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_LD_UD_CODE, 0x0000}
|
||||
};
|
||||
DP(NETIF_MSG_LINK, "Disabling 20G-KR2\n");
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(reg_set); i++)
|
||||
bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg,
|
||||
reg_set[i].val);
|
||||
vars->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE;
|
||||
bnx2x_update_link_attr(params, vars->link_attr_sync);
|
||||
|
||||
vars->check_kr2_recovery_cnt = CHECK_KR2_RECOVERY_CNT;
|
||||
/* Restart AN on leading lane */
|
||||
bnx2x_warpcore_restart_AN_KR(phy, params);
|
||||
}
|
||||
|
||||
static void bnx2x_kr2_recovery(struct link_params *params,
|
||||
struct link_vars *vars,
|
||||
struct bnx2x_phy *phy)
|
||||
@ -13530,6 +13530,8 @@ static void bnx2x_check_kr2_wa(struct link_params *params,
|
||||
/* Disable KR2 on both lanes */
|
||||
DP(NETIF_MSG_LINK, "BP=0x%x, NP=0x%x\n", base_page, next_page);
|
||||
bnx2x_disable_kr2(params, vars, phy);
|
||||
/* Restart AN on leading lane */
|
||||
bnx2x_warpcore_restart_AN_KR(phy, params);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user