diff options
author | Emil Tantilov <emil.s.tantilov@intel.com> | 2013-04-11 22:10:25 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2013-04-25 22:05:45 -0400 |
commit | 26b4742beaf18456195eeda1b8f59547f5569ac7 (patch) | |
tree | a861cc7b22b7319d35b2349eadd44c7f7e42c244 | |
parent | d87d830720a1446403ed38bfc2da268be0d356d1 (diff) |
ixgbe: fix register access during ethtool loopback test
This patch cleans up the logic in ixgbe_setup_loopback_test() to only access
registers applicable to the MAC type. AUTOC is only valid on MACs older than
X540. MACC is used for X540.
In addition it removes a read of AUTOC and uses the stored value to force the
link up.
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index bbe00bcc7582..509d3ae191f3 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | |||
@@ -1609,16 +1609,9 @@ static int ixgbe_setup_loopback_test(struct ixgbe_adapter *adapter) | |||
1609 | struct ixgbe_hw *hw = &adapter->hw; | 1609 | struct ixgbe_hw *hw = &adapter->hw; |
1610 | u32 reg_data; | 1610 | u32 reg_data; |
1611 | 1611 | ||
1612 | /* X540 needs to set the MACC.FLU bit to force link up */ | ||
1613 | if (adapter->hw.mac.type == ixgbe_mac_X540) { | ||
1614 | reg_data = IXGBE_READ_REG(hw, IXGBE_MACC); | ||
1615 | reg_data |= IXGBE_MACC_FLU; | ||
1616 | IXGBE_WRITE_REG(hw, IXGBE_MACC, reg_data); | ||
1617 | } | ||
1618 | 1612 | ||
1619 | /* right now we only support MAC loopback in the driver */ | ||
1620 | reg_data = IXGBE_READ_REG(hw, IXGBE_HLREG0); | ||
1621 | /* Setup MAC loopback */ | 1613 | /* Setup MAC loopback */ |
1614 | reg_data = IXGBE_READ_REG(hw, IXGBE_HLREG0); | ||
1622 | reg_data |= IXGBE_HLREG0_LPBK; | 1615 | reg_data |= IXGBE_HLREG0_LPBK; |
1623 | IXGBE_WRITE_REG(hw, IXGBE_HLREG0, reg_data); | 1616 | IXGBE_WRITE_REG(hw, IXGBE_HLREG0, reg_data); |
1624 | 1617 | ||
@@ -1626,10 +1619,19 @@ static int ixgbe_setup_loopback_test(struct ixgbe_adapter *adapter) | |||
1626 | reg_data |= IXGBE_FCTRL_BAM | IXGBE_FCTRL_SBP | IXGBE_FCTRL_MPE; | 1619 | reg_data |= IXGBE_FCTRL_BAM | IXGBE_FCTRL_SBP | IXGBE_FCTRL_MPE; |
1627 | IXGBE_WRITE_REG(hw, IXGBE_FCTRL, reg_data); | 1620 | IXGBE_WRITE_REG(hw, IXGBE_FCTRL, reg_data); |
1628 | 1621 | ||
1629 | reg_data = IXGBE_READ_REG(hw, IXGBE_AUTOC); | 1622 | /* X540 needs to set the MACC.FLU bit to force link up */ |
1630 | reg_data &= ~IXGBE_AUTOC_LMS_MASK; | 1623 | if (adapter->hw.mac.type == ixgbe_mac_X540) { |
1631 | reg_data |= IXGBE_AUTOC_LMS_10G_LINK_NO_AN | IXGBE_AUTOC_FLU; | 1624 | reg_data = IXGBE_READ_REG(hw, IXGBE_MACC); |
1632 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, reg_data); | 1625 | reg_data |= IXGBE_MACC_FLU; |
1626 | IXGBE_WRITE_REG(hw, IXGBE_MACC, reg_data); | ||
1627 | } else { | ||
1628 | if (hw->mac.orig_autoc) { | ||
1629 | reg_data = hw->mac.orig_autoc | IXGBE_AUTOC_FLU; | ||
1630 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, reg_data); | ||
1631 | } else { | ||
1632 | return 10; | ||
1633 | } | ||
1634 | } | ||
1633 | IXGBE_WRITE_FLUSH(hw); | 1635 | IXGBE_WRITE_FLUSH(hw); |
1634 | usleep_range(10000, 20000); | 1636 | usleep_range(10000, 20000); |
1635 | 1637 | ||