mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
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>
This commit is contained in:
parent
d87d830720
commit
26b4742bea
1 changed files with 14 additions and 12 deletions
|
@ -1609,16 +1609,9 @@ static int ixgbe_setup_loopback_test(struct ixgbe_adapter *adapter)
|
|||
struct ixgbe_hw *hw = &adapter->hw;
|
||||
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 */
|
||||
reg_data = IXGBE_READ_REG(hw, IXGBE_HLREG0);
|
||||
reg_data |= IXGBE_HLREG0_LPBK;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_HLREG0, reg_data);
|
||||
|
||||
|
@ -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;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCTRL, reg_data);
|
||||
|
||||
reg_data = IXGBE_READ_REG(hw, IXGBE_AUTOC);
|
||||
reg_data &= ~IXGBE_AUTOC_LMS_MASK;
|
||||
reg_data |= IXGBE_AUTOC_LMS_10G_LINK_NO_AN | IXGBE_AUTOC_FLU;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_AUTOC, 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);
|
||||
} else {
|
||||
if (hw->mac.orig_autoc) {
|
||||
reg_data = hw->mac.orig_autoc | IXGBE_AUTOC_FLU;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_AUTOC, reg_data);
|
||||
} else {
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
IXGBE_WRITE_FLUSH(hw);
|
||||
usleep_range(10000, 20000);
|
||||
|
||||
|
|
Loading…
Reference in a new issue