diff options
author | Don Skidmore <donald.c.skidmore@intel.com> | 2010-12-03 08:23:30 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-12-06 16:18:50 -0500 |
commit | a7f5a5fcd9f13afd3471a0de8c1fdaa8f989497c (patch) | |
tree | f209c677d351b228dd6be42d50b21d814abb933d /drivers/net/ixgbe | |
parent | 8917a3c0b7d1557548f50bfe3f0e18e0354e38f6 (diff) |
ixgbe: fix for link failure on SFP+ DA cables
This patch helps prevent FW/SW semaphore collision from leading
to link establishment failure. The collision might mess up the
PHY registers so we reset the PHY. However there are SFI/KR areas
in the PHY that are not reset with a Reset_AN so we need to change
LMS to reset it. Also wait until AN state machine is AN_GOOD
Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com>
Tested-by: Stephen Ko <stephen.s.ko@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_82599.c | 28 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_type.h | 3 |
2 files changed, 28 insertions, 3 deletions
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c index 385ccebb826c..6827dddc383e 100644 --- a/drivers/net/ixgbe/ixgbe_82599.c +++ b/drivers/net/ixgbe/ixgbe_82599.c | |||
@@ -96,6 +96,8 @@ static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw) | |||
96 | static s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw) | 96 | static s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw) |
97 | { | 97 | { |
98 | s32 ret_val = 0; | 98 | s32 ret_val = 0; |
99 | u32 reg_anlp1 = 0; | ||
100 | u32 i = 0; | ||
99 | u16 list_offset, data_offset, data_value; | 101 | u16 list_offset, data_offset, data_value; |
100 | 102 | ||
101 | if (hw->phy.sfp_type != ixgbe_sfp_type_unknown) { | 103 | if (hw->phy.sfp_type != ixgbe_sfp_type_unknown) { |
@@ -122,14 +124,34 @@ static s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw) | |||
122 | IXGBE_WRITE_FLUSH(hw); | 124 | IXGBE_WRITE_FLUSH(hw); |
123 | hw->eeprom.ops.read(hw, ++data_offset, &data_value); | 125 | hw->eeprom.ops.read(hw, ++data_offset, &data_value); |
124 | } | 126 | } |
125 | /* Now restart DSP by setting Restart_AN */ | ||
126 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, | ||
127 | (IXGBE_READ_REG(hw, IXGBE_AUTOC) | IXGBE_AUTOC_AN_RESTART)); | ||
128 | 127 | ||
129 | /* Release the semaphore */ | 128 | /* Release the semaphore */ |
130 | ixgbe_release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM); | 129 | ixgbe_release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM); |
131 | /* Delay obtaining semaphore again to allow FW access */ | 130 | /* Delay obtaining semaphore again to allow FW access */ |
132 | msleep(hw->eeprom.semaphore_delay); | 131 | msleep(hw->eeprom.semaphore_delay); |
132 | |||
133 | /* Now restart DSP by setting Restart_AN and clearing LMS */ | ||
134 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, ((IXGBE_READ_REG(hw, | ||
135 | IXGBE_AUTOC) & ~IXGBE_AUTOC_LMS_MASK) | | ||
136 | IXGBE_AUTOC_AN_RESTART)); | ||
137 | |||
138 | /* Wait for AN to leave state 0 */ | ||
139 | for (i = 0; i < 10; i++) { | ||
140 | msleep(4); | ||
141 | reg_anlp1 = IXGBE_READ_REG(hw, IXGBE_ANLP1); | ||
142 | if (reg_anlp1 & IXGBE_ANLP1_AN_STATE_MASK) | ||
143 | break; | ||
144 | } | ||
145 | if (!(reg_anlp1 & IXGBE_ANLP1_AN_STATE_MASK)) { | ||
146 | hw_dbg(hw, "sfp module setup not complete\n"); | ||
147 | ret_val = IXGBE_ERR_SFP_SETUP_NOT_COMPLETE; | ||
148 | goto setup_sfp_out; | ||
149 | } | ||
150 | |||
151 | /* Restart DSP by setting Restart_AN and return to SFI mode */ | ||
152 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, (IXGBE_READ_REG(hw, | ||
153 | IXGBE_AUTOC) | IXGBE_AUTOC_LMS_10G_SERIAL | | ||
154 | IXGBE_AUTOC_AN_RESTART)); | ||
133 | } | 155 | } |
134 | 156 | ||
135 | setup_sfp_out: | 157 | setup_sfp_out: |
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h index ef816dd5a8f0..0f80893edabf 100644 --- a/drivers/net/ixgbe/ixgbe_type.h +++ b/drivers/net/ixgbe/ixgbe_type.h | |||
@@ -1470,6 +1470,8 @@ | |||
1470 | #define IXGBE_ANLP1_PAUSE 0x0C00 | 1470 | #define IXGBE_ANLP1_PAUSE 0x0C00 |
1471 | #define IXGBE_ANLP1_SYM_PAUSE 0x0400 | 1471 | #define IXGBE_ANLP1_SYM_PAUSE 0x0400 |
1472 | #define IXGBE_ANLP1_ASM_PAUSE 0x0800 | 1472 | #define IXGBE_ANLP1_ASM_PAUSE 0x0800 |
1473 | #define IXGBE_ANLP1_AN_STATE_MASK 0x000f0000 | ||
1474 | |||
1473 | 1475 | ||
1474 | /* SW Semaphore Register bitmasks */ | 1476 | /* SW Semaphore Register bitmasks */ |
1475 | #define IXGBE_SWSM_SMBI 0x00000001 /* Driver Semaphore bit */ | 1477 | #define IXGBE_SWSM_SMBI 0x00000001 /* Driver Semaphore bit */ |
@@ -2641,6 +2643,7 @@ struct ixgbe_info { | |||
2641 | #define IXGBE_ERR_NO_SPACE -25 | 2643 | #define IXGBE_ERR_NO_SPACE -25 |
2642 | #define IXGBE_ERR_OVERTEMP -26 | 2644 | #define IXGBE_ERR_OVERTEMP -26 |
2643 | #define IXGBE_ERR_RAR_INDEX -27 | 2645 | #define IXGBE_ERR_RAR_INDEX -27 |
2646 | #define IXGBE_ERR_SFP_SETUP_NOT_COMPLETE -30 | ||
2644 | #define IXGBE_ERR_PBA_SECTION -31 | 2647 | #define IXGBE_ERR_PBA_SECTION -31 |
2645 | #define IXGBE_ERR_INVALID_ARGUMENT -32 | 2648 | #define IXGBE_ERR_INVALID_ARGUMENT -32 |
2646 | #define IXGBE_NOT_IMPLEMENTED 0x7FFFFFFF | 2649 | #define IXGBE_NOT_IMPLEMENTED 0x7FFFFFFF |