Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | |
| 3 | Intel PRO/1000 Linux driver |
Bruce Allan | f5e261e | 2012-01-01 16:00:03 +0000 | [diff] [blame] | 4 | Copyright(c) 1999 - 2012 Intel Corporation. |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 5 | |
| 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | under the terms and conditions of the GNU General Public License, |
| 8 | version 2, as published by the Free Software Foundation. |
| 9 | |
| 10 | This program is distributed in the hope it will be useful, but WITHOUT |
| 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 13 | more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License along with |
| 16 | this program; if not, write to the Free Software Foundation, Inc., |
| 17 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | |
| 19 | The full GNU General Public License is included in this distribution in |
| 20 | the file called "COPYING". |
| 21 | |
| 22 | Contact Information: |
| 23 | Linux NICS <linux.nics@intel.com> |
| 24 | e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> |
| 25 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
| 26 | |
| 27 | *******************************************************************************/ |
| 28 | |
| 29 | /* |
| 30 | * 82571EB Gigabit Ethernet Controller |
Bruce Allan | 1605927 | 2008-11-21 16:51:06 -0800 | [diff] [blame] | 31 | * 82571EB Gigabit Ethernet Controller (Copper) |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 32 | * 82571EB Gigabit Ethernet Controller (Fiber) |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 33 | * 82571EB Dual Port Gigabit Mezzanine Adapter |
| 34 | * 82571EB Quad Port Gigabit Mezzanine Adapter |
| 35 | * 82571PT Gigabit PT Quad Port Server ExpressModule |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 36 | * 82572EI Gigabit Ethernet Controller (Copper) |
| 37 | * 82572EI Gigabit Ethernet Controller (Fiber) |
| 38 | * 82572EI Gigabit Ethernet Controller |
| 39 | * 82573V Gigabit Ethernet Controller (Copper) |
| 40 | * 82573E Gigabit Ethernet Controller (Copper) |
| 41 | * 82573L Gigabit Ethernet Controller |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 42 | * 82574L Gigabit Network Connection |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 43 | * 82583V Gigabit Network Connection |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 44 | */ |
| 45 | |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 46 | #include "e1000.h" |
| 47 | |
| 48 | #define ID_LED_RESERVED_F746 0xF746 |
| 49 | #define ID_LED_DEFAULT_82573 ((ID_LED_DEF1_DEF2 << 12) | \ |
| 50 | (ID_LED_OFF1_ON2 << 8) | \ |
| 51 | (ID_LED_DEF1_DEF2 << 4) | \ |
| 52 | (ID_LED_DEF1_DEF2)) |
| 53 | |
| 54 | #define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000 |
Bruce Allan | d9c76f9 | 2010-11-24 06:01:35 +0000 | [diff] [blame] | 55 | #define AN_RETRY_COUNT 5 /* Autoneg Retry Count value */ |
Carolyn Wyborny | ff10e13 | 2010-10-28 00:59:53 +0000 | [diff] [blame] | 56 | #define E1000_BASE1000T_STATUS 10 |
| 57 | #define E1000_IDLE_ERROR_COUNT_MASK 0xFF |
| 58 | #define E1000_RECEIVE_ERROR_COUNTER 21 |
| 59 | #define E1000_RECEIVE_ERROR_MAX 0xFFFF |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 60 | |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 61 | #define E1000_NVM_INIT_CTRL2_MNGM 0x6000 /* Manageability Operation Mode mask */ |
| 62 | |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 63 | static s32 e1000_get_phy_id_82571(struct e1000_hw *hw); |
| 64 | static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw); |
| 65 | static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw); |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 66 | static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 67 | static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset, |
| 68 | u16 words, u16 *data); |
| 69 | static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw); |
| 70 | static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw); |
| 71 | static s32 e1000_setup_link_82571(struct e1000_hw *hw); |
| 72 | static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw); |
Bruce Allan | caaddaf | 2009-12-01 15:46:43 +0000 | [diff] [blame] | 73 | static void e1000_clear_vfta_82571(struct e1000_hw *hw); |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 74 | static bool e1000_check_mng_mode_82574(struct e1000_hw *hw); |
| 75 | static s32 e1000_led_on_82574(struct e1000_hw *hw); |
Dave Graham | 23a2d1b | 2009-06-08 14:28:17 +0000 | [diff] [blame] | 76 | static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw); |
Bruce Allan | 17f208d | 2009-12-01 15:47:22 +0000 | [diff] [blame] | 77 | static void e1000_power_down_phy_copper_82571(struct e1000_hw *hw); |
Bruce Allan | 1b98c2b | 2010-11-16 19:50:14 -0800 | [diff] [blame] | 78 | static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw); |
| 79 | static s32 e1000_get_hw_semaphore_82574(struct e1000_hw *hw); |
| 80 | static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw); |
Bruce Allan | 77996d1 | 2011-01-06 14:29:53 +0000 | [diff] [blame] | 81 | static s32 e1000_set_d0_lplu_state_82574(struct e1000_hw *hw, bool active); |
| 82 | static s32 e1000_set_d3_lplu_state_82574(struct e1000_hw *hw, bool active); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 83 | |
| 84 | /** |
| 85 | * e1000_init_phy_params_82571 - Init PHY func ptrs. |
| 86 | * @hw: pointer to the HW structure |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 87 | **/ |
| 88 | static s32 e1000_init_phy_params_82571(struct e1000_hw *hw) |
| 89 | { |
| 90 | struct e1000_phy_info *phy = &hw->phy; |
| 91 | s32 ret_val; |
| 92 | |
Jeff Kirsher | 318a94d | 2008-03-28 09:15:16 -0700 | [diff] [blame] | 93 | if (hw->phy.media_type != e1000_media_type_copper) { |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 94 | phy->type = e1000_phy_none; |
| 95 | return 0; |
| 96 | } |
| 97 | |
| 98 | phy->addr = 1; |
| 99 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; |
| 100 | phy->reset_delay_us = 100; |
| 101 | |
Bruce Allan | 17f208d | 2009-12-01 15:47:22 +0000 | [diff] [blame] | 102 | phy->ops.power_up = e1000_power_up_phy_copper; |
| 103 | phy->ops.power_down = e1000_power_down_phy_copper_82571; |
| 104 | |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 105 | switch (hw->mac.type) { |
| 106 | case e1000_82571: |
| 107 | case e1000_82572: |
| 108 | phy->type = e1000_phy_igp_2; |
| 109 | break; |
| 110 | case e1000_82573: |
| 111 | phy->type = e1000_phy_m88; |
| 112 | break; |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 113 | case e1000_82574: |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 114 | case e1000_82583: |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 115 | phy->type = e1000_phy_bm; |
Bruce Allan | 1b98c2b | 2010-11-16 19:50:14 -0800 | [diff] [blame] | 116 | phy->ops.acquire = e1000_get_hw_semaphore_82574; |
| 117 | phy->ops.release = e1000_put_hw_semaphore_82574; |
Bruce Allan | 77996d1 | 2011-01-06 14:29:53 +0000 | [diff] [blame] | 118 | phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82574; |
| 119 | phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_82574; |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 120 | break; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 121 | default: |
| 122 | return -E1000_ERR_PHY; |
| 123 | break; |
| 124 | } |
| 125 | |
| 126 | /* This can only be done after all function pointers are setup. */ |
| 127 | ret_val = e1000_get_phy_id_82571(hw); |
Bruce Allan | dd93f95 | 2011-01-06 14:29:48 +0000 | [diff] [blame] | 128 | if (ret_val) { |
| 129 | e_dbg("Error getting PHY ID\n"); |
| 130 | return ret_val; |
| 131 | } |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 132 | |
| 133 | /* Verify phy id */ |
| 134 | switch (hw->mac.type) { |
| 135 | case e1000_82571: |
| 136 | case e1000_82572: |
| 137 | if (phy->id != IGP01E1000_I_PHY_ID) |
Bruce Allan | dd93f95 | 2011-01-06 14:29:48 +0000 | [diff] [blame] | 138 | ret_val = -E1000_ERR_PHY; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 139 | break; |
| 140 | case e1000_82573: |
| 141 | if (phy->id != M88E1111_I_PHY_ID) |
Bruce Allan | dd93f95 | 2011-01-06 14:29:48 +0000 | [diff] [blame] | 142 | ret_val = -E1000_ERR_PHY; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 143 | break; |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 144 | case e1000_82574: |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 145 | case e1000_82583: |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 146 | if (phy->id != BME1000_E_PHY_ID_R2) |
Bruce Allan | dd93f95 | 2011-01-06 14:29:48 +0000 | [diff] [blame] | 147 | ret_val = -E1000_ERR_PHY; |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 148 | break; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 149 | default: |
Bruce Allan | dd93f95 | 2011-01-06 14:29:48 +0000 | [diff] [blame] | 150 | ret_val = -E1000_ERR_PHY; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 151 | break; |
| 152 | } |
| 153 | |
Bruce Allan | dd93f95 | 2011-01-06 14:29:48 +0000 | [diff] [blame] | 154 | if (ret_val) |
| 155 | e_dbg("PHY ID unknown: type = 0x%08x\n", phy->id); |
| 156 | |
| 157 | return ret_val; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 158 | } |
| 159 | |
| 160 | /** |
| 161 | * e1000_init_nvm_params_82571 - Init NVM func ptrs. |
| 162 | * @hw: pointer to the HW structure |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 163 | **/ |
| 164 | static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw) |
| 165 | { |
| 166 | struct e1000_nvm_info *nvm = &hw->nvm; |
| 167 | u32 eecd = er32(EECD); |
| 168 | u16 size; |
| 169 | |
| 170 | nvm->opcode_bits = 8; |
| 171 | nvm->delay_usec = 1; |
| 172 | switch (nvm->override) { |
| 173 | case e1000_nvm_override_spi_large: |
| 174 | nvm->page_size = 32; |
| 175 | nvm->address_bits = 16; |
| 176 | break; |
| 177 | case e1000_nvm_override_spi_small: |
| 178 | nvm->page_size = 8; |
| 179 | nvm->address_bits = 8; |
| 180 | break; |
| 181 | default: |
| 182 | nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; |
| 183 | nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? 16 : 8; |
| 184 | break; |
| 185 | } |
| 186 | |
| 187 | switch (hw->mac.type) { |
| 188 | case e1000_82573: |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 189 | case e1000_82574: |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 190 | case e1000_82583: |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 191 | if (((eecd >> 15) & 0x3) == 0x3) { |
| 192 | nvm->type = e1000_nvm_flash_hw; |
| 193 | nvm->word_size = 2048; |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 194 | /* |
| 195 | * Autonomous Flash update bit must be cleared due |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 196 | * to Flash update issue. |
| 197 | */ |
| 198 | eecd &= ~E1000_EECD_AUPDEN; |
| 199 | ew32(EECD, eecd); |
| 200 | break; |
| 201 | } |
| 202 | /* Fall Through */ |
| 203 | default: |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 204 | nvm->type = e1000_nvm_eeprom_spi; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 205 | size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> |
| 206 | E1000_EECD_SIZE_EX_SHIFT); |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 207 | /* |
| 208 | * Added to a constant, "size" becomes the left-shift value |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 209 | * for setting word_size. |
| 210 | */ |
| 211 | size += NVM_WORD_SIZE_BASE_SHIFT; |
Jeff Kirsher | 8d7c294 | 2008-04-02 13:48:07 -0700 | [diff] [blame] | 212 | |
| 213 | /* EEPROM access above 16k is unsupported */ |
| 214 | if (size > 14) |
| 215 | size = 14; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 216 | nvm->word_size = 1 << size; |
| 217 | break; |
| 218 | } |
| 219 | |
Bruce Allan | 1b98c2b | 2010-11-16 19:50:14 -0800 | [diff] [blame] | 220 | /* Function Pointers */ |
| 221 | switch (hw->mac.type) { |
| 222 | case e1000_82574: |
| 223 | case e1000_82583: |
| 224 | nvm->ops.acquire = e1000_get_hw_semaphore_82574; |
| 225 | nvm->ops.release = e1000_put_hw_semaphore_82574; |
| 226 | break; |
| 227 | default: |
| 228 | break; |
| 229 | } |
| 230 | |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 231 | return 0; |
| 232 | } |
| 233 | |
| 234 | /** |
| 235 | * e1000_init_mac_params_82571 - Init MAC func ptrs. |
| 236 | * @hw: pointer to the HW structure |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 237 | **/ |
| 238 | static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) |
| 239 | { |
| 240 | struct e1000_hw *hw = &adapter->hw; |
| 241 | struct e1000_mac_info *mac = &hw->mac; |
Dave Graham | 23a2d1b | 2009-06-08 14:28:17 +0000 | [diff] [blame] | 242 | u32 swsm = 0; |
| 243 | u32 swsm2 = 0; |
| 244 | bool force_clear_smbi = false; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 245 | |
Bruce Allan | 66092f5 | 2012-01-31 06:37:48 +0000 | [diff] [blame^] | 246 | /* Set media type and media-dependent function pointers */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 247 | switch (adapter->pdev->device) { |
| 248 | case E1000_DEV_ID_82571EB_FIBER: |
| 249 | case E1000_DEV_ID_82572EI_FIBER: |
| 250 | case E1000_DEV_ID_82571EB_QUAD_FIBER: |
Jeff Kirsher | 318a94d | 2008-03-28 09:15:16 -0700 | [diff] [blame] | 251 | hw->phy.media_type = e1000_media_type_fiber; |
Bruce Allan | 66092f5 | 2012-01-31 06:37:48 +0000 | [diff] [blame^] | 252 | mac->ops.setup_physical_interface = |
| 253 | e1000_setup_fiber_serdes_link_82571; |
| 254 | mac->ops.check_for_link = e1000e_check_for_fiber_link; |
| 255 | mac->ops.get_link_up_info = |
| 256 | e1000e_get_speed_and_duplex_fiber_serdes; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 257 | break; |
| 258 | case E1000_DEV_ID_82571EB_SERDES: |
Auke Kok | 040babf | 2007-10-31 15:22:05 -0700 | [diff] [blame] | 259 | case E1000_DEV_ID_82571EB_SERDES_DUAL: |
| 260 | case E1000_DEV_ID_82571EB_SERDES_QUAD: |
Bruce Allan | 66092f5 | 2012-01-31 06:37:48 +0000 | [diff] [blame^] | 261 | case E1000_DEV_ID_82572EI_SERDES: |
Jeff Kirsher | 318a94d | 2008-03-28 09:15:16 -0700 | [diff] [blame] | 262 | hw->phy.media_type = e1000_media_type_internal_serdes; |
Bruce Allan | 66092f5 | 2012-01-31 06:37:48 +0000 | [diff] [blame^] | 263 | mac->ops.setup_physical_interface = |
| 264 | e1000_setup_fiber_serdes_link_82571; |
| 265 | mac->ops.check_for_link = e1000_check_for_serdes_link_82571; |
| 266 | mac->ops.get_link_up_info = |
| 267 | e1000e_get_speed_and_duplex_fiber_serdes; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 268 | break; |
| 269 | default: |
Jeff Kirsher | 318a94d | 2008-03-28 09:15:16 -0700 | [diff] [blame] | 270 | hw->phy.media_type = e1000_media_type_copper; |
Bruce Allan | 66092f5 | 2012-01-31 06:37:48 +0000 | [diff] [blame^] | 271 | mac->ops.setup_physical_interface = |
| 272 | e1000_setup_copper_link_82571; |
| 273 | mac->ops.check_for_link = e1000e_check_for_copper_link; |
| 274 | mac->ops.get_link_up_info = e1000e_get_speed_and_duplex_copper; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 275 | break; |
| 276 | } |
| 277 | |
| 278 | /* Set mta register count */ |
| 279 | mac->mta_reg_count = 128; |
| 280 | /* Set rar entry count */ |
| 281 | mac->rar_entry_count = E1000_RAR_ENTRIES; |
Bruce Allan | f464ba8 | 2010-01-07 16:31:35 +0000 | [diff] [blame] | 282 | /* Adaptive IFS supported */ |
| 283 | mac->adaptive_ifs = true; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 284 | |
Bruce Allan | 66092f5 | 2012-01-31 06:37:48 +0000 | [diff] [blame^] | 285 | /* MAC-specific function pointers */ |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 286 | switch (hw->mac.type) { |
Bruce Allan | f4d2dd4 | 2010-01-13 02:05:18 +0000 | [diff] [blame] | 287 | case e1000_82573: |
Bruce Allan | 66092f5 | 2012-01-31 06:37:48 +0000 | [diff] [blame^] | 288 | mac->ops.set_lan_id = e1000_set_lan_id_single_port; |
| 289 | mac->ops.check_mng_mode = e1000e_check_mng_mode_generic; |
| 290 | mac->ops.led_on = e1000e_led_on_generic; |
| 291 | mac->ops.blink_led = e1000e_blink_led_generic; |
Bruce Allan | a65a4a0 | 2010-05-10 15:01:51 +0000 | [diff] [blame] | 292 | |
| 293 | /* FWSM register */ |
| 294 | mac->has_fwsm = true; |
| 295 | /* |
| 296 | * ARC supported; valid only if manageability features are |
| 297 | * enabled. |
| 298 | */ |
| 299 | mac->arc_subsystem_valid = |
| 300 | (er32(FWSM) & E1000_FWSM_MODE_MASK) |
| 301 | ? true : false; |
Bruce Allan | f4d2dd4 | 2010-01-13 02:05:18 +0000 | [diff] [blame] | 302 | break; |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 303 | case e1000_82574: |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 304 | case e1000_82583: |
Bruce Allan | 66092f5 | 2012-01-31 06:37:48 +0000 | [diff] [blame^] | 305 | mac->ops.set_lan_id = e1000_set_lan_id_single_port; |
| 306 | mac->ops.check_mng_mode = e1000_check_mng_mode_82574; |
| 307 | mac->ops.led_on = e1000_led_on_82574; |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 308 | break; |
| 309 | default: |
Bruce Allan | 66092f5 | 2012-01-31 06:37:48 +0000 | [diff] [blame^] | 310 | mac->ops.check_mng_mode = e1000e_check_mng_mode_generic; |
| 311 | mac->ops.led_on = e1000e_led_on_generic; |
| 312 | mac->ops.blink_led = e1000e_blink_led_generic; |
Bruce Allan | a65a4a0 | 2010-05-10 15:01:51 +0000 | [diff] [blame] | 313 | |
| 314 | /* FWSM register */ |
| 315 | mac->has_fwsm = true; |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 316 | break; |
| 317 | } |
| 318 | |
Dave Graham | 23a2d1b | 2009-06-08 14:28:17 +0000 | [diff] [blame] | 319 | /* |
| 320 | * Ensure that the inter-port SWSM.SMBI lock bit is clear before |
Uwe Kleine-König | b595076 | 2010-11-01 15:38:34 -0400 | [diff] [blame] | 321 | * first NVM or PHY access. This should be done for single-port |
Dave Graham | 23a2d1b | 2009-06-08 14:28:17 +0000 | [diff] [blame] | 322 | * devices, and for one port only on dual-port devices so that |
| 323 | * for those devices we can still use the SMBI lock to synchronize |
| 324 | * inter-port accesses to the PHY & NVM. |
| 325 | */ |
| 326 | switch (hw->mac.type) { |
| 327 | case e1000_82571: |
| 328 | case e1000_82572: |
| 329 | swsm2 = er32(SWSM2); |
| 330 | |
| 331 | if (!(swsm2 & E1000_SWSM2_LOCK)) { |
| 332 | /* Only do this for the first interface on this card */ |
Bruce Allan | 66092f5 | 2012-01-31 06:37:48 +0000 | [diff] [blame^] | 333 | ew32(SWSM2, swsm2 | E1000_SWSM2_LOCK); |
Dave Graham | 23a2d1b | 2009-06-08 14:28:17 +0000 | [diff] [blame] | 334 | force_clear_smbi = true; |
Bruce Allan | 66092f5 | 2012-01-31 06:37:48 +0000 | [diff] [blame^] | 335 | } else { |
Dave Graham | 23a2d1b | 2009-06-08 14:28:17 +0000 | [diff] [blame] | 336 | force_clear_smbi = false; |
Bruce Allan | 66092f5 | 2012-01-31 06:37:48 +0000 | [diff] [blame^] | 337 | } |
Dave Graham | 23a2d1b | 2009-06-08 14:28:17 +0000 | [diff] [blame] | 338 | break; |
| 339 | default: |
| 340 | force_clear_smbi = true; |
| 341 | break; |
| 342 | } |
| 343 | |
| 344 | if (force_clear_smbi) { |
| 345 | /* Make sure SWSM.SMBI is clear */ |
| 346 | swsm = er32(SWSM); |
| 347 | if (swsm & E1000_SWSM_SMBI) { |
| 348 | /* This bit should not be set on a first interface, and |
| 349 | * indicates that the bootagent or EFI code has |
| 350 | * improperly left this bit enabled |
| 351 | */ |
Bruce Allan | 3bb99fe | 2009-11-20 23:25:07 +0000 | [diff] [blame] | 352 | e_dbg("Please update your 82571 Bootagent\n"); |
Dave Graham | 23a2d1b | 2009-06-08 14:28:17 +0000 | [diff] [blame] | 353 | } |
| 354 | ew32(SWSM, swsm & ~E1000_SWSM_SMBI); |
| 355 | } |
| 356 | |
| 357 | /* |
Joe Perches | 2c73e1f | 2010-03-26 20:16:59 +0000 | [diff] [blame] | 358 | * Initialize device specific counter of SMBI acquisition |
Dave Graham | 23a2d1b | 2009-06-08 14:28:17 +0000 | [diff] [blame] | 359 | * timeouts. |
| 360 | */ |
| 361 | hw->dev_spec.e82571.smb_counter = 0; |
| 362 | |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 363 | return 0; |
| 364 | } |
| 365 | |
Jeff Kirsher | 69e3fd8 | 2008-04-02 13:48:18 -0700 | [diff] [blame] | 366 | static s32 e1000_get_variants_82571(struct e1000_adapter *adapter) |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 367 | { |
| 368 | struct e1000_hw *hw = &adapter->hw; |
| 369 | static int global_quad_port_a; /* global port a indication */ |
| 370 | struct pci_dev *pdev = adapter->pdev; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 371 | int is_port_b = er32(STATUS) & E1000_STATUS_FUNC_1; |
| 372 | s32 rc; |
| 373 | |
| 374 | rc = e1000_init_mac_params_82571(adapter); |
| 375 | if (rc) |
| 376 | return rc; |
| 377 | |
| 378 | rc = e1000_init_nvm_params_82571(hw); |
| 379 | if (rc) |
| 380 | return rc; |
| 381 | |
| 382 | rc = e1000_init_phy_params_82571(hw); |
| 383 | if (rc) |
| 384 | return rc; |
| 385 | |
| 386 | /* tag quad port adapters first, it's used below */ |
| 387 | switch (pdev->device) { |
| 388 | case E1000_DEV_ID_82571EB_QUAD_COPPER: |
| 389 | case E1000_DEV_ID_82571EB_QUAD_FIBER: |
| 390 | case E1000_DEV_ID_82571EB_QUAD_COPPER_LP: |
Auke Kok | 040babf | 2007-10-31 15:22:05 -0700 | [diff] [blame] | 391 | case E1000_DEV_ID_82571PT_QUAD_COPPER: |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 392 | adapter->flags |= FLAG_IS_QUAD_PORT; |
| 393 | /* mark the first port */ |
| 394 | if (global_quad_port_a == 0) |
| 395 | adapter->flags |= FLAG_IS_QUAD_PORT_A; |
| 396 | /* Reset for multiple quad port adapters */ |
| 397 | global_quad_port_a++; |
| 398 | if (global_quad_port_a == 4) |
| 399 | global_quad_port_a = 0; |
| 400 | break; |
| 401 | default: |
| 402 | break; |
| 403 | } |
| 404 | |
| 405 | switch (adapter->hw.mac.type) { |
| 406 | case e1000_82571: |
| 407 | /* these dual ports don't have WoL on port B at all */ |
| 408 | if (((pdev->device == E1000_DEV_ID_82571EB_FIBER) || |
| 409 | (pdev->device == E1000_DEV_ID_82571EB_SERDES) || |
| 410 | (pdev->device == E1000_DEV_ID_82571EB_COPPER)) && |
| 411 | (is_port_b)) |
| 412 | adapter->flags &= ~FLAG_HAS_WOL; |
| 413 | /* quad ports only support WoL on port A */ |
| 414 | if (adapter->flags & FLAG_IS_QUAD_PORT && |
Roel Kluin | 6e4ca80 | 2007-10-29 10:50:05 -0700 | [diff] [blame] | 415 | (!(adapter->flags & FLAG_IS_QUAD_PORT_A))) |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 416 | adapter->flags &= ~FLAG_HAS_WOL; |
Auke Kok | 040babf | 2007-10-31 15:22:05 -0700 | [diff] [blame] | 417 | /* Does not support WoL on any port */ |
| 418 | if (pdev->device == E1000_DEV_ID_82571EB_SERDES_QUAD) |
| 419 | adapter->flags &= ~FLAG_HAS_WOL; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 420 | break; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 421 | case e1000_82573: |
| 422 | if (pdev->device == E1000_DEV_ID_82573L) { |
Bruce Allan | 6f461f6 | 2010-04-27 03:33:04 +0000 | [diff] [blame] | 423 | adapter->flags |= FLAG_HAS_JUMBO_FRAMES; |
| 424 | adapter->max_hw_frame_size = DEFAULT_JUMBO; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 425 | } |
| 426 | break; |
| 427 | default: |
| 428 | break; |
| 429 | } |
| 430 | |
| 431 | return 0; |
| 432 | } |
| 433 | |
| 434 | /** |
| 435 | * e1000_get_phy_id_82571 - Retrieve the PHY ID and revision |
| 436 | * @hw: pointer to the HW structure |
| 437 | * |
| 438 | * Reads the PHY registers and stores the PHY ID and possibly the PHY |
| 439 | * revision in the hardware structure. |
| 440 | **/ |
| 441 | static s32 e1000_get_phy_id_82571(struct e1000_hw *hw) |
| 442 | { |
| 443 | struct e1000_phy_info *phy = &hw->phy; |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 444 | s32 ret_val; |
| 445 | u16 phy_id = 0; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 446 | |
| 447 | switch (hw->mac.type) { |
| 448 | case e1000_82571: |
| 449 | case e1000_82572: |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 450 | /* |
| 451 | * The 82571 firmware may still be configuring the PHY. |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 452 | * In this case, we cannot access the PHY until the |
| 453 | * configuration is done. So we explicitly set the |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 454 | * PHY ID. |
| 455 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 456 | phy->id = IGP01E1000_I_PHY_ID; |
| 457 | break; |
| 458 | case e1000_82573: |
| 459 | return e1000e_get_phy_id(hw); |
| 460 | break; |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 461 | case e1000_82574: |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 462 | case e1000_82583: |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 463 | ret_val = e1e_rphy(hw, PHY_ID1, &phy_id); |
| 464 | if (ret_val) |
| 465 | return ret_val; |
| 466 | |
| 467 | phy->id = (u32)(phy_id << 16); |
| 468 | udelay(20); |
| 469 | ret_val = e1e_rphy(hw, PHY_ID2, &phy_id); |
| 470 | if (ret_val) |
| 471 | return ret_val; |
| 472 | |
| 473 | phy->id |= (u32)(phy_id); |
| 474 | phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK); |
| 475 | break; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 476 | default: |
| 477 | return -E1000_ERR_PHY; |
| 478 | break; |
| 479 | } |
| 480 | |
| 481 | return 0; |
| 482 | } |
| 483 | |
| 484 | /** |
| 485 | * e1000_get_hw_semaphore_82571 - Acquire hardware semaphore |
| 486 | * @hw: pointer to the HW structure |
| 487 | * |
| 488 | * Acquire the HW semaphore to access the PHY or NVM |
| 489 | **/ |
| 490 | static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw) |
| 491 | { |
| 492 | u32 swsm; |
Dave Graham | 23a2d1b | 2009-06-08 14:28:17 +0000 | [diff] [blame] | 493 | s32 sw_timeout = hw->nvm.word_size + 1; |
| 494 | s32 fw_timeout = hw->nvm.word_size + 1; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 495 | s32 i = 0; |
| 496 | |
Dave Graham | 23a2d1b | 2009-06-08 14:28:17 +0000 | [diff] [blame] | 497 | /* |
| 498 | * If we have timedout 3 times on trying to acquire |
| 499 | * the inter-port SMBI semaphore, there is old code |
| 500 | * operating on the other port, and it is not |
| 501 | * releasing SMBI. Modify the number of times that |
| 502 | * we try for the semaphore to interwork with this |
| 503 | * older code. |
| 504 | */ |
| 505 | if (hw->dev_spec.e82571.smb_counter > 2) |
| 506 | sw_timeout = 1; |
| 507 | |
| 508 | /* Get the SW semaphore */ |
| 509 | while (i < sw_timeout) { |
| 510 | swsm = er32(SWSM); |
| 511 | if (!(swsm & E1000_SWSM_SMBI)) |
| 512 | break; |
| 513 | |
| 514 | udelay(50); |
| 515 | i++; |
| 516 | } |
| 517 | |
| 518 | if (i == sw_timeout) { |
Bruce Allan | 3bb99fe | 2009-11-20 23:25:07 +0000 | [diff] [blame] | 519 | e_dbg("Driver can't access device - SMBI bit is set.\n"); |
Dave Graham | 23a2d1b | 2009-06-08 14:28:17 +0000 | [diff] [blame] | 520 | hw->dev_spec.e82571.smb_counter++; |
| 521 | } |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 522 | /* Get the FW semaphore. */ |
Dave Graham | 23a2d1b | 2009-06-08 14:28:17 +0000 | [diff] [blame] | 523 | for (i = 0; i < fw_timeout; i++) { |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 524 | swsm = er32(SWSM); |
| 525 | ew32(SWSM, swsm | E1000_SWSM_SWESMBI); |
| 526 | |
| 527 | /* Semaphore acquired if bit latched */ |
| 528 | if (er32(SWSM) & E1000_SWSM_SWESMBI) |
| 529 | break; |
| 530 | |
| 531 | udelay(50); |
| 532 | } |
| 533 | |
Dave Graham | 23a2d1b | 2009-06-08 14:28:17 +0000 | [diff] [blame] | 534 | if (i == fw_timeout) { |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 535 | /* Release semaphores */ |
Dave Graham | 23a2d1b | 2009-06-08 14:28:17 +0000 | [diff] [blame] | 536 | e1000_put_hw_semaphore_82571(hw); |
Bruce Allan | 3bb99fe | 2009-11-20 23:25:07 +0000 | [diff] [blame] | 537 | e_dbg("Driver can't access the NVM\n"); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 538 | return -E1000_ERR_NVM; |
| 539 | } |
| 540 | |
| 541 | return 0; |
| 542 | } |
| 543 | |
| 544 | /** |
| 545 | * e1000_put_hw_semaphore_82571 - Release hardware semaphore |
| 546 | * @hw: pointer to the HW structure |
| 547 | * |
| 548 | * Release hardware semaphore used to access the PHY or NVM |
| 549 | **/ |
| 550 | static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw) |
| 551 | { |
| 552 | u32 swsm; |
| 553 | |
| 554 | swsm = er32(SWSM); |
Dave Graham | 23a2d1b | 2009-06-08 14:28:17 +0000 | [diff] [blame] | 555 | swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 556 | ew32(SWSM, swsm); |
| 557 | } |
Bruce Allan | 1b98c2b | 2010-11-16 19:50:14 -0800 | [diff] [blame] | 558 | /** |
| 559 | * e1000_get_hw_semaphore_82573 - Acquire hardware semaphore |
| 560 | * @hw: pointer to the HW structure |
| 561 | * |
| 562 | * Acquire the HW semaphore during reset. |
| 563 | * |
| 564 | **/ |
| 565 | static s32 e1000_get_hw_semaphore_82573(struct e1000_hw *hw) |
| 566 | { |
| 567 | u32 extcnf_ctrl; |
| 568 | s32 ret_val = 0; |
| 569 | s32 i = 0; |
| 570 | |
| 571 | extcnf_ctrl = er32(EXTCNF_CTRL); |
| 572 | extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; |
| 573 | do { |
| 574 | ew32(EXTCNF_CTRL, extcnf_ctrl); |
| 575 | extcnf_ctrl = er32(EXTCNF_CTRL); |
| 576 | |
| 577 | if (extcnf_ctrl & E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP) |
| 578 | break; |
| 579 | |
| 580 | extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; |
| 581 | |
Bruce Allan | 1bba438 | 2011-03-19 00:27:20 +0000 | [diff] [blame] | 582 | usleep_range(2000, 4000); |
Bruce Allan | 1b98c2b | 2010-11-16 19:50:14 -0800 | [diff] [blame] | 583 | i++; |
| 584 | } while (i < MDIO_OWNERSHIP_TIMEOUT); |
| 585 | |
| 586 | if (i == MDIO_OWNERSHIP_TIMEOUT) { |
| 587 | /* Release semaphores */ |
| 588 | e1000_put_hw_semaphore_82573(hw); |
| 589 | e_dbg("Driver can't access the PHY\n"); |
| 590 | ret_val = -E1000_ERR_PHY; |
| 591 | goto out; |
| 592 | } |
| 593 | |
| 594 | out: |
| 595 | return ret_val; |
| 596 | } |
| 597 | |
| 598 | /** |
| 599 | * e1000_put_hw_semaphore_82573 - Release hardware semaphore |
| 600 | * @hw: pointer to the HW structure |
| 601 | * |
| 602 | * Release hardware semaphore used during reset. |
| 603 | * |
| 604 | **/ |
| 605 | static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw) |
| 606 | { |
| 607 | u32 extcnf_ctrl; |
| 608 | |
| 609 | extcnf_ctrl = er32(EXTCNF_CTRL); |
| 610 | extcnf_ctrl &= ~E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; |
| 611 | ew32(EXTCNF_CTRL, extcnf_ctrl); |
| 612 | } |
| 613 | |
| 614 | static DEFINE_MUTEX(swflag_mutex); |
| 615 | |
| 616 | /** |
| 617 | * e1000_get_hw_semaphore_82574 - Acquire hardware semaphore |
| 618 | * @hw: pointer to the HW structure |
| 619 | * |
| 620 | * Acquire the HW semaphore to access the PHY or NVM. |
| 621 | * |
| 622 | **/ |
| 623 | static s32 e1000_get_hw_semaphore_82574(struct e1000_hw *hw) |
| 624 | { |
| 625 | s32 ret_val; |
| 626 | |
| 627 | mutex_lock(&swflag_mutex); |
| 628 | ret_val = e1000_get_hw_semaphore_82573(hw); |
| 629 | if (ret_val) |
| 630 | mutex_unlock(&swflag_mutex); |
| 631 | return ret_val; |
| 632 | } |
| 633 | |
| 634 | /** |
| 635 | * e1000_put_hw_semaphore_82574 - Release hardware semaphore |
| 636 | * @hw: pointer to the HW structure |
| 637 | * |
| 638 | * Release hardware semaphore used to access the PHY or NVM |
| 639 | * |
| 640 | **/ |
| 641 | static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw) |
| 642 | { |
| 643 | e1000_put_hw_semaphore_82573(hw); |
| 644 | mutex_unlock(&swflag_mutex); |
| 645 | } |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 646 | |
| 647 | /** |
Bruce Allan | 77996d1 | 2011-01-06 14:29:53 +0000 | [diff] [blame] | 648 | * e1000_set_d0_lplu_state_82574 - Set Low Power Linkup D0 state |
| 649 | * @hw: pointer to the HW structure |
| 650 | * @active: true to enable LPLU, false to disable |
| 651 | * |
| 652 | * Sets the LPLU D0 state according to the active flag. |
| 653 | * LPLU will not be activated unless the |
| 654 | * device autonegotiation advertisement meets standards of |
| 655 | * either 10 or 10/100 or 10/100/1000 at all duplexes. |
| 656 | * This is a function pointer entry point only called by |
| 657 | * PHY setup routines. |
| 658 | **/ |
| 659 | static s32 e1000_set_d0_lplu_state_82574(struct e1000_hw *hw, bool active) |
| 660 | { |
| 661 | u16 data = er32(POEMB); |
| 662 | |
| 663 | if (active) |
| 664 | data |= E1000_PHY_CTRL_D0A_LPLU; |
| 665 | else |
| 666 | data &= ~E1000_PHY_CTRL_D0A_LPLU; |
| 667 | |
| 668 | ew32(POEMB, data); |
| 669 | return 0; |
| 670 | } |
| 671 | |
| 672 | /** |
| 673 | * e1000_set_d3_lplu_state_82574 - Sets low power link up state for D3 |
| 674 | * @hw: pointer to the HW structure |
| 675 | * @active: boolean used to enable/disable lplu |
| 676 | * |
| 677 | * The low power link up (lplu) state is set to the power management level D3 |
| 678 | * when active is true, else clear lplu for D3. LPLU |
| 679 | * is used during Dx states where the power conservation is most important. |
| 680 | * During driver activity, SmartSpeed should be enabled so performance is |
| 681 | * maintained. |
| 682 | **/ |
| 683 | static s32 e1000_set_d3_lplu_state_82574(struct e1000_hw *hw, bool active) |
| 684 | { |
| 685 | u16 data = er32(POEMB); |
| 686 | |
| 687 | if (!active) { |
| 688 | data &= ~E1000_PHY_CTRL_NOND0A_LPLU; |
| 689 | } else if ((hw->phy.autoneg_advertised == E1000_ALL_SPEED_DUPLEX) || |
| 690 | (hw->phy.autoneg_advertised == E1000_ALL_NOT_GIG) || |
| 691 | (hw->phy.autoneg_advertised == E1000_ALL_10_SPEED)) { |
| 692 | data |= E1000_PHY_CTRL_NOND0A_LPLU; |
| 693 | } |
| 694 | |
| 695 | ew32(POEMB, data); |
| 696 | return 0; |
| 697 | } |
| 698 | |
| 699 | /** |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 700 | * e1000_acquire_nvm_82571 - Request for access to the EEPROM |
| 701 | * @hw: pointer to the HW structure |
| 702 | * |
| 703 | * To gain access to the EEPROM, first we must obtain a hardware semaphore. |
| 704 | * Then for non-82573 hardware, set the EEPROM access request bit and wait |
| 705 | * for EEPROM access grant bit. If the access grant bit is not set, release |
| 706 | * hardware semaphore. |
| 707 | **/ |
| 708 | static s32 e1000_acquire_nvm_82571(struct e1000_hw *hw) |
| 709 | { |
| 710 | s32 ret_val; |
| 711 | |
| 712 | ret_val = e1000_get_hw_semaphore_82571(hw); |
| 713 | if (ret_val) |
| 714 | return ret_val; |
| 715 | |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 716 | switch (hw->mac.type) { |
| 717 | case e1000_82573: |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 718 | break; |
| 719 | default: |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 720 | ret_val = e1000e_acquire_nvm(hw); |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 721 | break; |
| 722 | } |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 723 | |
| 724 | if (ret_val) |
| 725 | e1000_put_hw_semaphore_82571(hw); |
| 726 | |
| 727 | return ret_val; |
| 728 | } |
| 729 | |
| 730 | /** |
| 731 | * e1000_release_nvm_82571 - Release exclusive access to EEPROM |
| 732 | * @hw: pointer to the HW structure |
| 733 | * |
| 734 | * Stop any current commands to the EEPROM and clear the EEPROM request bit. |
| 735 | **/ |
| 736 | static void e1000_release_nvm_82571(struct e1000_hw *hw) |
| 737 | { |
| 738 | e1000e_release_nvm(hw); |
| 739 | e1000_put_hw_semaphore_82571(hw); |
| 740 | } |
| 741 | |
| 742 | /** |
| 743 | * e1000_write_nvm_82571 - Write to EEPROM using appropriate interface |
| 744 | * @hw: pointer to the HW structure |
| 745 | * @offset: offset within the EEPROM to be written to |
| 746 | * @words: number of words to write |
| 747 | * @data: 16 bit word(s) to be written to the EEPROM |
| 748 | * |
| 749 | * For non-82573 silicon, write data to EEPROM at offset using SPI interface. |
| 750 | * |
| 751 | * If e1000e_update_nvm_checksum is not called after this function, the |
Auke Kok | 489815c | 2008-02-21 15:11:07 -0800 | [diff] [blame] | 752 | * EEPROM will most likely contain an invalid checksum. |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 753 | **/ |
| 754 | static s32 e1000_write_nvm_82571(struct e1000_hw *hw, u16 offset, u16 words, |
| 755 | u16 *data) |
| 756 | { |
| 757 | s32 ret_val; |
| 758 | |
| 759 | switch (hw->mac.type) { |
| 760 | case e1000_82573: |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 761 | case e1000_82574: |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 762 | case e1000_82583: |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 763 | ret_val = e1000_write_nvm_eewr_82571(hw, offset, words, data); |
| 764 | break; |
| 765 | case e1000_82571: |
| 766 | case e1000_82572: |
| 767 | ret_val = e1000e_write_nvm_spi(hw, offset, words, data); |
| 768 | break; |
| 769 | default: |
| 770 | ret_val = -E1000_ERR_NVM; |
| 771 | break; |
| 772 | } |
| 773 | |
| 774 | return ret_val; |
| 775 | } |
| 776 | |
| 777 | /** |
| 778 | * e1000_update_nvm_checksum_82571 - Update EEPROM checksum |
| 779 | * @hw: pointer to the HW structure |
| 780 | * |
| 781 | * Updates the EEPROM checksum by reading/adding each word of the EEPROM |
| 782 | * up to the checksum. Then calculates the EEPROM checksum and writes the |
| 783 | * value to the EEPROM. |
| 784 | **/ |
| 785 | static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw) |
| 786 | { |
| 787 | u32 eecd; |
| 788 | s32 ret_val; |
| 789 | u16 i; |
| 790 | |
| 791 | ret_val = e1000e_update_nvm_checksum_generic(hw); |
| 792 | if (ret_val) |
| 793 | return ret_val; |
| 794 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 795 | /* |
| 796 | * If our nvm is an EEPROM, then we're done |
| 797 | * otherwise, commit the checksum to the flash NVM. |
| 798 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 799 | if (hw->nvm.type != e1000_nvm_flash_hw) |
| 800 | return ret_val; |
| 801 | |
| 802 | /* Check for pending operations. */ |
| 803 | for (i = 0; i < E1000_FLASH_UPDATES; i++) { |
Bruce Allan | 1bba438 | 2011-03-19 00:27:20 +0000 | [diff] [blame] | 804 | usleep_range(1000, 2000); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 805 | if ((er32(EECD) & E1000_EECD_FLUPD) == 0) |
| 806 | break; |
| 807 | } |
| 808 | |
| 809 | if (i == E1000_FLASH_UPDATES) |
| 810 | return -E1000_ERR_NVM; |
| 811 | |
| 812 | /* Reset the firmware if using STM opcode. */ |
| 813 | if ((er32(FLOP) & 0xFF00) == E1000_STM_OPCODE) { |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 814 | /* |
| 815 | * The enabling of and the actual reset must be done |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 816 | * in two write cycles. |
| 817 | */ |
| 818 | ew32(HICR, E1000_HICR_FW_RESET_ENABLE); |
| 819 | e1e_flush(); |
| 820 | ew32(HICR, E1000_HICR_FW_RESET); |
| 821 | } |
| 822 | |
| 823 | /* Commit the write to flash */ |
| 824 | eecd = er32(EECD) | E1000_EECD_FLUPD; |
| 825 | ew32(EECD, eecd); |
| 826 | |
| 827 | for (i = 0; i < E1000_FLASH_UPDATES; i++) { |
Bruce Allan | 1bba438 | 2011-03-19 00:27:20 +0000 | [diff] [blame] | 828 | usleep_range(1000, 2000); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 829 | if ((er32(EECD) & E1000_EECD_FLUPD) == 0) |
| 830 | break; |
| 831 | } |
| 832 | |
| 833 | if (i == E1000_FLASH_UPDATES) |
| 834 | return -E1000_ERR_NVM; |
| 835 | |
| 836 | return 0; |
| 837 | } |
| 838 | |
| 839 | /** |
| 840 | * e1000_validate_nvm_checksum_82571 - Validate EEPROM checksum |
| 841 | * @hw: pointer to the HW structure |
| 842 | * |
| 843 | * Calculates the EEPROM checksum by reading/adding each word of the EEPROM |
| 844 | * and then verifies that the sum of the EEPROM is equal to 0xBABA. |
| 845 | **/ |
| 846 | static s32 e1000_validate_nvm_checksum_82571(struct e1000_hw *hw) |
| 847 | { |
| 848 | if (hw->nvm.type == e1000_nvm_flash_hw) |
| 849 | e1000_fix_nvm_checksum_82571(hw); |
| 850 | |
| 851 | return e1000e_validate_nvm_checksum_generic(hw); |
| 852 | } |
| 853 | |
| 854 | /** |
| 855 | * e1000_write_nvm_eewr_82571 - Write to EEPROM for 82573 silicon |
| 856 | * @hw: pointer to the HW structure |
| 857 | * @offset: offset within the EEPROM to be written to |
| 858 | * @words: number of words to write |
| 859 | * @data: 16 bit word(s) to be written to the EEPROM |
| 860 | * |
| 861 | * After checking for invalid values, poll the EEPROM to ensure the previous |
| 862 | * command has completed before trying to write the next word. After write |
| 863 | * poll for completion. |
| 864 | * |
| 865 | * If e1000e_update_nvm_checksum is not called after this function, the |
Auke Kok | 489815c | 2008-02-21 15:11:07 -0800 | [diff] [blame] | 866 | * EEPROM will most likely contain an invalid checksum. |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 867 | **/ |
| 868 | static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset, |
| 869 | u16 words, u16 *data) |
| 870 | { |
| 871 | struct e1000_nvm_info *nvm = &hw->nvm; |
Bruce Allan | a708dd8 | 2009-11-20 23:28:37 +0000 | [diff] [blame] | 872 | u32 i, eewr = 0; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 873 | s32 ret_val = 0; |
| 874 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 875 | /* |
| 876 | * A check for invalid values: offset too large, too many words, |
| 877 | * and not enough words. |
| 878 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 879 | if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || |
| 880 | (words == 0)) { |
Bruce Allan | 3bb99fe | 2009-11-20 23:25:07 +0000 | [diff] [blame] | 881 | e_dbg("nvm parameter(s) out of bounds\n"); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 882 | return -E1000_ERR_NVM; |
| 883 | } |
| 884 | |
| 885 | for (i = 0; i < words; i++) { |
| 886 | eewr = (data[i] << E1000_NVM_RW_REG_DATA) | |
| 887 | ((offset+i) << E1000_NVM_RW_ADDR_SHIFT) | |
| 888 | E1000_NVM_RW_REG_START; |
| 889 | |
| 890 | ret_val = e1000e_poll_eerd_eewr_done(hw, E1000_NVM_POLL_WRITE); |
| 891 | if (ret_val) |
| 892 | break; |
| 893 | |
| 894 | ew32(EEWR, eewr); |
| 895 | |
| 896 | ret_val = e1000e_poll_eerd_eewr_done(hw, E1000_NVM_POLL_WRITE); |
| 897 | if (ret_val) |
| 898 | break; |
| 899 | } |
| 900 | |
| 901 | return ret_val; |
| 902 | } |
| 903 | |
| 904 | /** |
| 905 | * e1000_get_cfg_done_82571 - Poll for configuration done |
| 906 | * @hw: pointer to the HW structure |
| 907 | * |
| 908 | * Reads the management control register for the config done bit to be set. |
| 909 | **/ |
| 910 | static s32 e1000_get_cfg_done_82571(struct e1000_hw *hw) |
| 911 | { |
| 912 | s32 timeout = PHY_CFG_TIMEOUT; |
| 913 | |
| 914 | while (timeout) { |
| 915 | if (er32(EEMNGCTL) & |
| 916 | E1000_NVM_CFG_DONE_PORT_0) |
| 917 | break; |
Bruce Allan | 1bba438 | 2011-03-19 00:27:20 +0000 | [diff] [blame] | 918 | usleep_range(1000, 2000); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 919 | timeout--; |
| 920 | } |
| 921 | if (!timeout) { |
Bruce Allan | 3bb99fe | 2009-11-20 23:25:07 +0000 | [diff] [blame] | 922 | e_dbg("MNG configuration cycle has not completed.\n"); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 923 | return -E1000_ERR_RESET; |
| 924 | } |
| 925 | |
| 926 | return 0; |
| 927 | } |
| 928 | |
| 929 | /** |
| 930 | * e1000_set_d0_lplu_state_82571 - Set Low Power Linkup D0 state |
| 931 | * @hw: pointer to the HW structure |
Bruce Allan | 564ea9b | 2009-11-20 23:26:44 +0000 | [diff] [blame] | 932 | * @active: true to enable LPLU, false to disable |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 933 | * |
| 934 | * Sets the LPLU D0 state according to the active flag. When activating LPLU |
| 935 | * this function also disables smart speed and vice versa. LPLU will not be |
| 936 | * activated unless the device autonegotiation advertisement meets standards |
| 937 | * of either 10 or 10/100 or 10/100/1000 at all duplexes. This is a function |
| 938 | * pointer entry point only called by PHY setup routines. |
| 939 | **/ |
| 940 | static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active) |
| 941 | { |
| 942 | struct e1000_phy_info *phy = &hw->phy; |
| 943 | s32 ret_val; |
| 944 | u16 data; |
| 945 | |
| 946 | ret_val = e1e_rphy(hw, IGP02E1000_PHY_POWER_MGMT, &data); |
| 947 | if (ret_val) |
| 948 | return ret_val; |
| 949 | |
| 950 | if (active) { |
| 951 | data |= IGP02E1000_PM_D0_LPLU; |
| 952 | ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data); |
| 953 | if (ret_val) |
| 954 | return ret_val; |
| 955 | |
| 956 | /* When LPLU is enabled, we should disable SmartSpeed */ |
| 957 | ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, &data); |
| 958 | data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
| 959 | ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, data); |
| 960 | if (ret_val) |
| 961 | return ret_val; |
| 962 | } else { |
| 963 | data &= ~IGP02E1000_PM_D0_LPLU; |
| 964 | ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data); |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 965 | /* |
| 966 | * LPLU and SmartSpeed are mutually exclusive. LPLU is used |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 967 | * during Dx states where the power conservation is most |
| 968 | * important. During driver activity we should enable |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 969 | * SmartSpeed, so performance is maintained. |
| 970 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 971 | if (phy->smart_speed == e1000_smart_speed_on) { |
| 972 | ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 973 | &data); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 974 | if (ret_val) |
| 975 | return ret_val; |
| 976 | |
| 977 | data |= IGP01E1000_PSCFR_SMART_SPEED; |
| 978 | ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 979 | data); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 980 | if (ret_val) |
| 981 | return ret_val; |
| 982 | } else if (phy->smart_speed == e1000_smart_speed_off) { |
| 983 | ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 984 | &data); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 985 | if (ret_val) |
| 986 | return ret_val; |
| 987 | |
| 988 | data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
| 989 | ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 990 | data); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 991 | if (ret_val) |
| 992 | return ret_val; |
| 993 | } |
| 994 | } |
| 995 | |
| 996 | return 0; |
| 997 | } |
| 998 | |
| 999 | /** |
| 1000 | * e1000_reset_hw_82571 - Reset hardware |
| 1001 | * @hw: pointer to the HW structure |
| 1002 | * |
Bruce Allan | fe40167 | 2009-11-20 23:26:05 +0000 | [diff] [blame] | 1003 | * This resets the hardware into a known state. |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1004 | **/ |
| 1005 | static s32 e1000_reset_hw_82571(struct e1000_hw *hw) |
| 1006 | { |
Bruce Allan | dd93f95 | 2011-01-06 14:29:48 +0000 | [diff] [blame] | 1007 | u32 ctrl, ctrl_ext; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1008 | s32 ret_val; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1009 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1010 | /* |
| 1011 | * Prevent the PCI-E bus from sticking if there is no TLP connection |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1012 | * on the last TLP read/write transaction when MAC is reset. |
| 1013 | */ |
| 1014 | ret_val = e1000e_disable_pcie_master(hw); |
| 1015 | if (ret_val) |
Bruce Allan | 3bb99fe | 2009-11-20 23:25:07 +0000 | [diff] [blame] | 1016 | e_dbg("PCI-E Master disable polling has failed.\n"); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1017 | |
Bruce Allan | 3bb99fe | 2009-11-20 23:25:07 +0000 | [diff] [blame] | 1018 | e_dbg("Masking off all interrupts\n"); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1019 | ew32(IMC, 0xffffffff); |
| 1020 | |
| 1021 | ew32(RCTL, 0); |
| 1022 | ew32(TCTL, E1000_TCTL_PSP); |
| 1023 | e1e_flush(); |
| 1024 | |
Bruce Allan | 1bba438 | 2011-03-19 00:27:20 +0000 | [diff] [blame] | 1025 | usleep_range(10000, 20000); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1026 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1027 | /* |
| 1028 | * Must acquire the MDIO ownership before MAC reset. |
| 1029 | * Ownership defaults to firmware after a reset. |
| 1030 | */ |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 1031 | switch (hw->mac.type) { |
| 1032 | case e1000_82573: |
Bruce Allan | 1b98c2b | 2010-11-16 19:50:14 -0800 | [diff] [blame] | 1033 | ret_val = e1000_get_hw_semaphore_82573(hw); |
| 1034 | break; |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 1035 | case e1000_82574: |
| 1036 | case e1000_82583: |
Bruce Allan | 1b98c2b | 2010-11-16 19:50:14 -0800 | [diff] [blame] | 1037 | ret_val = e1000_get_hw_semaphore_82574(hw); |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 1038 | break; |
| 1039 | default: |
| 1040 | break; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1041 | } |
Bruce Allan | 1b98c2b | 2010-11-16 19:50:14 -0800 | [diff] [blame] | 1042 | if (ret_val) |
| 1043 | e_dbg("Cannot acquire MDIO ownership\n"); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1044 | |
| 1045 | ctrl = er32(CTRL); |
| 1046 | |
Bruce Allan | 3bb99fe | 2009-11-20 23:25:07 +0000 | [diff] [blame] | 1047 | e_dbg("Issuing a global reset to MAC\n"); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1048 | ew32(CTRL, ctrl | E1000_CTRL_RST); |
| 1049 | |
Bruce Allan | 1b98c2b | 2010-11-16 19:50:14 -0800 | [diff] [blame] | 1050 | /* Must release MDIO ownership and mutex after MAC reset. */ |
| 1051 | switch (hw->mac.type) { |
| 1052 | case e1000_82574: |
| 1053 | case e1000_82583: |
| 1054 | e1000_put_hw_semaphore_82574(hw); |
| 1055 | break; |
| 1056 | default: |
| 1057 | break; |
| 1058 | } |
| 1059 | |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1060 | if (hw->nvm.type == e1000_nvm_flash_hw) { |
| 1061 | udelay(10); |
| 1062 | ctrl_ext = er32(CTRL_EXT); |
| 1063 | ctrl_ext |= E1000_CTRL_EXT_EE_RST; |
| 1064 | ew32(CTRL_EXT, ctrl_ext); |
| 1065 | e1e_flush(); |
| 1066 | } |
| 1067 | |
| 1068 | ret_val = e1000e_get_auto_rd_done(hw); |
| 1069 | if (ret_val) |
| 1070 | /* We don't want to continue accessing MAC registers. */ |
| 1071 | return ret_val; |
| 1072 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1073 | /* |
| 1074 | * Phy configuration from NVM just starts after EECD_AUTO_RD is set. |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1075 | * Need to wait for Phy configuration completion before accessing |
| 1076 | * NVM and Phy. |
| 1077 | */ |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 1078 | |
| 1079 | switch (hw->mac.type) { |
| 1080 | case e1000_82573: |
| 1081 | case e1000_82574: |
| 1082 | case e1000_82583: |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1083 | msleep(25); |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 1084 | break; |
| 1085 | default: |
| 1086 | break; |
| 1087 | } |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1088 | |
| 1089 | /* Clear any pending interrupt events. */ |
| 1090 | ew32(IMC, 0xffffffff); |
Bruce Allan | dd93f95 | 2011-01-06 14:29:48 +0000 | [diff] [blame] | 1091 | er32(ICR); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1092 | |
Bruce Allan | 1aef70e | 2010-08-19 15:48:52 -0700 | [diff] [blame] | 1093 | if (hw->mac.type == e1000_82571) { |
| 1094 | /* Install any alternate MAC address into RAR0 */ |
| 1095 | ret_val = e1000_check_alt_mac_addr_generic(hw); |
| 1096 | if (ret_val) |
| 1097 | return ret_val; |
Bruce Allan | 608f8a0 | 2010-01-13 02:04:58 +0000 | [diff] [blame] | 1098 | |
Bruce Allan | 1aef70e | 2010-08-19 15:48:52 -0700 | [diff] [blame] | 1099 | e1000e_set_laa_state_82571(hw, true); |
| 1100 | } |
Bill Hayes | 93ca161 | 2007-10-31 15:21:52 -0700 | [diff] [blame] | 1101 | |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1102 | /* Reinitialize the 82571 serdes link state machine */ |
| 1103 | if (hw->phy.media_type == e1000_media_type_internal_serdes) |
| 1104 | hw->mac.serdes_link_state = e1000_serdes_link_down; |
| 1105 | |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1106 | return 0; |
| 1107 | } |
| 1108 | |
| 1109 | /** |
| 1110 | * e1000_init_hw_82571 - Initialize hardware |
| 1111 | * @hw: pointer to the HW structure |
| 1112 | * |
| 1113 | * This inits the hardware readying it for operation. |
| 1114 | **/ |
| 1115 | static s32 e1000_init_hw_82571(struct e1000_hw *hw) |
| 1116 | { |
| 1117 | struct e1000_mac_info *mac = &hw->mac; |
| 1118 | u32 reg_data; |
| 1119 | s32 ret_val; |
Bruce Allan | a708dd8 | 2009-11-20 23:28:37 +0000 | [diff] [blame] | 1120 | u16 i, rar_count = mac->rar_entry_count; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1121 | |
| 1122 | e1000_initialize_hw_bits_82571(hw); |
| 1123 | |
| 1124 | /* Initialize identification LED */ |
| 1125 | ret_val = e1000e_id_led_init(hw); |
Bruce Allan | de39b75 | 2009-11-20 23:27:59 +0000 | [diff] [blame] | 1126 | if (ret_val) |
Bruce Allan | 3bb99fe | 2009-11-20 23:25:07 +0000 | [diff] [blame] | 1127 | e_dbg("Error initializing identification LED\n"); |
Bruce Allan | de39b75 | 2009-11-20 23:27:59 +0000 | [diff] [blame] | 1128 | /* This is not fatal and we should not stop init due to this */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1129 | |
| 1130 | /* Disabling VLAN filtering */ |
Bruce Allan | 3bb99fe | 2009-11-20 23:25:07 +0000 | [diff] [blame] | 1131 | e_dbg("Initializing the IEEE VLAN\n"); |
Bruce Allan | caaddaf | 2009-12-01 15:46:43 +0000 | [diff] [blame] | 1132 | mac->ops.clear_vfta(hw); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1133 | |
| 1134 | /* Setup the receive address. */ |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1135 | /* |
| 1136 | * If, however, a locally administered address was assigned to the |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1137 | * 82571, we must reserve a RAR for it to work around an issue where |
| 1138 | * resetting one port will reload the MAC on the other port. |
| 1139 | */ |
| 1140 | if (e1000e_get_laa_state_82571(hw)) |
| 1141 | rar_count--; |
| 1142 | e1000e_init_rx_addrs(hw, rar_count); |
| 1143 | |
| 1144 | /* Zero out the Multicast HASH table */ |
Bruce Allan | 3bb99fe | 2009-11-20 23:25:07 +0000 | [diff] [blame] | 1145 | e_dbg("Zeroing the MTA\n"); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1146 | for (i = 0; i < mac->mta_reg_count; i++) |
| 1147 | E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); |
| 1148 | |
| 1149 | /* Setup link and flow control */ |
| 1150 | ret_val = e1000_setup_link_82571(hw); |
| 1151 | |
| 1152 | /* Set the transmit descriptor write-back policy */ |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1153 | reg_data = er32(TXDCTL(0)); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1154 | reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) | |
| 1155 | E1000_TXDCTL_FULL_TX_DESC_WB | |
| 1156 | E1000_TXDCTL_COUNT_DESC; |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1157 | ew32(TXDCTL(0), reg_data); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1158 | |
| 1159 | /* ...for both queues. */ |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 1160 | switch (mac->type) { |
| 1161 | case e1000_82573: |
Bruce Allan | a65a4a0 | 2010-05-10 15:01:51 +0000 | [diff] [blame] | 1162 | e1000e_enable_tx_pkt_filtering(hw); |
| 1163 | /* fall through */ |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 1164 | case e1000_82574: |
| 1165 | case e1000_82583: |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 1166 | reg_data = er32(GCR); |
| 1167 | reg_data |= E1000_GCR_L1_ACT_WITHOUT_L0S_RX; |
| 1168 | ew32(GCR, reg_data); |
| 1169 | break; |
| 1170 | default: |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1171 | reg_data = er32(TXDCTL(1)); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1172 | reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) | |
| 1173 | E1000_TXDCTL_FULL_TX_DESC_WB | |
| 1174 | E1000_TXDCTL_COUNT_DESC; |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1175 | ew32(TXDCTL(1), reg_data); |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 1176 | break; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1177 | } |
| 1178 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1179 | /* |
| 1180 | * Clear all of the statistics registers (clear on read). It is |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1181 | * important that we do this after we have tried to establish link |
| 1182 | * because the symbol error count will increment wildly if there |
| 1183 | * is no link. |
| 1184 | */ |
| 1185 | e1000_clear_hw_cntrs_82571(hw); |
| 1186 | |
| 1187 | return ret_val; |
| 1188 | } |
| 1189 | |
| 1190 | /** |
| 1191 | * e1000_initialize_hw_bits_82571 - Initialize hardware-dependent bits |
| 1192 | * @hw: pointer to the HW structure |
| 1193 | * |
| 1194 | * Initializes required hardware-dependent bits needed for normal operation. |
| 1195 | **/ |
| 1196 | static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw) |
| 1197 | { |
| 1198 | u32 reg; |
| 1199 | |
| 1200 | /* Transmit Descriptor Control 0 */ |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1201 | reg = er32(TXDCTL(0)); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1202 | reg |= (1 << 22); |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1203 | ew32(TXDCTL(0), reg); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1204 | |
| 1205 | /* Transmit Descriptor Control 1 */ |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1206 | reg = er32(TXDCTL(1)); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1207 | reg |= (1 << 22); |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1208 | ew32(TXDCTL(1), reg); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1209 | |
| 1210 | /* Transmit Arbitration Control 0 */ |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1211 | reg = er32(TARC(0)); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1212 | reg &= ~(0xF << 27); /* 30:27 */ |
| 1213 | switch (hw->mac.type) { |
| 1214 | case e1000_82571: |
| 1215 | case e1000_82572: |
| 1216 | reg |= (1 << 23) | (1 << 24) | (1 << 25) | (1 << 26); |
| 1217 | break; |
Bruce Allan | d6cb17d | 2011-12-16 00:46:22 +0000 | [diff] [blame] | 1218 | case e1000_82574: |
| 1219 | case e1000_82583: |
| 1220 | reg |= (1 << 26); |
| 1221 | break; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1222 | default: |
| 1223 | break; |
| 1224 | } |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1225 | ew32(TARC(0), reg); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1226 | |
| 1227 | /* Transmit Arbitration Control 1 */ |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1228 | reg = er32(TARC(1)); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1229 | switch (hw->mac.type) { |
| 1230 | case e1000_82571: |
| 1231 | case e1000_82572: |
| 1232 | reg &= ~((1 << 29) | (1 << 30)); |
| 1233 | reg |= (1 << 22) | (1 << 24) | (1 << 25) | (1 << 26); |
| 1234 | if (er32(TCTL) & E1000_TCTL_MULR) |
| 1235 | reg &= ~(1 << 28); |
| 1236 | else |
| 1237 | reg |= (1 << 28); |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1238 | ew32(TARC(1), reg); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1239 | break; |
| 1240 | default: |
| 1241 | break; |
| 1242 | } |
| 1243 | |
| 1244 | /* Device Control */ |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 1245 | switch (hw->mac.type) { |
| 1246 | case e1000_82573: |
| 1247 | case e1000_82574: |
| 1248 | case e1000_82583: |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1249 | reg = er32(CTRL); |
| 1250 | reg &= ~(1 << 29); |
| 1251 | ew32(CTRL, reg); |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 1252 | break; |
| 1253 | default: |
| 1254 | break; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1255 | } |
| 1256 | |
| 1257 | /* Extended Device Control */ |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 1258 | switch (hw->mac.type) { |
| 1259 | case e1000_82573: |
| 1260 | case e1000_82574: |
| 1261 | case e1000_82583: |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1262 | reg = er32(CTRL_EXT); |
| 1263 | reg &= ~(1 << 23); |
| 1264 | reg |= (1 << 22); |
| 1265 | ew32(CTRL_EXT, reg); |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 1266 | break; |
| 1267 | default: |
| 1268 | break; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1269 | } |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 1270 | |
Alexander Duyck | 6ea7ae1 | 2008-11-14 06:54:36 +0000 | [diff] [blame] | 1271 | if (hw->mac.type == e1000_82571) { |
| 1272 | reg = er32(PBA_ECC); |
| 1273 | reg |= E1000_PBA_ECC_CORR_EN; |
| 1274 | ew32(PBA_ECC, reg); |
| 1275 | } |
dave graham | 5df3f0e | 2009-02-10 12:51:41 +0000 | [diff] [blame] | 1276 | /* |
| 1277 | * Workaround for hardware errata. |
| 1278 | * Ensure that DMA Dynamic Clock gating is disabled on 82571 and 82572 |
| 1279 | */ |
| 1280 | |
| 1281 | if ((hw->mac.type == e1000_82571) || |
| 1282 | (hw->mac.type == e1000_82572)) { |
| 1283 | reg = er32(CTRL_EXT); |
| 1284 | reg &= ~E1000_CTRL_EXT_DMA_DYN_CLK_EN; |
| 1285 | ew32(CTRL_EXT, reg); |
| 1286 | } |
| 1287 | |
Alexander Duyck | 6ea7ae1 | 2008-11-14 06:54:36 +0000 | [diff] [blame] | 1288 | |
Jesse Brandeburg | 78272bb | 2009-01-26 12:16:26 -0800 | [diff] [blame] | 1289 | /* PCI-Ex Control Registers */ |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 1290 | switch (hw->mac.type) { |
| 1291 | case e1000_82574: |
| 1292 | case e1000_82583: |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 1293 | reg = er32(GCR); |
| 1294 | reg |= (1 << 22); |
| 1295 | ew32(GCR, reg); |
Jesse Brandeburg | 78272bb | 2009-01-26 12:16:26 -0800 | [diff] [blame] | 1296 | |
Bruce Allan | 84efb7b | 2009-11-20 23:26:24 +0000 | [diff] [blame] | 1297 | /* |
| 1298 | * Workaround for hardware errata. |
| 1299 | * apply workaround for hardware errata documented in errata |
| 1300 | * docs Fixes issue where some error prone or unreliable PCIe |
| 1301 | * completions are occurring, particularly with ASPM enabled. |
Bruce Allan | af667a2 | 2010-12-31 06:10:01 +0000 | [diff] [blame] | 1302 | * Without fix, issue can cause Tx timeouts. |
Bruce Allan | 84efb7b | 2009-11-20 23:26:24 +0000 | [diff] [blame] | 1303 | */ |
Jesse Brandeburg | 78272bb | 2009-01-26 12:16:26 -0800 | [diff] [blame] | 1304 | reg = er32(GCR2); |
| 1305 | reg |= 1; |
| 1306 | ew32(GCR2, reg); |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 1307 | break; |
| 1308 | default: |
| 1309 | break; |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 1310 | } |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1311 | } |
| 1312 | |
| 1313 | /** |
Bruce Allan | caaddaf | 2009-12-01 15:46:43 +0000 | [diff] [blame] | 1314 | * e1000_clear_vfta_82571 - Clear VLAN filter table |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1315 | * @hw: pointer to the HW structure |
| 1316 | * |
| 1317 | * Clears the register array which contains the VLAN filter table by |
| 1318 | * setting all the values to 0. |
| 1319 | **/ |
Bruce Allan | caaddaf | 2009-12-01 15:46:43 +0000 | [diff] [blame] | 1320 | static void e1000_clear_vfta_82571(struct e1000_hw *hw) |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1321 | { |
| 1322 | u32 offset; |
| 1323 | u32 vfta_value = 0; |
| 1324 | u32 vfta_offset = 0; |
| 1325 | u32 vfta_bit_in_reg = 0; |
| 1326 | |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 1327 | switch (hw->mac.type) { |
| 1328 | case e1000_82573: |
| 1329 | case e1000_82574: |
| 1330 | case e1000_82583: |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1331 | if (hw->mng_cookie.vlan_id != 0) { |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1332 | /* |
| 1333 | * The VFTA is a 4096b bit-field, each identifying |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1334 | * a single VLAN ID. The following operations |
| 1335 | * determine which 32b entry (i.e. offset) into the |
| 1336 | * array we want to set the VLAN ID (i.e. bit) of |
| 1337 | * the manageability unit. |
| 1338 | */ |
| 1339 | vfta_offset = (hw->mng_cookie.vlan_id >> |
| 1340 | E1000_VFTA_ENTRY_SHIFT) & |
| 1341 | E1000_VFTA_ENTRY_MASK; |
| 1342 | vfta_bit_in_reg = 1 << (hw->mng_cookie.vlan_id & |
| 1343 | E1000_VFTA_ENTRY_BIT_SHIFT_MASK); |
| 1344 | } |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 1345 | break; |
| 1346 | default: |
| 1347 | break; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1348 | } |
| 1349 | for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) { |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1350 | /* |
| 1351 | * If the offset we want to clear is the same offset of the |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1352 | * manageability VLAN ID, then clear all bits except that of |
| 1353 | * the manageability unit. |
| 1354 | */ |
| 1355 | vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0; |
| 1356 | E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset, vfta_value); |
| 1357 | e1e_flush(); |
| 1358 | } |
| 1359 | } |
| 1360 | |
| 1361 | /** |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 1362 | * e1000_check_mng_mode_82574 - Check manageability is enabled |
| 1363 | * @hw: pointer to the HW structure |
| 1364 | * |
| 1365 | * Reads the NVM Initialization Control Word 2 and returns true |
| 1366 | * (>0) if any manageability is enabled, else false (0). |
| 1367 | **/ |
| 1368 | static bool e1000_check_mng_mode_82574(struct e1000_hw *hw) |
| 1369 | { |
| 1370 | u16 data; |
| 1371 | |
| 1372 | e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &data); |
| 1373 | return (data & E1000_NVM_INIT_CTRL2_MNGM) != 0; |
| 1374 | } |
| 1375 | |
| 1376 | /** |
| 1377 | * e1000_led_on_82574 - Turn LED on |
| 1378 | * @hw: pointer to the HW structure |
| 1379 | * |
| 1380 | * Turn LED on. |
| 1381 | **/ |
| 1382 | static s32 e1000_led_on_82574(struct e1000_hw *hw) |
| 1383 | { |
| 1384 | u32 ctrl; |
| 1385 | u32 i; |
| 1386 | |
| 1387 | ctrl = hw->mac.ledctl_mode2; |
| 1388 | if (!(E1000_STATUS_LU & er32(STATUS))) { |
| 1389 | /* |
| 1390 | * If no link, then turn LED on by setting the invert bit |
| 1391 | * for each LED that's "on" (0x0E) in ledctl_mode2. |
| 1392 | */ |
| 1393 | for (i = 0; i < 4; i++) |
| 1394 | if (((hw->mac.ledctl_mode2 >> (i * 8)) & 0xFF) == |
| 1395 | E1000_LEDCTL_MODE_LED_ON) |
| 1396 | ctrl |= (E1000_LEDCTL_LED0_IVRT << (i * 8)); |
| 1397 | } |
| 1398 | ew32(LEDCTL, ctrl); |
| 1399 | |
| 1400 | return 0; |
| 1401 | } |
| 1402 | |
| 1403 | /** |
Carolyn Wyborny | ff10e13 | 2010-10-28 00:59:53 +0000 | [diff] [blame] | 1404 | * e1000_check_phy_82574 - check 82574 phy hung state |
| 1405 | * @hw: pointer to the HW structure |
| 1406 | * |
| 1407 | * Returns whether phy is hung or not |
| 1408 | **/ |
| 1409 | bool e1000_check_phy_82574(struct e1000_hw *hw) |
| 1410 | { |
| 1411 | u16 status_1kbt = 0; |
| 1412 | u16 receive_errors = 0; |
| 1413 | bool phy_hung = false; |
| 1414 | s32 ret_val = 0; |
| 1415 | |
| 1416 | /* |
| 1417 | * Read PHY Receive Error counter first, if its is max - all F's then |
| 1418 | * read the Base1000T status register If both are max then PHY is hung. |
| 1419 | */ |
| 1420 | ret_val = e1e_rphy(hw, E1000_RECEIVE_ERROR_COUNTER, &receive_errors); |
| 1421 | |
| 1422 | if (ret_val) |
| 1423 | goto out; |
| 1424 | if (receive_errors == E1000_RECEIVE_ERROR_MAX) { |
| 1425 | ret_val = e1e_rphy(hw, E1000_BASE1000T_STATUS, &status_1kbt); |
| 1426 | if (ret_val) |
| 1427 | goto out; |
| 1428 | if ((status_1kbt & E1000_IDLE_ERROR_COUNT_MASK) == |
| 1429 | E1000_IDLE_ERROR_COUNT_MASK) |
| 1430 | phy_hung = true; |
| 1431 | } |
| 1432 | out: |
| 1433 | return phy_hung; |
| 1434 | } |
| 1435 | |
| 1436 | /** |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1437 | * e1000_setup_link_82571 - Setup flow control and link settings |
| 1438 | * @hw: pointer to the HW structure |
| 1439 | * |
| 1440 | * Determines which flow control settings to use, then configures flow |
| 1441 | * control. Calls the appropriate media-specific link configuration |
| 1442 | * function. Assuming the adapter has a valid link partner, a valid link |
| 1443 | * should be established. Assumes the hardware has previously been reset |
| 1444 | * and the transmitter and receiver are not enabled. |
| 1445 | **/ |
| 1446 | static s32 e1000_setup_link_82571(struct e1000_hw *hw) |
| 1447 | { |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1448 | /* |
| 1449 | * 82573 does not have a word in the NVM to determine |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1450 | * the default flow control setting, so we explicitly |
| 1451 | * set it to full. |
| 1452 | */ |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 1453 | switch (hw->mac.type) { |
| 1454 | case e1000_82573: |
| 1455 | case e1000_82574: |
| 1456 | case e1000_82583: |
| 1457 | if (hw->fc.requested_mode == e1000_fc_default) |
| 1458 | hw->fc.requested_mode = e1000_fc_full; |
| 1459 | break; |
| 1460 | default: |
| 1461 | break; |
| 1462 | } |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1463 | |
| 1464 | return e1000e_setup_link(hw); |
| 1465 | } |
| 1466 | |
| 1467 | /** |
| 1468 | * e1000_setup_copper_link_82571 - Configure copper link settings |
| 1469 | * @hw: pointer to the HW structure |
| 1470 | * |
| 1471 | * Configures the link for auto-neg or forced speed and duplex. Then we check |
| 1472 | * for link, once link is established calls to configure collision distance |
| 1473 | * and flow control are called. |
| 1474 | **/ |
| 1475 | static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw) |
| 1476 | { |
| 1477 | u32 ctrl; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1478 | s32 ret_val; |
| 1479 | |
| 1480 | ctrl = er32(CTRL); |
| 1481 | ctrl |= E1000_CTRL_SLU; |
| 1482 | ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); |
| 1483 | ew32(CTRL, ctrl); |
| 1484 | |
| 1485 | switch (hw->phy.type) { |
| 1486 | case e1000_phy_m88: |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 1487 | case e1000_phy_bm: |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1488 | ret_val = e1000e_copper_link_setup_m88(hw); |
| 1489 | break; |
| 1490 | case e1000_phy_igp_2: |
| 1491 | ret_val = e1000e_copper_link_setup_igp(hw); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1492 | break; |
| 1493 | default: |
| 1494 | return -E1000_ERR_PHY; |
| 1495 | break; |
| 1496 | } |
| 1497 | |
| 1498 | if (ret_val) |
| 1499 | return ret_val; |
| 1500 | |
| 1501 | ret_val = e1000e_setup_copper_link(hw); |
| 1502 | |
| 1503 | return ret_val; |
| 1504 | } |
| 1505 | |
| 1506 | /** |
| 1507 | * e1000_setup_fiber_serdes_link_82571 - Setup link for fiber/serdes |
| 1508 | * @hw: pointer to the HW structure |
| 1509 | * |
| 1510 | * Configures collision distance and flow control for fiber and serdes links. |
| 1511 | * Upon successful setup, poll for link. |
| 1512 | **/ |
| 1513 | static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw) |
| 1514 | { |
| 1515 | switch (hw->mac.type) { |
| 1516 | case e1000_82571: |
| 1517 | case e1000_82572: |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1518 | /* |
| 1519 | * If SerDes loopback mode is entered, there is no form |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1520 | * of reset to take the adapter out of that mode. So we |
| 1521 | * have to explicitly take the adapter out of loopback |
Auke Kok | 489815c | 2008-02-21 15:11:07 -0800 | [diff] [blame] | 1522 | * mode. This prevents drivers from twiddling their thumbs |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1523 | * if another tool failed to take it out of loopback mode. |
| 1524 | */ |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1525 | ew32(SCTL, E1000_SCTL_DISABLE_SERDES_LOOPBACK); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1526 | break; |
| 1527 | default: |
| 1528 | break; |
| 1529 | } |
| 1530 | |
| 1531 | return e1000e_setup_fiber_serdes_link(hw); |
| 1532 | } |
| 1533 | |
| 1534 | /** |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1535 | * e1000_check_for_serdes_link_82571 - Check for link (Serdes) |
| 1536 | * @hw: pointer to the HW structure |
| 1537 | * |
Bruce Allan | 1a40d5c | 2009-12-01 15:49:51 +0000 | [diff] [blame] | 1538 | * Reports the link state as up or down. |
| 1539 | * |
| 1540 | * If autonegotiation is supported by the link partner, the link state is |
| 1541 | * determined by the result of autonegotiation. This is the most likely case. |
| 1542 | * If autonegotiation is not supported by the link partner, and the link |
| 1543 | * has a valid signal, force the link up. |
| 1544 | * |
| 1545 | * The link state is represented internally here by 4 states: |
| 1546 | * |
| 1547 | * 1) down |
| 1548 | * 2) autoneg_progress |
Daniel Mack | 3ad2f3f | 2010-02-03 08:01:28 +0800 | [diff] [blame] | 1549 | * 3) autoneg_complete (the link successfully autonegotiated) |
Bruce Allan | 1a40d5c | 2009-12-01 15:49:51 +0000 | [diff] [blame] | 1550 | * 4) forced_up (the link has been forced up, it did not autonegotiate) |
| 1551 | * |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1552 | **/ |
Hannes Eder | f637011 | 2009-02-14 11:32:25 +0000 | [diff] [blame] | 1553 | static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1554 | { |
| 1555 | struct e1000_mac_info *mac = &hw->mac; |
| 1556 | u32 rxcw; |
| 1557 | u32 ctrl; |
| 1558 | u32 status; |
Bruce Allan | d9c76f9 | 2010-11-24 06:01:35 +0000 | [diff] [blame] | 1559 | u32 txcw; |
| 1560 | u32 i; |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1561 | s32 ret_val = 0; |
| 1562 | |
| 1563 | ctrl = er32(CTRL); |
| 1564 | status = er32(STATUS); |
| 1565 | rxcw = er32(RXCW); |
| 1566 | |
| 1567 | if ((rxcw & E1000_RXCW_SYNCH) && !(rxcw & E1000_RXCW_IV)) { |
| 1568 | |
| 1569 | /* Receiver is synchronized with no invalid bits. */ |
| 1570 | switch (mac->serdes_link_state) { |
| 1571 | case e1000_serdes_link_autoneg_complete: |
| 1572 | if (!(status & E1000_STATUS_LU)) { |
| 1573 | /* |
| 1574 | * We have lost link, retry autoneg before |
| 1575 | * reporting link failure |
| 1576 | */ |
| 1577 | mac->serdes_link_state = |
| 1578 | e1000_serdes_link_autoneg_progress; |
Bruce Allan | 1a40d5c | 2009-12-01 15:49:51 +0000 | [diff] [blame] | 1579 | mac->serdes_has_link = false; |
Bruce Allan | 3bb99fe | 2009-11-20 23:25:07 +0000 | [diff] [blame] | 1580 | e_dbg("AN_UP -> AN_PROG\n"); |
Bruce Allan | a82a14f | 2010-11-24 06:01:20 +0000 | [diff] [blame] | 1581 | } else { |
| 1582 | mac->serdes_has_link = true; |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1583 | } |
Bruce Allan | a82a14f | 2010-11-24 06:01:20 +0000 | [diff] [blame] | 1584 | break; |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1585 | |
| 1586 | case e1000_serdes_link_forced_up: |
| 1587 | /* |
| 1588 | * If we are receiving /C/ ordered sets, re-enable |
| 1589 | * auto-negotiation in the TXCW register and disable |
| 1590 | * forced link in the Device Control register in an |
| 1591 | * attempt to auto-negotiate with our link partner. |
Bruce Allan | d478eb4 | 2010-11-16 19:50:13 -0800 | [diff] [blame] | 1592 | * If the partner code word is null, stop forcing |
| 1593 | * and restart auto negotiation. |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1594 | */ |
Bruce Allan | d478eb4 | 2010-11-16 19:50:13 -0800 | [diff] [blame] | 1595 | if ((rxcw & E1000_RXCW_C) || !(rxcw & E1000_RXCW_CW)) { |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1596 | /* Enable autoneg, and unforce link up */ |
| 1597 | ew32(TXCW, mac->txcw); |
Bruce Allan | 1a40d5c | 2009-12-01 15:49:51 +0000 | [diff] [blame] | 1598 | ew32(CTRL, (ctrl & ~E1000_CTRL_SLU)); |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1599 | mac->serdes_link_state = |
| 1600 | e1000_serdes_link_autoneg_progress; |
Bruce Allan | 1a40d5c | 2009-12-01 15:49:51 +0000 | [diff] [blame] | 1601 | mac->serdes_has_link = false; |
Bruce Allan | 3bb99fe | 2009-11-20 23:25:07 +0000 | [diff] [blame] | 1602 | e_dbg("FORCED_UP -> AN_PROG\n"); |
Bruce Allan | a82a14f | 2010-11-24 06:01:20 +0000 | [diff] [blame] | 1603 | } else { |
| 1604 | mac->serdes_has_link = true; |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1605 | } |
| 1606 | break; |
| 1607 | |
| 1608 | case e1000_serdes_link_autoneg_progress: |
Bruce Allan | 1a40d5c | 2009-12-01 15:49:51 +0000 | [diff] [blame] | 1609 | if (rxcw & E1000_RXCW_C) { |
| 1610 | /* |
| 1611 | * We received /C/ ordered sets, meaning the |
| 1612 | * link partner has autonegotiated, and we can |
| 1613 | * trust the Link Up (LU) status bit. |
| 1614 | */ |
| 1615 | if (status & E1000_STATUS_LU) { |
| 1616 | mac->serdes_link_state = |
| 1617 | e1000_serdes_link_autoneg_complete; |
| 1618 | e_dbg("AN_PROG -> AN_UP\n"); |
| 1619 | mac->serdes_has_link = true; |
| 1620 | } else { |
| 1621 | /* Autoneg completed, but failed. */ |
| 1622 | mac->serdes_link_state = |
| 1623 | e1000_serdes_link_down; |
| 1624 | e_dbg("AN_PROG -> DOWN\n"); |
| 1625 | } |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1626 | } else { |
| 1627 | /* |
Bruce Allan | 1a40d5c | 2009-12-01 15:49:51 +0000 | [diff] [blame] | 1628 | * The link partner did not autoneg. |
| 1629 | * Force link up and full duplex, and change |
| 1630 | * state to forced. |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1631 | */ |
Bruce Allan | 1a40d5c | 2009-12-01 15:49:51 +0000 | [diff] [blame] | 1632 | ew32(TXCW, (mac->txcw & ~E1000_TXCW_ANE)); |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1633 | ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD); |
| 1634 | ew32(CTRL, ctrl); |
| 1635 | |
| 1636 | /* Configure Flow Control after link up. */ |
Bruce Allan | 1a40d5c | 2009-12-01 15:49:51 +0000 | [diff] [blame] | 1637 | ret_val = e1000e_config_fc_after_link_up(hw); |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1638 | if (ret_val) { |
Bruce Allan | 3bb99fe | 2009-11-20 23:25:07 +0000 | [diff] [blame] | 1639 | e_dbg("Error config flow control\n"); |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1640 | break; |
| 1641 | } |
| 1642 | mac->serdes_link_state = |
| 1643 | e1000_serdes_link_forced_up; |
Bruce Allan | 1a40d5c | 2009-12-01 15:49:51 +0000 | [diff] [blame] | 1644 | mac->serdes_has_link = true; |
Bruce Allan | 3bb99fe | 2009-11-20 23:25:07 +0000 | [diff] [blame] | 1645 | e_dbg("AN_PROG -> FORCED_UP\n"); |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1646 | } |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1647 | break; |
| 1648 | |
| 1649 | case e1000_serdes_link_down: |
| 1650 | default: |
Bruce Allan | 1a40d5c | 2009-12-01 15:49:51 +0000 | [diff] [blame] | 1651 | /* |
| 1652 | * The link was down but the receiver has now gained |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1653 | * valid sync, so lets see if we can bring the link |
Bruce Allan | 1a40d5c | 2009-12-01 15:49:51 +0000 | [diff] [blame] | 1654 | * up. |
| 1655 | */ |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1656 | ew32(TXCW, mac->txcw); |
Bruce Allan | 1a40d5c | 2009-12-01 15:49:51 +0000 | [diff] [blame] | 1657 | ew32(CTRL, (ctrl & ~E1000_CTRL_SLU)); |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1658 | mac->serdes_link_state = |
| 1659 | e1000_serdes_link_autoneg_progress; |
Bruce Allan | a82a14f | 2010-11-24 06:01:20 +0000 | [diff] [blame] | 1660 | mac->serdes_has_link = false; |
Bruce Allan | 3bb99fe | 2009-11-20 23:25:07 +0000 | [diff] [blame] | 1661 | e_dbg("DOWN -> AN_PROG\n"); |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1662 | break; |
| 1663 | } |
| 1664 | } else { |
| 1665 | if (!(rxcw & E1000_RXCW_SYNCH)) { |
| 1666 | mac->serdes_has_link = false; |
| 1667 | mac->serdes_link_state = e1000_serdes_link_down; |
Bruce Allan | 3bb99fe | 2009-11-20 23:25:07 +0000 | [diff] [blame] | 1668 | e_dbg("ANYSTATE -> DOWN\n"); |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1669 | } else { |
| 1670 | /* |
Bruce Allan | d9c76f9 | 2010-11-24 06:01:35 +0000 | [diff] [blame] | 1671 | * Check several times, if Sync and Config |
| 1672 | * both are consistently 1 then simply ignore |
| 1673 | * the Invalid bit and restart Autoneg |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1674 | */ |
Bruce Allan | d9c76f9 | 2010-11-24 06:01:35 +0000 | [diff] [blame] | 1675 | for (i = 0; i < AN_RETRY_COUNT; i++) { |
| 1676 | udelay(10); |
| 1677 | rxcw = er32(RXCW); |
| 1678 | if ((rxcw & E1000_RXCW_IV) && |
| 1679 | !((rxcw & E1000_RXCW_SYNCH) && |
| 1680 | (rxcw & E1000_RXCW_C))) { |
| 1681 | mac->serdes_has_link = false; |
| 1682 | mac->serdes_link_state = |
| 1683 | e1000_serdes_link_down; |
| 1684 | e_dbg("ANYSTATE -> DOWN\n"); |
| 1685 | break; |
| 1686 | } |
| 1687 | } |
| 1688 | |
| 1689 | if (i == AN_RETRY_COUNT) { |
| 1690 | txcw = er32(TXCW); |
| 1691 | txcw |= E1000_TXCW_ANE; |
| 1692 | ew32(TXCW, txcw); |
| 1693 | mac->serdes_link_state = |
| 1694 | e1000_serdes_link_autoneg_progress; |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1695 | mac->serdes_has_link = false; |
Bruce Allan | d9c76f9 | 2010-11-24 06:01:35 +0000 | [diff] [blame] | 1696 | e_dbg("ANYSTATE -> AN_PROG\n"); |
dave graham | c952337 | 2009-02-10 12:52:28 +0000 | [diff] [blame] | 1697 | } |
| 1698 | } |
| 1699 | } |
| 1700 | |
| 1701 | return ret_val; |
| 1702 | } |
| 1703 | |
| 1704 | /** |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1705 | * e1000_valid_led_default_82571 - Verify a valid default LED config |
| 1706 | * @hw: pointer to the HW structure |
| 1707 | * @data: pointer to the NVM (EEPROM) |
| 1708 | * |
| 1709 | * Read the EEPROM for the current default LED configuration. If the |
| 1710 | * LED configuration is not valid, set to a valid LED configuration. |
| 1711 | **/ |
| 1712 | static s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data) |
| 1713 | { |
| 1714 | s32 ret_val; |
| 1715 | |
| 1716 | ret_val = e1000_read_nvm(hw, NVM_ID_LED_SETTINGS, 1, data); |
| 1717 | if (ret_val) { |
Bruce Allan | 3bb99fe | 2009-11-20 23:25:07 +0000 | [diff] [blame] | 1718 | e_dbg("NVM Read Error\n"); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1719 | return ret_val; |
| 1720 | } |
| 1721 | |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 1722 | switch (hw->mac.type) { |
| 1723 | case e1000_82573: |
| 1724 | case e1000_82574: |
| 1725 | case e1000_82583: |
| 1726 | if (*data == ID_LED_RESERVED_F746) |
| 1727 | *data = ID_LED_DEFAULT_82573; |
| 1728 | break; |
| 1729 | default: |
| 1730 | if (*data == ID_LED_RESERVED_0000 || |
| 1731 | *data == ID_LED_RESERVED_FFFF) |
| 1732 | *data = ID_LED_DEFAULT; |
| 1733 | break; |
| 1734 | } |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1735 | |
| 1736 | return 0; |
| 1737 | } |
| 1738 | |
| 1739 | /** |
| 1740 | * e1000e_get_laa_state_82571 - Get locally administered address state |
| 1741 | * @hw: pointer to the HW structure |
| 1742 | * |
Auke Kok | 489815c | 2008-02-21 15:11:07 -0800 | [diff] [blame] | 1743 | * Retrieve and return the current locally administered address state. |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1744 | **/ |
| 1745 | bool e1000e_get_laa_state_82571(struct e1000_hw *hw) |
| 1746 | { |
| 1747 | if (hw->mac.type != e1000_82571) |
Bruce Allan | 564ea9b | 2009-11-20 23:26:44 +0000 | [diff] [blame] | 1748 | return false; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1749 | |
| 1750 | return hw->dev_spec.e82571.laa_is_present; |
| 1751 | } |
| 1752 | |
| 1753 | /** |
| 1754 | * e1000e_set_laa_state_82571 - Set locally administered address state |
| 1755 | * @hw: pointer to the HW structure |
| 1756 | * @state: enable/disable locally administered address |
| 1757 | * |
Bruce Allan | 5ff5b66 | 2009-12-01 15:51:11 +0000 | [diff] [blame] | 1758 | * Enable/Disable the current locally administered address state. |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1759 | **/ |
| 1760 | void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state) |
| 1761 | { |
| 1762 | if (hw->mac.type != e1000_82571) |
| 1763 | return; |
| 1764 | |
| 1765 | hw->dev_spec.e82571.laa_is_present = state; |
| 1766 | |
| 1767 | /* If workaround is activated... */ |
| 1768 | if (state) |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1769 | /* |
| 1770 | * Hold a copy of the LAA in RAR[14] This is done so that |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1771 | * between the time RAR[0] gets clobbered and the time it |
| 1772 | * gets fixed, the actual LAA is in one of the RARs and no |
| 1773 | * incoming packets directed to this port are dropped. |
| 1774 | * Eventually the LAA will be in RAR[0] and RAR[14]. |
| 1775 | */ |
| 1776 | e1000e_rar_set(hw, hw->mac.addr, hw->mac.rar_entry_count - 1); |
| 1777 | } |
| 1778 | |
| 1779 | /** |
| 1780 | * e1000_fix_nvm_checksum_82571 - Fix EEPROM checksum |
| 1781 | * @hw: pointer to the HW structure |
| 1782 | * |
| 1783 | * Verifies that the EEPROM has completed the update. After updating the |
| 1784 | * EEPROM, we need to check bit 15 in work 0x23 for the checksum fix. If |
| 1785 | * the checksum fix is not implemented, we need to set the bit and update |
| 1786 | * the checksum. Otherwise, if bit 15 is set and the checksum is incorrect, |
| 1787 | * we need to return bad checksum. |
| 1788 | **/ |
| 1789 | static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw) |
| 1790 | { |
| 1791 | struct e1000_nvm_info *nvm = &hw->nvm; |
| 1792 | s32 ret_val; |
| 1793 | u16 data; |
| 1794 | |
| 1795 | if (nvm->type != e1000_nvm_flash_hw) |
| 1796 | return 0; |
| 1797 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1798 | /* |
| 1799 | * Check bit 4 of word 10h. If it is 0, firmware is done updating |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1800 | * 10h-12h. Checksum may need to be fixed. |
| 1801 | */ |
| 1802 | ret_val = e1000_read_nvm(hw, 0x10, 1, &data); |
| 1803 | if (ret_val) |
| 1804 | return ret_val; |
| 1805 | |
| 1806 | if (!(data & 0x10)) { |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1807 | /* |
| 1808 | * Read 0x23 and check bit 15. This bit is a 1 |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1809 | * when the checksum has already been fixed. If |
| 1810 | * the checksum is still wrong and this bit is a |
| 1811 | * 1, we need to return bad checksum. Otherwise, |
| 1812 | * we need to set this bit to a 1 and update the |
| 1813 | * checksum. |
| 1814 | */ |
| 1815 | ret_val = e1000_read_nvm(hw, 0x23, 1, &data); |
| 1816 | if (ret_val) |
| 1817 | return ret_val; |
| 1818 | |
| 1819 | if (!(data & 0x8000)) { |
| 1820 | data |= 0x8000; |
| 1821 | ret_val = e1000_write_nvm(hw, 0x23, 1, &data); |
| 1822 | if (ret_val) |
| 1823 | return ret_val; |
| 1824 | ret_val = e1000e_update_nvm_checksum(hw); |
| 1825 | } |
| 1826 | } |
| 1827 | |
| 1828 | return 0; |
| 1829 | } |
| 1830 | |
| 1831 | /** |
Bruce Allan | 608f8a0 | 2010-01-13 02:04:58 +0000 | [diff] [blame] | 1832 | * e1000_read_mac_addr_82571 - Read device MAC address |
| 1833 | * @hw: pointer to the HW structure |
| 1834 | **/ |
| 1835 | static s32 e1000_read_mac_addr_82571(struct e1000_hw *hw) |
| 1836 | { |
| 1837 | s32 ret_val = 0; |
| 1838 | |
Bruce Allan | 1aef70e | 2010-08-19 15:48:52 -0700 | [diff] [blame] | 1839 | if (hw->mac.type == e1000_82571) { |
| 1840 | /* |
| 1841 | * If there's an alternate MAC address place it in RAR0 |
| 1842 | * so that it will override the Si installed default perm |
| 1843 | * address. |
| 1844 | */ |
| 1845 | ret_val = e1000_check_alt_mac_addr_generic(hw); |
| 1846 | if (ret_val) |
| 1847 | goto out; |
| 1848 | } |
Bruce Allan | 608f8a0 | 2010-01-13 02:04:58 +0000 | [diff] [blame] | 1849 | |
| 1850 | ret_val = e1000_read_mac_addr_generic(hw); |
| 1851 | |
| 1852 | out: |
| 1853 | return ret_val; |
| 1854 | } |
| 1855 | |
| 1856 | /** |
Bruce Allan | 17f208d | 2009-12-01 15:47:22 +0000 | [diff] [blame] | 1857 | * e1000_power_down_phy_copper_82571 - Remove link during PHY power down |
| 1858 | * @hw: pointer to the HW structure |
| 1859 | * |
| 1860 | * In the case of a PHY power down to save power, or to turn off link during a |
| 1861 | * driver unload, or wake on lan is not enabled, remove the link. |
| 1862 | **/ |
| 1863 | static void e1000_power_down_phy_copper_82571(struct e1000_hw *hw) |
| 1864 | { |
| 1865 | struct e1000_phy_info *phy = &hw->phy; |
| 1866 | struct e1000_mac_info *mac = &hw->mac; |
| 1867 | |
| 1868 | if (!(phy->ops.check_reset_block)) |
| 1869 | return; |
| 1870 | |
| 1871 | /* If the management interface is not enabled, then power down */ |
| 1872 | if (!(mac->ops.check_mng_mode(hw) || phy->ops.check_reset_block(hw))) |
| 1873 | e1000_power_down_phy_copper(hw); |
Bruce Allan | 17f208d | 2009-12-01 15:47:22 +0000 | [diff] [blame] | 1874 | } |
| 1875 | |
| 1876 | /** |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1877 | * e1000_clear_hw_cntrs_82571 - Clear device specific hardware counters |
| 1878 | * @hw: pointer to the HW structure |
| 1879 | * |
| 1880 | * Clears the hardware counters by reading the counter registers. |
| 1881 | **/ |
| 1882 | static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw) |
| 1883 | { |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1884 | e1000e_clear_hw_cntrs_base(hw); |
| 1885 | |
Bruce Allan | 99673d9 | 2009-11-20 23:27:21 +0000 | [diff] [blame] | 1886 | er32(PRC64); |
| 1887 | er32(PRC127); |
| 1888 | er32(PRC255); |
| 1889 | er32(PRC511); |
| 1890 | er32(PRC1023); |
| 1891 | er32(PRC1522); |
| 1892 | er32(PTC64); |
| 1893 | er32(PTC127); |
| 1894 | er32(PTC255); |
| 1895 | er32(PTC511); |
| 1896 | er32(PTC1023); |
| 1897 | er32(PTC1522); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1898 | |
Bruce Allan | 99673d9 | 2009-11-20 23:27:21 +0000 | [diff] [blame] | 1899 | er32(ALGNERRC); |
| 1900 | er32(RXERRC); |
| 1901 | er32(TNCRS); |
| 1902 | er32(CEXTERR); |
| 1903 | er32(TSCTC); |
| 1904 | er32(TSCTFC); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1905 | |
Bruce Allan | 99673d9 | 2009-11-20 23:27:21 +0000 | [diff] [blame] | 1906 | er32(MGTPRC); |
| 1907 | er32(MGTPDC); |
| 1908 | er32(MGTPTC); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1909 | |
Bruce Allan | 99673d9 | 2009-11-20 23:27:21 +0000 | [diff] [blame] | 1910 | er32(IAC); |
| 1911 | er32(ICRXOC); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1912 | |
Bruce Allan | 99673d9 | 2009-11-20 23:27:21 +0000 | [diff] [blame] | 1913 | er32(ICRXPTC); |
| 1914 | er32(ICRXATC); |
| 1915 | er32(ICTXPTC); |
| 1916 | er32(ICTXATC); |
| 1917 | er32(ICTXQEC); |
| 1918 | er32(ICTXQMTC); |
| 1919 | er32(ICRXDMTC); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1920 | } |
| 1921 | |
Jeff Kirsher | 8ce9d6c | 2011-09-24 13:23:52 +0000 | [diff] [blame] | 1922 | static const struct e1000_mac_operations e82571_mac_ops = { |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 1923 | /* .check_mng_mode: mac type dependent */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1924 | /* .check_for_link: media type dependent */ |
Bruce Allan | a4f58f5 | 2009-06-02 11:29:18 +0000 | [diff] [blame] | 1925 | .id_led_init = e1000e_id_led_init, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1926 | .cleanup_led = e1000e_cleanup_led_generic, |
| 1927 | .clear_hw_cntrs = e1000_clear_hw_cntrs_82571, |
| 1928 | .get_bus_info = e1000e_get_bus_info_pcie, |
Bruce Allan | f4d2dd4 | 2010-01-13 02:05:18 +0000 | [diff] [blame] | 1929 | .set_lan_id = e1000_set_lan_id_multi_port_pcie, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1930 | /* .get_link_up_info: media type dependent */ |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 1931 | /* .led_on: mac type dependent */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1932 | .led_off = e1000e_led_off_generic, |
Bruce Allan | ab8932f | 2010-01-13 02:05:38 +0000 | [diff] [blame] | 1933 | .update_mc_addr_list = e1000e_update_mc_addr_list_generic, |
Bruce Allan | caaddaf | 2009-12-01 15:46:43 +0000 | [diff] [blame] | 1934 | .write_vfta = e1000_write_vfta_generic, |
| 1935 | .clear_vfta = e1000_clear_vfta_82571, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1936 | .reset_hw = e1000_reset_hw_82571, |
| 1937 | .init_hw = e1000_init_hw_82571, |
| 1938 | .setup_link = e1000_setup_link_82571, |
| 1939 | /* .setup_physical_interface: media type dependent */ |
Bruce Allan | a4f58f5 | 2009-06-02 11:29:18 +0000 | [diff] [blame] | 1940 | .setup_led = e1000e_setup_led_generic, |
Bruce Allan | 608f8a0 | 2010-01-13 02:04:58 +0000 | [diff] [blame] | 1941 | .read_mac_addr = e1000_read_mac_addr_82571, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1942 | }; |
| 1943 | |
Jeff Kirsher | 8ce9d6c | 2011-09-24 13:23:52 +0000 | [diff] [blame] | 1944 | static const struct e1000_phy_operations e82_phy_ops_igp = { |
Bruce Allan | 94d8186 | 2009-11-20 23:25:26 +0000 | [diff] [blame] | 1945 | .acquire = e1000_get_hw_semaphore_82571, |
Bruce Allan | 94e5b65 | 2009-12-02 17:02:14 +0000 | [diff] [blame] | 1946 | .check_polarity = e1000_check_polarity_igp, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1947 | .check_reset_block = e1000e_check_reset_block_generic, |
Bruce Allan | 94d8186 | 2009-11-20 23:25:26 +0000 | [diff] [blame] | 1948 | .commit = NULL, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1949 | .force_speed_duplex = e1000e_phy_force_speed_duplex_igp, |
| 1950 | .get_cfg_done = e1000_get_cfg_done_82571, |
| 1951 | .get_cable_length = e1000e_get_cable_length_igp_2, |
Bruce Allan | 94d8186 | 2009-11-20 23:25:26 +0000 | [diff] [blame] | 1952 | .get_info = e1000e_get_phy_info_igp, |
| 1953 | .read_reg = e1000e_read_phy_reg_igp, |
| 1954 | .release = e1000_put_hw_semaphore_82571, |
| 1955 | .reset = e1000e_phy_hw_reset_generic, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1956 | .set_d0_lplu_state = e1000_set_d0_lplu_state_82571, |
| 1957 | .set_d3_lplu_state = e1000e_set_d3_lplu_state, |
Bruce Allan | 94d8186 | 2009-11-20 23:25:26 +0000 | [diff] [blame] | 1958 | .write_reg = e1000e_write_phy_reg_igp, |
Bruce Allan | 75eb0fa | 2008-11-21 16:53:51 -0800 | [diff] [blame] | 1959 | .cfg_on_link_up = NULL, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1960 | }; |
| 1961 | |
Jeff Kirsher | 8ce9d6c | 2011-09-24 13:23:52 +0000 | [diff] [blame] | 1962 | static const struct e1000_phy_operations e82_phy_ops_m88 = { |
Bruce Allan | 94d8186 | 2009-11-20 23:25:26 +0000 | [diff] [blame] | 1963 | .acquire = e1000_get_hw_semaphore_82571, |
Bruce Allan | 94e5b65 | 2009-12-02 17:02:14 +0000 | [diff] [blame] | 1964 | .check_polarity = e1000_check_polarity_m88, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1965 | .check_reset_block = e1000e_check_reset_block_generic, |
Bruce Allan | 94d8186 | 2009-11-20 23:25:26 +0000 | [diff] [blame] | 1966 | .commit = e1000e_phy_sw_reset, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1967 | .force_speed_duplex = e1000e_phy_force_speed_duplex_m88, |
| 1968 | .get_cfg_done = e1000e_get_cfg_done, |
| 1969 | .get_cable_length = e1000e_get_cable_length_m88, |
Bruce Allan | 94d8186 | 2009-11-20 23:25:26 +0000 | [diff] [blame] | 1970 | .get_info = e1000e_get_phy_info_m88, |
| 1971 | .read_reg = e1000e_read_phy_reg_m88, |
| 1972 | .release = e1000_put_hw_semaphore_82571, |
| 1973 | .reset = e1000e_phy_hw_reset_generic, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1974 | .set_d0_lplu_state = e1000_set_d0_lplu_state_82571, |
| 1975 | .set_d3_lplu_state = e1000e_set_d3_lplu_state, |
Bruce Allan | 94d8186 | 2009-11-20 23:25:26 +0000 | [diff] [blame] | 1976 | .write_reg = e1000e_write_phy_reg_m88, |
Bruce Allan | 75eb0fa | 2008-11-21 16:53:51 -0800 | [diff] [blame] | 1977 | .cfg_on_link_up = NULL, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1978 | }; |
| 1979 | |
Jeff Kirsher | 8ce9d6c | 2011-09-24 13:23:52 +0000 | [diff] [blame] | 1980 | static const struct e1000_phy_operations e82_phy_ops_bm = { |
Bruce Allan | 94d8186 | 2009-11-20 23:25:26 +0000 | [diff] [blame] | 1981 | .acquire = e1000_get_hw_semaphore_82571, |
Bruce Allan | 94e5b65 | 2009-12-02 17:02:14 +0000 | [diff] [blame] | 1982 | .check_polarity = e1000_check_polarity_m88, |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 1983 | .check_reset_block = e1000e_check_reset_block_generic, |
Bruce Allan | 94d8186 | 2009-11-20 23:25:26 +0000 | [diff] [blame] | 1984 | .commit = e1000e_phy_sw_reset, |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 1985 | .force_speed_duplex = e1000e_phy_force_speed_duplex_m88, |
| 1986 | .get_cfg_done = e1000e_get_cfg_done, |
| 1987 | .get_cable_length = e1000e_get_cable_length_m88, |
Bruce Allan | 94d8186 | 2009-11-20 23:25:26 +0000 | [diff] [blame] | 1988 | .get_info = e1000e_get_phy_info_m88, |
| 1989 | .read_reg = e1000e_read_phy_reg_bm2, |
| 1990 | .release = e1000_put_hw_semaphore_82571, |
| 1991 | .reset = e1000e_phy_hw_reset_generic, |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 1992 | .set_d0_lplu_state = e1000_set_d0_lplu_state_82571, |
| 1993 | .set_d3_lplu_state = e1000e_set_d3_lplu_state, |
Bruce Allan | 94d8186 | 2009-11-20 23:25:26 +0000 | [diff] [blame] | 1994 | .write_reg = e1000e_write_phy_reg_bm2, |
Bruce Allan | 75eb0fa | 2008-11-21 16:53:51 -0800 | [diff] [blame] | 1995 | .cfg_on_link_up = NULL, |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 1996 | }; |
| 1997 | |
Jeff Kirsher | 8ce9d6c | 2011-09-24 13:23:52 +0000 | [diff] [blame] | 1998 | static const struct e1000_nvm_operations e82571_nvm_ops = { |
Bruce Allan | 94d8186 | 2009-11-20 23:25:26 +0000 | [diff] [blame] | 1999 | .acquire = e1000_acquire_nvm_82571, |
| 2000 | .read = e1000e_read_nvm_eerd, |
| 2001 | .release = e1000_release_nvm_82571, |
| 2002 | .update = e1000_update_nvm_checksum_82571, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2003 | .valid_led_default = e1000_valid_led_default_82571, |
Bruce Allan | 94d8186 | 2009-11-20 23:25:26 +0000 | [diff] [blame] | 2004 | .validate = e1000_validate_nvm_checksum_82571, |
| 2005 | .write = e1000_write_nvm_82571, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2006 | }; |
| 2007 | |
Jeff Kirsher | 8ce9d6c | 2011-09-24 13:23:52 +0000 | [diff] [blame] | 2008 | const struct e1000_info e1000_82571_info = { |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2009 | .mac = e1000_82571, |
| 2010 | .flags = FLAG_HAS_HW_VLAN_FILTER |
| 2011 | | FLAG_HAS_JUMBO_FRAMES |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2012 | | FLAG_HAS_WOL |
| 2013 | | FLAG_APME_IN_CTRL3 |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2014 | | FLAG_HAS_CTRLEXT_ON_LOAD |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2015 | | FLAG_HAS_SMART_POWER_DOWN |
| 2016 | | FLAG_RESET_OVERWRITES_LAA /* errata */ |
| 2017 | | FLAG_TARC_SPEED_MODE_BIT /* errata */ |
| 2018 | | FLAG_APME_CHECK_PORT_B, |
Jesse Brandeburg | 3a3b758 | 2010-09-29 21:38:49 +0000 | [diff] [blame] | 2019 | .flags2 = FLAG2_DISABLE_ASPM_L1 /* errata 13 */ |
| 2020 | | FLAG2_DMA_BURST, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2021 | .pba = 38, |
Bruce Allan | 2adc55c | 2009-06-02 11:28:58 +0000 | [diff] [blame] | 2022 | .max_hw_frame_size = DEFAULT_JUMBO, |
Jeff Kirsher | 69e3fd8 | 2008-04-02 13:48:18 -0700 | [diff] [blame] | 2023 | .get_variants = e1000_get_variants_82571, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2024 | .mac_ops = &e82571_mac_ops, |
| 2025 | .phy_ops = &e82_phy_ops_igp, |
| 2026 | .nvm_ops = &e82571_nvm_ops, |
| 2027 | }; |
| 2028 | |
Jeff Kirsher | 8ce9d6c | 2011-09-24 13:23:52 +0000 | [diff] [blame] | 2029 | const struct e1000_info e1000_82572_info = { |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2030 | .mac = e1000_82572, |
| 2031 | .flags = FLAG_HAS_HW_VLAN_FILTER |
| 2032 | | FLAG_HAS_JUMBO_FRAMES |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2033 | | FLAG_HAS_WOL |
| 2034 | | FLAG_APME_IN_CTRL3 |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2035 | | FLAG_HAS_CTRLEXT_ON_LOAD |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2036 | | FLAG_TARC_SPEED_MODE_BIT, /* errata */ |
Jesse Brandeburg | 3a3b758 | 2010-09-29 21:38:49 +0000 | [diff] [blame] | 2037 | .flags2 = FLAG2_DISABLE_ASPM_L1 /* errata 13 */ |
| 2038 | | FLAG2_DMA_BURST, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2039 | .pba = 38, |
Bruce Allan | 2adc55c | 2009-06-02 11:28:58 +0000 | [diff] [blame] | 2040 | .max_hw_frame_size = DEFAULT_JUMBO, |
Jeff Kirsher | 69e3fd8 | 2008-04-02 13:48:18 -0700 | [diff] [blame] | 2041 | .get_variants = e1000_get_variants_82571, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2042 | .mac_ops = &e82571_mac_ops, |
| 2043 | .phy_ops = &e82_phy_ops_igp, |
| 2044 | .nvm_ops = &e82571_nvm_ops, |
| 2045 | }; |
| 2046 | |
Jeff Kirsher | 8ce9d6c | 2011-09-24 13:23:52 +0000 | [diff] [blame] | 2047 | const struct e1000_info e1000_82573_info = { |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2048 | .mac = e1000_82573, |
| 2049 | .flags = FLAG_HAS_HW_VLAN_FILTER |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2050 | | FLAG_HAS_WOL |
| 2051 | | FLAG_APME_IN_CTRL3 |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2052 | | FLAG_HAS_SMART_POWER_DOWN |
| 2053 | | FLAG_HAS_AMT |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2054 | | FLAG_HAS_SWSM_ON_LOAD, |
Bruce Allan | 78cd29d | 2011-03-24 03:09:03 +0000 | [diff] [blame] | 2055 | .flags2 = FLAG2_DISABLE_ASPM_L1 |
| 2056 | | FLAG2_DISABLE_ASPM_L0S, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2057 | .pba = 20, |
Bruce Allan | 2adc55c | 2009-06-02 11:28:58 +0000 | [diff] [blame] | 2058 | .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN, |
Jeff Kirsher | 69e3fd8 | 2008-04-02 13:48:18 -0700 | [diff] [blame] | 2059 | .get_variants = e1000_get_variants_82571, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2060 | .mac_ops = &e82571_mac_ops, |
| 2061 | .phy_ops = &e82_phy_ops_m88, |
Auke Kok | 31f8c4f | 2008-02-21 15:10:47 -0800 | [diff] [blame] | 2062 | .nvm_ops = &e82571_nvm_ops, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2063 | }; |
| 2064 | |
Jeff Kirsher | 8ce9d6c | 2011-09-24 13:23:52 +0000 | [diff] [blame] | 2065 | const struct e1000_info e1000_82574_info = { |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 2066 | .mac = e1000_82574, |
| 2067 | .flags = FLAG_HAS_HW_VLAN_FILTER |
| 2068 | | FLAG_HAS_MSIX |
| 2069 | | FLAG_HAS_JUMBO_FRAMES |
| 2070 | | FLAG_HAS_WOL |
| 2071 | | FLAG_APME_IN_CTRL3 |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 2072 | | FLAG_HAS_SMART_POWER_DOWN |
| 2073 | | FLAG_HAS_AMT |
| 2074 | | FLAG_HAS_CTRLEXT_ON_LOAD, |
Bruce Allan | 78cd29d | 2011-03-24 03:09:03 +0000 | [diff] [blame] | 2075 | .flags2 = FLAG2_CHECK_PHY_HANG |
Bruce Allan | 7f99ae6 | 2011-07-22 06:21:35 +0000 | [diff] [blame] | 2076 | | FLAG2_DISABLE_ASPM_L0S |
| 2077 | | FLAG2_NO_DISABLE_RX, |
Bruce Allan | ed5c2b0 | 2010-11-24 06:01:25 +0000 | [diff] [blame] | 2078 | .pba = 32, |
Alexander Duyck | a825e00 | 2009-10-02 12:30:42 +0000 | [diff] [blame] | 2079 | .max_hw_frame_size = DEFAULT_JUMBO, |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 2080 | .get_variants = e1000_get_variants_82571, |
| 2081 | .mac_ops = &e82571_mac_ops, |
| 2082 | .phy_ops = &e82_phy_ops_bm, |
| 2083 | .nvm_ops = &e82571_nvm_ops, |
| 2084 | }; |
| 2085 | |
Jeff Kirsher | 8ce9d6c | 2011-09-24 13:23:52 +0000 | [diff] [blame] | 2086 | const struct e1000_info e1000_82583_info = { |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 2087 | .mac = e1000_82583, |
| 2088 | .flags = FLAG_HAS_HW_VLAN_FILTER |
| 2089 | | FLAG_HAS_WOL |
| 2090 | | FLAG_APME_IN_CTRL3 |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 2091 | | FLAG_HAS_SMART_POWER_DOWN |
| 2092 | | FLAG_HAS_AMT |
Carolyn Wyborny | a3d72d5 | 2011-07-12 16:10:11 +0000 | [diff] [blame] | 2093 | | FLAG_HAS_JUMBO_FRAMES |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 2094 | | FLAG_HAS_CTRLEXT_ON_LOAD, |
Bruce Allan | 7f99ae6 | 2011-07-22 06:21:35 +0000 | [diff] [blame] | 2095 | .flags2 = FLAG2_DISABLE_ASPM_L0S |
| 2096 | | FLAG2_NO_DISABLE_RX, |
Bruce Allan | ed5c2b0 | 2010-11-24 06:01:25 +0000 | [diff] [blame] | 2097 | .pba = 32, |
Carolyn Wyborny | a3d72d5 | 2011-07-12 16:10:11 +0000 | [diff] [blame] | 2098 | .max_hw_frame_size = DEFAULT_JUMBO, |
Alexander Duyck | 8c81c9c | 2009-03-19 01:12:27 +0000 | [diff] [blame] | 2099 | .get_variants = e1000_get_variants_82571, |
| 2100 | .mac_ops = &e82571_mac_ops, |
| 2101 | .phy_ops = &e82_phy_ops_bm, |
| 2102 | .nvm_ops = &e82571_nvm_ops, |
| 2103 | }; |
| 2104 | |