aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/intel/e1000e/ich8lan.c103
1 files changed, 49 insertions, 54 deletions
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
index e446e0582503..50a61fcf75cc 100644
--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
@@ -306,7 +306,6 @@ static void e1000_toggle_lanphypc_value_ich8lan(struct e1000_hw *hw)
306static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) 306static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
307{ 307{
308 struct e1000_phy_info *phy = &hw->phy; 308 struct e1000_phy_info *phy = &hw->phy;
309 u32 fwsm;
310 s32 ret_val = 0; 309 s32 ret_val = 0;
311 310
312 phy->addr = 1; 311 phy->addr = 1;
@@ -325,14 +324,14 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
325 phy->ops.power_down = e1000_power_down_phy_copper_ich8lan; 324 phy->ops.power_down = e1000_power_down_phy_copper_ich8lan;
326 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; 325 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
327 326
328 /* 327 if (!e1000_check_reset_block(hw)) {
329 * The MAC-PHY interconnect may still be in SMBus mode 328 u32 fwsm = er32(FWSM);
330 * after Sx->S0. If the manageability engine (ME) is 329
331 * disabled, then toggle the LANPHYPC Value bit to force 330 /*
332 * the interconnect to PCIe mode. 331 * The MAC-PHY interconnect may still be in SMBus mode after
333 */ 332 * Sx->S0. If resetting the PHY is not blocked, toggle the
334 fwsm = er32(FWSM); 333 * LANPHYPC Value bit to force the interconnect to PCIe mode.
335 if (!(fwsm & E1000_ICH_FWSM_FW_VALID) && !e1000_check_reset_block(hw)) { 334 */
336 e1000_toggle_lanphypc_value_ich8lan(hw); 335 e1000_toggle_lanphypc_value_ich8lan(hw);
337 msleep(50); 336 msleep(50);
338 337
@@ -340,25 +339,26 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
340 * Gate automatic PHY configuration by hardware on 339 * Gate automatic PHY configuration by hardware on
341 * non-managed 82579 340 * non-managed 82579
342 */ 341 */
343 if (hw->mac.type == e1000_pch2lan) 342 if ((hw->mac.type == e1000_pch2lan) &&
343 !(fwsm & E1000_ICH_FWSM_FW_VALID))
344 e1000_gate_hw_phy_config_ich8lan(hw, true); 344 e1000_gate_hw_phy_config_ich8lan(hw, true);
345 }
346 345
347 /* 346 /*
348 * Reset the PHY before any access to it. Doing so, ensures that 347 * Reset the PHY before any access to it. Doing so, ensures
349 * the PHY is in a known good state before we read/write PHY registers. 348 * that the PHY is in a known good state before we read/write
350 * The generic reset is sufficient here, because we haven't determined 349 * PHY registers. The generic reset is sufficient here,
351 * the PHY type yet. 350 * because we haven't determined the PHY type yet.
352 */ 351 */
353 ret_val = e1000e_phy_hw_reset_generic(hw); 352 ret_val = e1000e_phy_hw_reset_generic(hw);
354 if (ret_val) 353 if (ret_val)
355 goto out; 354 goto out;
356 355
357 /* Ungate automatic PHY configuration on non-managed 82579 */ 356 /* Ungate automatic PHY configuration on non-managed 82579 */
358 if ((hw->mac.type == e1000_pch2lan) && 357 if ((hw->mac.type == e1000_pch2lan) &&
359 !(fwsm & E1000_ICH_FWSM_FW_VALID)) { 358 !(fwsm & E1000_ICH_FWSM_FW_VALID)) {
360 usleep_range(10000, 20000); 359 usleep_range(10000, 20000);
361 e1000_gate_hw_phy_config_ich8lan(hw, false); 360 e1000_gate_hw_phy_config_ich8lan(hw, false);
361 }
362 } 362 }
363 363
364 phy->id = e1000_phy_unknown; 364 phy->id = e1000_phy_unknown;
@@ -3736,42 +3736,37 @@ void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw)
3736 **/ 3736 **/
3737void e1000_resume_workarounds_pchlan(struct e1000_hw *hw) 3737void e1000_resume_workarounds_pchlan(struct e1000_hw *hw)
3738{ 3738{
3739 u32 fwsm; 3739 u16 phy_id1, phy_id2;
3740 s32 ret_val;
3740 3741
3741 if (hw->mac.type != e1000_pch2lan) 3742 if ((hw->mac.type != e1000_pch2lan) || e1000_check_reset_block(hw))
3742 return; 3743 return;
3743 3744
3744 fwsm = er32(FWSM); 3745 ret_val = hw->phy.ops.acquire(hw);
3745 if (!(fwsm & E1000_ICH_FWSM_FW_VALID) || !e1000_check_reset_block(hw)) { 3746 if (ret_val) {
3746 u16 phy_id1, phy_id2; 3747 e_dbg("Failed to acquire PHY semaphore in resume\n");
3747 s32 ret_val; 3748 return;
3748 3749 }
3749 ret_val = hw->phy.ops.acquire(hw);
3750 if (ret_val) {
3751 e_dbg("Failed to acquire PHY semaphore in resume\n");
3752 return;
3753 }
3754 3750
3755 /* Test access to the PHY registers by reading the ID regs */ 3751 /* Test access to the PHY registers by reading the ID regs */
3756 ret_val = hw->phy.ops.read_reg_locked(hw, PHY_ID1, &phy_id1); 3752 ret_val = hw->phy.ops.read_reg_locked(hw, PHY_ID1, &phy_id1);
3757 if (ret_val) 3753 if (ret_val)
3758 goto release; 3754 goto release;
3759 ret_val = hw->phy.ops.read_reg_locked(hw, PHY_ID2, &phy_id2); 3755 ret_val = hw->phy.ops.read_reg_locked(hw, PHY_ID2, &phy_id2);
3760 if (ret_val) 3756 if (ret_val)
3761 goto release; 3757 goto release;
3762 3758
3763 if (hw->phy.id == ((u32)(phy_id1 << 16) | 3759 if (hw->phy.id == ((u32)(phy_id1 << 16) |
3764 (u32)(phy_id2 & PHY_REVISION_MASK))) 3760 (u32)(phy_id2 & PHY_REVISION_MASK)))
3765 goto release; 3761 goto release;
3766 3762
3767 e1000_toggle_lanphypc_value_ich8lan(hw); 3763 e1000_toggle_lanphypc_value_ich8lan(hw);
3768 3764
3769 hw->phy.ops.release(hw); 3765 hw->phy.ops.release(hw);
3770 msleep(50); 3766 msleep(50);
3771 e1000_phy_hw_reset(hw); 3767 e1000_phy_hw_reset(hw);
3772 msleep(50); 3768 msleep(50);
3773 return; 3769 return;
3774 }
3775 3770
3776release: 3771release:
3777 hw->phy.ops.release(hw); 3772 hw->phy.ops.release(hw);