Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | |
| 3 | Intel PRO/1000 Linux driver |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 4 | Copyright(c) 1999 - 2008 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 | * 82562G-2 10/100 Network Connection |
| 31 | * 82562GT 10/100 Network Connection |
| 32 | * 82562GT-2 10/100 Network Connection |
| 33 | * 82562V 10/100 Network Connection |
| 34 | * 82562V-2 10/100 Network Connection |
| 35 | * 82566DC-2 Gigabit Network Connection |
| 36 | * 82566DC Gigabit Network Connection |
| 37 | * 82566DM-2 Gigabit Network Connection |
| 38 | * 82566DM Gigabit Network Connection |
| 39 | * 82566MC Gigabit Network Connection |
| 40 | * 82566MM Gigabit Network Connection |
Bruce Allan | 97ac8ca | 2008-04-29 09:16:05 -0700 | [diff] [blame] | 41 | * 82567LM Gigabit Network Connection |
| 42 | * 82567LF Gigabit Network Connection |
| 43 | * 82567LM-2 Gigabit Network Connection |
| 44 | * 82567LF-2 Gigabit Network Connection |
| 45 | * 82567V-2 Gigabit Network Connection |
Bruce Allan | f4187b5 | 2008-08-26 18:36:50 -0700 | [diff] [blame] | 46 | * 82567LF-3 Gigabit Network Connection |
| 47 | * 82567LM-3 Gigabit Network Connection |
Bruce Allan | 2f15f9d | 2008-08-26 18:36:36 -0700 | [diff] [blame] | 48 | * 82567LM-4 Gigabit Network Connection |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 49 | */ |
| 50 | |
| 51 | #include <linux/netdevice.h> |
| 52 | #include <linux/ethtool.h> |
| 53 | #include <linux/delay.h> |
| 54 | #include <linux/pci.h> |
| 55 | |
| 56 | #include "e1000.h" |
| 57 | |
| 58 | #define ICH_FLASH_GFPREG 0x0000 |
| 59 | #define ICH_FLASH_HSFSTS 0x0004 |
| 60 | #define ICH_FLASH_HSFCTL 0x0006 |
| 61 | #define ICH_FLASH_FADDR 0x0008 |
| 62 | #define ICH_FLASH_FDATA0 0x0010 |
| 63 | |
| 64 | #define ICH_FLASH_READ_COMMAND_TIMEOUT 500 |
| 65 | #define ICH_FLASH_WRITE_COMMAND_TIMEOUT 500 |
| 66 | #define ICH_FLASH_ERASE_COMMAND_TIMEOUT 3000000 |
| 67 | #define ICH_FLASH_LINEAR_ADDR_MASK 0x00FFFFFF |
| 68 | #define ICH_FLASH_CYCLE_REPEAT_COUNT 10 |
| 69 | |
| 70 | #define ICH_CYCLE_READ 0 |
| 71 | #define ICH_CYCLE_WRITE 2 |
| 72 | #define ICH_CYCLE_ERASE 3 |
| 73 | |
| 74 | #define FLASH_GFPREG_BASE_MASK 0x1FFF |
| 75 | #define FLASH_SECTOR_ADDR_SHIFT 12 |
| 76 | |
| 77 | #define ICH_FLASH_SEG_SIZE_256 256 |
| 78 | #define ICH_FLASH_SEG_SIZE_4K 4096 |
| 79 | #define ICH_FLASH_SEG_SIZE_8K 8192 |
| 80 | #define ICH_FLASH_SEG_SIZE_64K 65536 |
| 81 | |
| 82 | |
| 83 | #define E1000_ICH_FWSM_RSPCIPHY 0x00000040 /* Reset PHY on PCI Reset */ |
| 84 | |
| 85 | #define E1000_ICH_MNG_IAMT_MODE 0x2 |
| 86 | |
| 87 | #define ID_LED_DEFAULT_ICH8LAN ((ID_LED_DEF1_DEF2 << 12) | \ |
| 88 | (ID_LED_DEF1_OFF2 << 8) | \ |
| 89 | (ID_LED_DEF1_ON2 << 4) | \ |
| 90 | (ID_LED_DEF1_DEF2)) |
| 91 | |
| 92 | #define E1000_ICH_NVM_SIG_WORD 0x13 |
| 93 | #define E1000_ICH_NVM_SIG_MASK 0xC000 |
| 94 | |
| 95 | #define E1000_ICH8_LAN_INIT_TIMEOUT 1500 |
| 96 | |
| 97 | #define E1000_FEXTNVM_SW_CONFIG 1 |
| 98 | #define E1000_FEXTNVM_SW_CONFIG_ICH8M (1 << 27) /* Bit redefined for ICH8M :/ */ |
| 99 | |
| 100 | #define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL |
| 101 | |
| 102 | #define E1000_ICH_RAR_ENTRIES 7 |
| 103 | |
| 104 | #define PHY_PAGE_SHIFT 5 |
| 105 | #define PHY_REG(page, reg) (((page) << PHY_PAGE_SHIFT) | \ |
| 106 | ((reg) & MAX_PHY_REG_ADDRESS)) |
| 107 | #define IGP3_KMRN_DIAG PHY_REG(770, 19) /* KMRN Diagnostic */ |
| 108 | #define IGP3_VR_CTRL PHY_REG(776, 18) /* Voltage Regulator Control */ |
| 109 | |
| 110 | #define IGP3_KMRN_DIAG_PCS_LOCK_LOSS 0x0002 |
| 111 | #define IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK 0x0300 |
| 112 | #define IGP3_VR_CTRL_MODE_SHUTDOWN 0x0200 |
| 113 | |
| 114 | /* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */ |
| 115 | /* Offset 04h HSFSTS */ |
| 116 | union ich8_hws_flash_status { |
| 117 | struct ich8_hsfsts { |
| 118 | u16 flcdone :1; /* bit 0 Flash Cycle Done */ |
| 119 | u16 flcerr :1; /* bit 1 Flash Cycle Error */ |
| 120 | u16 dael :1; /* bit 2 Direct Access error Log */ |
| 121 | u16 berasesz :2; /* bit 4:3 Sector Erase Size */ |
| 122 | u16 flcinprog :1; /* bit 5 flash cycle in Progress */ |
| 123 | u16 reserved1 :2; /* bit 13:6 Reserved */ |
| 124 | u16 reserved2 :6; /* bit 13:6 Reserved */ |
| 125 | u16 fldesvalid :1; /* bit 14 Flash Descriptor Valid */ |
| 126 | u16 flockdn :1; /* bit 15 Flash Config Lock-Down */ |
| 127 | } hsf_status; |
| 128 | u16 regval; |
| 129 | }; |
| 130 | |
| 131 | /* ICH GbE Flash Hardware Sequencing Flash control Register bit breakdown */ |
| 132 | /* Offset 06h FLCTL */ |
| 133 | union ich8_hws_flash_ctrl { |
| 134 | struct ich8_hsflctl { |
| 135 | u16 flcgo :1; /* 0 Flash Cycle Go */ |
| 136 | u16 flcycle :2; /* 2:1 Flash Cycle */ |
| 137 | u16 reserved :5; /* 7:3 Reserved */ |
| 138 | u16 fldbcount :2; /* 9:8 Flash Data Byte Count */ |
| 139 | u16 flockdn :6; /* 15:10 Reserved */ |
| 140 | } hsf_ctrl; |
| 141 | u16 regval; |
| 142 | }; |
| 143 | |
| 144 | /* ICH Flash Region Access Permissions */ |
| 145 | union ich8_hws_flash_regacc { |
| 146 | struct ich8_flracc { |
| 147 | u32 grra :8; /* 0:7 GbE region Read Access */ |
| 148 | u32 grwa :8; /* 8:15 GbE region Write Access */ |
| 149 | u32 gmrag :8; /* 23:16 GbE Master Read Access Grant */ |
| 150 | u32 gmwag :8; /* 31:24 GbE Master Write Access Grant */ |
| 151 | } hsf_flregacc; |
| 152 | u16 regval; |
| 153 | }; |
| 154 | |
| 155 | static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw); |
| 156 | static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw); |
| 157 | static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw); |
| 158 | static s32 e1000_check_polarity_ife_ich8lan(struct e1000_hw *hw); |
| 159 | static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank); |
| 160 | static s32 e1000_retry_write_flash_byte_ich8lan(struct e1000_hw *hw, |
| 161 | u32 offset, u8 byte); |
Bruce Allan | f4187b5 | 2008-08-26 18:36:50 -0700 | [diff] [blame] | 162 | static s32 e1000_read_flash_byte_ich8lan(struct e1000_hw *hw, u32 offset, |
| 163 | u8 *data); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 164 | static s32 e1000_read_flash_word_ich8lan(struct e1000_hw *hw, u32 offset, |
| 165 | u16 *data); |
| 166 | static s32 e1000_read_flash_data_ich8lan(struct e1000_hw *hw, u32 offset, |
| 167 | u8 size, u16 *data); |
| 168 | static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw); |
| 169 | static s32 e1000_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw); |
Bruce Allan | f4187b5 | 2008-08-26 18:36:50 -0700 | [diff] [blame] | 170 | static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 171 | |
| 172 | static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg) |
| 173 | { |
| 174 | return readw(hw->flash_address + reg); |
| 175 | } |
| 176 | |
| 177 | static inline u32 __er32flash(struct e1000_hw *hw, unsigned long reg) |
| 178 | { |
| 179 | return readl(hw->flash_address + reg); |
| 180 | } |
| 181 | |
| 182 | static inline void __ew16flash(struct e1000_hw *hw, unsigned long reg, u16 val) |
| 183 | { |
| 184 | writew(val, hw->flash_address + reg); |
| 185 | } |
| 186 | |
| 187 | static inline void __ew32flash(struct e1000_hw *hw, unsigned long reg, u32 val) |
| 188 | { |
| 189 | writel(val, hw->flash_address + reg); |
| 190 | } |
| 191 | |
| 192 | #define er16flash(reg) __er16flash(hw, (reg)) |
| 193 | #define er32flash(reg) __er32flash(hw, (reg)) |
| 194 | #define ew16flash(reg,val) __ew16flash(hw, (reg), (val)) |
| 195 | #define ew32flash(reg,val) __ew32flash(hw, (reg), (val)) |
| 196 | |
| 197 | /** |
| 198 | * e1000_init_phy_params_ich8lan - Initialize PHY function pointers |
| 199 | * @hw: pointer to the HW structure |
| 200 | * |
| 201 | * Initialize family-specific PHY parameters and function pointers. |
| 202 | **/ |
| 203 | static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw) |
| 204 | { |
| 205 | struct e1000_phy_info *phy = &hw->phy; |
| 206 | s32 ret_val; |
| 207 | u16 i = 0; |
| 208 | |
| 209 | phy->addr = 1; |
| 210 | phy->reset_delay_us = 100; |
| 211 | |
Bruce Allan | 97ac8ca | 2008-04-29 09:16:05 -0700 | [diff] [blame] | 212 | /* |
| 213 | * We may need to do this twice - once for IGP and if that fails, |
| 214 | * we'll set BM func pointers and try again |
| 215 | */ |
| 216 | ret_val = e1000e_determine_phy_address(hw); |
| 217 | if (ret_val) { |
| 218 | hw->phy.ops.write_phy_reg = e1000e_write_phy_reg_bm; |
| 219 | hw->phy.ops.read_phy_reg = e1000e_read_phy_reg_bm; |
| 220 | ret_val = e1000e_determine_phy_address(hw); |
| 221 | if (ret_val) |
| 222 | return ret_val; |
| 223 | } |
| 224 | |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 225 | phy->id = 0; |
| 226 | while ((e1000_phy_unknown == e1000e_get_phy_type_from_id(phy->id)) && |
| 227 | (i++ < 100)) { |
| 228 | msleep(1); |
| 229 | ret_val = e1000e_get_phy_id(hw); |
| 230 | if (ret_val) |
| 231 | return ret_val; |
| 232 | } |
| 233 | |
| 234 | /* Verify phy id */ |
| 235 | switch (phy->id) { |
| 236 | case IGP03E1000_E_PHY_ID: |
| 237 | phy->type = e1000_phy_igp_3; |
| 238 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; |
| 239 | break; |
| 240 | case IFE_E_PHY_ID: |
| 241 | case IFE_PLUS_E_PHY_ID: |
| 242 | case IFE_C_E_PHY_ID: |
| 243 | phy->type = e1000_phy_ife; |
| 244 | phy->autoneg_mask = E1000_ALL_NOT_GIG; |
| 245 | break; |
Bruce Allan | 97ac8ca | 2008-04-29 09:16:05 -0700 | [diff] [blame] | 246 | case BME1000_E_PHY_ID: |
| 247 | phy->type = e1000_phy_bm; |
| 248 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; |
| 249 | hw->phy.ops.read_phy_reg = e1000e_read_phy_reg_bm; |
| 250 | hw->phy.ops.write_phy_reg = e1000e_write_phy_reg_bm; |
| 251 | hw->phy.ops.commit_phy = e1000e_phy_sw_reset; |
| 252 | break; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 253 | default: |
| 254 | return -E1000_ERR_PHY; |
| 255 | break; |
| 256 | } |
| 257 | |
| 258 | return 0; |
| 259 | } |
| 260 | |
| 261 | /** |
| 262 | * e1000_init_nvm_params_ich8lan - Initialize NVM function pointers |
| 263 | * @hw: pointer to the HW structure |
| 264 | * |
| 265 | * Initialize family-specific NVM parameters and function |
| 266 | * pointers. |
| 267 | **/ |
| 268 | static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw) |
| 269 | { |
| 270 | struct e1000_nvm_info *nvm = &hw->nvm; |
| 271 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; |
| 272 | u32 gfpreg; |
| 273 | u32 sector_base_addr; |
| 274 | u32 sector_end_addr; |
| 275 | u16 i; |
| 276 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 277 | /* Can't read flash registers if the register set isn't mapped. */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 278 | if (!hw->flash_address) { |
| 279 | hw_dbg(hw, "ERROR: Flash registers not mapped\n"); |
| 280 | return -E1000_ERR_CONFIG; |
| 281 | } |
| 282 | |
| 283 | nvm->type = e1000_nvm_flash_sw; |
| 284 | |
| 285 | gfpreg = er32flash(ICH_FLASH_GFPREG); |
| 286 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 287 | /* |
| 288 | * sector_X_addr is a "sector"-aligned address (4096 bytes) |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 289 | * Add 1 to sector_end_addr since this sector is included in |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 290 | * the overall size. |
| 291 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 292 | sector_base_addr = gfpreg & FLASH_GFPREG_BASE_MASK; |
| 293 | sector_end_addr = ((gfpreg >> 16) & FLASH_GFPREG_BASE_MASK) + 1; |
| 294 | |
| 295 | /* flash_base_addr is byte-aligned */ |
| 296 | nvm->flash_base_addr = sector_base_addr << FLASH_SECTOR_ADDR_SHIFT; |
| 297 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 298 | /* |
| 299 | * find total size of the NVM, then cut in half since the total |
| 300 | * size represents two separate NVM banks. |
| 301 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 302 | nvm->flash_bank_size = (sector_end_addr - sector_base_addr) |
| 303 | << FLASH_SECTOR_ADDR_SHIFT; |
| 304 | nvm->flash_bank_size /= 2; |
| 305 | /* Adjust to word count */ |
| 306 | nvm->flash_bank_size /= sizeof(u16); |
| 307 | |
| 308 | nvm->word_size = E1000_ICH8_SHADOW_RAM_WORDS; |
| 309 | |
| 310 | /* Clear shadow ram */ |
| 311 | for (i = 0; i < nvm->word_size; i++) { |
| 312 | dev_spec->shadow_ram[i].modified = 0; |
| 313 | dev_spec->shadow_ram[i].value = 0xFFFF; |
| 314 | } |
| 315 | |
| 316 | return 0; |
| 317 | } |
| 318 | |
| 319 | /** |
| 320 | * e1000_init_mac_params_ich8lan - Initialize MAC function pointers |
| 321 | * @hw: pointer to the HW structure |
| 322 | * |
| 323 | * Initialize family-specific MAC parameters and function |
| 324 | * pointers. |
| 325 | **/ |
| 326 | static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter) |
| 327 | { |
| 328 | struct e1000_hw *hw = &adapter->hw; |
| 329 | struct e1000_mac_info *mac = &hw->mac; |
| 330 | |
| 331 | /* Set media type function pointer */ |
Jeff Kirsher | 318a94d | 2008-03-28 09:15:16 -0700 | [diff] [blame] | 332 | hw->phy.media_type = e1000_media_type_copper; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 333 | |
| 334 | /* Set mta register count */ |
| 335 | mac->mta_reg_count = 32; |
| 336 | /* Set rar entry count */ |
| 337 | mac->rar_entry_count = E1000_ICH_RAR_ENTRIES; |
| 338 | if (mac->type == e1000_ich8lan) |
| 339 | mac->rar_entry_count--; |
| 340 | /* Set if manageability features are enabled. */ |
| 341 | mac->arc_subsystem_valid = 1; |
| 342 | |
| 343 | /* Enable PCS Lock-loss workaround for ICH8 */ |
| 344 | if (mac->type == e1000_ich8lan) |
| 345 | e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, 1); |
| 346 | |
| 347 | return 0; |
| 348 | } |
| 349 | |
Jeff Kirsher | 69e3fd8 | 2008-04-02 13:48:18 -0700 | [diff] [blame] | 350 | static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter) |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 351 | { |
| 352 | struct e1000_hw *hw = &adapter->hw; |
| 353 | s32 rc; |
| 354 | |
| 355 | rc = e1000_init_mac_params_ich8lan(adapter); |
| 356 | if (rc) |
| 357 | return rc; |
| 358 | |
| 359 | rc = e1000_init_nvm_params_ich8lan(hw); |
| 360 | if (rc) |
| 361 | return rc; |
| 362 | |
| 363 | rc = e1000_init_phy_params_ich8lan(hw); |
| 364 | if (rc) |
| 365 | return rc; |
| 366 | |
| 367 | if ((adapter->hw.mac.type == e1000_ich8lan) && |
| 368 | (adapter->hw.phy.type == e1000_phy_igp_3)) |
| 369 | adapter->flags |= FLAG_LSC_GIG_SPEED_DROP; |
| 370 | |
| 371 | return 0; |
| 372 | } |
| 373 | |
| 374 | /** |
| 375 | * e1000_acquire_swflag_ich8lan - Acquire software control flag |
| 376 | * @hw: pointer to the HW structure |
| 377 | * |
| 378 | * Acquires the software control flag for performing NVM and PHY |
| 379 | * operations. This is a function pointer entry point only called by |
| 380 | * read/write routines for the PHY and NVM parts. |
| 381 | **/ |
| 382 | static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) |
| 383 | { |
| 384 | u32 extcnf_ctrl; |
| 385 | u32 timeout = PHY_CFG_TIMEOUT; |
| 386 | |
| 387 | while (timeout) { |
| 388 | extcnf_ctrl = er32(EXTCNF_CTRL); |
| 389 | extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG; |
| 390 | ew32(EXTCNF_CTRL, extcnf_ctrl); |
| 391 | |
| 392 | extcnf_ctrl = er32(EXTCNF_CTRL); |
| 393 | if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG) |
| 394 | break; |
| 395 | mdelay(1); |
| 396 | timeout--; |
| 397 | } |
| 398 | |
| 399 | if (!timeout) { |
| 400 | hw_dbg(hw, "FW or HW has locked the resource for too long.\n"); |
| 401 | return -E1000_ERR_CONFIG; |
| 402 | } |
| 403 | |
| 404 | return 0; |
| 405 | } |
| 406 | |
| 407 | /** |
| 408 | * e1000_release_swflag_ich8lan - Release software control flag |
| 409 | * @hw: pointer to the HW structure |
| 410 | * |
| 411 | * Releases the software control flag for performing NVM and PHY operations. |
| 412 | * This is a function pointer entry point only called by read/write |
| 413 | * routines for the PHY and NVM parts. |
| 414 | **/ |
| 415 | static void e1000_release_swflag_ich8lan(struct e1000_hw *hw) |
| 416 | { |
| 417 | u32 extcnf_ctrl; |
| 418 | |
| 419 | extcnf_ctrl = er32(EXTCNF_CTRL); |
| 420 | extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; |
| 421 | ew32(EXTCNF_CTRL, extcnf_ctrl); |
| 422 | } |
| 423 | |
| 424 | /** |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame^] | 425 | * e1000_check_mng_mode_ich8lan - Checks management mode |
| 426 | * @hw: pointer to the HW structure |
| 427 | * |
| 428 | * This checks if the adapter has manageability enabled. |
| 429 | * This is a function pointer entry point only called by read/write |
| 430 | * routines for the PHY and NVM parts. |
| 431 | **/ |
| 432 | static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw) |
| 433 | { |
| 434 | u32 fwsm = er32(FWSM); |
| 435 | |
| 436 | return (fwsm & E1000_FWSM_MODE_MASK) == |
| 437 | (E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT); |
| 438 | } |
| 439 | |
| 440 | /** |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 441 | * e1000_check_reset_block_ich8lan - Check if PHY reset is blocked |
| 442 | * @hw: pointer to the HW structure |
| 443 | * |
| 444 | * Checks if firmware is blocking the reset of the PHY. |
| 445 | * This is a function pointer entry point only called by |
| 446 | * reset routines. |
| 447 | **/ |
| 448 | static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw) |
| 449 | { |
| 450 | u32 fwsm; |
| 451 | |
| 452 | fwsm = er32(FWSM); |
| 453 | |
| 454 | return (fwsm & E1000_ICH_FWSM_RSPCIPHY) ? 0 : E1000_BLK_PHY_RESET; |
| 455 | } |
| 456 | |
| 457 | /** |
| 458 | * e1000_phy_force_speed_duplex_ich8lan - Force PHY speed & duplex |
| 459 | * @hw: pointer to the HW structure |
| 460 | * |
| 461 | * Forces the speed and duplex settings of the PHY. |
| 462 | * This is a function pointer entry point only called by |
| 463 | * PHY setup routines. |
| 464 | **/ |
| 465 | static s32 e1000_phy_force_speed_duplex_ich8lan(struct e1000_hw *hw) |
| 466 | { |
| 467 | struct e1000_phy_info *phy = &hw->phy; |
| 468 | s32 ret_val; |
| 469 | u16 data; |
| 470 | bool link; |
| 471 | |
| 472 | if (phy->type != e1000_phy_ife) { |
| 473 | ret_val = e1000e_phy_force_speed_duplex_igp(hw); |
| 474 | return ret_val; |
| 475 | } |
| 476 | |
| 477 | ret_val = e1e_rphy(hw, PHY_CONTROL, &data); |
| 478 | if (ret_val) |
| 479 | return ret_val; |
| 480 | |
| 481 | e1000e_phy_force_speed_duplex_setup(hw, &data); |
| 482 | |
| 483 | ret_val = e1e_wphy(hw, PHY_CONTROL, data); |
| 484 | if (ret_val) |
| 485 | return ret_val; |
| 486 | |
| 487 | /* Disable MDI-X support for 10/100 */ |
| 488 | ret_val = e1e_rphy(hw, IFE_PHY_MDIX_CONTROL, &data); |
| 489 | if (ret_val) |
| 490 | return ret_val; |
| 491 | |
| 492 | data &= ~IFE_PMC_AUTO_MDIX; |
| 493 | data &= ~IFE_PMC_FORCE_MDIX; |
| 494 | |
| 495 | ret_val = e1e_wphy(hw, IFE_PHY_MDIX_CONTROL, data); |
| 496 | if (ret_val) |
| 497 | return ret_val; |
| 498 | |
| 499 | hw_dbg(hw, "IFE PMC: %X\n", data); |
| 500 | |
| 501 | udelay(1); |
| 502 | |
Jeff Kirsher | 318a94d | 2008-03-28 09:15:16 -0700 | [diff] [blame] | 503 | if (phy->autoneg_wait_to_complete) { |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 504 | hw_dbg(hw, "Waiting for forced speed/duplex link on IFE phy.\n"); |
| 505 | |
| 506 | ret_val = e1000e_phy_has_link_generic(hw, |
| 507 | PHY_FORCE_LIMIT, |
| 508 | 100000, |
| 509 | &link); |
| 510 | if (ret_val) |
| 511 | return ret_val; |
| 512 | |
| 513 | if (!link) |
| 514 | hw_dbg(hw, "Link taking longer than expected.\n"); |
| 515 | |
| 516 | /* Try once more */ |
| 517 | ret_val = e1000e_phy_has_link_generic(hw, |
| 518 | PHY_FORCE_LIMIT, |
| 519 | 100000, |
| 520 | &link); |
| 521 | if (ret_val) |
| 522 | return ret_val; |
| 523 | } |
| 524 | |
| 525 | return 0; |
| 526 | } |
| 527 | |
| 528 | /** |
| 529 | * e1000_phy_hw_reset_ich8lan - Performs a PHY reset |
| 530 | * @hw: pointer to the HW structure |
| 531 | * |
| 532 | * Resets the PHY |
| 533 | * This is a function pointer entry point called by drivers |
| 534 | * or other shared routines. |
| 535 | **/ |
| 536 | static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) |
| 537 | { |
| 538 | struct e1000_phy_info *phy = &hw->phy; |
| 539 | u32 i; |
| 540 | u32 data, cnf_size, cnf_base_addr, sw_cfg_mask; |
| 541 | s32 ret_val; |
| 542 | u16 loop = E1000_ICH8_LAN_INIT_TIMEOUT; |
| 543 | u16 word_addr, reg_data, reg_addr, phy_page = 0; |
| 544 | |
| 545 | ret_val = e1000e_phy_hw_reset_generic(hw); |
| 546 | if (ret_val) |
| 547 | return ret_val; |
| 548 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 549 | /* |
| 550 | * Initialize the PHY from the NVM on ICH platforms. This |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 551 | * is needed due to an issue where the NVM configuration is |
| 552 | * not properly autoloaded after power transitions. |
| 553 | * Therefore, after each PHY reset, we will load the |
| 554 | * configuration data out of the NVM manually. |
| 555 | */ |
| 556 | if (hw->mac.type == e1000_ich8lan && phy->type == e1000_phy_igp_3) { |
| 557 | struct e1000_adapter *adapter = hw->adapter; |
| 558 | |
| 559 | /* Check if SW needs configure the PHY */ |
| 560 | if ((adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M_AMT) || |
| 561 | (adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M)) |
| 562 | sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M; |
| 563 | else |
| 564 | sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG; |
| 565 | |
| 566 | data = er32(FEXTNVM); |
| 567 | if (!(data & sw_cfg_mask)) |
| 568 | return 0; |
| 569 | |
| 570 | /* Wait for basic configuration completes before proceeding*/ |
| 571 | do { |
| 572 | data = er32(STATUS); |
| 573 | data &= E1000_STATUS_LAN_INIT_DONE; |
| 574 | udelay(100); |
| 575 | } while ((!data) && --loop); |
| 576 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 577 | /* |
| 578 | * If basic configuration is incomplete before the above loop |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 579 | * count reaches 0, loading the configuration from NVM will |
| 580 | * leave the PHY in a bad state possibly resulting in no link. |
| 581 | */ |
| 582 | if (loop == 0) { |
| 583 | hw_dbg(hw, "LAN_INIT_DONE not set, increase timeout\n"); |
| 584 | } |
| 585 | |
| 586 | /* Clear the Init Done bit for the next init event */ |
| 587 | data = er32(STATUS); |
| 588 | data &= ~E1000_STATUS_LAN_INIT_DONE; |
| 589 | ew32(STATUS, data); |
| 590 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 591 | /* |
| 592 | * Make sure HW does not configure LCD from PHY |
| 593 | * extended configuration before SW configuration |
| 594 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 595 | data = er32(EXTCNF_CTRL); |
| 596 | if (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE) |
| 597 | return 0; |
| 598 | |
| 599 | cnf_size = er32(EXTCNF_SIZE); |
| 600 | cnf_size &= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK; |
| 601 | cnf_size >>= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT; |
| 602 | if (!cnf_size) |
| 603 | return 0; |
| 604 | |
| 605 | cnf_base_addr = data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK; |
| 606 | cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT; |
| 607 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 608 | /* Configure LCD from extended configuration region. */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 609 | |
| 610 | /* cnf_base_addr is in DWORD */ |
| 611 | word_addr = (u16)(cnf_base_addr << 1); |
| 612 | |
| 613 | for (i = 0; i < cnf_size; i++) { |
| 614 | ret_val = e1000_read_nvm(hw, |
| 615 | (word_addr + i * 2), |
| 616 | 1, |
| 617 | ®_data); |
| 618 | if (ret_val) |
| 619 | return ret_val; |
| 620 | |
| 621 | ret_val = e1000_read_nvm(hw, |
| 622 | (word_addr + i * 2 + 1), |
| 623 | 1, |
| 624 | ®_addr); |
| 625 | if (ret_val) |
| 626 | return ret_val; |
| 627 | |
| 628 | /* Save off the PHY page for future writes. */ |
| 629 | if (reg_addr == IGP01E1000_PHY_PAGE_SELECT) { |
| 630 | phy_page = reg_data; |
| 631 | continue; |
| 632 | } |
| 633 | |
| 634 | reg_addr |= phy_page; |
| 635 | |
| 636 | ret_val = e1e_wphy(hw, (u32)reg_addr, reg_data); |
| 637 | if (ret_val) |
| 638 | return ret_val; |
| 639 | } |
| 640 | } |
| 641 | |
| 642 | return 0; |
| 643 | } |
| 644 | |
| 645 | /** |
| 646 | * e1000_get_phy_info_ife_ich8lan - Retrieves various IFE PHY states |
| 647 | * @hw: pointer to the HW structure |
| 648 | * |
| 649 | * Populates "phy" structure with various feature states. |
| 650 | * This function is only called by other family-specific |
| 651 | * routines. |
| 652 | **/ |
| 653 | static s32 e1000_get_phy_info_ife_ich8lan(struct e1000_hw *hw) |
| 654 | { |
| 655 | struct e1000_phy_info *phy = &hw->phy; |
| 656 | s32 ret_val; |
| 657 | u16 data; |
| 658 | bool link; |
| 659 | |
| 660 | ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link); |
| 661 | if (ret_val) |
| 662 | return ret_val; |
| 663 | |
| 664 | if (!link) { |
| 665 | hw_dbg(hw, "Phy info is only valid if link is up\n"); |
| 666 | return -E1000_ERR_CONFIG; |
| 667 | } |
| 668 | |
| 669 | ret_val = e1e_rphy(hw, IFE_PHY_SPECIAL_CONTROL, &data); |
| 670 | if (ret_val) |
| 671 | return ret_val; |
| 672 | phy->polarity_correction = (!(data & IFE_PSC_AUTO_POLARITY_DISABLE)); |
| 673 | |
| 674 | if (phy->polarity_correction) { |
| 675 | ret_val = e1000_check_polarity_ife_ich8lan(hw); |
| 676 | if (ret_val) |
| 677 | return ret_val; |
| 678 | } else { |
| 679 | /* Polarity is forced */ |
| 680 | phy->cable_polarity = (data & IFE_PSC_FORCE_POLARITY) |
| 681 | ? e1000_rev_polarity_reversed |
| 682 | : e1000_rev_polarity_normal; |
| 683 | } |
| 684 | |
| 685 | ret_val = e1e_rphy(hw, IFE_PHY_MDIX_CONTROL, &data); |
| 686 | if (ret_val) |
| 687 | return ret_val; |
| 688 | |
| 689 | phy->is_mdix = (data & IFE_PMC_MDIX_STATUS); |
| 690 | |
| 691 | /* The following parameters are undefined for 10/100 operation. */ |
| 692 | phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; |
| 693 | phy->local_rx = e1000_1000t_rx_status_undefined; |
| 694 | phy->remote_rx = e1000_1000t_rx_status_undefined; |
| 695 | |
| 696 | return 0; |
| 697 | } |
| 698 | |
| 699 | /** |
| 700 | * e1000_get_phy_info_ich8lan - Calls appropriate PHY type get_phy_info |
| 701 | * @hw: pointer to the HW structure |
| 702 | * |
| 703 | * Wrapper for calling the get_phy_info routines for the appropriate phy type. |
| 704 | * This is a function pointer entry point called by drivers |
| 705 | * or other shared routines. |
| 706 | **/ |
| 707 | static s32 e1000_get_phy_info_ich8lan(struct e1000_hw *hw) |
| 708 | { |
| 709 | switch (hw->phy.type) { |
| 710 | case e1000_phy_ife: |
| 711 | return e1000_get_phy_info_ife_ich8lan(hw); |
| 712 | break; |
| 713 | case e1000_phy_igp_3: |
Bruce Allan | 97ac8ca | 2008-04-29 09:16:05 -0700 | [diff] [blame] | 714 | case e1000_phy_bm: |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 715 | return e1000e_get_phy_info_igp(hw); |
| 716 | break; |
| 717 | default: |
| 718 | break; |
| 719 | } |
| 720 | |
| 721 | return -E1000_ERR_PHY_TYPE; |
| 722 | } |
| 723 | |
| 724 | /** |
| 725 | * e1000_check_polarity_ife_ich8lan - Check cable polarity for IFE PHY |
| 726 | * @hw: pointer to the HW structure |
| 727 | * |
Auke Kok | 489815c | 2008-02-21 15:11:07 -0800 | [diff] [blame] | 728 | * Polarity is determined on the polarity reversal feature being enabled. |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 729 | * This function is only called by other family-specific |
| 730 | * routines. |
| 731 | **/ |
| 732 | static s32 e1000_check_polarity_ife_ich8lan(struct e1000_hw *hw) |
| 733 | { |
| 734 | struct e1000_phy_info *phy = &hw->phy; |
| 735 | s32 ret_val; |
| 736 | u16 phy_data, offset, mask; |
| 737 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 738 | /* |
| 739 | * Polarity is determined based on the reversal feature being enabled. |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 740 | */ |
| 741 | if (phy->polarity_correction) { |
| 742 | offset = IFE_PHY_EXTENDED_STATUS_CONTROL; |
| 743 | mask = IFE_PESC_POLARITY_REVERSED; |
| 744 | } else { |
| 745 | offset = IFE_PHY_SPECIAL_CONTROL; |
| 746 | mask = IFE_PSC_FORCE_POLARITY; |
| 747 | } |
| 748 | |
| 749 | ret_val = e1e_rphy(hw, offset, &phy_data); |
| 750 | |
| 751 | if (!ret_val) |
| 752 | phy->cable_polarity = (phy_data & mask) |
| 753 | ? e1000_rev_polarity_reversed |
| 754 | : e1000_rev_polarity_normal; |
| 755 | |
| 756 | return ret_val; |
| 757 | } |
| 758 | |
| 759 | /** |
| 760 | * e1000_set_d0_lplu_state_ich8lan - Set Low Power Linkup D0 state |
| 761 | * @hw: pointer to the HW structure |
| 762 | * @active: TRUE to enable LPLU, FALSE to disable |
| 763 | * |
| 764 | * Sets the LPLU D0 state according to the active flag. When |
| 765 | * activating LPLU this function also disables smart speed |
| 766 | * and vice versa. LPLU will not be activated unless the |
| 767 | * device autonegotiation advertisement meets standards of |
| 768 | * either 10 or 10/100 or 10/100/1000 at all duplexes. |
| 769 | * This is a function pointer entry point only called by |
| 770 | * PHY setup routines. |
| 771 | **/ |
| 772 | static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active) |
| 773 | { |
| 774 | struct e1000_phy_info *phy = &hw->phy; |
| 775 | u32 phy_ctrl; |
| 776 | s32 ret_val = 0; |
| 777 | u16 data; |
| 778 | |
Bruce Allan | 97ac8ca | 2008-04-29 09:16:05 -0700 | [diff] [blame] | 779 | if (phy->type == e1000_phy_ife) |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 780 | return ret_val; |
| 781 | |
| 782 | phy_ctrl = er32(PHY_CTRL); |
| 783 | |
| 784 | if (active) { |
| 785 | phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU; |
| 786 | ew32(PHY_CTRL, phy_ctrl); |
| 787 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 788 | /* |
| 789 | * Call gig speed drop workaround on LPLU before accessing |
| 790 | * any PHY registers |
| 791 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 792 | if ((hw->mac.type == e1000_ich8lan) && |
| 793 | (hw->phy.type == e1000_phy_igp_3)) |
| 794 | e1000e_gig_downshift_workaround_ich8lan(hw); |
| 795 | |
| 796 | /* When LPLU is enabled, we should disable SmartSpeed */ |
| 797 | ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, &data); |
| 798 | data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
| 799 | ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, data); |
| 800 | if (ret_val) |
| 801 | return ret_val; |
| 802 | } else { |
| 803 | phy_ctrl &= ~E1000_PHY_CTRL_D0A_LPLU; |
| 804 | ew32(PHY_CTRL, phy_ctrl); |
| 805 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 806 | /* |
| 807 | * LPLU and SmartSpeed are mutually exclusive. LPLU is used |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 808 | * during Dx states where the power conservation is most |
| 809 | * important. During driver activity we should enable |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 810 | * SmartSpeed, so performance is maintained. |
| 811 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 812 | if (phy->smart_speed == e1000_smart_speed_on) { |
| 813 | ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 814 | &data); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 815 | if (ret_val) |
| 816 | return ret_val; |
| 817 | |
| 818 | data |= IGP01E1000_PSCFR_SMART_SPEED; |
| 819 | ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 820 | data); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 821 | if (ret_val) |
| 822 | return ret_val; |
| 823 | } else if (phy->smart_speed == e1000_smart_speed_off) { |
| 824 | ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 825 | &data); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 826 | if (ret_val) |
| 827 | return ret_val; |
| 828 | |
| 829 | data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
| 830 | ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 831 | data); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 832 | if (ret_val) |
| 833 | return ret_val; |
| 834 | } |
| 835 | } |
| 836 | |
| 837 | return 0; |
| 838 | } |
| 839 | |
| 840 | /** |
| 841 | * e1000_set_d3_lplu_state_ich8lan - Set Low Power Linkup D3 state |
| 842 | * @hw: pointer to the HW structure |
| 843 | * @active: TRUE to enable LPLU, FALSE to disable |
| 844 | * |
| 845 | * Sets the LPLU D3 state according to the active flag. When |
| 846 | * activating LPLU this function also disables smart speed |
| 847 | * and vice versa. LPLU will not be activated unless the |
| 848 | * device autonegotiation advertisement meets standards of |
| 849 | * either 10 or 10/100 or 10/100/1000 at all duplexes. |
| 850 | * This is a function pointer entry point only called by |
| 851 | * PHY setup routines. |
| 852 | **/ |
| 853 | static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, bool active) |
| 854 | { |
| 855 | struct e1000_phy_info *phy = &hw->phy; |
| 856 | u32 phy_ctrl; |
| 857 | s32 ret_val; |
| 858 | u16 data; |
| 859 | |
| 860 | phy_ctrl = er32(PHY_CTRL); |
| 861 | |
| 862 | if (!active) { |
| 863 | phy_ctrl &= ~E1000_PHY_CTRL_NOND0A_LPLU; |
| 864 | ew32(PHY_CTRL, phy_ctrl); |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 865 | /* |
| 866 | * LPLU and SmartSpeed are mutually exclusive. LPLU is used |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 867 | * during Dx states where the power conservation is most |
| 868 | * important. During driver activity we should enable |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 869 | * SmartSpeed, so performance is maintained. |
| 870 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 871 | if (phy->smart_speed == e1000_smart_speed_on) { |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 872 | ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, |
| 873 | &data); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 874 | if (ret_val) |
| 875 | return ret_val; |
| 876 | |
| 877 | data |= IGP01E1000_PSCFR_SMART_SPEED; |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 878 | ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, |
| 879 | data); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 880 | if (ret_val) |
| 881 | return ret_val; |
| 882 | } else if (phy->smart_speed == e1000_smart_speed_off) { |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 883 | ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, |
| 884 | &data); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 885 | if (ret_val) |
| 886 | return ret_val; |
| 887 | |
| 888 | data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 889 | ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, |
| 890 | data); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 891 | if (ret_val) |
| 892 | return ret_val; |
| 893 | } |
| 894 | } else if ((phy->autoneg_advertised == E1000_ALL_SPEED_DUPLEX) || |
| 895 | (phy->autoneg_advertised == E1000_ALL_NOT_GIG) || |
| 896 | (phy->autoneg_advertised == E1000_ALL_10_SPEED)) { |
| 897 | phy_ctrl |= E1000_PHY_CTRL_NOND0A_LPLU; |
| 898 | ew32(PHY_CTRL, phy_ctrl); |
| 899 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 900 | /* |
| 901 | * Call gig speed drop workaround on LPLU before accessing |
| 902 | * any PHY registers |
| 903 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 904 | if ((hw->mac.type == e1000_ich8lan) && |
| 905 | (hw->phy.type == e1000_phy_igp_3)) |
| 906 | e1000e_gig_downshift_workaround_ich8lan(hw); |
| 907 | |
| 908 | /* When LPLU is enabled, we should disable SmartSpeed */ |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 909 | ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, &data); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 910 | if (ret_val) |
| 911 | return ret_val; |
| 912 | |
| 913 | data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 914 | ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, data); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 915 | } |
| 916 | |
| 917 | return 0; |
| 918 | } |
| 919 | |
| 920 | /** |
Bruce Allan | f4187b5 | 2008-08-26 18:36:50 -0700 | [diff] [blame] | 921 | * e1000_valid_nvm_bank_detect_ich8lan - finds out the valid bank 0 or 1 |
| 922 | * @hw: pointer to the HW structure |
| 923 | * @bank: pointer to the variable that returns the active bank |
| 924 | * |
| 925 | * Reads signature byte from the NVM using the flash access registers. |
| 926 | **/ |
| 927 | static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank) |
| 928 | { |
| 929 | struct e1000_nvm_info *nvm = &hw->nvm; |
| 930 | /* flash bank size is in words */ |
| 931 | u32 bank1_offset = nvm->flash_bank_size * sizeof(u16); |
| 932 | u32 act_offset = E1000_ICH_NVM_SIG_WORD * 2 + 1; |
| 933 | u8 bank_high_byte = 0; |
| 934 | |
| 935 | if (hw->mac.type != e1000_ich10lan) { |
| 936 | if (er32(EECD) & E1000_EECD_SEC1VAL) |
| 937 | *bank = 1; |
| 938 | else |
| 939 | *bank = 0; |
| 940 | } else { |
| 941 | /* |
| 942 | * Make sure the signature for bank 0 is valid, |
| 943 | * if not check for bank1 |
| 944 | */ |
| 945 | e1000_read_flash_byte_ich8lan(hw, act_offset, &bank_high_byte); |
| 946 | if ((bank_high_byte & 0xC0) == 0x80) { |
| 947 | *bank = 0; |
| 948 | } else { |
| 949 | /* |
| 950 | * find if segment 1 is valid by verifying |
| 951 | * bit 15:14 = 10b in word 0x13 |
| 952 | */ |
| 953 | e1000_read_flash_byte_ich8lan(hw, |
| 954 | act_offset + bank1_offset, |
| 955 | &bank_high_byte); |
| 956 | |
| 957 | /* bank1 has a valid signature equivalent to SEC1V */ |
| 958 | if ((bank_high_byte & 0xC0) == 0x80) { |
| 959 | *bank = 1; |
| 960 | } else { |
| 961 | hw_dbg(hw, "ERROR: EEPROM not present\n"); |
| 962 | return -E1000_ERR_NVM; |
| 963 | } |
| 964 | } |
| 965 | } |
| 966 | |
| 967 | return 0; |
| 968 | } |
| 969 | |
| 970 | /** |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 971 | * e1000_read_nvm_ich8lan - Read word(s) from the NVM |
| 972 | * @hw: pointer to the HW structure |
| 973 | * @offset: The offset (in bytes) of the word(s) to read. |
| 974 | * @words: Size of data to read in words |
| 975 | * @data: Pointer to the word(s) to read at offset. |
| 976 | * |
| 977 | * Reads a word(s) from the NVM using the flash access registers. |
| 978 | **/ |
| 979 | static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, |
| 980 | u16 *data) |
| 981 | { |
| 982 | struct e1000_nvm_info *nvm = &hw->nvm; |
| 983 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; |
| 984 | u32 act_offset; |
| 985 | s32 ret_val; |
Bruce Allan | f4187b5 | 2008-08-26 18:36:50 -0700 | [diff] [blame] | 986 | u32 bank = 0; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 987 | u16 i, word; |
| 988 | |
| 989 | if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) || |
| 990 | (words == 0)) { |
| 991 | hw_dbg(hw, "nvm parameter(s) out of bounds\n"); |
| 992 | return -E1000_ERR_NVM; |
| 993 | } |
| 994 | |
| 995 | ret_val = e1000_acquire_swflag_ich8lan(hw); |
| 996 | if (ret_val) |
| 997 | return ret_val; |
| 998 | |
Bruce Allan | f4187b5 | 2008-08-26 18:36:50 -0700 | [diff] [blame] | 999 | ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); |
| 1000 | if (ret_val) |
| 1001 | return ret_val; |
| 1002 | |
| 1003 | act_offset = (bank) ? nvm->flash_bank_size : 0; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1004 | act_offset += offset; |
| 1005 | |
| 1006 | for (i = 0; i < words; i++) { |
| 1007 | if ((dev_spec->shadow_ram) && |
| 1008 | (dev_spec->shadow_ram[offset+i].modified)) { |
| 1009 | data[i] = dev_spec->shadow_ram[offset+i].value; |
| 1010 | } else { |
| 1011 | ret_val = e1000_read_flash_word_ich8lan(hw, |
| 1012 | act_offset + i, |
| 1013 | &word); |
| 1014 | if (ret_val) |
| 1015 | break; |
| 1016 | data[i] = word; |
| 1017 | } |
| 1018 | } |
| 1019 | |
| 1020 | e1000_release_swflag_ich8lan(hw); |
| 1021 | |
| 1022 | return ret_val; |
| 1023 | } |
| 1024 | |
| 1025 | /** |
| 1026 | * e1000_flash_cycle_init_ich8lan - Initialize flash |
| 1027 | * @hw: pointer to the HW structure |
| 1028 | * |
| 1029 | * This function does initial flash setup so that a new read/write/erase cycle |
| 1030 | * can be started. |
| 1031 | **/ |
| 1032 | static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw) |
| 1033 | { |
| 1034 | union ich8_hws_flash_status hsfsts; |
| 1035 | s32 ret_val = -E1000_ERR_NVM; |
| 1036 | s32 i = 0; |
| 1037 | |
| 1038 | hsfsts.regval = er16flash(ICH_FLASH_HSFSTS); |
| 1039 | |
| 1040 | /* Check if the flash descriptor is valid */ |
| 1041 | if (hsfsts.hsf_status.fldesvalid == 0) { |
| 1042 | hw_dbg(hw, "Flash descriptor invalid. " |
| 1043 | "SW Sequencing must be used."); |
| 1044 | return -E1000_ERR_NVM; |
| 1045 | } |
| 1046 | |
| 1047 | /* Clear FCERR and DAEL in hw status by writing 1 */ |
| 1048 | hsfsts.hsf_status.flcerr = 1; |
| 1049 | hsfsts.hsf_status.dael = 1; |
| 1050 | |
| 1051 | ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval); |
| 1052 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1053 | /* |
| 1054 | * Either we should have a hardware SPI cycle in progress |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1055 | * bit to check against, in order to start a new cycle or |
| 1056 | * FDONE bit should be changed in the hardware so that it |
Auke Kok | 489815c | 2008-02-21 15:11:07 -0800 | [diff] [blame] | 1057 | * is 1 after hardware reset, which can then be used as an |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1058 | * indication whether a cycle is in progress or has been |
| 1059 | * completed. |
| 1060 | */ |
| 1061 | |
| 1062 | if (hsfsts.hsf_status.flcinprog == 0) { |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1063 | /* |
| 1064 | * There is no cycle running at present, |
| 1065 | * so we can start a cycle |
| 1066 | * Begin by setting Flash Cycle Done. |
| 1067 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1068 | hsfsts.hsf_status.flcdone = 1; |
| 1069 | ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval); |
| 1070 | ret_val = 0; |
| 1071 | } else { |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1072 | /* |
| 1073 | * otherwise poll for sometime so the current |
| 1074 | * cycle has a chance to end before giving up. |
| 1075 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1076 | for (i = 0; i < ICH_FLASH_READ_COMMAND_TIMEOUT; i++) { |
| 1077 | hsfsts.regval = __er16flash(hw, ICH_FLASH_HSFSTS); |
| 1078 | if (hsfsts.hsf_status.flcinprog == 0) { |
| 1079 | ret_val = 0; |
| 1080 | break; |
| 1081 | } |
| 1082 | udelay(1); |
| 1083 | } |
| 1084 | if (ret_val == 0) { |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1085 | /* |
| 1086 | * Successful in waiting for previous cycle to timeout, |
| 1087 | * now set the Flash Cycle Done. |
| 1088 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1089 | hsfsts.hsf_status.flcdone = 1; |
| 1090 | ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval); |
| 1091 | } else { |
| 1092 | hw_dbg(hw, "Flash controller busy, cannot get access"); |
| 1093 | } |
| 1094 | } |
| 1095 | |
| 1096 | return ret_val; |
| 1097 | } |
| 1098 | |
| 1099 | /** |
| 1100 | * e1000_flash_cycle_ich8lan - Starts flash cycle (read/write/erase) |
| 1101 | * @hw: pointer to the HW structure |
| 1102 | * @timeout: maximum time to wait for completion |
| 1103 | * |
| 1104 | * This function starts a flash cycle and waits for its completion. |
| 1105 | **/ |
| 1106 | static s32 e1000_flash_cycle_ich8lan(struct e1000_hw *hw, u32 timeout) |
| 1107 | { |
| 1108 | union ich8_hws_flash_ctrl hsflctl; |
| 1109 | union ich8_hws_flash_status hsfsts; |
| 1110 | s32 ret_val = -E1000_ERR_NVM; |
| 1111 | u32 i = 0; |
| 1112 | |
| 1113 | /* Start a cycle by writing 1 in Flash Cycle Go in Hw Flash Control */ |
| 1114 | hsflctl.regval = er16flash(ICH_FLASH_HSFCTL); |
| 1115 | hsflctl.hsf_ctrl.flcgo = 1; |
| 1116 | ew16flash(ICH_FLASH_HSFCTL, hsflctl.regval); |
| 1117 | |
| 1118 | /* wait till FDONE bit is set to 1 */ |
| 1119 | do { |
| 1120 | hsfsts.regval = er16flash(ICH_FLASH_HSFSTS); |
| 1121 | if (hsfsts.hsf_status.flcdone == 1) |
| 1122 | break; |
| 1123 | udelay(1); |
| 1124 | } while (i++ < timeout); |
| 1125 | |
| 1126 | if (hsfsts.hsf_status.flcdone == 1 && hsfsts.hsf_status.flcerr == 0) |
| 1127 | return 0; |
| 1128 | |
| 1129 | return ret_val; |
| 1130 | } |
| 1131 | |
| 1132 | /** |
| 1133 | * e1000_read_flash_word_ich8lan - Read word from flash |
| 1134 | * @hw: pointer to the HW structure |
| 1135 | * @offset: offset to data location |
| 1136 | * @data: pointer to the location for storing the data |
| 1137 | * |
| 1138 | * Reads the flash word at offset into data. Offset is converted |
| 1139 | * to bytes before read. |
| 1140 | **/ |
| 1141 | static s32 e1000_read_flash_word_ich8lan(struct e1000_hw *hw, u32 offset, |
| 1142 | u16 *data) |
| 1143 | { |
| 1144 | /* Must convert offset into bytes. */ |
| 1145 | offset <<= 1; |
| 1146 | |
| 1147 | return e1000_read_flash_data_ich8lan(hw, offset, 2, data); |
| 1148 | } |
| 1149 | |
| 1150 | /** |
Bruce Allan | f4187b5 | 2008-08-26 18:36:50 -0700 | [diff] [blame] | 1151 | * e1000_read_flash_byte_ich8lan - Read byte from flash |
| 1152 | * @hw: pointer to the HW structure |
| 1153 | * @offset: The offset of the byte to read. |
| 1154 | * @data: Pointer to a byte to store the value read. |
| 1155 | * |
| 1156 | * Reads a single byte from the NVM using the flash access registers. |
| 1157 | **/ |
| 1158 | static s32 e1000_read_flash_byte_ich8lan(struct e1000_hw *hw, u32 offset, |
| 1159 | u8 *data) |
| 1160 | { |
| 1161 | s32 ret_val; |
| 1162 | u16 word = 0; |
| 1163 | |
| 1164 | ret_val = e1000_read_flash_data_ich8lan(hw, offset, 1, &word); |
| 1165 | if (ret_val) |
| 1166 | return ret_val; |
| 1167 | |
| 1168 | *data = (u8)word; |
| 1169 | |
| 1170 | return 0; |
| 1171 | } |
| 1172 | |
| 1173 | /** |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1174 | * e1000_read_flash_data_ich8lan - Read byte or word from NVM |
| 1175 | * @hw: pointer to the HW structure |
| 1176 | * @offset: The offset (in bytes) of the byte or word to read. |
| 1177 | * @size: Size of data to read, 1=byte 2=word |
| 1178 | * @data: Pointer to the word to store the value read. |
| 1179 | * |
| 1180 | * Reads a byte or word from the NVM using the flash access registers. |
| 1181 | **/ |
| 1182 | static s32 e1000_read_flash_data_ich8lan(struct e1000_hw *hw, u32 offset, |
| 1183 | u8 size, u16 *data) |
| 1184 | { |
| 1185 | union ich8_hws_flash_status hsfsts; |
| 1186 | union ich8_hws_flash_ctrl hsflctl; |
| 1187 | u32 flash_linear_addr; |
| 1188 | u32 flash_data = 0; |
| 1189 | s32 ret_val = -E1000_ERR_NVM; |
| 1190 | u8 count = 0; |
| 1191 | |
| 1192 | if (size < 1 || size > 2 || offset > ICH_FLASH_LINEAR_ADDR_MASK) |
| 1193 | return -E1000_ERR_NVM; |
| 1194 | |
| 1195 | flash_linear_addr = (ICH_FLASH_LINEAR_ADDR_MASK & offset) + |
| 1196 | hw->nvm.flash_base_addr; |
| 1197 | |
| 1198 | do { |
| 1199 | udelay(1); |
| 1200 | /* Steps */ |
| 1201 | ret_val = e1000_flash_cycle_init_ich8lan(hw); |
| 1202 | if (ret_val != 0) |
| 1203 | break; |
| 1204 | |
| 1205 | hsflctl.regval = er16flash(ICH_FLASH_HSFCTL); |
| 1206 | /* 0b/1b corresponds to 1 or 2 byte size, respectively. */ |
| 1207 | hsflctl.hsf_ctrl.fldbcount = size - 1; |
| 1208 | hsflctl.hsf_ctrl.flcycle = ICH_CYCLE_READ; |
| 1209 | ew16flash(ICH_FLASH_HSFCTL, hsflctl.regval); |
| 1210 | |
| 1211 | ew32flash(ICH_FLASH_FADDR, flash_linear_addr); |
| 1212 | |
| 1213 | ret_val = e1000_flash_cycle_ich8lan(hw, |
| 1214 | ICH_FLASH_READ_COMMAND_TIMEOUT); |
| 1215 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1216 | /* |
| 1217 | * Check if FCERR is set to 1, if set to 1, clear it |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1218 | * and try the whole sequence a few more times, else |
| 1219 | * read in (shift in) the Flash Data0, the order is |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1220 | * least significant byte first msb to lsb |
| 1221 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1222 | if (ret_val == 0) { |
| 1223 | flash_data = er32flash(ICH_FLASH_FDATA0); |
| 1224 | if (size == 1) { |
| 1225 | *data = (u8)(flash_data & 0x000000FF); |
| 1226 | } else if (size == 2) { |
| 1227 | *data = (u16)(flash_data & 0x0000FFFF); |
| 1228 | } |
| 1229 | break; |
| 1230 | } else { |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1231 | /* |
| 1232 | * If we've gotten here, then things are probably |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1233 | * completely hosed, but if the error condition is |
| 1234 | * detected, it won't hurt to give it another try... |
| 1235 | * ICH_FLASH_CYCLE_REPEAT_COUNT times. |
| 1236 | */ |
| 1237 | hsfsts.regval = er16flash(ICH_FLASH_HSFSTS); |
| 1238 | if (hsfsts.hsf_status.flcerr == 1) { |
| 1239 | /* Repeat for some time before giving up. */ |
| 1240 | continue; |
| 1241 | } else if (hsfsts.hsf_status.flcdone == 0) { |
| 1242 | hw_dbg(hw, "Timeout error - flash cycle " |
| 1243 | "did not complete."); |
| 1244 | break; |
| 1245 | } |
| 1246 | } |
| 1247 | } while (count++ < ICH_FLASH_CYCLE_REPEAT_COUNT); |
| 1248 | |
| 1249 | return ret_val; |
| 1250 | } |
| 1251 | |
| 1252 | /** |
| 1253 | * e1000_write_nvm_ich8lan - Write word(s) to the NVM |
| 1254 | * @hw: pointer to the HW structure |
| 1255 | * @offset: The offset (in bytes) of the word(s) to write. |
| 1256 | * @words: Size of data to write in words |
| 1257 | * @data: Pointer to the word(s) to write at offset. |
| 1258 | * |
| 1259 | * Writes a byte or word to the NVM using the flash access registers. |
| 1260 | **/ |
| 1261 | static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, |
| 1262 | u16 *data) |
| 1263 | { |
| 1264 | struct e1000_nvm_info *nvm = &hw->nvm; |
| 1265 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; |
| 1266 | s32 ret_val; |
| 1267 | u16 i; |
| 1268 | |
| 1269 | if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) || |
| 1270 | (words == 0)) { |
| 1271 | hw_dbg(hw, "nvm parameter(s) out of bounds\n"); |
| 1272 | return -E1000_ERR_NVM; |
| 1273 | } |
| 1274 | |
| 1275 | ret_val = e1000_acquire_swflag_ich8lan(hw); |
| 1276 | if (ret_val) |
| 1277 | return ret_val; |
| 1278 | |
| 1279 | for (i = 0; i < words; i++) { |
| 1280 | dev_spec->shadow_ram[offset+i].modified = 1; |
| 1281 | dev_spec->shadow_ram[offset+i].value = data[i]; |
| 1282 | } |
| 1283 | |
| 1284 | e1000_release_swflag_ich8lan(hw); |
| 1285 | |
| 1286 | return 0; |
| 1287 | } |
| 1288 | |
| 1289 | /** |
| 1290 | * e1000_update_nvm_checksum_ich8lan - Update the checksum for NVM |
| 1291 | * @hw: pointer to the HW structure |
| 1292 | * |
| 1293 | * The NVM checksum is updated by calling the generic update_nvm_checksum, |
| 1294 | * which writes the checksum to the shadow ram. The changes in the shadow |
| 1295 | * ram are then committed to the EEPROM by processing each bank at a time |
| 1296 | * checking for the modified bit and writing only the pending changes. |
Auke Kok | 489815c | 2008-02-21 15:11:07 -0800 | [diff] [blame] | 1297 | * After a successful commit, the shadow ram is cleared and is ready for |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1298 | * future writes. |
| 1299 | **/ |
| 1300 | static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) |
| 1301 | { |
| 1302 | struct e1000_nvm_info *nvm = &hw->nvm; |
| 1303 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; |
Bruce Allan | f4187b5 | 2008-08-26 18:36:50 -0700 | [diff] [blame] | 1304 | u32 i, act_offset, new_bank_offset, old_bank_offset, bank; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1305 | s32 ret_val; |
| 1306 | u16 data; |
| 1307 | |
| 1308 | ret_val = e1000e_update_nvm_checksum_generic(hw); |
| 1309 | if (ret_val) |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1310 | return ret_val; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1311 | |
| 1312 | if (nvm->type != e1000_nvm_flash_sw) |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1313 | return ret_val; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1314 | |
| 1315 | ret_val = e1000_acquire_swflag_ich8lan(hw); |
| 1316 | if (ret_val) |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1317 | return ret_val; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1318 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1319 | /* |
| 1320 | * We're writing to the opposite bank so if we're on bank 1, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1321 | * write to bank 0 etc. We also need to erase the segment that |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1322 | * is going to be written |
| 1323 | */ |
Bruce Allan | f4187b5 | 2008-08-26 18:36:50 -0700 | [diff] [blame] | 1324 | ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); |
| 1325 | if (ret_val) |
| 1326 | return ret_val; |
| 1327 | |
| 1328 | if (bank == 0) { |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1329 | new_bank_offset = nvm->flash_bank_size; |
| 1330 | old_bank_offset = 0; |
| 1331 | e1000_erase_flash_bank_ich8lan(hw, 1); |
| 1332 | } else { |
| 1333 | old_bank_offset = nvm->flash_bank_size; |
| 1334 | new_bank_offset = 0; |
| 1335 | e1000_erase_flash_bank_ich8lan(hw, 0); |
| 1336 | } |
| 1337 | |
| 1338 | for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) { |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1339 | /* |
| 1340 | * Determine whether to write the value stored |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1341 | * in the other NVM bank or a modified value stored |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1342 | * in the shadow RAM |
| 1343 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1344 | if (dev_spec->shadow_ram[i].modified) { |
| 1345 | data = dev_spec->shadow_ram[i].value; |
| 1346 | } else { |
| 1347 | e1000_read_flash_word_ich8lan(hw, |
| 1348 | i + old_bank_offset, |
| 1349 | &data); |
| 1350 | } |
| 1351 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1352 | /* |
| 1353 | * If the word is 0x13, then make sure the signature bits |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1354 | * (15:14) are 11b until the commit has completed. |
| 1355 | * This will allow us to write 10b which indicates the |
| 1356 | * signature is valid. We want to do this after the write |
| 1357 | * has completed so that we don't mark the segment valid |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1358 | * while the write is still in progress |
| 1359 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1360 | if (i == E1000_ICH_NVM_SIG_WORD) |
| 1361 | data |= E1000_ICH_NVM_SIG_MASK; |
| 1362 | |
| 1363 | /* Convert offset to bytes. */ |
| 1364 | act_offset = (i + new_bank_offset) << 1; |
| 1365 | |
| 1366 | udelay(100); |
| 1367 | /* Write the bytes to the new bank. */ |
| 1368 | ret_val = e1000_retry_write_flash_byte_ich8lan(hw, |
| 1369 | act_offset, |
| 1370 | (u8)data); |
| 1371 | if (ret_val) |
| 1372 | break; |
| 1373 | |
| 1374 | udelay(100); |
| 1375 | ret_val = e1000_retry_write_flash_byte_ich8lan(hw, |
| 1376 | act_offset + 1, |
| 1377 | (u8)(data >> 8)); |
| 1378 | if (ret_val) |
| 1379 | break; |
| 1380 | } |
| 1381 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1382 | /* |
| 1383 | * Don't bother writing the segment valid bits if sector |
| 1384 | * programming failed. |
| 1385 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1386 | if (ret_val) { |
| 1387 | hw_dbg(hw, "Flash commit failed.\n"); |
| 1388 | e1000_release_swflag_ich8lan(hw); |
| 1389 | return ret_val; |
| 1390 | } |
| 1391 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1392 | /* |
| 1393 | * Finally validate the new segment by setting bit 15:14 |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1394 | * to 10b in word 0x13 , this can be done without an |
| 1395 | * erase as well since these bits are 11 to start with |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1396 | * and we need to change bit 14 to 0b |
| 1397 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1398 | act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD; |
| 1399 | e1000_read_flash_word_ich8lan(hw, act_offset, &data); |
| 1400 | data &= 0xBFFF; |
| 1401 | ret_val = e1000_retry_write_flash_byte_ich8lan(hw, |
| 1402 | act_offset * 2 + 1, |
| 1403 | (u8)(data >> 8)); |
| 1404 | if (ret_val) { |
| 1405 | e1000_release_swflag_ich8lan(hw); |
| 1406 | return ret_val; |
| 1407 | } |
| 1408 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1409 | /* |
| 1410 | * And invalidate the previously valid segment by setting |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1411 | * its signature word (0x13) high_byte to 0b. This can be |
| 1412 | * done without an erase because flash erase sets all bits |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1413 | * to 1's. We can write 1's to 0's without an erase |
| 1414 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1415 | act_offset = (old_bank_offset + E1000_ICH_NVM_SIG_WORD) * 2 + 1; |
| 1416 | ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0); |
| 1417 | if (ret_val) { |
| 1418 | e1000_release_swflag_ich8lan(hw); |
| 1419 | return ret_val; |
| 1420 | } |
| 1421 | |
| 1422 | /* Great! Everything worked, we can now clear the cached entries. */ |
| 1423 | for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) { |
| 1424 | dev_spec->shadow_ram[i].modified = 0; |
| 1425 | dev_spec->shadow_ram[i].value = 0xFFFF; |
| 1426 | } |
| 1427 | |
| 1428 | e1000_release_swflag_ich8lan(hw); |
| 1429 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1430 | /* |
| 1431 | * Reload the EEPROM, or else modifications will not appear |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1432 | * until after the next adapter reset. |
| 1433 | */ |
| 1434 | e1000e_reload_nvm(hw); |
| 1435 | msleep(10); |
| 1436 | |
| 1437 | return ret_val; |
| 1438 | } |
| 1439 | |
| 1440 | /** |
| 1441 | * e1000_validate_nvm_checksum_ich8lan - Validate EEPROM checksum |
| 1442 | * @hw: pointer to the HW structure |
| 1443 | * |
| 1444 | * Check to see if checksum needs to be fixed by reading bit 6 in word 0x19. |
| 1445 | * If the bit is 0, that the EEPROM had been modified, but the checksum was not |
| 1446 | * calculated, in which case we need to calculate the checksum and set bit 6. |
| 1447 | **/ |
| 1448 | static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw) |
| 1449 | { |
| 1450 | s32 ret_val; |
| 1451 | u16 data; |
| 1452 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1453 | /* |
| 1454 | * Read 0x19 and check bit 6. If this bit is 0, the checksum |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1455 | * needs to be fixed. This bit is an indication that the NVM |
| 1456 | * was prepared by OEM software and did not calculate the |
| 1457 | * checksum...a likely scenario. |
| 1458 | */ |
| 1459 | ret_val = e1000_read_nvm(hw, 0x19, 1, &data); |
| 1460 | if (ret_val) |
| 1461 | return ret_val; |
| 1462 | |
| 1463 | if ((data & 0x40) == 0) { |
| 1464 | data |= 0x40; |
| 1465 | ret_val = e1000_write_nvm(hw, 0x19, 1, &data); |
| 1466 | if (ret_val) |
| 1467 | return ret_val; |
| 1468 | ret_val = e1000e_update_nvm_checksum(hw); |
| 1469 | if (ret_val) |
| 1470 | return ret_val; |
| 1471 | } |
| 1472 | |
| 1473 | return e1000e_validate_nvm_checksum_generic(hw); |
| 1474 | } |
| 1475 | |
| 1476 | /** |
| 1477 | * e1000_write_flash_data_ich8lan - Writes bytes to the NVM |
| 1478 | * @hw: pointer to the HW structure |
| 1479 | * @offset: The offset (in bytes) of the byte/word to read. |
| 1480 | * @size: Size of data to read, 1=byte 2=word |
| 1481 | * @data: The byte(s) to write to the NVM. |
| 1482 | * |
| 1483 | * Writes one/two bytes to the NVM using the flash access registers. |
| 1484 | **/ |
| 1485 | static s32 e1000_write_flash_data_ich8lan(struct e1000_hw *hw, u32 offset, |
| 1486 | u8 size, u16 data) |
| 1487 | { |
| 1488 | union ich8_hws_flash_status hsfsts; |
| 1489 | union ich8_hws_flash_ctrl hsflctl; |
| 1490 | u32 flash_linear_addr; |
| 1491 | u32 flash_data = 0; |
| 1492 | s32 ret_val; |
| 1493 | u8 count = 0; |
| 1494 | |
| 1495 | if (size < 1 || size > 2 || data > size * 0xff || |
| 1496 | offset > ICH_FLASH_LINEAR_ADDR_MASK) |
| 1497 | return -E1000_ERR_NVM; |
| 1498 | |
| 1499 | flash_linear_addr = (ICH_FLASH_LINEAR_ADDR_MASK & offset) + |
| 1500 | hw->nvm.flash_base_addr; |
| 1501 | |
| 1502 | do { |
| 1503 | udelay(1); |
| 1504 | /* Steps */ |
| 1505 | ret_val = e1000_flash_cycle_init_ich8lan(hw); |
| 1506 | if (ret_val) |
| 1507 | break; |
| 1508 | |
| 1509 | hsflctl.regval = er16flash(ICH_FLASH_HSFCTL); |
| 1510 | /* 0b/1b corresponds to 1 or 2 byte size, respectively. */ |
| 1511 | hsflctl.hsf_ctrl.fldbcount = size -1; |
| 1512 | hsflctl.hsf_ctrl.flcycle = ICH_CYCLE_WRITE; |
| 1513 | ew16flash(ICH_FLASH_HSFCTL, hsflctl.regval); |
| 1514 | |
| 1515 | ew32flash(ICH_FLASH_FADDR, flash_linear_addr); |
| 1516 | |
| 1517 | if (size == 1) |
| 1518 | flash_data = (u32)data & 0x00FF; |
| 1519 | else |
| 1520 | flash_data = (u32)data; |
| 1521 | |
| 1522 | ew32flash(ICH_FLASH_FDATA0, flash_data); |
| 1523 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1524 | /* |
| 1525 | * check if FCERR is set to 1 , if set to 1, clear it |
| 1526 | * and try the whole sequence a few more times else done |
| 1527 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1528 | ret_val = e1000_flash_cycle_ich8lan(hw, |
| 1529 | ICH_FLASH_WRITE_COMMAND_TIMEOUT); |
| 1530 | if (!ret_val) |
| 1531 | break; |
| 1532 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1533 | /* |
| 1534 | * If we're here, then things are most likely |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1535 | * completely hosed, but if the error condition |
| 1536 | * is detected, it won't hurt to give it another |
| 1537 | * try...ICH_FLASH_CYCLE_REPEAT_COUNT times. |
| 1538 | */ |
| 1539 | hsfsts.regval = er16flash(ICH_FLASH_HSFSTS); |
| 1540 | if (hsfsts.hsf_status.flcerr == 1) |
| 1541 | /* Repeat for some time before giving up. */ |
| 1542 | continue; |
| 1543 | if (hsfsts.hsf_status.flcdone == 0) { |
| 1544 | hw_dbg(hw, "Timeout error - flash cycle " |
| 1545 | "did not complete."); |
| 1546 | break; |
| 1547 | } |
| 1548 | } while (count++ < ICH_FLASH_CYCLE_REPEAT_COUNT); |
| 1549 | |
| 1550 | return ret_val; |
| 1551 | } |
| 1552 | |
| 1553 | /** |
| 1554 | * e1000_write_flash_byte_ich8lan - Write a single byte to NVM |
| 1555 | * @hw: pointer to the HW structure |
| 1556 | * @offset: The index of the byte to read. |
| 1557 | * @data: The byte to write to the NVM. |
| 1558 | * |
| 1559 | * Writes a single byte to the NVM using the flash access registers. |
| 1560 | **/ |
| 1561 | static s32 e1000_write_flash_byte_ich8lan(struct e1000_hw *hw, u32 offset, |
| 1562 | u8 data) |
| 1563 | { |
| 1564 | u16 word = (u16)data; |
| 1565 | |
| 1566 | return e1000_write_flash_data_ich8lan(hw, offset, 1, word); |
| 1567 | } |
| 1568 | |
| 1569 | /** |
| 1570 | * e1000_retry_write_flash_byte_ich8lan - Writes a single byte to NVM |
| 1571 | * @hw: pointer to the HW structure |
| 1572 | * @offset: The offset of the byte to write. |
| 1573 | * @byte: The byte to write to the NVM. |
| 1574 | * |
| 1575 | * Writes a single byte to the NVM using the flash access registers. |
| 1576 | * Goes through a retry algorithm before giving up. |
| 1577 | **/ |
| 1578 | static s32 e1000_retry_write_flash_byte_ich8lan(struct e1000_hw *hw, |
| 1579 | u32 offset, u8 byte) |
| 1580 | { |
| 1581 | s32 ret_val; |
| 1582 | u16 program_retries; |
| 1583 | |
| 1584 | ret_val = e1000_write_flash_byte_ich8lan(hw, offset, byte); |
| 1585 | if (!ret_val) |
| 1586 | return ret_val; |
| 1587 | |
| 1588 | for (program_retries = 0; program_retries < 100; program_retries++) { |
| 1589 | hw_dbg(hw, "Retrying Byte %2.2X at offset %u\n", byte, offset); |
| 1590 | udelay(100); |
| 1591 | ret_val = e1000_write_flash_byte_ich8lan(hw, offset, byte); |
| 1592 | if (!ret_val) |
| 1593 | break; |
| 1594 | } |
| 1595 | if (program_retries == 100) |
| 1596 | return -E1000_ERR_NVM; |
| 1597 | |
| 1598 | return 0; |
| 1599 | } |
| 1600 | |
| 1601 | /** |
| 1602 | * e1000_erase_flash_bank_ich8lan - Erase a bank (4k) from NVM |
| 1603 | * @hw: pointer to the HW structure |
| 1604 | * @bank: 0 for first bank, 1 for second bank, etc. |
| 1605 | * |
| 1606 | * Erases the bank specified. Each bank is a 4k block. Banks are 0 based. |
| 1607 | * bank N is 4096 * N + flash_reg_addr. |
| 1608 | **/ |
| 1609 | static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank) |
| 1610 | { |
| 1611 | struct e1000_nvm_info *nvm = &hw->nvm; |
| 1612 | union ich8_hws_flash_status hsfsts; |
| 1613 | union ich8_hws_flash_ctrl hsflctl; |
| 1614 | u32 flash_linear_addr; |
| 1615 | /* bank size is in 16bit words - adjust to bytes */ |
| 1616 | u32 flash_bank_size = nvm->flash_bank_size * 2; |
| 1617 | s32 ret_val; |
| 1618 | s32 count = 0; |
| 1619 | s32 iteration; |
| 1620 | s32 sector_size; |
| 1621 | s32 j; |
| 1622 | |
| 1623 | hsfsts.regval = er16flash(ICH_FLASH_HSFSTS); |
| 1624 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1625 | /* |
| 1626 | * Determine HW Sector size: Read BERASE bits of hw flash status |
| 1627 | * register |
| 1628 | * 00: The Hw sector is 256 bytes, hence we need to erase 16 |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1629 | * consecutive sectors. The start index for the nth Hw sector |
| 1630 | * can be calculated as = bank * 4096 + n * 256 |
| 1631 | * 01: The Hw sector is 4K bytes, hence we need to erase 1 sector. |
| 1632 | * The start index for the nth Hw sector can be calculated |
| 1633 | * as = bank * 4096 |
| 1634 | * 10: The Hw sector is 8K bytes, nth sector = bank * 8192 |
| 1635 | * (ich9 only, otherwise error condition) |
| 1636 | * 11: The Hw sector is 64K bytes, nth sector = bank * 65536 |
| 1637 | */ |
| 1638 | switch (hsfsts.hsf_status.berasesz) { |
| 1639 | case 0: |
| 1640 | /* Hw sector size 256 */ |
| 1641 | sector_size = ICH_FLASH_SEG_SIZE_256; |
| 1642 | iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_256; |
| 1643 | break; |
| 1644 | case 1: |
| 1645 | sector_size = ICH_FLASH_SEG_SIZE_4K; |
| 1646 | iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_4K; |
| 1647 | break; |
| 1648 | case 2: |
| 1649 | if (hw->mac.type == e1000_ich9lan) { |
| 1650 | sector_size = ICH_FLASH_SEG_SIZE_8K; |
| 1651 | iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_8K; |
| 1652 | } else { |
| 1653 | return -E1000_ERR_NVM; |
| 1654 | } |
| 1655 | break; |
| 1656 | case 3: |
| 1657 | sector_size = ICH_FLASH_SEG_SIZE_64K; |
| 1658 | iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_64K; |
| 1659 | break; |
| 1660 | default: |
| 1661 | return -E1000_ERR_NVM; |
| 1662 | } |
| 1663 | |
| 1664 | /* Start with the base address, then add the sector offset. */ |
| 1665 | flash_linear_addr = hw->nvm.flash_base_addr; |
| 1666 | flash_linear_addr += (bank) ? (sector_size * iteration) : 0; |
| 1667 | |
| 1668 | for (j = 0; j < iteration ; j++) { |
| 1669 | do { |
| 1670 | /* Steps */ |
| 1671 | ret_val = e1000_flash_cycle_init_ich8lan(hw); |
| 1672 | if (ret_val) |
| 1673 | return ret_val; |
| 1674 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1675 | /* |
| 1676 | * Write a value 11 (block Erase) in Flash |
| 1677 | * Cycle field in hw flash control |
| 1678 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1679 | hsflctl.regval = er16flash(ICH_FLASH_HSFCTL); |
| 1680 | hsflctl.hsf_ctrl.flcycle = ICH_CYCLE_ERASE; |
| 1681 | ew16flash(ICH_FLASH_HSFCTL, hsflctl.regval); |
| 1682 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1683 | /* |
| 1684 | * Write the last 24 bits of an index within the |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1685 | * block into Flash Linear address field in Flash |
| 1686 | * Address. |
| 1687 | */ |
| 1688 | flash_linear_addr += (j * sector_size); |
| 1689 | ew32flash(ICH_FLASH_FADDR, flash_linear_addr); |
| 1690 | |
| 1691 | ret_val = e1000_flash_cycle_ich8lan(hw, |
| 1692 | ICH_FLASH_ERASE_COMMAND_TIMEOUT); |
| 1693 | if (ret_val == 0) |
| 1694 | break; |
| 1695 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1696 | /* |
| 1697 | * Check if FCERR is set to 1. If 1, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1698 | * clear it and try the whole sequence |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1699 | * a few more times else Done |
| 1700 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1701 | hsfsts.regval = er16flash(ICH_FLASH_HSFSTS); |
| 1702 | if (hsfsts.hsf_status.flcerr == 1) |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1703 | /* repeat for some time before giving up */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1704 | continue; |
| 1705 | else if (hsfsts.hsf_status.flcdone == 0) |
| 1706 | return ret_val; |
| 1707 | } while (++count < ICH_FLASH_CYCLE_REPEAT_COUNT); |
| 1708 | } |
| 1709 | |
| 1710 | return 0; |
| 1711 | } |
| 1712 | |
| 1713 | /** |
| 1714 | * e1000_valid_led_default_ich8lan - Set the default LED settings |
| 1715 | * @hw: pointer to the HW structure |
| 1716 | * @data: Pointer to the LED settings |
| 1717 | * |
| 1718 | * Reads the LED default settings from the NVM to data. If the NVM LED |
| 1719 | * settings is all 0's or F's, set the LED default to a valid LED default |
| 1720 | * setting. |
| 1721 | **/ |
| 1722 | static s32 e1000_valid_led_default_ich8lan(struct e1000_hw *hw, u16 *data) |
| 1723 | { |
| 1724 | s32 ret_val; |
| 1725 | |
| 1726 | ret_val = e1000_read_nvm(hw, NVM_ID_LED_SETTINGS, 1, data); |
| 1727 | if (ret_val) { |
| 1728 | hw_dbg(hw, "NVM Read Error\n"); |
| 1729 | return ret_val; |
| 1730 | } |
| 1731 | |
| 1732 | if (*data == ID_LED_RESERVED_0000 || |
| 1733 | *data == ID_LED_RESERVED_FFFF) |
| 1734 | *data = ID_LED_DEFAULT_ICH8LAN; |
| 1735 | |
| 1736 | return 0; |
| 1737 | } |
| 1738 | |
| 1739 | /** |
| 1740 | * e1000_get_bus_info_ich8lan - Get/Set the bus type and width |
| 1741 | * @hw: pointer to the HW structure |
| 1742 | * |
| 1743 | * ICH8 use the PCI Express bus, but does not contain a PCI Express Capability |
| 1744 | * register, so the the bus width is hard coded. |
| 1745 | **/ |
| 1746 | static s32 e1000_get_bus_info_ich8lan(struct e1000_hw *hw) |
| 1747 | { |
| 1748 | struct e1000_bus_info *bus = &hw->bus; |
| 1749 | s32 ret_val; |
| 1750 | |
| 1751 | ret_val = e1000e_get_bus_info_pcie(hw); |
| 1752 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1753 | /* |
| 1754 | * ICH devices are "PCI Express"-ish. They have |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1755 | * a configuration space, but do not contain |
| 1756 | * PCI Express Capability registers, so bus width |
| 1757 | * must be hardcoded. |
| 1758 | */ |
| 1759 | if (bus->width == e1000_bus_width_unknown) |
| 1760 | bus->width = e1000_bus_width_pcie_x1; |
| 1761 | |
| 1762 | return ret_val; |
| 1763 | } |
| 1764 | |
| 1765 | /** |
| 1766 | * e1000_reset_hw_ich8lan - Reset the hardware |
| 1767 | * @hw: pointer to the HW structure |
| 1768 | * |
| 1769 | * Does a full reset of the hardware which includes a reset of the PHY and |
| 1770 | * MAC. |
| 1771 | **/ |
| 1772 | static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) |
| 1773 | { |
| 1774 | u32 ctrl, icr, kab; |
| 1775 | s32 ret_val; |
| 1776 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1777 | /* |
| 1778 | * 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] | 1779 | * on the last TLP read/write transaction when MAC is reset. |
| 1780 | */ |
| 1781 | ret_val = e1000e_disable_pcie_master(hw); |
| 1782 | if (ret_val) { |
| 1783 | hw_dbg(hw, "PCI-E Master disable polling has failed.\n"); |
| 1784 | } |
| 1785 | |
| 1786 | hw_dbg(hw, "Masking off all interrupts\n"); |
| 1787 | ew32(IMC, 0xffffffff); |
| 1788 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1789 | /* |
| 1790 | * Disable the Transmit and Receive units. Then delay to allow |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1791 | * any pending transactions to complete before we hit the MAC |
| 1792 | * with the global reset. |
| 1793 | */ |
| 1794 | ew32(RCTL, 0); |
| 1795 | ew32(TCTL, E1000_TCTL_PSP); |
| 1796 | e1e_flush(); |
| 1797 | |
| 1798 | msleep(10); |
| 1799 | |
| 1800 | /* Workaround for ICH8 bit corruption issue in FIFO memory */ |
| 1801 | if (hw->mac.type == e1000_ich8lan) { |
| 1802 | /* Set Tx and Rx buffer allocation to 8k apiece. */ |
| 1803 | ew32(PBA, E1000_PBA_8K); |
| 1804 | /* Set Packet Buffer Size to 16k. */ |
| 1805 | ew32(PBS, E1000_PBS_16K); |
| 1806 | } |
| 1807 | |
| 1808 | ctrl = er32(CTRL); |
| 1809 | |
| 1810 | if (!e1000_check_reset_block(hw)) { |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1811 | /* |
| 1812 | * PHY HW reset requires MAC CORE reset at the same |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1813 | * time to make sure the interface between MAC and the |
| 1814 | * external PHY is reset. |
| 1815 | */ |
| 1816 | ctrl |= E1000_CTRL_PHY_RST; |
| 1817 | } |
| 1818 | ret_val = e1000_acquire_swflag_ich8lan(hw); |
| 1819 | hw_dbg(hw, "Issuing a global reset to ich8lan"); |
| 1820 | ew32(CTRL, (ctrl | E1000_CTRL_RST)); |
| 1821 | msleep(20); |
| 1822 | |
| 1823 | ret_val = e1000e_get_auto_rd_done(hw); |
| 1824 | if (ret_val) { |
| 1825 | /* |
| 1826 | * When auto config read does not complete, do not |
| 1827 | * return with an error. This can happen in situations |
| 1828 | * where there is no eeprom and prevents getting link. |
| 1829 | */ |
| 1830 | hw_dbg(hw, "Auto Read Done did not complete\n"); |
| 1831 | } |
| 1832 | |
| 1833 | ew32(IMC, 0xffffffff); |
| 1834 | icr = er32(ICR); |
| 1835 | |
| 1836 | kab = er32(KABGTXD); |
| 1837 | kab |= E1000_KABGTXD_BGSQLBIAS; |
| 1838 | ew32(KABGTXD, kab); |
| 1839 | |
| 1840 | return ret_val; |
| 1841 | } |
| 1842 | |
| 1843 | /** |
| 1844 | * e1000_init_hw_ich8lan - Initialize the hardware |
| 1845 | * @hw: pointer to the HW structure |
| 1846 | * |
| 1847 | * Prepares the hardware for transmit and receive by doing the following: |
| 1848 | * - initialize hardware bits |
| 1849 | * - initialize LED identification |
| 1850 | * - setup receive address registers |
| 1851 | * - setup flow control |
Auke Kok | 489815c | 2008-02-21 15:11:07 -0800 | [diff] [blame] | 1852 | * - setup transmit descriptors |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1853 | * - clear statistics |
| 1854 | **/ |
| 1855 | static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw) |
| 1856 | { |
| 1857 | struct e1000_mac_info *mac = &hw->mac; |
| 1858 | u32 ctrl_ext, txdctl, snoop; |
| 1859 | s32 ret_val; |
| 1860 | u16 i; |
| 1861 | |
| 1862 | e1000_initialize_hw_bits_ich8lan(hw); |
| 1863 | |
| 1864 | /* Initialize identification LED */ |
| 1865 | ret_val = e1000e_id_led_init(hw); |
| 1866 | if (ret_val) { |
| 1867 | hw_dbg(hw, "Error initializing identification LED\n"); |
| 1868 | return ret_val; |
| 1869 | } |
| 1870 | |
| 1871 | /* Setup the receive address. */ |
| 1872 | e1000e_init_rx_addrs(hw, mac->rar_entry_count); |
| 1873 | |
| 1874 | /* Zero out the Multicast HASH table */ |
| 1875 | hw_dbg(hw, "Zeroing the MTA\n"); |
| 1876 | for (i = 0; i < mac->mta_reg_count; i++) |
| 1877 | E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); |
| 1878 | |
| 1879 | /* Setup link and flow control */ |
| 1880 | ret_val = e1000_setup_link_ich8lan(hw); |
| 1881 | |
| 1882 | /* Set the transmit descriptor write-back policy for both queues */ |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1883 | txdctl = er32(TXDCTL(0)); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1884 | txdctl = (txdctl & ~E1000_TXDCTL_WTHRESH) | |
| 1885 | E1000_TXDCTL_FULL_TX_DESC_WB; |
| 1886 | txdctl = (txdctl & ~E1000_TXDCTL_PTHRESH) | |
| 1887 | E1000_TXDCTL_MAX_TX_DESC_PREFETCH; |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1888 | ew32(TXDCTL(0), txdctl); |
| 1889 | txdctl = er32(TXDCTL(1)); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1890 | txdctl = (txdctl & ~E1000_TXDCTL_WTHRESH) | |
| 1891 | E1000_TXDCTL_FULL_TX_DESC_WB; |
| 1892 | txdctl = (txdctl & ~E1000_TXDCTL_PTHRESH) | |
| 1893 | E1000_TXDCTL_MAX_TX_DESC_PREFETCH; |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1894 | ew32(TXDCTL(1), txdctl); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1895 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1896 | /* |
| 1897 | * ICH8 has opposite polarity of no_snoop bits. |
| 1898 | * By default, we should use snoop behavior. |
| 1899 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1900 | if (mac->type == e1000_ich8lan) |
| 1901 | snoop = PCIE_ICH8_SNOOP_ALL; |
| 1902 | else |
| 1903 | snoop = (u32) ~(PCIE_NO_SNOOP_ALL); |
| 1904 | e1000e_set_pcie_no_snoop(hw, snoop); |
| 1905 | |
| 1906 | ctrl_ext = er32(CTRL_EXT); |
| 1907 | ctrl_ext |= E1000_CTRL_EXT_RO_DIS; |
| 1908 | ew32(CTRL_EXT, ctrl_ext); |
| 1909 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1910 | /* |
| 1911 | * Clear all of the statistics registers (clear on read). It is |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1912 | * important that we do this after we have tried to establish link |
| 1913 | * because the symbol error count will increment wildly if there |
| 1914 | * is no link. |
| 1915 | */ |
| 1916 | e1000_clear_hw_cntrs_ich8lan(hw); |
| 1917 | |
| 1918 | return 0; |
| 1919 | } |
| 1920 | /** |
| 1921 | * e1000_initialize_hw_bits_ich8lan - Initialize required hardware bits |
| 1922 | * @hw: pointer to the HW structure |
| 1923 | * |
| 1924 | * Sets/Clears required hardware bits necessary for correctly setting up the |
| 1925 | * hardware for transmit and receive. |
| 1926 | **/ |
| 1927 | static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw) |
| 1928 | { |
| 1929 | u32 reg; |
| 1930 | |
| 1931 | /* Extended Device Control */ |
| 1932 | reg = er32(CTRL_EXT); |
| 1933 | reg |= (1 << 22); |
| 1934 | ew32(CTRL_EXT, reg); |
| 1935 | |
| 1936 | /* Transmit Descriptor Control 0 */ |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1937 | reg = er32(TXDCTL(0)); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1938 | reg |= (1 << 22); |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1939 | ew32(TXDCTL(0), reg); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1940 | |
| 1941 | /* Transmit Descriptor Control 1 */ |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1942 | reg = er32(TXDCTL(1)); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1943 | reg |= (1 << 22); |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1944 | ew32(TXDCTL(1), reg); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1945 | |
| 1946 | /* Transmit Arbitration Control 0 */ |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1947 | reg = er32(TARC(0)); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1948 | if (hw->mac.type == e1000_ich8lan) |
| 1949 | reg |= (1 << 28) | (1 << 29); |
| 1950 | reg |= (1 << 23) | (1 << 24) | (1 << 26) | (1 << 27); |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1951 | ew32(TARC(0), reg); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1952 | |
| 1953 | /* Transmit Arbitration Control 1 */ |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1954 | reg = er32(TARC(1)); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1955 | if (er32(TCTL) & E1000_TCTL_MULR) |
| 1956 | reg &= ~(1 << 28); |
| 1957 | else |
| 1958 | reg |= (1 << 28); |
| 1959 | reg |= (1 << 24) | (1 << 26) | (1 << 30); |
Jeff Kirsher | e9ec2c0 | 2008-04-02 13:48:13 -0700 | [diff] [blame] | 1960 | ew32(TARC(1), reg); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1961 | |
| 1962 | /* Device Status */ |
| 1963 | if (hw->mac.type == e1000_ich8lan) { |
| 1964 | reg = er32(STATUS); |
| 1965 | reg &= ~(1 << 31); |
| 1966 | ew32(STATUS, reg); |
| 1967 | } |
| 1968 | } |
| 1969 | |
| 1970 | /** |
| 1971 | * e1000_setup_link_ich8lan - Setup flow control and link settings |
| 1972 | * @hw: pointer to the HW structure |
| 1973 | * |
| 1974 | * Determines which flow control settings to use, then configures flow |
| 1975 | * control. Calls the appropriate media-specific link configuration |
| 1976 | * function. Assuming the adapter has a valid link partner, a valid link |
| 1977 | * should be established. Assumes the hardware has previously been reset |
| 1978 | * and the transmitter and receiver are not enabled. |
| 1979 | **/ |
| 1980 | static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw) |
| 1981 | { |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1982 | s32 ret_val; |
| 1983 | |
| 1984 | if (e1000_check_reset_block(hw)) |
| 1985 | return 0; |
| 1986 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 1987 | /* |
| 1988 | * ICH parts do not have a word in the NVM to determine |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1989 | * the default flow control setting, so we explicitly |
| 1990 | * set it to full. |
| 1991 | */ |
Jeff Kirsher | 318a94d | 2008-03-28 09:15:16 -0700 | [diff] [blame] | 1992 | if (hw->fc.type == e1000_fc_default) |
| 1993 | hw->fc.type = e1000_fc_full; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1994 | |
Jeff Kirsher | 318a94d | 2008-03-28 09:15:16 -0700 | [diff] [blame] | 1995 | hw->fc.original_type = hw->fc.type; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1996 | |
Jeff Kirsher | 318a94d | 2008-03-28 09:15:16 -0700 | [diff] [blame] | 1997 | hw_dbg(hw, "After fix-ups FlowControl is now = %x\n", hw->fc.type); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1998 | |
| 1999 | /* Continue to configure the copper link. */ |
| 2000 | ret_val = e1000_setup_copper_link_ich8lan(hw); |
| 2001 | if (ret_val) |
| 2002 | return ret_val; |
| 2003 | |
Jeff Kirsher | 318a94d | 2008-03-28 09:15:16 -0700 | [diff] [blame] | 2004 | ew32(FCTTV, hw->fc.pause_time); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2005 | |
| 2006 | return e1000e_set_fc_watermarks(hw); |
| 2007 | } |
| 2008 | |
| 2009 | /** |
| 2010 | * e1000_setup_copper_link_ich8lan - Configure MAC/PHY interface |
| 2011 | * @hw: pointer to the HW structure |
| 2012 | * |
| 2013 | * Configures the kumeran interface to the PHY to wait the appropriate time |
| 2014 | * when polling the PHY, then call the generic setup_copper_link to finish |
| 2015 | * configuring the copper link. |
| 2016 | **/ |
| 2017 | static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw) |
| 2018 | { |
| 2019 | u32 ctrl; |
| 2020 | s32 ret_val; |
| 2021 | u16 reg_data; |
| 2022 | |
| 2023 | ctrl = er32(CTRL); |
| 2024 | ctrl |= E1000_CTRL_SLU; |
| 2025 | ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); |
| 2026 | ew32(CTRL, ctrl); |
| 2027 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 2028 | /* |
| 2029 | * Set the mac to wait the maximum time between each iteration |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2030 | * and increase the max iterations when polling the phy; |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 2031 | * this fixes erroneous timeouts at 10Mbps. |
| 2032 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2033 | ret_val = e1000e_write_kmrn_reg(hw, GG82563_REG(0x34, 4), 0xFFFF); |
| 2034 | if (ret_val) |
| 2035 | return ret_val; |
| 2036 | ret_val = e1000e_read_kmrn_reg(hw, GG82563_REG(0x34, 9), ®_data); |
| 2037 | if (ret_val) |
| 2038 | return ret_val; |
| 2039 | reg_data |= 0x3F; |
| 2040 | ret_val = e1000e_write_kmrn_reg(hw, GG82563_REG(0x34, 9), reg_data); |
| 2041 | if (ret_val) |
| 2042 | return ret_val; |
| 2043 | |
| 2044 | if (hw->phy.type == e1000_phy_igp_3) { |
| 2045 | ret_val = e1000e_copper_link_setup_igp(hw); |
| 2046 | if (ret_val) |
| 2047 | return ret_val; |
Bruce Allan | 97ac8ca | 2008-04-29 09:16:05 -0700 | [diff] [blame] | 2048 | } else if (hw->phy.type == e1000_phy_bm) { |
| 2049 | ret_val = e1000e_copper_link_setup_m88(hw); |
| 2050 | if (ret_val) |
| 2051 | return ret_val; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2052 | } |
| 2053 | |
Bruce Allan | 97ac8ca | 2008-04-29 09:16:05 -0700 | [diff] [blame] | 2054 | if (hw->phy.type == e1000_phy_ife) { |
| 2055 | ret_val = e1e_rphy(hw, IFE_PHY_MDIX_CONTROL, ®_data); |
| 2056 | if (ret_val) |
| 2057 | return ret_val; |
| 2058 | |
| 2059 | reg_data &= ~IFE_PMC_AUTO_MDIX; |
| 2060 | |
| 2061 | switch (hw->phy.mdix) { |
| 2062 | case 1: |
| 2063 | reg_data &= ~IFE_PMC_FORCE_MDIX; |
| 2064 | break; |
| 2065 | case 2: |
| 2066 | reg_data |= IFE_PMC_FORCE_MDIX; |
| 2067 | break; |
| 2068 | case 0: |
| 2069 | default: |
| 2070 | reg_data |= IFE_PMC_AUTO_MDIX; |
| 2071 | break; |
| 2072 | } |
| 2073 | ret_val = e1e_wphy(hw, IFE_PHY_MDIX_CONTROL, reg_data); |
| 2074 | if (ret_val) |
| 2075 | return ret_val; |
| 2076 | } |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2077 | return e1000e_setup_copper_link(hw); |
| 2078 | } |
| 2079 | |
| 2080 | /** |
| 2081 | * e1000_get_link_up_info_ich8lan - Get current link speed and duplex |
| 2082 | * @hw: pointer to the HW structure |
| 2083 | * @speed: pointer to store current link speed |
| 2084 | * @duplex: pointer to store the current link duplex |
| 2085 | * |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 2086 | * Calls the generic get_speed_and_duplex to retrieve the current link |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2087 | * information and then calls the Kumeran lock loss workaround for links at |
| 2088 | * gigabit speeds. |
| 2089 | **/ |
| 2090 | static s32 e1000_get_link_up_info_ich8lan(struct e1000_hw *hw, u16 *speed, |
| 2091 | u16 *duplex) |
| 2092 | { |
| 2093 | s32 ret_val; |
| 2094 | |
| 2095 | ret_val = e1000e_get_speed_and_duplex_copper(hw, speed, duplex); |
| 2096 | if (ret_val) |
| 2097 | return ret_val; |
| 2098 | |
| 2099 | if ((hw->mac.type == e1000_ich8lan) && |
| 2100 | (hw->phy.type == e1000_phy_igp_3) && |
| 2101 | (*speed == SPEED_1000)) { |
| 2102 | ret_val = e1000_kmrn_lock_loss_workaround_ich8lan(hw); |
| 2103 | } |
| 2104 | |
| 2105 | return ret_val; |
| 2106 | } |
| 2107 | |
| 2108 | /** |
| 2109 | * e1000_kmrn_lock_loss_workaround_ich8lan - Kumeran workaround |
| 2110 | * @hw: pointer to the HW structure |
| 2111 | * |
| 2112 | * Work-around for 82566 Kumeran PCS lock loss: |
| 2113 | * On link status change (i.e. PCI reset, speed change) and link is up and |
| 2114 | * speed is gigabit- |
| 2115 | * 0) if workaround is optionally disabled do nothing |
| 2116 | * 1) wait 1ms for Kumeran link to come up |
| 2117 | * 2) check Kumeran Diagnostic register PCS lock loss bit |
| 2118 | * 3) if not set the link is locked (all is good), otherwise... |
| 2119 | * 4) reset the PHY |
| 2120 | * 5) repeat up to 10 times |
| 2121 | * Note: this is only called for IGP3 copper when speed is 1gb. |
| 2122 | **/ |
| 2123 | static s32 e1000_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw) |
| 2124 | { |
| 2125 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; |
| 2126 | u32 phy_ctrl; |
| 2127 | s32 ret_val; |
| 2128 | u16 i, data; |
| 2129 | bool link; |
| 2130 | |
| 2131 | if (!dev_spec->kmrn_lock_loss_workaround_enabled) |
| 2132 | return 0; |
| 2133 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 2134 | /* |
| 2135 | * Make sure link is up before proceeding. If not just return. |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2136 | * Attempting this while link is negotiating fouled up link |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 2137 | * stability |
| 2138 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2139 | ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link); |
| 2140 | if (!link) |
| 2141 | return 0; |
| 2142 | |
| 2143 | for (i = 0; i < 10; i++) { |
| 2144 | /* read once to clear */ |
| 2145 | ret_val = e1e_rphy(hw, IGP3_KMRN_DIAG, &data); |
| 2146 | if (ret_val) |
| 2147 | return ret_val; |
| 2148 | /* and again to get new status */ |
| 2149 | ret_val = e1e_rphy(hw, IGP3_KMRN_DIAG, &data); |
| 2150 | if (ret_val) |
| 2151 | return ret_val; |
| 2152 | |
| 2153 | /* check for PCS lock */ |
| 2154 | if (!(data & IGP3_KMRN_DIAG_PCS_LOCK_LOSS)) |
| 2155 | return 0; |
| 2156 | |
| 2157 | /* Issue PHY reset */ |
| 2158 | e1000_phy_hw_reset(hw); |
| 2159 | mdelay(5); |
| 2160 | } |
| 2161 | /* Disable GigE link negotiation */ |
| 2162 | phy_ctrl = er32(PHY_CTRL); |
| 2163 | phy_ctrl |= (E1000_PHY_CTRL_GBE_DISABLE | |
| 2164 | E1000_PHY_CTRL_NOND0A_GBE_DISABLE); |
| 2165 | ew32(PHY_CTRL, phy_ctrl); |
| 2166 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 2167 | /* |
| 2168 | * Call gig speed drop workaround on Gig disable before accessing |
| 2169 | * any PHY registers |
| 2170 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2171 | e1000e_gig_downshift_workaround_ich8lan(hw); |
| 2172 | |
| 2173 | /* unable to acquire PCS lock */ |
| 2174 | return -E1000_ERR_PHY; |
| 2175 | } |
| 2176 | |
| 2177 | /** |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 2178 | * e1000_set_kmrn_lock_loss_workaround_ich8lan - Set Kumeran workaround state |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2179 | * @hw: pointer to the HW structure |
Auke Kok | 489815c | 2008-02-21 15:11:07 -0800 | [diff] [blame] | 2180 | * @state: boolean value used to set the current Kumeran workaround state |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2181 | * |
| 2182 | * If ICH8, set the current Kumeran workaround state (enabled - TRUE |
| 2183 | * /disabled - FALSE). |
| 2184 | **/ |
| 2185 | void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw, |
| 2186 | bool state) |
| 2187 | { |
| 2188 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; |
| 2189 | |
| 2190 | if (hw->mac.type != e1000_ich8lan) { |
| 2191 | hw_dbg(hw, "Workaround applies to ICH8 only.\n"); |
| 2192 | return; |
| 2193 | } |
| 2194 | |
| 2195 | dev_spec->kmrn_lock_loss_workaround_enabled = state; |
| 2196 | } |
| 2197 | |
| 2198 | /** |
| 2199 | * e1000_ipg3_phy_powerdown_workaround_ich8lan - Power down workaround on D3 |
| 2200 | * @hw: pointer to the HW structure |
| 2201 | * |
| 2202 | * Workaround for 82566 power-down on D3 entry: |
| 2203 | * 1) disable gigabit link |
| 2204 | * 2) write VR power-down enable |
| 2205 | * 3) read it back |
| 2206 | * Continue if successful, else issue LCD reset and repeat |
| 2207 | **/ |
| 2208 | void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw) |
| 2209 | { |
| 2210 | u32 reg; |
| 2211 | u16 data; |
| 2212 | u8 retry = 0; |
| 2213 | |
| 2214 | if (hw->phy.type != e1000_phy_igp_3) |
| 2215 | return; |
| 2216 | |
| 2217 | /* Try the workaround twice (if needed) */ |
| 2218 | do { |
| 2219 | /* Disable link */ |
| 2220 | reg = er32(PHY_CTRL); |
| 2221 | reg |= (E1000_PHY_CTRL_GBE_DISABLE | |
| 2222 | E1000_PHY_CTRL_NOND0A_GBE_DISABLE); |
| 2223 | ew32(PHY_CTRL, reg); |
| 2224 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 2225 | /* |
| 2226 | * Call gig speed drop workaround on Gig disable before |
| 2227 | * accessing any PHY registers |
| 2228 | */ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2229 | if (hw->mac.type == e1000_ich8lan) |
| 2230 | e1000e_gig_downshift_workaround_ich8lan(hw); |
| 2231 | |
| 2232 | /* Write VR power-down enable */ |
| 2233 | e1e_rphy(hw, IGP3_VR_CTRL, &data); |
| 2234 | data &= ~IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK; |
| 2235 | e1e_wphy(hw, IGP3_VR_CTRL, data | IGP3_VR_CTRL_MODE_SHUTDOWN); |
| 2236 | |
| 2237 | /* Read it back and test */ |
| 2238 | e1e_rphy(hw, IGP3_VR_CTRL, &data); |
| 2239 | data &= IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK; |
| 2240 | if ((data == IGP3_VR_CTRL_MODE_SHUTDOWN) || retry) |
| 2241 | break; |
| 2242 | |
| 2243 | /* Issue PHY reset and repeat at most one more time */ |
| 2244 | reg = er32(CTRL); |
| 2245 | ew32(CTRL, reg | E1000_CTRL_PHY_RST); |
| 2246 | retry++; |
| 2247 | } while (retry); |
| 2248 | } |
| 2249 | |
| 2250 | /** |
| 2251 | * e1000e_gig_downshift_workaround_ich8lan - WoL from S5 stops working |
| 2252 | * @hw: pointer to the HW structure |
| 2253 | * |
| 2254 | * Steps to take when dropping from 1Gb/s (eg. link cable removal (LSC), |
Auke Kok | 489815c | 2008-02-21 15:11:07 -0800 | [diff] [blame] | 2255 | * LPLU, Gig disable, MDIC PHY reset): |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2256 | * 1) Set Kumeran Near-end loopback |
| 2257 | * 2) Clear Kumeran Near-end loopback |
| 2258 | * Should only be called for ICH8[m] devices with IGP_3 Phy. |
| 2259 | **/ |
| 2260 | void e1000e_gig_downshift_workaround_ich8lan(struct e1000_hw *hw) |
| 2261 | { |
| 2262 | s32 ret_val; |
| 2263 | u16 reg_data; |
| 2264 | |
| 2265 | if ((hw->mac.type != e1000_ich8lan) || |
| 2266 | (hw->phy.type != e1000_phy_igp_3)) |
| 2267 | return; |
| 2268 | |
| 2269 | ret_val = e1000e_read_kmrn_reg(hw, E1000_KMRNCTRLSTA_DIAG_OFFSET, |
| 2270 | ®_data); |
| 2271 | if (ret_val) |
| 2272 | return; |
| 2273 | reg_data |= E1000_KMRNCTRLSTA_DIAG_NELPBK; |
| 2274 | ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_DIAG_OFFSET, |
| 2275 | reg_data); |
| 2276 | if (ret_val) |
| 2277 | return; |
| 2278 | reg_data &= ~E1000_KMRNCTRLSTA_DIAG_NELPBK; |
| 2279 | ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_DIAG_OFFSET, |
| 2280 | reg_data); |
| 2281 | } |
| 2282 | |
| 2283 | /** |
Bruce Allan | 97ac8ca | 2008-04-29 09:16:05 -0700 | [diff] [blame] | 2284 | * e1000e_disable_gig_wol_ich8lan - disable gig during WoL |
| 2285 | * @hw: pointer to the HW structure |
| 2286 | * |
| 2287 | * During S0 to Sx transition, it is possible the link remains at gig |
| 2288 | * instead of negotiating to a lower speed. Before going to Sx, set |
| 2289 | * 'LPLU Enabled' and 'Gig Disable' to force link speed negotiation |
| 2290 | * to a lower speed. |
| 2291 | * |
Bruce Allan | f4187b5 | 2008-08-26 18:36:50 -0700 | [diff] [blame] | 2292 | * Should only be called for ICH9 and ICH10 devices. |
Bruce Allan | 97ac8ca | 2008-04-29 09:16:05 -0700 | [diff] [blame] | 2293 | **/ |
| 2294 | void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw) |
| 2295 | { |
| 2296 | u32 phy_ctrl; |
| 2297 | |
Bruce Allan | f4187b5 | 2008-08-26 18:36:50 -0700 | [diff] [blame] | 2298 | if ((hw->mac.type == e1000_ich10lan) || |
| 2299 | (hw->mac.type == e1000_ich9lan)) { |
Bruce Allan | 97ac8ca | 2008-04-29 09:16:05 -0700 | [diff] [blame] | 2300 | phy_ctrl = er32(PHY_CTRL); |
| 2301 | phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU | |
| 2302 | E1000_PHY_CTRL_GBE_DISABLE; |
| 2303 | ew32(PHY_CTRL, phy_ctrl); |
| 2304 | } |
| 2305 | |
| 2306 | return; |
| 2307 | } |
| 2308 | |
| 2309 | /** |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2310 | * e1000_cleanup_led_ich8lan - Restore the default LED operation |
| 2311 | * @hw: pointer to the HW structure |
| 2312 | * |
| 2313 | * Return the LED back to the default configuration. |
| 2314 | **/ |
| 2315 | static s32 e1000_cleanup_led_ich8lan(struct e1000_hw *hw) |
| 2316 | { |
| 2317 | if (hw->phy.type == e1000_phy_ife) |
| 2318 | return e1e_wphy(hw, IFE_PHY_SPECIAL_CONTROL_LED, 0); |
| 2319 | |
| 2320 | ew32(LEDCTL, hw->mac.ledctl_default); |
| 2321 | return 0; |
| 2322 | } |
| 2323 | |
| 2324 | /** |
Auke Kok | 489815c | 2008-02-21 15:11:07 -0800 | [diff] [blame] | 2325 | * e1000_led_on_ich8lan - Turn LEDs on |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2326 | * @hw: pointer to the HW structure |
| 2327 | * |
Auke Kok | 489815c | 2008-02-21 15:11:07 -0800 | [diff] [blame] | 2328 | * Turn on the LEDs. |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2329 | **/ |
| 2330 | static s32 e1000_led_on_ich8lan(struct e1000_hw *hw) |
| 2331 | { |
| 2332 | if (hw->phy.type == e1000_phy_ife) |
| 2333 | return e1e_wphy(hw, IFE_PHY_SPECIAL_CONTROL_LED, |
| 2334 | (IFE_PSCL_PROBE_MODE | IFE_PSCL_PROBE_LEDS_ON)); |
| 2335 | |
| 2336 | ew32(LEDCTL, hw->mac.ledctl_mode2); |
| 2337 | return 0; |
| 2338 | } |
| 2339 | |
| 2340 | /** |
Auke Kok | 489815c | 2008-02-21 15:11:07 -0800 | [diff] [blame] | 2341 | * e1000_led_off_ich8lan - Turn LEDs off |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2342 | * @hw: pointer to the HW structure |
| 2343 | * |
Auke Kok | 489815c | 2008-02-21 15:11:07 -0800 | [diff] [blame] | 2344 | * Turn off the LEDs. |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2345 | **/ |
| 2346 | static s32 e1000_led_off_ich8lan(struct e1000_hw *hw) |
| 2347 | { |
| 2348 | if (hw->phy.type == e1000_phy_ife) |
| 2349 | return e1e_wphy(hw, IFE_PHY_SPECIAL_CONTROL_LED, |
| 2350 | (IFE_PSCL_PROBE_MODE | IFE_PSCL_PROBE_LEDS_OFF)); |
| 2351 | |
| 2352 | ew32(LEDCTL, hw->mac.ledctl_mode1); |
| 2353 | return 0; |
| 2354 | } |
| 2355 | |
| 2356 | /** |
Bruce Allan | f4187b5 | 2008-08-26 18:36:50 -0700 | [diff] [blame] | 2357 | * e1000_get_cfg_done_ich8lan - Read config done bit |
| 2358 | * @hw: pointer to the HW structure |
| 2359 | * |
| 2360 | * Read the management control register for the config done bit for |
| 2361 | * completion status. NOTE: silicon which is EEPROM-less will fail trying |
| 2362 | * to read the config done bit, so an error is *ONLY* logged and returns |
| 2363 | * E1000_SUCCESS. If we were to return with error, EEPROM-less silicon |
| 2364 | * would not be able to be reset or change link. |
| 2365 | **/ |
| 2366 | static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw) |
| 2367 | { |
| 2368 | u32 bank = 0; |
| 2369 | |
| 2370 | e1000e_get_cfg_done(hw); |
| 2371 | |
| 2372 | /* If EEPROM is not marked present, init the IGP 3 PHY manually */ |
| 2373 | if (hw->mac.type != e1000_ich10lan) { |
| 2374 | if (((er32(EECD) & E1000_EECD_PRES) == 0) && |
| 2375 | (hw->phy.type == e1000_phy_igp_3)) { |
| 2376 | e1000e_phy_init_script_igp3(hw); |
| 2377 | } |
| 2378 | } else { |
| 2379 | if (e1000_valid_nvm_bank_detect_ich8lan(hw, &bank)) { |
| 2380 | /* Maybe we should do a basic PHY config */ |
| 2381 | hw_dbg(hw, "EEPROM not present\n"); |
| 2382 | return -E1000_ERR_CONFIG; |
| 2383 | } |
| 2384 | } |
| 2385 | |
| 2386 | return 0; |
| 2387 | } |
| 2388 | |
| 2389 | /** |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2390 | * e1000_clear_hw_cntrs_ich8lan - Clear statistical counters |
| 2391 | * @hw: pointer to the HW structure |
| 2392 | * |
| 2393 | * Clears hardware counters specific to the silicon family and calls |
| 2394 | * clear_hw_cntrs_generic to clear all general purpose counters. |
| 2395 | **/ |
| 2396 | static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw) |
| 2397 | { |
| 2398 | u32 temp; |
| 2399 | |
| 2400 | e1000e_clear_hw_cntrs_base(hw); |
| 2401 | |
| 2402 | temp = er32(ALGNERRC); |
| 2403 | temp = er32(RXERRC); |
| 2404 | temp = er32(TNCRS); |
| 2405 | temp = er32(CEXTERR); |
| 2406 | temp = er32(TSCTC); |
| 2407 | temp = er32(TSCTFC); |
| 2408 | |
| 2409 | temp = er32(MGTPRC); |
| 2410 | temp = er32(MGTPDC); |
| 2411 | temp = er32(MGTPTC); |
| 2412 | |
| 2413 | temp = er32(IAC); |
| 2414 | temp = er32(ICRXOC); |
| 2415 | |
| 2416 | } |
| 2417 | |
| 2418 | static struct e1000_mac_operations ich8_mac_ops = { |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame^] | 2419 | .check_mng_mode = e1000_check_mng_mode_ich8lan, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2420 | .check_for_link = e1000e_check_for_copper_link, |
| 2421 | .cleanup_led = e1000_cleanup_led_ich8lan, |
| 2422 | .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan, |
| 2423 | .get_bus_info = e1000_get_bus_info_ich8lan, |
| 2424 | .get_link_up_info = e1000_get_link_up_info_ich8lan, |
| 2425 | .led_on = e1000_led_on_ich8lan, |
| 2426 | .led_off = e1000_led_off_ich8lan, |
Jeff Kirsher | e2de3eb | 2008-03-28 09:15:11 -0700 | [diff] [blame] | 2427 | .update_mc_addr_list = e1000e_update_mc_addr_list_generic, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2428 | .reset_hw = e1000_reset_hw_ich8lan, |
| 2429 | .init_hw = e1000_init_hw_ich8lan, |
| 2430 | .setup_link = e1000_setup_link_ich8lan, |
| 2431 | .setup_physical_interface= e1000_setup_copper_link_ich8lan, |
| 2432 | }; |
| 2433 | |
| 2434 | static struct e1000_phy_operations ich8_phy_ops = { |
| 2435 | .acquire_phy = e1000_acquire_swflag_ich8lan, |
| 2436 | .check_reset_block = e1000_check_reset_block_ich8lan, |
| 2437 | .commit_phy = NULL, |
| 2438 | .force_speed_duplex = e1000_phy_force_speed_duplex_ich8lan, |
Bruce Allan | f4187b5 | 2008-08-26 18:36:50 -0700 | [diff] [blame] | 2439 | .get_cfg_done = e1000_get_cfg_done_ich8lan, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2440 | .get_cable_length = e1000e_get_cable_length_igp_2, |
| 2441 | .get_phy_info = e1000_get_phy_info_ich8lan, |
| 2442 | .read_phy_reg = e1000e_read_phy_reg_igp, |
| 2443 | .release_phy = e1000_release_swflag_ich8lan, |
| 2444 | .reset_phy = e1000_phy_hw_reset_ich8lan, |
| 2445 | .set_d0_lplu_state = e1000_set_d0_lplu_state_ich8lan, |
| 2446 | .set_d3_lplu_state = e1000_set_d3_lplu_state_ich8lan, |
| 2447 | .write_phy_reg = e1000e_write_phy_reg_igp, |
| 2448 | }; |
| 2449 | |
| 2450 | static struct e1000_nvm_operations ich8_nvm_ops = { |
| 2451 | .acquire_nvm = e1000_acquire_swflag_ich8lan, |
| 2452 | .read_nvm = e1000_read_nvm_ich8lan, |
| 2453 | .release_nvm = e1000_release_swflag_ich8lan, |
| 2454 | .update_nvm = e1000_update_nvm_checksum_ich8lan, |
| 2455 | .valid_led_default = e1000_valid_led_default_ich8lan, |
| 2456 | .validate_nvm = e1000_validate_nvm_checksum_ich8lan, |
| 2457 | .write_nvm = e1000_write_nvm_ich8lan, |
| 2458 | }; |
| 2459 | |
| 2460 | struct e1000_info e1000_ich8_info = { |
| 2461 | .mac = e1000_ich8lan, |
| 2462 | .flags = FLAG_HAS_WOL |
Bruce Allan | 97ac8ca | 2008-04-29 09:16:05 -0700 | [diff] [blame] | 2463 | | FLAG_IS_ICH |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2464 | | FLAG_RX_CSUM_ENABLED |
| 2465 | | FLAG_HAS_CTRLEXT_ON_LOAD |
| 2466 | | FLAG_HAS_AMT |
| 2467 | | FLAG_HAS_FLASH |
| 2468 | | FLAG_APME_IN_WUC, |
| 2469 | .pba = 8, |
Jeff Kirsher | 69e3fd8 | 2008-04-02 13:48:18 -0700 | [diff] [blame] | 2470 | .get_variants = e1000_get_variants_ich8lan, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2471 | .mac_ops = &ich8_mac_ops, |
| 2472 | .phy_ops = &ich8_phy_ops, |
| 2473 | .nvm_ops = &ich8_nvm_ops, |
| 2474 | }; |
| 2475 | |
| 2476 | struct e1000_info e1000_ich9_info = { |
| 2477 | .mac = e1000_ich9lan, |
| 2478 | .flags = FLAG_HAS_JUMBO_FRAMES |
Bruce Allan | 97ac8ca | 2008-04-29 09:16:05 -0700 | [diff] [blame] | 2479 | | FLAG_IS_ICH |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2480 | | FLAG_HAS_WOL |
| 2481 | | FLAG_RX_CSUM_ENABLED |
| 2482 | | FLAG_HAS_CTRLEXT_ON_LOAD |
| 2483 | | FLAG_HAS_AMT |
| 2484 | | FLAG_HAS_ERT |
| 2485 | | FLAG_HAS_FLASH |
| 2486 | | FLAG_APME_IN_WUC, |
| 2487 | .pba = 10, |
Jeff Kirsher | 69e3fd8 | 2008-04-02 13:48:18 -0700 | [diff] [blame] | 2488 | .get_variants = e1000_get_variants_ich8lan, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 2489 | .mac_ops = &ich8_mac_ops, |
| 2490 | .phy_ops = &ich8_phy_ops, |
| 2491 | .nvm_ops = &ich8_nvm_ops, |
| 2492 | }; |
| 2493 | |
Bruce Allan | f4187b5 | 2008-08-26 18:36:50 -0700 | [diff] [blame] | 2494 | struct e1000_info e1000_ich10_info = { |
| 2495 | .mac = e1000_ich10lan, |
| 2496 | .flags = FLAG_HAS_JUMBO_FRAMES |
| 2497 | | FLAG_IS_ICH |
| 2498 | | FLAG_HAS_WOL |
| 2499 | | FLAG_RX_CSUM_ENABLED |
| 2500 | | FLAG_HAS_CTRLEXT_ON_LOAD |
| 2501 | | FLAG_HAS_AMT |
| 2502 | | FLAG_HAS_ERT |
| 2503 | | FLAG_HAS_FLASH |
| 2504 | | FLAG_APME_IN_WUC, |
| 2505 | .pba = 10, |
| 2506 | .get_variants = e1000_get_variants_ich8lan, |
| 2507 | .mac_ops = &ich8_mac_ops, |
| 2508 | .phy_ops = &ich8_phy_ops, |
| 2509 | .nvm_ops = &ich8_nvm_ops, |
| 2510 | }; |