aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe
diff options
context:
space:
mode:
authorMallikarjuna R Chilakala <mallikarjuna.chilakala@intel.com>2009-12-15 06:57:20 -0500
committerDavid S. Miller <davem@davemloft.net>2009-12-16 02:18:26 -0500
commit734e979f25a74e0d7da4ae0498ecac644db6377d (patch)
tree7f08862f5fcfb900eae9c7046c1fd7bb2f5f95f8 /drivers/net/ixgbe
parenteb985f09b2a189bde80550e410ddfc28c4276c53 (diff)
ixgbe: Fix 82598 premature copper PHY link indicatation
Modified patch with Dave's comments to replace mdelay with proper msleep. Fix 82598 copper link issue, where the phy prematurely indicates link before it is ready to process packets. The new function looks for phy link and indicates that, when it is available. If phy is not ready within few seconds of MAC indicating link, the function will return failure which translates to link down indication. Signed-off-by: Mallikarjuna R Chilakala <mallikarjuna.chilakala@intel.com> Acked-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe')
-rw-r--r--drivers/net/ixgbe/ixgbe_82598.c38
-rw-r--r--drivers/net/ixgbe/ixgbe_type.h2
2 files changed, 40 insertions, 0 deletions
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c
index e2d5343f127..204177d78ce 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 **/
519static 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 f3e8d52610b..84650c6ebe0 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 */