X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Ftxgbe%2Fbase%2Ftxgbe_hw.c;h=3e7f2f9a3f237f33d6a42091f1c899e5a45d5fdc;hb=db94014c4c6084d4797b514c6d0f517cdd546076;hp=26562f50de3f1013412587efa155dec476b12475;hpb=6f47613c14453a74cee2ad0dc96c54f8cd506bcd;p=dpdk.git diff --git a/drivers/net/txgbe/base/txgbe_hw.c b/drivers/net/txgbe/base/txgbe_hw.c index 26562f50de..3e7f2f9a3f 100644 --- a/drivers/net/txgbe/base/txgbe_hw.c +++ b/drivers/net/txgbe/base/txgbe_hw.c @@ -91,7 +91,6 @@ s32 txgbe_setup_fc(struct txgbe_hw *hw) u16 reg_cu = 0; u32 value = 0; u64 reg_bp = 0; - bool locked = false; DEBUGFUNC("txgbe_setup_fc"); @@ -109,29 +108,6 @@ s32 txgbe_setup_fc(struct txgbe_hw *hw) if (hw->fc.requested_mode == txgbe_fc_default) hw->fc.requested_mode = txgbe_fc_full; - /* - * Set up the 1G and 10G flow control advertisement registers so the - * HW will be able to do fc autoneg once the cable is plugged in. If - * we link at 10G, the 1G advertisement is harmless and vice versa. - */ - switch (hw->phy.media_type) { - case txgbe_media_type_backplane: - /* some MAC's need RMW protection on AUTOC */ - err = hw->mac.prot_autoc_read(hw, &locked, ®_bp); - if (err != 0) - goto out; - - /* fall through - only backplane uses autoc */ - case txgbe_media_type_fiber_qsfp: - case txgbe_media_type_fiber: - case txgbe_media_type_copper: - hw->phy.read_reg(hw, TXGBE_MD_AUTO_NEG_ADVT, - TXGBE_MD_DEV_AUTO_NEG, ®_cu); - break; - default: - break; - } - /* * The possible values of fc.requested_mode are: * 0: Flow control is completely disabled @@ -145,13 +121,6 @@ s32 txgbe_setup_fc(struct txgbe_hw *hw) switch (hw->fc.requested_mode) { case txgbe_fc_none: /* Flow control completely disabled by software override. */ - reg &= ~(SR_MII_MMD_AN_ADV_PAUSE_SYM | - SR_MII_MMD_AN_ADV_PAUSE_ASM); - if (hw->phy.media_type == txgbe_media_type_backplane) - reg_bp &= ~(TXGBE_AUTOC_SYM_PAUSE | - TXGBE_AUTOC_ASM_PAUSE); - else if (hw->phy.media_type == txgbe_media_type_copper) - reg_cu &= ~(TXGBE_TAF_SYM_PAUSE | TXGBE_TAF_ASM_PAUSE); break; case txgbe_fc_tx_pause: /* @@ -159,15 +128,6 @@ s32 txgbe_setup_fc(struct txgbe_hw *hw) * disabled by software override. */ reg |= SR_MII_MMD_AN_ADV_PAUSE_ASM; - reg &= ~SR_MII_MMD_AN_ADV_PAUSE_SYM; - if (hw->phy.media_type == txgbe_media_type_backplane) { - reg_bp |= TXGBE_AUTOC_ASM_PAUSE; - reg_bp &= ~TXGBE_AUTOC_SYM_PAUSE; - } else if (hw->phy.media_type == txgbe_media_type_copper) { - reg_cu |= TXGBE_TAF_ASM_PAUSE; - reg_cu &= ~TXGBE_TAF_SYM_PAUSE; - } - reg |= SR_MII_MMD_AN_ADV_PAUSE_ASM; reg_bp |= SR_AN_MMD_ADV_REG1_PAUSE_ASM; break; case txgbe_fc_rx_pause: @@ -182,13 +142,6 @@ s32 txgbe_setup_fc(struct txgbe_hw *hw) */ case txgbe_fc_full: /* Flow control (both Rx and Tx) is enabled by SW override. */ - reg |= SR_MII_MMD_AN_ADV_PAUSE_SYM | - SR_MII_MMD_AN_ADV_PAUSE_ASM; - if (hw->phy.media_type == txgbe_media_type_backplane) - reg_bp |= TXGBE_AUTOC_SYM_PAUSE | - TXGBE_AUTOC_ASM_PAUSE; - else if (hw->phy.media_type == txgbe_media_type_copper) - reg_cu |= TXGBE_TAF_SYM_PAUSE | TXGBE_TAF_ASM_PAUSE; reg |= SR_MII_MMD_AN_ADV_PAUSE_SYM | SR_MII_MMD_AN_ADV_PAUSE_ASM; reg_bp |= SR_AN_MMD_ADV_REG1_PAUSE_SYM | @@ -2575,13 +2528,9 @@ void txgbe_init_mac_link_ops(struct txgbe_hw *hw) mac->setup_link = txgbe_setup_mac_link_multispeed_fiber; mac->setup_mac_link = txgbe_setup_mac_link; mac->set_rate_select_speed = txgbe_set_hard_rate_select_speed; - } else if ((hw->phy.media_type == txgbe_media_type_backplane) && - (hw->phy.smart_speed == txgbe_smart_speed_auto || - hw->phy.smart_speed == txgbe_smart_speed_on) && - !txgbe_verify_lesm_fw_enabled_raptor(hw)) { - mac->setup_link = txgbe_setup_mac_link_smartspeed; } else { mac->setup_link = txgbe_setup_mac_link; + mac->set_rate_select_speed = txgbe_set_hard_rate_select_speed; } } @@ -2625,6 +2574,11 @@ s32 txgbe_init_phy_raptor(struct txgbe_hw *hw) txgbe_get_copper_link_capabilities; } + if (phy->media_type == txgbe_media_type_backplane) { + mac->kr_handle = txgbe_kr_handle; + mac->bp_down_event = txgbe_bp_down_event; + } + /* Set necessary function pointers based on PHY type */ switch (hw->phy.type) { case txgbe_phy_tn: @@ -2997,6 +2951,9 @@ u32 txgbe_get_media_type_raptor(struct txgbe_hw *hw) DEBUGFUNC("txgbe_get_media_type_raptor"); + if (hw->phy.ffe_set) + txgbe_bp_mode_set(hw); + /* Detect if there is a copper PHY attached. */ switch (hw->phy.type) { case txgbe_phy_cu_unknown: @@ -3309,13 +3266,11 @@ s32 txgbe_setup_mac_link(struct txgbe_hw *hw, u64 pma_pmd_10gs = autoc & TXGBE_AUTOC_10GS_PMA_PMD_MASK; u64 pma_pmd_1g = autoc & TXGBE_AUTOC_1G_PMA_PMD_MASK; u64 link_mode = autoc & TXGBE_AUTOC_LMS_MASK; - u64 current_autoc = autoc; u64 orig_autoc = 0; - u32 links_reg; - u32 i; u32 link_capabilities = TXGBE_LINK_SPEED_UNKNOWN; DEBUGFUNC("txgbe_setup_mac_link"); + UNREFERENCED_PARAMETER(autoneg_wait_to_complete); /* Check to see if speed passed in is supported. */ status = hw->mac.get_link_capabilities(hw, @@ -3346,8 +3301,7 @@ s32 txgbe_setup_mac_link(struct txgbe_hw *hw, if (speed & TXGBE_LINK_SPEED_10GB_FULL) { if (orig_autoc & TXGBE_AUTOC_KX4_SUPP) autoc |= TXGBE_AUTOC_KX4_SUPP; - if ((orig_autoc & TXGBE_AUTOC_KR_SUPP) && - !hw->phy.smart_speed_active) + if (orig_autoc & TXGBE_AUTOC_KR_SUPP) autoc |= TXGBE_AUTOC_KR_SUPP; } if (speed & TXGBE_LINK_SPEED_1GB_FULL) @@ -3374,35 +3328,14 @@ s32 txgbe_setup_mac_link(struct txgbe_hw *hw, } } - if (autoc == current_autoc) - return status; - autoc &= ~TXGBE_AUTOC_SPEED_MASK; autoc |= TXGBE_AUTOC_SPEED(speed); + autoc &= ~TXGBE_AUTOC_AUTONEG; autoc |= (autoneg ? TXGBE_AUTOC_AUTONEG : 0); /* Restart link */ hw->mac.autoc_write(hw, autoc); - /* Only poll for autoneg to complete if specified to do so */ - if (autoneg_wait_to_complete) { - if (link_mode == TXGBE_AUTOC_LMS_KX4_KX_KR || - link_mode == TXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN || - link_mode == TXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) { - links_reg = 0; /*Just in case Autoneg time=0*/ - for (i = 0; i < TXGBE_AUTO_NEG_TIME; i++) { - links_reg = rd32(hw, TXGBE_PORTSTAT); - if (links_reg & TXGBE_PORTSTAT_UP) - break; - msec_delay(100); - } - if (!(links_reg & TXGBE_PORTSTAT_UP)) { - status = TXGBE_ERR_AUTONEG_NOT_COMPLETE; - DEBUGOUT("Autoneg did not complete.\n"); - } - } - } - /* Add delay to filter out noises during initial link setup */ msec_delay(50); @@ -3515,6 +3448,7 @@ txgbe_reset_misc(struct txgbe_hw *hw) /* enable mac transmitter */ wr32m(hw, TXGBE_MACTXCFG, TXGBE_MACTXCFG_TXE, TXGBE_MACTXCFG_TXE); + hw->mac.autoc = hw->mac.orig_autoc; for (i = 0; i < 4; i++) wr32m(hw, TXGBE_IVAR(i), 0x80808080, 0); } @@ -3608,12 +3542,19 @@ mac_reset_top: */ if (!hw->mac.orig_link_settings_stored) { hw->mac.orig_autoc = hw->mac.autoc_read(hw); - hw->mac.autoc_write(hw, hw->mac.orig_autoc); hw->mac.orig_link_settings_stored = true; } else { hw->mac.orig_autoc = autoc; } + if (hw->phy.ffe_set) { + /* Make sure phy power is up */ + msec_delay(50); + + /* A temporary solution to set phy */ + txgbe_set_phy_temp(hw); + } + /* Store the permanent mac address */ hw->mac.get_mac_addr(hw, hw->mac.perm_addr);