diff options
Diffstat (limited to 'drivers/net/ethernet/intel/e1000e/ich8lan.c')
-rw-r--r-- | drivers/net/ethernet/intel/e1000e/ich8lan.c | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c index 238ab2f8a5e7..e3a7b07df629 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c | |||
@@ -325,24 +325,46 @@ static inline void __ew32flash(struct e1000_hw *hw, unsigned long reg, u32 val) | |||
325 | **/ | 325 | **/ |
326 | static bool e1000_phy_is_accessible_pchlan(struct e1000_hw *hw) | 326 | static bool e1000_phy_is_accessible_pchlan(struct e1000_hw *hw) |
327 | { | 327 | { |
328 | u16 phy_reg; | 328 | u16 phy_reg = 0; |
329 | u32 phy_id; | 329 | u32 phy_id = 0; |
330 | s32 ret_val; | ||
331 | u16 retry_count; | ||
332 | |||
333 | for (retry_count = 0; retry_count < 2; retry_count++) { | ||
334 | ret_val = e1e_rphy_locked(hw, PHY_ID1, &phy_reg); | ||
335 | if (ret_val || (phy_reg == 0xFFFF)) | ||
336 | continue; | ||
337 | phy_id = (u32)(phy_reg << 16); | ||
330 | 338 | ||
331 | e1e_rphy_locked(hw, PHY_ID1, &phy_reg); | 339 | ret_val = e1e_rphy_locked(hw, PHY_ID2, &phy_reg); |
332 | phy_id = (u32)(phy_reg << 16); | 340 | if (ret_val || (phy_reg == 0xFFFF)) { |
333 | e1e_rphy_locked(hw, PHY_ID2, &phy_reg); | 341 | phy_id = 0; |
334 | phy_id |= (u32)(phy_reg & PHY_REVISION_MASK); | 342 | continue; |
343 | } | ||
344 | phy_id |= (u32)(phy_reg & PHY_REVISION_MASK); | ||
345 | break; | ||
346 | } | ||
335 | 347 | ||
336 | if (hw->phy.id) { | 348 | if (hw->phy.id) { |
337 | if (hw->phy.id == phy_id) | 349 | if (hw->phy.id == phy_id) |
338 | return true; | 350 | return true; |
339 | } else { | 351 | } else if (phy_id) { |
340 | if ((phy_id != 0) && (phy_id != PHY_REVISION_MASK)) | 352 | hw->phy.id = phy_id; |
341 | hw->phy.id = phy_id; | 353 | hw->phy.revision = (u32)(phy_reg & ~PHY_REVISION_MASK); |
342 | return true; | 354 | return true; |
343 | } | 355 | } |
344 | 356 | ||
345 | return false; | 357 | /* |
358 | * In case the PHY needs to be in mdio slow mode, | ||
359 | * set slow mode and try to get the PHY id again. | ||
360 | */ | ||
361 | hw->phy.ops.release(hw); | ||
362 | ret_val = e1000_set_mdio_slow_mode_hv(hw); | ||
363 | if (!ret_val) | ||
364 | ret_val = e1000e_get_phy_id(hw); | ||
365 | hw->phy.ops.acquire(hw); | ||
366 | |||
367 | return !ret_val; | ||
346 | } | 368 | } |
347 | 369 | ||
348 | /** | 370 | /** |