aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaniv Rosner <yanivr@broadcom.com>2013-09-22 07:59:23 -0400
committerDavid S. Miller <davem@davemloft.net>2013-09-23 02:10:19 -0400
commit4e4b14c9f861e19e560abb4a12eca971568639f5 (patch)
tree4b63305fddcf850922cffa13f76242d8eeaa420a
parentb6a9c1ef3d82c1efb66340a27e810bad63e046ed (diff)
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>
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c76
1 files changed, 39 insertions, 37 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index 12ef8e1a2dad..84798bb8c020 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -3684,6 +3684,41 @@ static void bnx2x_warpcore_enable_AN_KR2(struct bnx2x_phy *phy,
3684 bnx2x_update_link_attr(params, vars->link_attr_sync); 3684 bnx2x_update_link_attr(params, vars->link_attr_sync);
3685} 3685}
3686 3686
3687static void bnx2x_disable_kr2(struct link_params *params,
3688 struct link_vars *vars,
3689 struct bnx2x_phy *phy)
3690{
3691 struct bnx2x *bp = params->bp;
3692 int i;
3693 static struct bnx2x_reg_set reg_set[] = {
3694 /* Step 1 - Program the TX/RX alignment markers */
3695 {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL5, 0x7690},
3696 {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL7, 0xe647},
3697 {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL6, 0xc4f0},
3698 {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL9, 0x7690},
3699 {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_RX_CTRL11, 0xe647},
3700 {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_RX_CTRL10, 0xc4f0},
3701 {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_USERB0_CTRL, 0x000c},
3702 {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CTRL1, 0x6000},
3703 {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CTRL3, 0x0000},
3704 {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CODE_FIELD, 0x0002},
3705 {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI1, 0x0000},
3706 {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI2, 0x0af7},
3707 {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI3, 0x0af7},
3708 {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_LD_BAM_CODE, 0x0002},
3709 {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_LD_UD_CODE, 0x0000}
3710 };
3711 DP(NETIF_MSG_LINK, "Disabling 20G-KR2\n");
3712
3713 for (i = 0; i < ARRAY_SIZE(reg_set); i++)
3714 bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg,
3715 reg_set[i].val);
3716 vars->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE;
3717 bnx2x_update_link_attr(params, vars->link_attr_sync);
3718
3719 vars->check_kr2_recovery_cnt = CHECK_KR2_RECOVERY_CNT;
3720}
3721
3687static void bnx2x_warpcore_set_lpi_passthrough(struct bnx2x_phy *phy, 3722static void bnx2x_warpcore_set_lpi_passthrough(struct bnx2x_phy *phy,
3688 struct link_params *params) 3723 struct link_params *params)
3689{ 3724{
@@ -3829,6 +3864,8 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy,
3829 bnx2x_set_aer_mmd(params, phy); 3864 bnx2x_set_aer_mmd(params, phy);
3830 3865
3831 bnx2x_warpcore_enable_AN_KR2(phy, params, vars); 3866 bnx2x_warpcore_enable_AN_KR2(phy, params, vars);
3867 } else {
3868 bnx2x_disable_kr2(params, vars, phy);
3832 } 3869 }
3833 3870
3834 /* Enable Autoneg: only on the main lane */ 3871 /* Enable Autoneg: only on the main lane */
@@ -13416,43 +13453,6 @@ static void bnx2x_sfp_tx_fault_detection(struct bnx2x_phy *phy,
13416 } 13453 }
13417 } 13454 }
13418} 13455}
13419static void bnx2x_disable_kr2(struct link_params *params,
13420 struct link_vars *vars,
13421 struct bnx2x_phy *phy)
13422{
13423 struct bnx2x *bp = params->bp;
13424 int i;
13425 static struct bnx2x_reg_set reg_set[] = {
13426 /* Step 1 - Program the TX/RX alignment markers */
13427 {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL5, 0x7690},
13428 {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL7, 0xe647},
13429 {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL6, 0xc4f0},
13430 {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL9, 0x7690},
13431 {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_RX_CTRL11, 0xe647},
13432 {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_RX_CTRL10, 0xc4f0},
13433 {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_USERB0_CTRL, 0x000c},
13434 {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CTRL1, 0x6000},
13435 {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CTRL3, 0x0000},
13436 {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CODE_FIELD, 0x0002},
13437 {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI1, 0x0000},
13438 {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI2, 0x0af7},
13439 {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI3, 0x0af7},
13440 {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_LD_BAM_CODE, 0x0002},
13441 {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_LD_UD_CODE, 0x0000}
13442 };
13443 DP(NETIF_MSG_LINK, "Disabling 20G-KR2\n");
13444
13445 for (i = 0; i < ARRAY_SIZE(reg_set); i++)
13446 bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg,
13447 reg_set[i].val);
13448 vars->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE;
13449 bnx2x_update_link_attr(params, vars->link_attr_sync);
13450
13451 vars->check_kr2_recovery_cnt = CHECK_KR2_RECOVERY_CNT;
13452 /* Restart AN on leading lane */
13453 bnx2x_warpcore_restart_AN_KR(phy, params);
13454}
13455
13456static void bnx2x_kr2_recovery(struct link_params *params, 13456static void bnx2x_kr2_recovery(struct link_params *params,
13457 struct link_vars *vars, 13457 struct link_vars *vars,
13458 struct bnx2x_phy *phy) 13458 struct bnx2x_phy *phy)
@@ -13530,6 +13530,8 @@ static void bnx2x_check_kr2_wa(struct link_params *params,
13530 /* Disable KR2 on both lanes */ 13530 /* Disable KR2 on both lanes */
13531 DP(NETIF_MSG_LINK, "BP=0x%x, NP=0x%x\n", base_page, next_page); 13531 DP(NETIF_MSG_LINK, "BP=0x%x, NP=0x%x\n", base_page, next_page);
13532 bnx2x_disable_kr2(params, vars, phy); 13532 bnx2x_disable_kr2(params, vars, phy);
13533 /* Restart AN on leading lane */
13534 bnx2x_warpcore_restart_AN_KR(phy, params);
13533 return; 13535 return;
13534 } 13536 }
13535} 13537}