diff options
| -rw-r--r-- | drivers/net/ixgbe/ixgbe_82598.c | 38 | ||||
| -rw-r--r-- | drivers/net/ixgbe/ixgbe_type.h | 2 |
2 files changed, 40 insertions, 0 deletions
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c index e2d5343f1275..204177d78cec 100644 --- a/drivers/net/ixgbe/ixgbe_82598.c +++ b/drivers/net/ixgbe/ixgbe_82598.c | |||
| @@ -510,6 +510,40 @@ static s32 ixgbe_start_mac_link_82598(struct ixgbe_hw *hw, | |||
| 510 | } | 510 | } |
| 511 | 511 | ||
| 512 | /** | 512 | /** |
| 513 | * ixgbe_validate_link_ready - Function looks for phy link | ||
| 514 | * @hw: pointer to hardware structure | ||
| 515 | * | ||
| 516 | * Function indicates success when phy link is available. If phy is not ready | ||
| 517 | * within 5 seconds of MAC indicating link, the function returns error. | ||
| 518 | **/ | ||
| 519 | static s32 ixgbe_validate_link_ready(struct ixgbe_hw *hw) | ||
| 520 | { | ||
| 521 | u32 timeout; | ||
| 522 | u16 an_reg; | ||
| 523 | |||
| 524 | if (hw->device_id != IXGBE_DEV_ID_82598AT2) | ||
| 525 | return 0; | ||
| 526 | |||
| 527 | for (timeout = 0; | ||
| 528 | timeout < IXGBE_VALIDATE_LINK_READY_TIMEOUT; timeout++) { | ||
| 529 | hw->phy.ops.read_reg(hw, MDIO_STAT1, MDIO_MMD_AN, &an_reg); | ||
| 530 | |||
| 531 | if ((an_reg & MDIO_AN_STAT1_COMPLETE) && | ||
| 532 | (an_reg & MDIO_STAT1_LSTATUS)) | ||
| 533 | break; | ||
| 534 | |||
| 535 | msleep(100); | ||
| 536 | } | ||
| 537 | |||
| 538 | if (timeout == IXGBE_VALIDATE_LINK_READY_TIMEOUT) { | ||
| 539 | hw_dbg(hw, "Link was indicated but link is down\n"); | ||
| 540 | return IXGBE_ERR_LINK_SETUP; | ||
| 541 | } | ||
| 542 | |||
| 543 | return 0; | ||
| 544 | } | ||
| 545 | |||
| 546 | /** | ||
| 513 | * ixgbe_check_mac_link_82598 - Get link/speed status | 547 | * ixgbe_check_mac_link_82598 - Get link/speed status |
| 514 | * @hw: pointer to hardware structure | 548 | * @hw: pointer to hardware structure |
| 515 | * @speed: pointer to link speed | 549 | * @speed: pointer to link speed |
| @@ -589,6 +623,10 @@ static s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw, | |||
| 589 | else | 623 | else |
| 590 | *speed = IXGBE_LINK_SPEED_1GB_FULL; | 624 | *speed = IXGBE_LINK_SPEED_1GB_FULL; |
| 591 | 625 | ||
| 626 | if ((hw->device_id == IXGBE_DEV_ID_82598AT2) && (*link_up == true) && | ||
| 627 | (ixgbe_validate_link_ready(hw) != 0)) | ||
| 628 | *link_up = false; | ||
| 629 | |||
| 592 | /* if link is down, zero out the current_mode */ | 630 | /* if link is down, zero out the current_mode */ |
| 593 | if (*link_up == false) { | 631 | if (*link_up == false) { |
| 594 | hw->fc.current_mode = ixgbe_fc_none; | 632 | hw->fc.current_mode = ixgbe_fc_none; |
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h index f3e8d52610b7..84650c6ebe03 100644 --- a/drivers/net/ixgbe/ixgbe_type.h +++ b/drivers/net/ixgbe/ixgbe_type.h | |||
| @@ -841,6 +841,8 @@ | |||
| 841 | #define IXGBE_MPVC 0x04318 | 841 | #define IXGBE_MPVC 0x04318 |
| 842 | #define IXGBE_SGMIIC 0x04314 | 842 | #define IXGBE_SGMIIC 0x04314 |
| 843 | 843 | ||
| 844 | #define IXGBE_VALIDATE_LINK_READY_TIMEOUT 50 | ||
| 845 | |||
| 844 | /* Omer CORECTL */ | 846 | /* Omer CORECTL */ |
| 845 | #define IXGBE_CORECTL 0x014F00 | 847 | #define IXGBE_CORECTL 0x014F00 |
| 846 | /* BARCTRL */ | 848 | /* BARCTRL */ |
