Commit 26b4742b authored by Emil Tantilov's avatar Emil Tantilov Committed by Jeff Kirsher

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: default avatarEmil Tantilov <emil.s.tantilov@intel.com>
Tested-by: default avatarPhil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent d87d8307
...@@ -1609,16 +1609,9 @@ static int ixgbe_setup_loopback_test(struct ixgbe_adapter *adapter) ...@@ -1609,16 +1609,9 @@ static int ixgbe_setup_loopback_test(struct ixgbe_adapter *adapter)
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw = &adapter->hw;
u32 reg_data; u32 reg_data;
/* X540 needs to set the MACC.FLU bit to force link up */
if (adapter->hw.mac.type == ixgbe_mac_X540) {
reg_data = IXGBE_READ_REG(hw, IXGBE_MACC);
reg_data |= IXGBE_MACC_FLU;
IXGBE_WRITE_REG(hw, IXGBE_MACC, reg_data);
}
/* right now we only support MAC loopback in the driver */
reg_data = IXGBE_READ_REG(hw, IXGBE_HLREG0);
/* Setup MAC loopback */ /* Setup MAC loopback */
reg_data = IXGBE_READ_REG(hw, IXGBE_HLREG0);
reg_data |= IXGBE_HLREG0_LPBK; reg_data |= IXGBE_HLREG0_LPBK;
IXGBE_WRITE_REG(hw, IXGBE_HLREG0, reg_data); IXGBE_WRITE_REG(hw, IXGBE_HLREG0, reg_data);
...@@ -1626,10 +1619,19 @@ static int ixgbe_setup_loopback_test(struct ixgbe_adapter *adapter) ...@@ -1626,10 +1619,19 @@ static int ixgbe_setup_loopback_test(struct ixgbe_adapter *adapter)
reg_data |= IXGBE_FCTRL_BAM | IXGBE_FCTRL_SBP | IXGBE_FCTRL_MPE; reg_data |= IXGBE_FCTRL_BAM | IXGBE_FCTRL_SBP | IXGBE_FCTRL_MPE;
IXGBE_WRITE_REG(hw, IXGBE_FCTRL, reg_data); IXGBE_WRITE_REG(hw, IXGBE_FCTRL, reg_data);
reg_data = IXGBE_READ_REG(hw, IXGBE_AUTOC); /* X540 needs to set the MACC.FLU bit to force link up */
reg_data &= ~IXGBE_AUTOC_LMS_MASK; if (adapter->hw.mac.type == ixgbe_mac_X540) {
reg_data |= IXGBE_AUTOC_LMS_10G_LINK_NO_AN | IXGBE_AUTOC_FLU; reg_data = IXGBE_READ_REG(hw, IXGBE_MACC);
reg_data |= IXGBE_MACC_FLU;
IXGBE_WRITE_REG(hw, IXGBE_MACC, reg_data);
} else {
if (hw->mac.orig_autoc) {
reg_data = hw->mac.orig_autoc | IXGBE_AUTOC_FLU;
IXGBE_WRITE_REG(hw, IXGBE_AUTOC, reg_data); IXGBE_WRITE_REG(hw, IXGBE_AUTOC, reg_data);
} else {
return 10;
}
}
IXGBE_WRITE_FLUSH(hw); IXGBE_WRITE_FLUSH(hw);
usleep_range(10000, 20000); usleep_range(10000, 20000);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment