Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | |
| 3 | Intel(R) Gigabit Ethernet Linux driver |
Alexander Duyck | 86d5d38 | 2009-02-06 23:23:12 +0000 | [diff] [blame] | 4 | Copyright(c) 2007-2009 Intel Corporation. |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [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 | e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> |
| 24 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
| 25 | |
| 26 | *******************************************************************************/ |
| 27 | |
| 28 | /* e1000_82575 |
| 29 | * e1000_82576 |
| 30 | */ |
| 31 | |
| 32 | #include <linux/types.h> |
| 33 | #include <linux/slab.h> |
Alexander Duyck | 2d064c0 | 2008-07-08 15:10:12 -0700 | [diff] [blame] | 34 | #include <linux/if_ether.h> |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 35 | |
| 36 | #include "e1000_mac.h" |
| 37 | #include "e1000_82575.h" |
| 38 | |
| 39 | static s32 igb_get_invariants_82575(struct e1000_hw *); |
| 40 | static s32 igb_acquire_phy_82575(struct e1000_hw *); |
| 41 | static void igb_release_phy_82575(struct e1000_hw *); |
| 42 | static s32 igb_acquire_nvm_82575(struct e1000_hw *); |
| 43 | static void igb_release_nvm_82575(struct e1000_hw *); |
| 44 | static s32 igb_check_for_link_82575(struct e1000_hw *); |
| 45 | static s32 igb_get_cfg_done_82575(struct e1000_hw *); |
| 46 | static s32 igb_init_hw_82575(struct e1000_hw *); |
| 47 | static s32 igb_phy_hw_reset_sgmii_82575(struct e1000_hw *); |
| 48 | static s32 igb_read_phy_reg_sgmii_82575(struct e1000_hw *, u32, u16 *); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 49 | static s32 igb_reset_hw_82575(struct e1000_hw *); |
| 50 | static s32 igb_set_d0_lplu_state_82575(struct e1000_hw *, bool); |
| 51 | static s32 igb_setup_copper_link_82575(struct e1000_hw *); |
| 52 | static s32 igb_setup_fiber_serdes_link_82575(struct e1000_hw *); |
| 53 | static s32 igb_write_phy_reg_sgmii_82575(struct e1000_hw *, u32, u16); |
| 54 | static void igb_clear_hw_cntrs_82575(struct e1000_hw *); |
| 55 | static s32 igb_acquire_swfw_sync_82575(struct e1000_hw *, u16); |
Alexander Duyck | f3e7841 | 2009-07-23 18:07:58 +0000 | [diff] [blame] | 56 | static void igb_configure_pcs_link_82575(struct e1000_hw *); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 57 | static s32 igb_get_pcs_speed_and_duplex_82575(struct e1000_hw *, u16 *, |
| 58 | u16 *); |
| 59 | static s32 igb_get_phy_id_82575(struct e1000_hw *); |
| 60 | static void igb_release_swfw_sync_82575(struct e1000_hw *, u16); |
| 61 | static bool igb_sgmii_active_82575(struct e1000_hw *); |
| 62 | static s32 igb_reset_init_script_82575(struct e1000_hw *); |
| 63 | static s32 igb_read_mac_addr_82575(struct e1000_hw *); |
Alexander Duyck | 009bc06 | 2009-07-23 18:08:35 +0000 | [diff] [blame^] | 64 | static s32 igb_set_pcie_completion_timeout(struct e1000_hw *hw); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 65 | |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 66 | static s32 igb_get_invariants_82575(struct e1000_hw *hw) |
| 67 | { |
| 68 | struct e1000_phy_info *phy = &hw->phy; |
| 69 | struct e1000_nvm_info *nvm = &hw->nvm; |
| 70 | struct e1000_mac_info *mac = &hw->mac; |
Alexander Duyck | c1889bf | 2009-02-06 23:16:45 +0000 | [diff] [blame] | 71 | struct e1000_dev_spec_82575 * dev_spec = &hw->dev_spec._82575; |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 72 | u32 eecd; |
| 73 | s32 ret_val; |
| 74 | u16 size; |
| 75 | u32 ctrl_ext = 0; |
| 76 | |
| 77 | switch (hw->device_id) { |
| 78 | case E1000_DEV_ID_82575EB_COPPER: |
| 79 | case E1000_DEV_ID_82575EB_FIBER_SERDES: |
| 80 | case E1000_DEV_ID_82575GB_QUAD_COPPER: |
| 81 | mac->type = e1000_82575; |
| 82 | break; |
Alexander Duyck | 2d064c0 | 2008-07-08 15:10:12 -0700 | [diff] [blame] | 83 | case E1000_DEV_ID_82576: |
Alexander Duyck | 9eb2341 | 2009-03-13 20:42:15 +0000 | [diff] [blame] | 84 | case E1000_DEV_ID_82576_NS: |
Alexander Duyck | 2d064c0 | 2008-07-08 15:10:12 -0700 | [diff] [blame] | 85 | case E1000_DEV_ID_82576_FIBER: |
| 86 | case E1000_DEV_ID_82576_SERDES: |
Alexander Duyck | c8ea5ea9 | 2009-03-13 20:42:35 +0000 | [diff] [blame] | 87 | case E1000_DEV_ID_82576_QUAD_COPPER: |
Alexander Duyck | 2d064c0 | 2008-07-08 15:10:12 -0700 | [diff] [blame] | 88 | mac->type = e1000_82576; |
| 89 | break; |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 90 | default: |
| 91 | return -E1000_ERR_MAC_INIT; |
| 92 | break; |
| 93 | } |
| 94 | |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 95 | /* Set media type */ |
| 96 | /* |
| 97 | * The 82575 uses bits 22:23 for link mode. The mode can be changed |
| 98 | * based on the EEPROM. We cannot rely upon device ID. There |
| 99 | * is no distinguishable difference between fiber and internal |
| 100 | * SerDes mode on the 82575. There can be an external PHY attached |
| 101 | * on the SGMII interface. For this, we'll set sgmii_active to true. |
| 102 | */ |
| 103 | phy->media_type = e1000_media_type_copper; |
| 104 | dev_spec->sgmii_active = false; |
| 105 | |
| 106 | ctrl_ext = rd32(E1000_CTRL_EXT); |
| 107 | if ((ctrl_ext & E1000_CTRL_EXT_LINK_MODE_MASK) == |
| 108 | E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES) { |
| 109 | hw->phy.media_type = e1000_media_type_internal_serdes; |
| 110 | ctrl_ext |= E1000_CTRL_I2C_ENA; |
| 111 | } else if (ctrl_ext & E1000_CTRL_EXT_LINK_MODE_SGMII) { |
| 112 | dev_spec->sgmii_active = true; |
| 113 | ctrl_ext |= E1000_CTRL_I2C_ENA; |
| 114 | } else { |
| 115 | ctrl_ext &= ~E1000_CTRL_I2C_ENA; |
| 116 | } |
| 117 | wr32(E1000_CTRL_EXT, ctrl_ext); |
| 118 | |
| 119 | /* Set mta register count */ |
| 120 | mac->mta_reg_count = 128; |
| 121 | /* Set rar entry count */ |
| 122 | mac->rar_entry_count = E1000_RAR_ENTRIES_82575; |
Alexander Duyck | 2d064c0 | 2008-07-08 15:10:12 -0700 | [diff] [blame] | 123 | if (mac->type == e1000_82576) |
| 124 | mac->rar_entry_count = E1000_RAR_ENTRIES_82576; |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 125 | /* Set if part includes ASF firmware */ |
| 126 | mac->asf_firmware_present = true; |
| 127 | /* Set if manageability features are enabled. */ |
| 128 | mac->arc_subsystem_valid = |
| 129 | (rd32(E1000_FWSM) & E1000_FWSM_MODE_MASK) |
| 130 | ? true : false; |
| 131 | |
| 132 | /* physical interface link setup */ |
| 133 | mac->ops.setup_physical_interface = |
| 134 | (hw->phy.media_type == e1000_media_type_copper) |
| 135 | ? igb_setup_copper_link_82575 |
| 136 | : igb_setup_fiber_serdes_link_82575; |
| 137 | |
| 138 | /* NVM initialization */ |
| 139 | eecd = rd32(E1000_EECD); |
| 140 | |
| 141 | nvm->opcode_bits = 8; |
| 142 | nvm->delay_usec = 1; |
| 143 | switch (nvm->override) { |
| 144 | case e1000_nvm_override_spi_large: |
| 145 | nvm->page_size = 32; |
| 146 | nvm->address_bits = 16; |
| 147 | break; |
| 148 | case e1000_nvm_override_spi_small: |
| 149 | nvm->page_size = 8; |
| 150 | nvm->address_bits = 8; |
| 151 | break; |
| 152 | default: |
| 153 | nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; |
| 154 | nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? 16 : 8; |
| 155 | break; |
| 156 | } |
| 157 | |
| 158 | nvm->type = e1000_nvm_eeprom_spi; |
| 159 | |
| 160 | size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> |
| 161 | E1000_EECD_SIZE_EX_SHIFT); |
| 162 | |
| 163 | /* |
| 164 | * Added to a constant, "size" becomes the left-shift value |
| 165 | * for setting word_size. |
| 166 | */ |
| 167 | size += NVM_WORD_SIZE_BASE_SHIFT; |
Jeff Kirsher | 5c3cad7 | 2008-06-27 10:59:33 -0700 | [diff] [blame] | 168 | |
| 169 | /* EEPROM access above 16k is unsupported */ |
| 170 | if (size > 14) |
| 171 | size = 14; |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 172 | nvm->word_size = 1 << size; |
| 173 | |
| 174 | /* setup PHY parameters */ |
| 175 | if (phy->media_type != e1000_media_type_copper) { |
| 176 | phy->type = e1000_phy_none; |
| 177 | return 0; |
| 178 | } |
| 179 | |
| 180 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; |
| 181 | phy->reset_delay_us = 100; |
| 182 | |
| 183 | /* PHY function pointers */ |
| 184 | if (igb_sgmii_active_82575(hw)) { |
Alexander Duyck | a8d2a0c | 2009-02-06 23:17:26 +0000 | [diff] [blame] | 185 | phy->ops.reset = igb_phy_hw_reset_sgmii_82575; |
| 186 | phy->ops.read_reg = igb_read_phy_reg_sgmii_82575; |
| 187 | phy->ops.write_reg = igb_write_phy_reg_sgmii_82575; |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 188 | } else { |
Alexander Duyck | a8d2a0c | 2009-02-06 23:17:26 +0000 | [diff] [blame] | 189 | phy->ops.reset = igb_phy_hw_reset; |
| 190 | phy->ops.read_reg = igb_read_phy_reg_igp; |
| 191 | phy->ops.write_reg = igb_write_phy_reg_igp; |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 192 | } |
| 193 | |
Alexander Duyck | 19e588e | 2009-07-07 13:01:55 +0000 | [diff] [blame] | 194 | /* set lan id */ |
| 195 | hw->bus.func = (rd32(E1000_STATUS) & E1000_STATUS_FUNC_MASK) >> |
| 196 | E1000_STATUS_FUNC_SHIFT; |
| 197 | |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 198 | /* Set phy->phy_addr and phy->id. */ |
| 199 | ret_val = igb_get_phy_id_82575(hw); |
| 200 | if (ret_val) |
| 201 | return ret_val; |
| 202 | |
| 203 | /* Verify phy id and set remaining function pointers */ |
| 204 | switch (phy->id) { |
| 205 | case M88E1111_I_PHY_ID: |
| 206 | phy->type = e1000_phy_m88; |
| 207 | phy->ops.get_phy_info = igb_get_phy_info_m88; |
| 208 | phy->ops.get_cable_length = igb_get_cable_length_m88; |
| 209 | phy->ops.force_speed_duplex = igb_phy_force_speed_duplex_m88; |
| 210 | break; |
| 211 | case IGP03E1000_E_PHY_ID: |
| 212 | phy->type = e1000_phy_igp_3; |
| 213 | phy->ops.get_phy_info = igb_get_phy_info_igp; |
| 214 | phy->ops.get_cable_length = igb_get_cable_length_igp_2; |
| 215 | phy->ops.force_speed_duplex = igb_phy_force_speed_duplex_igp; |
| 216 | phy->ops.set_d0_lplu_state = igb_set_d0_lplu_state_82575; |
| 217 | phy->ops.set_d3_lplu_state = igb_set_d3_lplu_state; |
| 218 | break; |
| 219 | default: |
| 220 | return -E1000_ERR_PHY; |
| 221 | } |
| 222 | |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 223 | /* if 82576 then initialize mailbox parameters */ |
| 224 | if (mac->type == e1000_82576) |
| 225 | igb_init_mbx_params_pf(hw); |
| 226 | |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 227 | return 0; |
| 228 | } |
| 229 | |
| 230 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 231 | * igb_acquire_phy_82575 - Acquire rights to access PHY |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 232 | * @hw: pointer to the HW structure |
| 233 | * |
| 234 | * Acquire access rights to the correct PHY. This is a |
| 235 | * function pointer entry point called by the api module. |
| 236 | **/ |
| 237 | static s32 igb_acquire_phy_82575(struct e1000_hw *hw) |
| 238 | { |
| 239 | u16 mask; |
| 240 | |
| 241 | mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; |
| 242 | |
| 243 | return igb_acquire_swfw_sync_82575(hw, mask); |
| 244 | } |
| 245 | |
| 246 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 247 | * igb_release_phy_82575 - Release rights to access PHY |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 248 | * @hw: pointer to the HW structure |
| 249 | * |
| 250 | * A wrapper to release access rights to the correct PHY. This is a |
| 251 | * function pointer entry point called by the api module. |
| 252 | **/ |
| 253 | static void igb_release_phy_82575(struct e1000_hw *hw) |
| 254 | { |
| 255 | u16 mask; |
| 256 | |
| 257 | mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; |
| 258 | igb_release_swfw_sync_82575(hw, mask); |
| 259 | } |
| 260 | |
| 261 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 262 | * igb_read_phy_reg_sgmii_82575 - Read PHY register using sgmii |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 263 | * @hw: pointer to the HW structure |
| 264 | * @offset: register offset to be read |
| 265 | * @data: pointer to the read data |
| 266 | * |
| 267 | * Reads the PHY register at offset using the serial gigabit media independent |
| 268 | * interface and stores the retrieved information in data. |
| 269 | **/ |
| 270 | static s32 igb_read_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset, |
| 271 | u16 *data) |
| 272 | { |
| 273 | struct e1000_phy_info *phy = &hw->phy; |
| 274 | u32 i, i2ccmd = 0; |
| 275 | |
| 276 | if (offset > E1000_MAX_SGMII_PHY_REG_ADDR) { |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 277 | hw_dbg("PHY Address %u is out of range\n", offset); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 278 | return -E1000_ERR_PARAM; |
| 279 | } |
| 280 | |
| 281 | /* |
| 282 | * Set up Op-code, Phy Address, and register address in the I2CCMD |
| 283 | * register. The MAC will take care of interfacing with the |
| 284 | * PHY to retrieve the desired data. |
| 285 | */ |
| 286 | i2ccmd = ((offset << E1000_I2CCMD_REG_ADDR_SHIFT) | |
| 287 | (phy->addr << E1000_I2CCMD_PHY_ADDR_SHIFT) | |
| 288 | (E1000_I2CCMD_OPCODE_READ)); |
| 289 | |
| 290 | wr32(E1000_I2CCMD, i2ccmd); |
| 291 | |
| 292 | /* Poll the ready bit to see if the I2C read completed */ |
| 293 | for (i = 0; i < E1000_I2CCMD_PHY_TIMEOUT; i++) { |
| 294 | udelay(50); |
| 295 | i2ccmd = rd32(E1000_I2CCMD); |
| 296 | if (i2ccmd & E1000_I2CCMD_READY) |
| 297 | break; |
| 298 | } |
| 299 | if (!(i2ccmd & E1000_I2CCMD_READY)) { |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 300 | hw_dbg("I2CCMD Read did not complete\n"); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 301 | return -E1000_ERR_PHY; |
| 302 | } |
| 303 | if (i2ccmd & E1000_I2CCMD_ERROR) { |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 304 | hw_dbg("I2CCMD Error bit set\n"); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 305 | return -E1000_ERR_PHY; |
| 306 | } |
| 307 | |
| 308 | /* Need to byte-swap the 16-bit value. */ |
| 309 | *data = ((i2ccmd >> 8) & 0x00FF) | ((i2ccmd << 8) & 0xFF00); |
| 310 | |
| 311 | return 0; |
| 312 | } |
| 313 | |
| 314 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 315 | * igb_write_phy_reg_sgmii_82575 - Write PHY register using sgmii |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 316 | * @hw: pointer to the HW structure |
| 317 | * @offset: register offset to write to |
| 318 | * @data: data to write at register offset |
| 319 | * |
| 320 | * Writes the data to PHY register at the offset using the serial gigabit |
| 321 | * media independent interface. |
| 322 | **/ |
| 323 | static s32 igb_write_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset, |
| 324 | u16 data) |
| 325 | { |
| 326 | struct e1000_phy_info *phy = &hw->phy; |
| 327 | u32 i, i2ccmd = 0; |
| 328 | u16 phy_data_swapped; |
| 329 | |
| 330 | if (offset > E1000_MAX_SGMII_PHY_REG_ADDR) { |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 331 | hw_dbg("PHY Address %d is out of range\n", offset); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 332 | return -E1000_ERR_PARAM; |
| 333 | } |
| 334 | |
| 335 | /* Swap the data bytes for the I2C interface */ |
| 336 | phy_data_swapped = ((data >> 8) & 0x00FF) | ((data << 8) & 0xFF00); |
| 337 | |
| 338 | /* |
| 339 | * Set up Op-code, Phy Address, and register address in the I2CCMD |
| 340 | * register. The MAC will take care of interfacing with the |
| 341 | * PHY to retrieve the desired data. |
| 342 | */ |
| 343 | i2ccmd = ((offset << E1000_I2CCMD_REG_ADDR_SHIFT) | |
| 344 | (phy->addr << E1000_I2CCMD_PHY_ADDR_SHIFT) | |
| 345 | E1000_I2CCMD_OPCODE_WRITE | |
| 346 | phy_data_swapped); |
| 347 | |
| 348 | wr32(E1000_I2CCMD, i2ccmd); |
| 349 | |
| 350 | /* Poll the ready bit to see if the I2C read completed */ |
| 351 | for (i = 0; i < E1000_I2CCMD_PHY_TIMEOUT; i++) { |
| 352 | udelay(50); |
| 353 | i2ccmd = rd32(E1000_I2CCMD); |
| 354 | if (i2ccmd & E1000_I2CCMD_READY) |
| 355 | break; |
| 356 | } |
| 357 | if (!(i2ccmd & E1000_I2CCMD_READY)) { |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 358 | hw_dbg("I2CCMD Write did not complete\n"); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 359 | return -E1000_ERR_PHY; |
| 360 | } |
| 361 | if (i2ccmd & E1000_I2CCMD_ERROR) { |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 362 | hw_dbg("I2CCMD Error bit set\n"); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 363 | return -E1000_ERR_PHY; |
| 364 | } |
| 365 | |
| 366 | return 0; |
| 367 | } |
| 368 | |
| 369 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 370 | * igb_get_phy_id_82575 - Retrieve PHY addr and id |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 371 | * @hw: pointer to the HW structure |
| 372 | * |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 373 | * Retrieves the PHY address and ID for both PHY's which do and do not use |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 374 | * sgmi interface. |
| 375 | **/ |
| 376 | static s32 igb_get_phy_id_82575(struct e1000_hw *hw) |
| 377 | { |
| 378 | struct e1000_phy_info *phy = &hw->phy; |
| 379 | s32 ret_val = 0; |
| 380 | u16 phy_id; |
| 381 | |
| 382 | /* |
| 383 | * For SGMII PHYs, we try the list of possible addresses until |
| 384 | * we find one that works. For non-SGMII PHYs |
| 385 | * (e.g. integrated copper PHYs), an address of 1 should |
| 386 | * work. The result of this function should mean phy->phy_addr |
| 387 | * and phy->id are set correctly. |
| 388 | */ |
| 389 | if (!(igb_sgmii_active_82575(hw))) { |
| 390 | phy->addr = 1; |
| 391 | ret_val = igb_get_phy_id(hw); |
| 392 | goto out; |
| 393 | } |
| 394 | |
| 395 | /* |
| 396 | * The address field in the I2CCMD register is 3 bits and 0 is invalid. |
| 397 | * Therefore, we need to test 1-7 |
| 398 | */ |
| 399 | for (phy->addr = 1; phy->addr < 8; phy->addr++) { |
| 400 | ret_val = igb_read_phy_reg_sgmii_82575(hw, PHY_ID1, &phy_id); |
| 401 | if (ret_val == 0) { |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 402 | hw_dbg("Vendor ID 0x%08X read at address %u\n", |
| 403 | phy_id, phy->addr); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 404 | /* |
| 405 | * At the time of this writing, The M88 part is |
| 406 | * the only supported SGMII PHY product. |
| 407 | */ |
| 408 | if (phy_id == M88_VENDOR) |
| 409 | break; |
| 410 | } else { |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 411 | hw_dbg("PHY address %u was unreadable\n", phy->addr); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 412 | } |
| 413 | } |
| 414 | |
| 415 | /* A valid PHY type couldn't be found. */ |
| 416 | if (phy->addr == 8) { |
| 417 | phy->addr = 0; |
| 418 | ret_val = -E1000_ERR_PHY; |
| 419 | goto out; |
| 420 | } |
| 421 | |
| 422 | ret_val = igb_get_phy_id(hw); |
| 423 | |
| 424 | out: |
| 425 | return ret_val; |
| 426 | } |
| 427 | |
| 428 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 429 | * igb_phy_hw_reset_sgmii_82575 - Performs a PHY reset |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 430 | * @hw: pointer to the HW structure |
| 431 | * |
| 432 | * Resets the PHY using the serial gigabit media independent interface. |
| 433 | **/ |
| 434 | static s32 igb_phy_hw_reset_sgmii_82575(struct e1000_hw *hw) |
| 435 | { |
| 436 | s32 ret_val; |
| 437 | |
| 438 | /* |
| 439 | * This isn't a true "hard" reset, but is the only reset |
| 440 | * available to us at this time. |
| 441 | */ |
| 442 | |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 443 | hw_dbg("Soft resetting SGMII attached PHY...\n"); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 444 | |
| 445 | /* |
| 446 | * SFP documentation requires the following to configure the SPF module |
| 447 | * to work on SGMII. No further documentation is given. |
| 448 | */ |
Alexander Duyck | a8d2a0c | 2009-02-06 23:17:26 +0000 | [diff] [blame] | 449 | ret_val = hw->phy.ops.write_reg(hw, 0x1B, 0x8084); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 450 | if (ret_val) |
| 451 | goto out; |
| 452 | |
| 453 | ret_val = igb_phy_sw_reset(hw); |
| 454 | |
| 455 | out: |
| 456 | return ret_val; |
| 457 | } |
| 458 | |
| 459 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 460 | * igb_set_d0_lplu_state_82575 - Set Low Power Linkup D0 state |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 461 | * @hw: pointer to the HW structure |
| 462 | * @active: true to enable LPLU, false to disable |
| 463 | * |
| 464 | * Sets the LPLU D0 state according to the active flag. When |
| 465 | * activating LPLU this function also disables smart speed |
| 466 | * and vice versa. LPLU will not be activated unless the |
| 467 | * device autonegotiation advertisement meets standards of |
| 468 | * either 10 or 10/100 or 10/100/1000 at all duplexes. |
| 469 | * This is a function pointer entry point only called by |
| 470 | * PHY setup routines. |
| 471 | **/ |
| 472 | static s32 igb_set_d0_lplu_state_82575(struct e1000_hw *hw, bool active) |
| 473 | { |
| 474 | struct e1000_phy_info *phy = &hw->phy; |
| 475 | s32 ret_val; |
| 476 | u16 data; |
| 477 | |
Alexander Duyck | a8d2a0c | 2009-02-06 23:17:26 +0000 | [diff] [blame] | 478 | ret_val = phy->ops.read_reg(hw, IGP02E1000_PHY_POWER_MGMT, &data); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 479 | if (ret_val) |
| 480 | goto out; |
| 481 | |
| 482 | if (active) { |
| 483 | data |= IGP02E1000_PM_D0_LPLU; |
Alexander Duyck | a8d2a0c | 2009-02-06 23:17:26 +0000 | [diff] [blame] | 484 | ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT, |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 485 | data); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 486 | if (ret_val) |
| 487 | goto out; |
| 488 | |
| 489 | /* When LPLU is enabled, we should disable SmartSpeed */ |
Alexander Duyck | a8d2a0c | 2009-02-06 23:17:26 +0000 | [diff] [blame] | 490 | ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 491 | &data); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 492 | data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
Alexander Duyck | a8d2a0c | 2009-02-06 23:17:26 +0000 | [diff] [blame] | 493 | ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 494 | data); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 495 | if (ret_val) |
| 496 | goto out; |
| 497 | } else { |
| 498 | data &= ~IGP02E1000_PM_D0_LPLU; |
Alexander Duyck | a8d2a0c | 2009-02-06 23:17:26 +0000 | [diff] [blame] | 499 | ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT, |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 500 | data); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 501 | /* |
| 502 | * LPLU and SmartSpeed are mutually exclusive. LPLU is used |
| 503 | * during Dx states where the power conservation is most |
| 504 | * important. During driver activity we should enable |
| 505 | * SmartSpeed, so performance is maintained. |
| 506 | */ |
| 507 | if (phy->smart_speed == e1000_smart_speed_on) { |
Alexander Duyck | a8d2a0c | 2009-02-06 23:17:26 +0000 | [diff] [blame] | 508 | ret_val = phy->ops.read_reg(hw, |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 509 | IGP01E1000_PHY_PORT_CONFIG, &data); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 510 | if (ret_val) |
| 511 | goto out; |
| 512 | |
| 513 | data |= IGP01E1000_PSCFR_SMART_SPEED; |
Alexander Duyck | a8d2a0c | 2009-02-06 23:17:26 +0000 | [diff] [blame] | 514 | ret_val = phy->ops.write_reg(hw, |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 515 | IGP01E1000_PHY_PORT_CONFIG, data); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 516 | if (ret_val) |
| 517 | goto out; |
| 518 | } else if (phy->smart_speed == e1000_smart_speed_off) { |
Alexander Duyck | a8d2a0c | 2009-02-06 23:17:26 +0000 | [diff] [blame] | 519 | ret_val = phy->ops.read_reg(hw, |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 520 | IGP01E1000_PHY_PORT_CONFIG, &data); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 521 | if (ret_val) |
| 522 | goto out; |
| 523 | |
| 524 | data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
Alexander Duyck | a8d2a0c | 2009-02-06 23:17:26 +0000 | [diff] [blame] | 525 | ret_val = phy->ops.write_reg(hw, |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 526 | IGP01E1000_PHY_PORT_CONFIG, data); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 527 | if (ret_val) |
| 528 | goto out; |
| 529 | } |
| 530 | } |
| 531 | |
| 532 | out: |
| 533 | return ret_val; |
| 534 | } |
| 535 | |
| 536 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 537 | * igb_acquire_nvm_82575 - Request for access to EEPROM |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 538 | * @hw: pointer to the HW structure |
| 539 | * |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 540 | * Acquire the necessary semaphores for exclusive access to the EEPROM. |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 541 | * Set the EEPROM access request bit and wait for EEPROM access grant bit. |
| 542 | * Return successful if access grant bit set, else clear the request for |
| 543 | * EEPROM access and return -E1000_ERR_NVM (-1). |
| 544 | **/ |
| 545 | static s32 igb_acquire_nvm_82575(struct e1000_hw *hw) |
| 546 | { |
| 547 | s32 ret_val; |
| 548 | |
| 549 | ret_val = igb_acquire_swfw_sync_82575(hw, E1000_SWFW_EEP_SM); |
| 550 | if (ret_val) |
| 551 | goto out; |
| 552 | |
| 553 | ret_val = igb_acquire_nvm(hw); |
| 554 | |
| 555 | if (ret_val) |
| 556 | igb_release_swfw_sync_82575(hw, E1000_SWFW_EEP_SM); |
| 557 | |
| 558 | out: |
| 559 | return ret_val; |
| 560 | } |
| 561 | |
| 562 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 563 | * igb_release_nvm_82575 - Release exclusive access to EEPROM |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 564 | * @hw: pointer to the HW structure |
| 565 | * |
| 566 | * Stop any current commands to the EEPROM and clear the EEPROM request bit, |
| 567 | * then release the semaphores acquired. |
| 568 | **/ |
| 569 | static void igb_release_nvm_82575(struct e1000_hw *hw) |
| 570 | { |
| 571 | igb_release_nvm(hw); |
| 572 | igb_release_swfw_sync_82575(hw, E1000_SWFW_EEP_SM); |
| 573 | } |
| 574 | |
| 575 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 576 | * igb_acquire_swfw_sync_82575 - Acquire SW/FW semaphore |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 577 | * @hw: pointer to the HW structure |
| 578 | * @mask: specifies which semaphore to acquire |
| 579 | * |
| 580 | * Acquire the SW/FW semaphore to access the PHY or NVM. The mask |
| 581 | * will also specify which port we're acquiring the lock for. |
| 582 | **/ |
| 583 | static s32 igb_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask) |
| 584 | { |
| 585 | u32 swfw_sync; |
| 586 | u32 swmask = mask; |
| 587 | u32 fwmask = mask << 16; |
| 588 | s32 ret_val = 0; |
| 589 | s32 i = 0, timeout = 200; /* FIXME: find real value to use here */ |
| 590 | |
| 591 | while (i < timeout) { |
| 592 | if (igb_get_hw_semaphore(hw)) { |
| 593 | ret_val = -E1000_ERR_SWFW_SYNC; |
| 594 | goto out; |
| 595 | } |
| 596 | |
| 597 | swfw_sync = rd32(E1000_SW_FW_SYNC); |
| 598 | if (!(swfw_sync & (fwmask | swmask))) |
| 599 | break; |
| 600 | |
| 601 | /* |
| 602 | * Firmware currently using resource (fwmask) |
| 603 | * or other software thread using resource (swmask) |
| 604 | */ |
| 605 | igb_put_hw_semaphore(hw); |
| 606 | mdelay(5); |
| 607 | i++; |
| 608 | } |
| 609 | |
| 610 | if (i == timeout) { |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 611 | hw_dbg("Driver can't access resource, SW_FW_SYNC timeout.\n"); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 612 | ret_val = -E1000_ERR_SWFW_SYNC; |
| 613 | goto out; |
| 614 | } |
| 615 | |
| 616 | swfw_sync |= swmask; |
| 617 | wr32(E1000_SW_FW_SYNC, swfw_sync); |
| 618 | |
| 619 | igb_put_hw_semaphore(hw); |
| 620 | |
| 621 | out: |
| 622 | return ret_val; |
| 623 | } |
| 624 | |
| 625 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 626 | * igb_release_swfw_sync_82575 - Release SW/FW semaphore |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 627 | * @hw: pointer to the HW structure |
| 628 | * @mask: specifies which semaphore to acquire |
| 629 | * |
| 630 | * Release the SW/FW semaphore used to access the PHY or NVM. The mask |
| 631 | * will also specify which port we're releasing the lock for. |
| 632 | **/ |
| 633 | static void igb_release_swfw_sync_82575(struct e1000_hw *hw, u16 mask) |
| 634 | { |
| 635 | u32 swfw_sync; |
| 636 | |
| 637 | while (igb_get_hw_semaphore(hw) != 0); |
| 638 | /* Empty */ |
| 639 | |
| 640 | swfw_sync = rd32(E1000_SW_FW_SYNC); |
| 641 | swfw_sync &= ~mask; |
| 642 | wr32(E1000_SW_FW_SYNC, swfw_sync); |
| 643 | |
| 644 | igb_put_hw_semaphore(hw); |
| 645 | } |
| 646 | |
| 647 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 648 | * igb_get_cfg_done_82575 - Read config done bit |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 649 | * @hw: pointer to the HW structure |
| 650 | * |
| 651 | * Read the management control register for the config done bit for |
| 652 | * completion status. NOTE: silicon which is EEPROM-less will fail trying |
| 653 | * to read the config done bit, so an error is *ONLY* logged and returns |
| 654 | * 0. If we were to return with error, EEPROM-less silicon |
| 655 | * would not be able to be reset or change link. |
| 656 | **/ |
| 657 | static s32 igb_get_cfg_done_82575(struct e1000_hw *hw) |
| 658 | { |
| 659 | s32 timeout = PHY_CFG_TIMEOUT; |
| 660 | s32 ret_val = 0; |
| 661 | u32 mask = E1000_NVM_CFG_DONE_PORT_0; |
| 662 | |
| 663 | if (hw->bus.func == 1) |
| 664 | mask = E1000_NVM_CFG_DONE_PORT_1; |
| 665 | |
| 666 | while (timeout) { |
| 667 | if (rd32(E1000_EEMNGCTL) & mask) |
| 668 | break; |
| 669 | msleep(1); |
| 670 | timeout--; |
| 671 | } |
| 672 | if (!timeout) |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 673 | hw_dbg("MNG configuration cycle has not completed.\n"); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 674 | |
| 675 | /* If EEPROM is not marked present, init the PHY manually */ |
| 676 | if (((rd32(E1000_EECD) & E1000_EECD_PRES) == 0) && |
| 677 | (hw->phy.type == e1000_phy_igp_3)) |
| 678 | igb_phy_init_script_igp3(hw); |
| 679 | |
| 680 | return ret_val; |
| 681 | } |
| 682 | |
| 683 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 684 | * igb_check_for_link_82575 - Check for link |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 685 | * @hw: pointer to the HW structure |
| 686 | * |
| 687 | * If sgmii is enabled, then use the pcs register to determine link, otherwise |
| 688 | * use the generic interface for determining link. |
| 689 | **/ |
| 690 | static s32 igb_check_for_link_82575(struct e1000_hw *hw) |
| 691 | { |
| 692 | s32 ret_val; |
| 693 | u16 speed, duplex; |
| 694 | |
| 695 | /* SGMII link check is done through the PCS register. */ |
| 696 | if ((hw->phy.media_type != e1000_media_type_copper) || |
Alexander Duyck | 5d0932a | 2009-01-31 00:53:18 -0800 | [diff] [blame] | 697 | (igb_sgmii_active_82575(hw))) { |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 698 | ret_val = igb_get_pcs_speed_and_duplex_82575(hw, &speed, |
Alexander Duyck | 2d064c0 | 2008-07-08 15:10:12 -0700 | [diff] [blame] | 699 | &duplex); |
Alexander Duyck | 5d0932a | 2009-01-31 00:53:18 -0800 | [diff] [blame] | 700 | /* |
| 701 | * Use this flag to determine if link needs to be checked or |
| 702 | * not. If we have link clear the flag so that we do not |
| 703 | * continue to check for link. |
| 704 | */ |
| 705 | hw->mac.get_link_status = !hw->mac.serdes_has_link; |
| 706 | } else { |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 707 | ret_val = igb_check_for_copper_link(hw); |
Alexander Duyck | 5d0932a | 2009-01-31 00:53:18 -0800 | [diff] [blame] | 708 | } |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 709 | |
| 710 | return ret_val; |
| 711 | } |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 712 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 713 | * igb_get_pcs_speed_and_duplex_82575 - Retrieve current speed/duplex |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 714 | * @hw: pointer to the HW structure |
| 715 | * @speed: stores the current speed |
| 716 | * @duplex: stores the current duplex |
| 717 | * |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 718 | * Using the physical coding sub-layer (PCS), retrieve the current speed and |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 719 | * duplex, then store the values in the pointers provided. |
| 720 | **/ |
| 721 | static s32 igb_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, u16 *speed, |
| 722 | u16 *duplex) |
| 723 | { |
| 724 | struct e1000_mac_info *mac = &hw->mac; |
| 725 | u32 pcs; |
| 726 | |
| 727 | /* Set up defaults for the return values of this function */ |
| 728 | mac->serdes_has_link = false; |
| 729 | *speed = 0; |
| 730 | *duplex = 0; |
| 731 | |
| 732 | /* |
| 733 | * Read the PCS Status register for link state. For non-copper mode, |
| 734 | * the status register is not accurate. The PCS status register is |
| 735 | * used instead. |
| 736 | */ |
| 737 | pcs = rd32(E1000_PCS_LSTAT); |
| 738 | |
| 739 | /* |
| 740 | * The link up bit determines when link is up on autoneg. The sync ok |
| 741 | * gets set once both sides sync up and agree upon link. Stable link |
| 742 | * can be determined by checking for both link up and link sync ok |
| 743 | */ |
| 744 | if ((pcs & E1000_PCS_LSTS_LINK_OK) && (pcs & E1000_PCS_LSTS_SYNK_OK)) { |
| 745 | mac->serdes_has_link = true; |
| 746 | |
| 747 | /* Detect and store PCS speed */ |
| 748 | if (pcs & E1000_PCS_LSTS_SPEED_1000) { |
| 749 | *speed = SPEED_1000; |
| 750 | } else if (pcs & E1000_PCS_LSTS_SPEED_100) { |
| 751 | *speed = SPEED_100; |
| 752 | } else { |
| 753 | *speed = SPEED_10; |
| 754 | } |
| 755 | |
| 756 | /* Detect and store PCS duplex */ |
| 757 | if (pcs & E1000_PCS_LSTS_DUPLEX_FULL) { |
| 758 | *duplex = FULL_DUPLEX; |
| 759 | } else { |
| 760 | *duplex = HALF_DUPLEX; |
| 761 | } |
| 762 | } |
| 763 | |
| 764 | return 0; |
| 765 | } |
| 766 | |
| 767 | /** |
Alexander Duyck | 2d064c0 | 2008-07-08 15:10:12 -0700 | [diff] [blame] | 768 | * igb_init_rx_addrs_82575 - Initialize receive address's |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 769 | * @hw: pointer to the HW structure |
Alexander Duyck | 2d064c0 | 2008-07-08 15:10:12 -0700 | [diff] [blame] | 770 | * @rar_count: receive address registers |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 771 | * |
Alexander Duyck | 2d064c0 | 2008-07-08 15:10:12 -0700 | [diff] [blame] | 772 | * Setups the receive address registers by setting the base receive address |
| 773 | * register to the devices MAC address and clearing all the other receive |
| 774 | * address registers to 0. |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 775 | **/ |
Alexander Duyck | 2d064c0 | 2008-07-08 15:10:12 -0700 | [diff] [blame] | 776 | static void igb_init_rx_addrs_82575(struct e1000_hw *hw, u16 rar_count) |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 777 | { |
Alexander Duyck | 2d064c0 | 2008-07-08 15:10:12 -0700 | [diff] [blame] | 778 | u32 i; |
| 779 | u8 addr[6] = {0,0,0,0,0,0}; |
| 780 | /* |
| 781 | * This function is essentially the same as that of |
| 782 | * e1000_init_rx_addrs_generic. However it also takes care |
| 783 | * of the special case where the register offset of the |
| 784 | * second set of RARs begins elsewhere. This is implicitly taken care by |
| 785 | * function e1000_rar_set_generic. |
| 786 | */ |
| 787 | |
| 788 | hw_dbg("e1000_init_rx_addrs_82575"); |
| 789 | |
| 790 | /* Setup the receive address */ |
| 791 | hw_dbg("Programming MAC Address into RAR[0]\n"); |
| 792 | hw->mac.ops.rar_set(hw, hw->mac.addr, 0); |
| 793 | |
| 794 | /* Zero out the other (rar_entry_count - 1) receive addresses */ |
| 795 | hw_dbg("Clearing RAR[1-%u]\n", rar_count-1); |
| 796 | for (i = 1; i < rar_count; i++) |
| 797 | hw->mac.ops.rar_set(hw, addr, i); |
| 798 | } |
| 799 | |
| 800 | /** |
Alexander Duyck | 8a90086 | 2009-02-06 23:20:10 +0000 | [diff] [blame] | 801 | * igb_update_mc_addr_list - Update Multicast addresses |
Alexander Duyck | 2d064c0 | 2008-07-08 15:10:12 -0700 | [diff] [blame] | 802 | * @hw: pointer to the HW structure |
| 803 | * @mc_addr_list: array of multicast addresses to program |
| 804 | * @mc_addr_count: number of multicast addresses to program |
| 805 | * @rar_used_count: the first RAR register free to program |
| 806 | * @rar_count: total number of supported Receive Address Registers |
| 807 | * |
| 808 | * Updates the Receive Address Registers and Multicast Table Array. |
| 809 | * The caller must have a packed mc_addr_list of multicast addresses. |
| 810 | * The parameter rar_count will usually be hw->mac.rar_entry_count |
| 811 | * unless there are workarounds that change this. |
| 812 | **/ |
Alexander Duyck | 8a90086 | 2009-02-06 23:20:10 +0000 | [diff] [blame] | 813 | void igb_update_mc_addr_list(struct e1000_hw *hw, |
| 814 | u8 *mc_addr_list, u32 mc_addr_count, |
| 815 | u32 rar_used_count, u32 rar_count) |
Alexander Duyck | 2d064c0 | 2008-07-08 15:10:12 -0700 | [diff] [blame] | 816 | { |
| 817 | u32 hash_value; |
| 818 | u32 i; |
| 819 | u8 addr[6] = {0,0,0,0,0,0}; |
| 820 | /* |
| 821 | * This function is essentially the same as that of |
| 822 | * igb_update_mc_addr_list_generic. However it also takes care |
| 823 | * of the special case where the register offset of the |
| 824 | * second set of RARs begins elsewhere. This is implicitly taken care by |
| 825 | * function e1000_rar_set_generic. |
| 826 | */ |
| 827 | |
| 828 | /* |
| 829 | * Load the first set of multicast addresses into the exact |
| 830 | * filters (RAR). If there are not enough to fill the RAR |
| 831 | * array, clear the filters. |
| 832 | */ |
| 833 | for (i = rar_used_count; i < rar_count; i++) { |
| 834 | if (mc_addr_count) { |
| 835 | igb_rar_set(hw, mc_addr_list, i); |
| 836 | mc_addr_count--; |
| 837 | mc_addr_list += ETH_ALEN; |
| 838 | } else { |
| 839 | igb_rar_set(hw, addr, i); |
| 840 | } |
| 841 | } |
| 842 | |
| 843 | /* Clear the old settings from the MTA */ |
| 844 | hw_dbg("Clearing MTA\n"); |
| 845 | for (i = 0; i < hw->mac.mta_reg_count; i++) { |
| 846 | array_wr32(E1000_MTA, i, 0); |
| 847 | wrfl(); |
| 848 | } |
| 849 | |
| 850 | /* Load any remaining multicast addresses into the hash table. */ |
| 851 | for (; mc_addr_count > 0; mc_addr_count--) { |
| 852 | hash_value = igb_hash_mc_addr(hw, mc_addr_list); |
| 853 | hw_dbg("Hash value = 0x%03X\n", hash_value); |
Alexander Duyck | 549bdd8 | 2008-08-04 15:00:06 -0700 | [diff] [blame] | 854 | igb_mta_set(hw, hash_value); |
Alexander Duyck | 2d064c0 | 2008-07-08 15:10:12 -0700 | [diff] [blame] | 855 | mc_addr_list += ETH_ALEN; |
| 856 | } |
| 857 | } |
| 858 | |
| 859 | /** |
| 860 | * igb_shutdown_fiber_serdes_link_82575 - Remove link during power down |
| 861 | * @hw: pointer to the HW structure |
| 862 | * |
| 863 | * In the case of fiber serdes, shut down optics and PCS on driver unload |
| 864 | * when management pass thru is not enabled. |
| 865 | **/ |
| 866 | void igb_shutdown_fiber_serdes_link_82575(struct e1000_hw *hw) |
| 867 | { |
| 868 | u32 reg; |
| 869 | |
Alexander Duyck | 099e1cb | 2009-07-23 18:07:40 +0000 | [diff] [blame] | 870 | if (hw->phy.media_type != e1000_media_type_internal_serdes) |
Alexander Duyck | 2d064c0 | 2008-07-08 15:10:12 -0700 | [diff] [blame] | 871 | return; |
| 872 | |
| 873 | /* if the management interface is not enabled, then power down */ |
| 874 | if (!igb_enable_mng_pass_thru(hw)) { |
| 875 | /* Disable PCS to turn off link */ |
| 876 | reg = rd32(E1000_PCS_CFG0); |
| 877 | reg &= ~E1000_PCS_CFG_PCS_EN; |
| 878 | wr32(E1000_PCS_CFG0, reg); |
| 879 | |
| 880 | /* shutdown the laser */ |
| 881 | reg = rd32(E1000_CTRL_EXT); |
| 882 | reg |= E1000_CTRL_EXT_SDP7_DATA; |
| 883 | wr32(E1000_CTRL_EXT, reg); |
| 884 | |
| 885 | /* flush the write to verify completion */ |
| 886 | wrfl(); |
| 887 | msleep(1); |
| 888 | } |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 889 | |
| 890 | return; |
| 891 | } |
| 892 | |
| 893 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 894 | * igb_reset_hw_82575 - Reset hardware |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 895 | * @hw: pointer to the HW structure |
| 896 | * |
| 897 | * This resets the hardware into a known state. This is a |
| 898 | * function pointer entry point called by the api module. |
| 899 | **/ |
| 900 | static s32 igb_reset_hw_82575(struct e1000_hw *hw) |
| 901 | { |
| 902 | u32 ctrl, icr; |
| 903 | s32 ret_val; |
| 904 | |
| 905 | /* |
| 906 | * Prevent the PCI-E bus from sticking if there is no TLP connection |
| 907 | * on the last TLP read/write transaction when MAC is reset. |
| 908 | */ |
| 909 | ret_val = igb_disable_pcie_master(hw); |
| 910 | if (ret_val) |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 911 | hw_dbg("PCI-E Master disable polling has failed.\n"); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 912 | |
Alexander Duyck | 009bc06 | 2009-07-23 18:08:35 +0000 | [diff] [blame^] | 913 | /* set the completion timeout for interface */ |
| 914 | ret_val = igb_set_pcie_completion_timeout(hw); |
| 915 | if (ret_val) { |
| 916 | hw_dbg("PCI-E Set completion timeout has failed.\n"); |
| 917 | } |
| 918 | |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 919 | hw_dbg("Masking off all interrupts\n"); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 920 | wr32(E1000_IMC, 0xffffffff); |
| 921 | |
| 922 | wr32(E1000_RCTL, 0); |
| 923 | wr32(E1000_TCTL, E1000_TCTL_PSP); |
| 924 | wrfl(); |
| 925 | |
| 926 | msleep(10); |
| 927 | |
| 928 | ctrl = rd32(E1000_CTRL); |
| 929 | |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 930 | hw_dbg("Issuing a global reset to MAC\n"); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 931 | wr32(E1000_CTRL, ctrl | E1000_CTRL_RST); |
| 932 | |
| 933 | ret_val = igb_get_auto_rd_done(hw); |
| 934 | if (ret_val) { |
| 935 | /* |
| 936 | * When auto config read does not complete, do not |
| 937 | * return with an error. This can happen in situations |
| 938 | * where there is no eeprom and prevents getting link. |
| 939 | */ |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 940 | hw_dbg("Auto Read Done did not complete\n"); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 941 | } |
| 942 | |
| 943 | /* If EEPROM is not present, run manual init scripts */ |
| 944 | if ((rd32(E1000_EECD) & E1000_EECD_PRES) == 0) |
| 945 | igb_reset_init_script_82575(hw); |
| 946 | |
| 947 | /* Clear any pending interrupt events. */ |
| 948 | wr32(E1000_IMC, 0xffffffff); |
| 949 | icr = rd32(E1000_ICR); |
| 950 | |
| 951 | igb_check_alt_mac_addr(hw); |
| 952 | |
| 953 | return ret_val; |
| 954 | } |
| 955 | |
| 956 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 957 | * igb_init_hw_82575 - Initialize hardware |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 958 | * @hw: pointer to the HW structure |
| 959 | * |
| 960 | * This inits the hardware readying it for operation. |
| 961 | **/ |
| 962 | static s32 igb_init_hw_82575(struct e1000_hw *hw) |
| 963 | { |
| 964 | struct e1000_mac_info *mac = &hw->mac; |
| 965 | s32 ret_val; |
| 966 | u16 i, rar_count = mac->rar_entry_count; |
| 967 | |
| 968 | /* Initialize identification LED */ |
| 969 | ret_val = igb_id_led_init(hw); |
| 970 | if (ret_val) { |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 971 | hw_dbg("Error initializing identification LED\n"); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 972 | /* This is not fatal and we should not stop init due to this */ |
| 973 | } |
| 974 | |
| 975 | /* Disabling VLAN filtering */ |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 976 | hw_dbg("Initializing the IEEE VLAN\n"); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 977 | igb_clear_vfta(hw); |
| 978 | |
| 979 | /* Setup the receive address */ |
Alexander Duyck | 2d064c0 | 2008-07-08 15:10:12 -0700 | [diff] [blame] | 980 | igb_init_rx_addrs_82575(hw, rar_count); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 981 | /* Zero out the Multicast HASH table */ |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 982 | hw_dbg("Zeroing the MTA\n"); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 983 | for (i = 0; i < mac->mta_reg_count; i++) |
| 984 | array_wr32(E1000_MTA, i, 0); |
| 985 | |
| 986 | /* Setup link and flow control */ |
| 987 | ret_val = igb_setup_link(hw); |
| 988 | |
| 989 | /* |
| 990 | * Clear all of the statistics registers (clear on read). It is |
| 991 | * important that we do this after we have tried to establish link |
| 992 | * because the symbol error count will increment wildly if there |
| 993 | * is no link. |
| 994 | */ |
| 995 | igb_clear_hw_cntrs_82575(hw); |
| 996 | |
| 997 | return ret_val; |
| 998 | } |
| 999 | |
| 1000 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 1001 | * igb_setup_copper_link_82575 - Configure copper link settings |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1002 | * @hw: pointer to the HW structure |
| 1003 | * |
| 1004 | * Configures the link for auto-neg or forced speed and duplex. Then we check |
| 1005 | * for link, once link is established calls to configure collision distance |
| 1006 | * and flow control are called. |
| 1007 | **/ |
| 1008 | static s32 igb_setup_copper_link_82575(struct e1000_hw *hw) |
| 1009 | { |
Alexander Duyck | 12645a1 | 2009-07-23 18:08:16 +0000 | [diff] [blame] | 1010 | u32 ctrl; |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1011 | s32 ret_val; |
| 1012 | bool link; |
| 1013 | |
| 1014 | ctrl = rd32(E1000_CTRL); |
| 1015 | ctrl |= E1000_CTRL_SLU; |
| 1016 | ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); |
| 1017 | wr32(E1000_CTRL, ctrl); |
| 1018 | |
| 1019 | switch (hw->phy.type) { |
| 1020 | case e1000_phy_m88: |
| 1021 | ret_val = igb_copper_link_setup_m88(hw); |
| 1022 | break; |
| 1023 | case e1000_phy_igp_3: |
| 1024 | ret_val = igb_copper_link_setup_igp(hw); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1025 | break; |
| 1026 | default: |
| 1027 | ret_val = -E1000_ERR_PHY; |
| 1028 | break; |
| 1029 | } |
| 1030 | |
| 1031 | if (ret_val) |
| 1032 | goto out; |
| 1033 | |
| 1034 | if (hw->mac.autoneg) { |
| 1035 | /* |
| 1036 | * Setup autoneg and flow control advertisement |
| 1037 | * and perform autonegotiation. |
| 1038 | */ |
| 1039 | ret_val = igb_copper_link_autoneg(hw); |
| 1040 | if (ret_val) |
| 1041 | goto out; |
| 1042 | } else { |
| 1043 | /* |
| 1044 | * PHY will be set to 10H, 10F, 100H or 100F |
| 1045 | * depending on user settings. |
| 1046 | */ |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 1047 | hw_dbg("Forcing Speed and Duplex\n"); |
Alexander Duyck | a8d2a0c | 2009-02-06 23:17:26 +0000 | [diff] [blame] | 1048 | ret_val = hw->phy.ops.force_speed_duplex(hw); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1049 | if (ret_val) { |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 1050 | hw_dbg("Error Forcing Speed and Duplex\n"); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1051 | goto out; |
| 1052 | } |
| 1053 | } |
| 1054 | |
Alexander Duyck | f3e7841 | 2009-07-23 18:07:58 +0000 | [diff] [blame] | 1055 | igb_configure_pcs_link_82575(hw); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1056 | |
| 1057 | /* |
| 1058 | * Check link status. Wait up to 100 microseconds for link to become |
| 1059 | * valid. |
| 1060 | */ |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 1061 | ret_val = igb_phy_has_link(hw, COPPER_LINK_UP_LIMIT, 10, &link); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1062 | if (ret_val) |
| 1063 | goto out; |
| 1064 | |
| 1065 | if (link) { |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 1066 | hw_dbg("Valid link established!!!\n"); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1067 | /* Config the MAC and PHY after link is up */ |
| 1068 | igb_config_collision_dist(hw); |
| 1069 | ret_val = igb_config_fc_after_link_up(hw); |
| 1070 | } else { |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 1071 | hw_dbg("Unable to establish link!!!\n"); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1072 | } |
| 1073 | |
| 1074 | out: |
| 1075 | return ret_val; |
| 1076 | } |
| 1077 | |
| 1078 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 1079 | * igb_setup_fiber_serdes_link_82575 - Setup link for fiber/serdes |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1080 | * @hw: pointer to the HW structure |
| 1081 | * |
| 1082 | * Configures speed and duplex for fiber and serdes links. |
| 1083 | **/ |
| 1084 | static s32 igb_setup_fiber_serdes_link_82575(struct e1000_hw *hw) |
| 1085 | { |
| 1086 | u32 reg; |
| 1087 | |
| 1088 | /* |
| 1089 | * On the 82575, SerDes loopback mode persists until it is |
| 1090 | * explicitly turned off or a power cycle is performed. A read to |
| 1091 | * the register does not indicate its status. Therefore, we ensure |
| 1092 | * loopback mode is disabled during initialization. |
| 1093 | */ |
| 1094 | wr32(E1000_SCTL, E1000_SCTL_DISABLE_SERDES_LOOPBACK); |
| 1095 | |
| 1096 | /* Force link up, set 1gb, set both sw defined pins */ |
| 1097 | reg = rd32(E1000_CTRL); |
| 1098 | reg |= E1000_CTRL_SLU | |
| 1099 | E1000_CTRL_SPD_1000 | |
| 1100 | E1000_CTRL_FRCSPD | |
| 1101 | E1000_CTRL_SWDPIN0 | |
| 1102 | E1000_CTRL_SWDPIN1; |
| 1103 | wr32(E1000_CTRL, reg); |
| 1104 | |
Alexander Duyck | 921aa74 | 2009-01-21 14:42:28 -0800 | [diff] [blame] | 1105 | /* Power on phy for 82576 fiber adapters */ |
| 1106 | if (hw->mac.type == e1000_82576) { |
| 1107 | reg = rd32(E1000_CTRL_EXT); |
| 1108 | reg &= ~E1000_CTRL_EXT_SDP7_DATA; |
| 1109 | wr32(E1000_CTRL_EXT, reg); |
| 1110 | } |
| 1111 | |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1112 | /* Set switch control to serdes energy detect */ |
| 1113 | reg = rd32(E1000_CONNSW); |
| 1114 | reg |= E1000_CONNSW_ENRGSRC; |
| 1115 | wr32(E1000_CONNSW, reg); |
| 1116 | |
| 1117 | /* |
| 1118 | * New SerDes mode allows for forcing speed or autonegotiating speed |
| 1119 | * at 1gb. Autoneg should be default set by most drivers. This is the |
| 1120 | * mode that will be compatible with older link partners and switches. |
| 1121 | * However, both are supported by the hardware and some drivers/tools. |
| 1122 | */ |
| 1123 | reg = rd32(E1000_PCS_LCTL); |
| 1124 | |
| 1125 | reg &= ~(E1000_PCS_LCTL_AN_ENABLE | E1000_PCS_LCTL_FLV_LINK_UP | |
| 1126 | E1000_PCS_LCTL_FSD | E1000_PCS_LCTL_FORCE_LINK); |
| 1127 | |
| 1128 | if (hw->mac.autoneg) { |
| 1129 | /* Set PCS register for autoneg */ |
| 1130 | reg |= E1000_PCS_LCTL_FSV_1000 | /* Force 1000 */ |
| 1131 | E1000_PCS_LCTL_FDV_FULL | /* SerDes Full duplex */ |
| 1132 | E1000_PCS_LCTL_AN_ENABLE | /* Enable Autoneg */ |
| 1133 | E1000_PCS_LCTL_AN_RESTART; /* Restart autoneg */ |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 1134 | hw_dbg("Configuring Autoneg; PCS_LCTL = 0x%08X\n", reg); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1135 | } else { |
| 1136 | /* Set PCS register for forced speed */ |
| 1137 | reg |= E1000_PCS_LCTL_FLV_LINK_UP | /* Force link up */ |
| 1138 | E1000_PCS_LCTL_FSV_1000 | /* Force 1000 */ |
| 1139 | E1000_PCS_LCTL_FDV_FULL | /* SerDes Full duplex */ |
| 1140 | E1000_PCS_LCTL_FSD | /* Force Speed */ |
| 1141 | E1000_PCS_LCTL_FORCE_LINK; /* Force Link */ |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 1142 | hw_dbg("Configuring Forced Link; PCS_LCTL = 0x%08X\n", reg); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1143 | } |
Alexander Duyck | 726c09e | 2008-08-04 14:59:56 -0700 | [diff] [blame] | 1144 | |
| 1145 | if (hw->mac.type == e1000_82576) { |
| 1146 | reg |= E1000_PCS_LCTL_FORCE_FCTRL; |
| 1147 | igb_force_mac_fc(hw); |
| 1148 | } |
| 1149 | |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1150 | wr32(E1000_PCS_LCTL, reg); |
| 1151 | |
| 1152 | return 0; |
| 1153 | } |
| 1154 | |
| 1155 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 1156 | * igb_configure_pcs_link_82575 - Configure PCS link |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1157 | * @hw: pointer to the HW structure |
| 1158 | * |
| 1159 | * Configure the physical coding sub-layer (PCS) link. The PCS link is |
| 1160 | * only used on copper connections where the serialized gigabit media |
| 1161 | * independent interface (sgmii) is being used. Configures the link |
| 1162 | * for auto-negotiation or forces speed/duplex. |
| 1163 | **/ |
Alexander Duyck | f3e7841 | 2009-07-23 18:07:58 +0000 | [diff] [blame] | 1164 | static void igb_configure_pcs_link_82575(struct e1000_hw *hw) |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1165 | { |
| 1166 | struct e1000_mac_info *mac = &hw->mac; |
| 1167 | u32 reg = 0; |
| 1168 | |
| 1169 | if (hw->phy.media_type != e1000_media_type_copper || |
| 1170 | !(igb_sgmii_active_82575(hw))) |
Alexander Duyck | f3e7841 | 2009-07-23 18:07:58 +0000 | [diff] [blame] | 1171 | return; |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1172 | |
| 1173 | /* For SGMII, we need to issue a PCS autoneg restart */ |
| 1174 | reg = rd32(E1000_PCS_LCTL); |
| 1175 | |
| 1176 | /* AN time out should be disabled for SGMII mode */ |
| 1177 | reg &= ~(E1000_PCS_LCTL_AN_TIMEOUT); |
| 1178 | |
| 1179 | if (mac->autoneg) { |
| 1180 | /* Make sure forced speed and force link are not set */ |
| 1181 | reg &= ~(E1000_PCS_LCTL_FSD | E1000_PCS_LCTL_FORCE_LINK); |
| 1182 | |
| 1183 | /* |
| 1184 | * The PHY should be setup prior to calling this function. |
| 1185 | * All we need to do is restart autoneg and enable autoneg. |
| 1186 | */ |
| 1187 | reg |= E1000_PCS_LCTL_AN_RESTART | E1000_PCS_LCTL_AN_ENABLE; |
| 1188 | } else { |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 1189 | /* Set PCS register for forced speed */ |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1190 | |
| 1191 | /* Turn off bits for full duplex, speed, and autoneg */ |
| 1192 | reg &= ~(E1000_PCS_LCTL_FSV_1000 | |
| 1193 | E1000_PCS_LCTL_FSV_100 | |
| 1194 | E1000_PCS_LCTL_FDV_FULL | |
| 1195 | E1000_PCS_LCTL_AN_ENABLE); |
| 1196 | |
| 1197 | /* Check for duplex first */ |
| 1198 | if (mac->forced_speed_duplex & E1000_ALL_FULL_DUPLEX) |
| 1199 | reg |= E1000_PCS_LCTL_FDV_FULL; |
| 1200 | |
| 1201 | /* Now set speed */ |
| 1202 | if (mac->forced_speed_duplex & E1000_ALL_100_SPEED) |
| 1203 | reg |= E1000_PCS_LCTL_FSV_100; |
| 1204 | |
| 1205 | /* Force speed and force link */ |
| 1206 | reg |= E1000_PCS_LCTL_FSD | |
| 1207 | E1000_PCS_LCTL_FORCE_LINK | |
| 1208 | E1000_PCS_LCTL_FLV_LINK_UP; |
| 1209 | |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 1210 | hw_dbg("Wrote 0x%08X to PCS_LCTL to configure forced link\n", |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1211 | reg); |
| 1212 | } |
| 1213 | wr32(E1000_PCS_LCTL, reg); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1214 | } |
| 1215 | |
| 1216 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 1217 | * igb_sgmii_active_82575 - Return sgmii state |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1218 | * @hw: pointer to the HW structure |
| 1219 | * |
| 1220 | * 82575 silicon has a serialized gigabit media independent interface (sgmii) |
| 1221 | * which can be enabled for use in the embedded applications. Simply |
| 1222 | * return the current state of the sgmii interface. |
| 1223 | **/ |
| 1224 | static bool igb_sgmii_active_82575(struct e1000_hw *hw) |
| 1225 | { |
Alexander Duyck | c1889bf | 2009-02-06 23:16:45 +0000 | [diff] [blame] | 1226 | struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575; |
Alexander Duyck | c1889bf | 2009-02-06 23:16:45 +0000 | [diff] [blame] | 1227 | return dev_spec->sgmii_active; |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1228 | } |
| 1229 | |
| 1230 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 1231 | * igb_reset_init_script_82575 - Inits HW defaults after reset |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1232 | * @hw: pointer to the HW structure |
| 1233 | * |
| 1234 | * Inits recommended HW defaults after a reset when there is no EEPROM |
| 1235 | * detected. This is only for the 82575. |
| 1236 | **/ |
| 1237 | static s32 igb_reset_init_script_82575(struct e1000_hw *hw) |
| 1238 | { |
| 1239 | if (hw->mac.type == e1000_82575) { |
Auke Kok | 652fff3 | 2008-06-27 11:00:18 -0700 | [diff] [blame] | 1240 | hw_dbg("Running reset init script for 82575\n"); |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1241 | /* SerDes configuration via SERDESCTRL */ |
| 1242 | igb_write_8bit_ctrl_reg(hw, E1000_SCTL, 0x00, 0x0C); |
| 1243 | igb_write_8bit_ctrl_reg(hw, E1000_SCTL, 0x01, 0x78); |
| 1244 | igb_write_8bit_ctrl_reg(hw, E1000_SCTL, 0x1B, 0x23); |
| 1245 | igb_write_8bit_ctrl_reg(hw, E1000_SCTL, 0x23, 0x15); |
| 1246 | |
| 1247 | /* CCM configuration via CCMCTL register */ |
| 1248 | igb_write_8bit_ctrl_reg(hw, E1000_CCMCTL, 0x14, 0x00); |
| 1249 | igb_write_8bit_ctrl_reg(hw, E1000_CCMCTL, 0x10, 0x00); |
| 1250 | |
| 1251 | /* PCIe lanes configuration */ |
| 1252 | igb_write_8bit_ctrl_reg(hw, E1000_GIOCTL, 0x00, 0xEC); |
| 1253 | igb_write_8bit_ctrl_reg(hw, E1000_GIOCTL, 0x61, 0xDF); |
| 1254 | igb_write_8bit_ctrl_reg(hw, E1000_GIOCTL, 0x34, 0x05); |
| 1255 | igb_write_8bit_ctrl_reg(hw, E1000_GIOCTL, 0x2F, 0x81); |
| 1256 | |
| 1257 | /* PCIe PLL Configuration */ |
| 1258 | igb_write_8bit_ctrl_reg(hw, E1000_SCCTL, 0x02, 0x47); |
| 1259 | igb_write_8bit_ctrl_reg(hw, E1000_SCCTL, 0x14, 0x00); |
| 1260 | igb_write_8bit_ctrl_reg(hw, E1000_SCCTL, 0x10, 0x00); |
| 1261 | } |
| 1262 | |
| 1263 | return 0; |
| 1264 | } |
| 1265 | |
| 1266 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 1267 | * igb_read_mac_addr_82575 - Read device MAC address |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1268 | * @hw: pointer to the HW structure |
| 1269 | **/ |
| 1270 | static s32 igb_read_mac_addr_82575(struct e1000_hw *hw) |
| 1271 | { |
| 1272 | s32 ret_val = 0; |
| 1273 | |
| 1274 | if (igb_check_alt_mac_addr(hw)) |
| 1275 | ret_val = igb_read_mac_addr(hw); |
| 1276 | |
| 1277 | return ret_val; |
| 1278 | } |
| 1279 | |
| 1280 | /** |
Jeff Kirsher | 733596b | 2008-06-27 10:59:59 -0700 | [diff] [blame] | 1281 | * igb_clear_hw_cntrs_82575 - Clear device specific hardware counters |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1282 | * @hw: pointer to the HW structure |
| 1283 | * |
| 1284 | * Clears the hardware counters by reading the counter registers. |
| 1285 | **/ |
| 1286 | static void igb_clear_hw_cntrs_82575(struct e1000_hw *hw) |
| 1287 | { |
| 1288 | u32 temp; |
| 1289 | |
| 1290 | igb_clear_hw_cntrs_base(hw); |
| 1291 | |
| 1292 | temp = rd32(E1000_PRC64); |
| 1293 | temp = rd32(E1000_PRC127); |
| 1294 | temp = rd32(E1000_PRC255); |
| 1295 | temp = rd32(E1000_PRC511); |
| 1296 | temp = rd32(E1000_PRC1023); |
| 1297 | temp = rd32(E1000_PRC1522); |
| 1298 | temp = rd32(E1000_PTC64); |
| 1299 | temp = rd32(E1000_PTC127); |
| 1300 | temp = rd32(E1000_PTC255); |
| 1301 | temp = rd32(E1000_PTC511); |
| 1302 | temp = rd32(E1000_PTC1023); |
| 1303 | temp = rd32(E1000_PTC1522); |
| 1304 | |
| 1305 | temp = rd32(E1000_ALGNERRC); |
| 1306 | temp = rd32(E1000_RXERRC); |
| 1307 | temp = rd32(E1000_TNCRS); |
| 1308 | temp = rd32(E1000_CEXTERR); |
| 1309 | temp = rd32(E1000_TSCTC); |
| 1310 | temp = rd32(E1000_TSCTFC); |
| 1311 | |
| 1312 | temp = rd32(E1000_MGTPRC); |
| 1313 | temp = rd32(E1000_MGTPDC); |
| 1314 | temp = rd32(E1000_MGTPTC); |
| 1315 | |
| 1316 | temp = rd32(E1000_IAC); |
| 1317 | temp = rd32(E1000_ICRXOC); |
| 1318 | |
| 1319 | temp = rd32(E1000_ICRXPTC); |
| 1320 | temp = rd32(E1000_ICRXATC); |
| 1321 | temp = rd32(E1000_ICTXPTC); |
| 1322 | temp = rd32(E1000_ICTXATC); |
| 1323 | temp = rd32(E1000_ICTXQEC); |
| 1324 | temp = rd32(E1000_ICTXQMTC); |
| 1325 | temp = rd32(E1000_ICRXDMTC); |
| 1326 | |
| 1327 | temp = rd32(E1000_CBTMPC); |
| 1328 | temp = rd32(E1000_HTDPMC); |
| 1329 | temp = rd32(E1000_CBRMPC); |
| 1330 | temp = rd32(E1000_RPTHC); |
| 1331 | temp = rd32(E1000_HGPTC); |
| 1332 | temp = rd32(E1000_HTCBDPC); |
| 1333 | temp = rd32(E1000_HGORCL); |
| 1334 | temp = rd32(E1000_HGORCH); |
| 1335 | temp = rd32(E1000_HGOTCL); |
| 1336 | temp = rd32(E1000_HGOTCH); |
| 1337 | temp = rd32(E1000_LENERRS); |
| 1338 | |
| 1339 | /* This register should not be read in copper configurations */ |
| 1340 | if (hw->phy.media_type == e1000_media_type_internal_serdes) |
| 1341 | temp = rd32(E1000_SCVPC); |
| 1342 | } |
| 1343 | |
Alexander Duyck | 662d720 | 2008-06-27 11:00:29 -0700 | [diff] [blame] | 1344 | /** |
| 1345 | * igb_rx_fifo_flush_82575 - Clean rx fifo after RX enable |
| 1346 | * @hw: pointer to the HW structure |
| 1347 | * |
| 1348 | * After rx enable if managability is enabled then there is likely some |
| 1349 | * bad data at the start of the fifo and possibly in the DMA fifo. This |
| 1350 | * function clears the fifos and flushes any packets that came in as rx was |
| 1351 | * being enabled. |
| 1352 | **/ |
| 1353 | void igb_rx_fifo_flush_82575(struct e1000_hw *hw) |
| 1354 | { |
| 1355 | u32 rctl, rlpml, rxdctl[4], rfctl, temp_rctl, rx_enabled; |
| 1356 | int i, ms_wait; |
| 1357 | |
| 1358 | if (hw->mac.type != e1000_82575 || |
| 1359 | !(rd32(E1000_MANC) & E1000_MANC_RCV_TCO_EN)) |
| 1360 | return; |
| 1361 | |
| 1362 | /* Disable all RX queues */ |
| 1363 | for (i = 0; i < 4; i++) { |
| 1364 | rxdctl[i] = rd32(E1000_RXDCTL(i)); |
| 1365 | wr32(E1000_RXDCTL(i), |
| 1366 | rxdctl[i] & ~E1000_RXDCTL_QUEUE_ENABLE); |
| 1367 | } |
| 1368 | /* Poll all queues to verify they have shut down */ |
| 1369 | for (ms_wait = 0; ms_wait < 10; ms_wait++) { |
| 1370 | msleep(1); |
| 1371 | rx_enabled = 0; |
| 1372 | for (i = 0; i < 4; i++) |
| 1373 | rx_enabled |= rd32(E1000_RXDCTL(i)); |
| 1374 | if (!(rx_enabled & E1000_RXDCTL_QUEUE_ENABLE)) |
| 1375 | break; |
| 1376 | } |
| 1377 | |
| 1378 | if (ms_wait == 10) |
| 1379 | hw_dbg("Queue disable timed out after 10ms\n"); |
| 1380 | |
| 1381 | /* Clear RLPML, RCTL.SBP, RFCTL.LEF, and set RCTL.LPE so that all |
| 1382 | * incoming packets are rejected. Set enable and wait 2ms so that |
| 1383 | * any packet that was coming in as RCTL.EN was set is flushed |
| 1384 | */ |
| 1385 | rfctl = rd32(E1000_RFCTL); |
| 1386 | wr32(E1000_RFCTL, rfctl & ~E1000_RFCTL_LEF); |
| 1387 | |
| 1388 | rlpml = rd32(E1000_RLPML); |
| 1389 | wr32(E1000_RLPML, 0); |
| 1390 | |
| 1391 | rctl = rd32(E1000_RCTL); |
| 1392 | temp_rctl = rctl & ~(E1000_RCTL_EN | E1000_RCTL_SBP); |
| 1393 | temp_rctl |= E1000_RCTL_LPE; |
| 1394 | |
| 1395 | wr32(E1000_RCTL, temp_rctl); |
| 1396 | wr32(E1000_RCTL, temp_rctl | E1000_RCTL_EN); |
| 1397 | wrfl(); |
| 1398 | msleep(2); |
| 1399 | |
| 1400 | /* Enable RX queues that were previously enabled and restore our |
| 1401 | * previous state |
| 1402 | */ |
| 1403 | for (i = 0; i < 4; i++) |
| 1404 | wr32(E1000_RXDCTL(i), rxdctl[i]); |
| 1405 | wr32(E1000_RCTL, rctl); |
| 1406 | wrfl(); |
| 1407 | |
| 1408 | wr32(E1000_RLPML, rlpml); |
| 1409 | wr32(E1000_RFCTL, rfctl); |
| 1410 | |
| 1411 | /* Flush receive errors generated by workaround */ |
| 1412 | rd32(E1000_ROC); |
| 1413 | rd32(E1000_RNBC); |
| 1414 | rd32(E1000_MPC); |
| 1415 | } |
| 1416 | |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 1417 | /** |
Alexander Duyck | 009bc06 | 2009-07-23 18:08:35 +0000 | [diff] [blame^] | 1418 | * igb_set_pcie_completion_timeout - set pci-e completion timeout |
| 1419 | * @hw: pointer to the HW structure |
| 1420 | * |
| 1421 | * The defaults for 82575 and 82576 should be in the range of 50us to 50ms, |
| 1422 | * however the hardware default for these parts is 500us to 1ms which is less |
| 1423 | * than the 10ms recommended by the pci-e spec. To address this we need to |
| 1424 | * increase the value to either 10ms to 200ms for capability version 1 config, |
| 1425 | * or 16ms to 55ms for version 2. |
| 1426 | **/ |
| 1427 | static s32 igb_set_pcie_completion_timeout(struct e1000_hw *hw) |
| 1428 | { |
| 1429 | u32 gcr = rd32(E1000_GCR); |
| 1430 | s32 ret_val = 0; |
| 1431 | u16 pcie_devctl2; |
| 1432 | |
| 1433 | /* only take action if timeout value is defaulted to 0 */ |
| 1434 | if (gcr & E1000_GCR_CMPL_TMOUT_MASK) |
| 1435 | goto out; |
| 1436 | |
| 1437 | /* |
| 1438 | * if capababilities version is type 1 we can write the |
| 1439 | * timeout of 10ms to 200ms through the GCR register |
| 1440 | */ |
| 1441 | if (!(gcr & E1000_GCR_CAP_VER2)) { |
| 1442 | gcr |= E1000_GCR_CMPL_TMOUT_10ms; |
| 1443 | goto out; |
| 1444 | } |
| 1445 | |
| 1446 | /* |
| 1447 | * for version 2 capabilities we need to write the config space |
| 1448 | * directly in order to set the completion timeout value for |
| 1449 | * 16ms to 55ms |
| 1450 | */ |
| 1451 | ret_val = igb_read_pcie_cap_reg(hw, PCIE_DEVICE_CONTROL2, |
| 1452 | &pcie_devctl2); |
| 1453 | if (ret_val) |
| 1454 | goto out; |
| 1455 | |
| 1456 | pcie_devctl2 |= PCIE_DEVICE_CONTROL2_16ms; |
| 1457 | |
| 1458 | ret_val = igb_write_pcie_cap_reg(hw, PCIE_DEVICE_CONTROL2, |
| 1459 | &pcie_devctl2); |
| 1460 | out: |
| 1461 | /* disable completion timeout resend */ |
| 1462 | gcr &= ~E1000_GCR_CMPL_TMOUT_RESEND; |
| 1463 | |
| 1464 | wr32(E1000_GCR, gcr); |
| 1465 | return ret_val; |
| 1466 | } |
| 1467 | |
| 1468 | /** |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 1469 | * igb_vmdq_set_loopback_pf - enable or disable vmdq loopback |
| 1470 | * @hw: pointer to the hardware struct |
| 1471 | * @enable: state to enter, either enabled or disabled |
| 1472 | * |
| 1473 | * enables/disables L2 switch loopback functionality. |
| 1474 | **/ |
| 1475 | void igb_vmdq_set_loopback_pf(struct e1000_hw *hw, bool enable) |
| 1476 | { |
| 1477 | u32 dtxswc = rd32(E1000_DTXSWC); |
| 1478 | |
| 1479 | if (enable) |
| 1480 | dtxswc |= E1000_DTXSWC_VMDQ_LOOPBACK_EN; |
| 1481 | else |
| 1482 | dtxswc &= ~E1000_DTXSWC_VMDQ_LOOPBACK_EN; |
| 1483 | |
| 1484 | wr32(E1000_DTXSWC, dtxswc); |
| 1485 | } |
| 1486 | |
| 1487 | /** |
| 1488 | * igb_vmdq_set_replication_pf - enable or disable vmdq replication |
| 1489 | * @hw: pointer to the hardware struct |
| 1490 | * @enable: state to enter, either enabled or disabled |
| 1491 | * |
| 1492 | * enables/disables replication of packets across multiple pools. |
| 1493 | **/ |
| 1494 | void igb_vmdq_set_replication_pf(struct e1000_hw *hw, bool enable) |
| 1495 | { |
| 1496 | u32 vt_ctl = rd32(E1000_VT_CTL); |
| 1497 | |
| 1498 | if (enable) |
| 1499 | vt_ctl |= E1000_VT_CTL_VM_REPL_EN; |
| 1500 | else |
| 1501 | vt_ctl &= ~E1000_VT_CTL_VM_REPL_EN; |
| 1502 | |
| 1503 | wr32(E1000_VT_CTL, vt_ctl); |
| 1504 | } |
| 1505 | |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1506 | static struct e1000_mac_operations e1000_mac_ops_82575 = { |
| 1507 | .reset_hw = igb_reset_hw_82575, |
| 1508 | .init_hw = igb_init_hw_82575, |
| 1509 | .check_for_link = igb_check_for_link_82575, |
Alexander Duyck | 2d064c0 | 2008-07-08 15:10:12 -0700 | [diff] [blame] | 1510 | .rar_set = igb_rar_set, |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1511 | .read_mac_addr = igb_read_mac_addr_82575, |
| 1512 | .get_speed_and_duplex = igb_get_speed_and_duplex_copper, |
| 1513 | }; |
| 1514 | |
| 1515 | static struct e1000_phy_operations e1000_phy_ops_82575 = { |
Alexander Duyck | a8d2a0c | 2009-02-06 23:17:26 +0000 | [diff] [blame] | 1516 | .acquire = igb_acquire_phy_82575, |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1517 | .get_cfg_done = igb_get_cfg_done_82575, |
Alexander Duyck | a8d2a0c | 2009-02-06 23:17:26 +0000 | [diff] [blame] | 1518 | .release = igb_release_phy_82575, |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1519 | }; |
| 1520 | |
| 1521 | static struct e1000_nvm_operations e1000_nvm_ops_82575 = { |
Alexander Duyck | 312c75a | 2009-02-06 23:17:47 +0000 | [diff] [blame] | 1522 | .acquire = igb_acquire_nvm_82575, |
| 1523 | .read = igb_read_nvm_eerd, |
| 1524 | .release = igb_release_nvm_82575, |
| 1525 | .write = igb_write_nvm_spi, |
Auke Kok | 9d5c824 | 2008-01-24 02:22:38 -0800 | [diff] [blame] | 1526 | }; |
| 1527 | |
| 1528 | const struct e1000_info e1000_82575_info = { |
| 1529 | .get_invariants = igb_get_invariants_82575, |
| 1530 | .mac_ops = &e1000_mac_ops_82575, |
| 1531 | .phy_ops = &e1000_phy_ops_82575, |
| 1532 | .nvm_ops = &e1000_nvm_ops_82575, |
| 1533 | }; |
| 1534 | |