1 /*******************************************************************************
3 Intel PRO/1000 Linux driver
4 Copyright(c) 1999 - 2010 Intel Corporation.
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.
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
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.
19 The full GNU General Public License is included in this distribution in
20 the file called "COPYING".
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
27 *******************************************************************************/
30 * 82562G 10/100 Network Connection
31 * 82562G-2 10/100 Network Connection
32 * 82562GT 10/100 Network Connection
33 * 82562GT-2 10/100 Network Connection
34 * 82562V 10/100 Network Connection
35 * 82562V-2 10/100 Network Connection
36 * 82566DC-2 Gigabit Network Connection
37 * 82566DC Gigabit Network Connection
38 * 82566DM-2 Gigabit Network Connection
39 * 82566DM Gigabit Network Connection
40 * 82566MC Gigabit Network Connection
41 * 82566MM Gigabit Network Connection
42 * 82567LM Gigabit Network Connection
43 * 82567LF Gigabit Network Connection
44 * 82567V Gigabit Network Connection
45 * 82567LM-2 Gigabit Network Connection
46 * 82567LF-2 Gigabit Network Connection
47 * 82567V-2 Gigabit Network Connection
48 * 82567LF-3 Gigabit Network Connection
49 * 82567LM-3 Gigabit Network Connection
50 * 82567LM-4 Gigabit Network Connection
51 * 82577LM Gigabit Network Connection
52 * 82577LC Gigabit Network Connection
53 * 82578DM Gigabit Network Connection
54 * 82578DC Gigabit Network Connection
55 * 82579LM Gigabit Network Connection
56 * 82579V Gigabit Network Connection
61 #define ICH_FLASH_GFPREG 0x0000
62 #define ICH_FLASH_HSFSTS 0x0004
63 #define ICH_FLASH_HSFCTL 0x0006
64 #define ICH_FLASH_FADDR 0x0008
65 #define ICH_FLASH_FDATA0 0x0010
66 #define ICH_FLASH_PR0 0x0074
68 #define ICH_FLASH_READ_COMMAND_TIMEOUT 500
69 #define ICH_FLASH_WRITE_COMMAND_TIMEOUT 500
70 #define ICH_FLASH_ERASE_COMMAND_TIMEOUT 3000000
71 #define ICH_FLASH_LINEAR_ADDR_MASK 0x00FFFFFF
72 #define ICH_FLASH_CYCLE_REPEAT_COUNT 10
74 #define ICH_CYCLE_READ 0
75 #define ICH_CYCLE_WRITE 2
76 #define ICH_CYCLE_ERASE 3
78 #define FLASH_GFPREG_BASE_MASK 0x1FFF
79 #define FLASH_SECTOR_ADDR_SHIFT 12
81 #define ICH_FLASH_SEG_SIZE_256 256
82 #define ICH_FLASH_SEG_SIZE_4K 4096
83 #define ICH_FLASH_SEG_SIZE_8K 8192
84 #define ICH_FLASH_SEG_SIZE_64K 65536
87 #define E1000_ICH_FWSM_RSPCIPHY 0x00000040 /* Reset PHY on PCI Reset */
88 /* FW established a valid mode */
89 #define E1000_ICH_FWSM_FW_VALID 0x00008000
91 #define E1000_ICH_MNG_IAMT_MODE 0x2
93 #define ID_LED_DEFAULT_ICH8LAN ((ID_LED_DEF1_DEF2 << 12) | \
94 (ID_LED_DEF1_OFF2 << 8) | \
95 (ID_LED_DEF1_ON2 << 4) | \
98 #define E1000_ICH_NVM_SIG_WORD 0x13
99 #define E1000_ICH_NVM_SIG_MASK 0xC000
100 #define E1000_ICH_NVM_VALID_SIG_MASK 0xC0
101 #define E1000_ICH_NVM_SIG_VALUE 0x80
103 #define E1000_ICH8_LAN_INIT_TIMEOUT 1500
105 #define E1000_FEXTNVM_SW_CONFIG 1
106 #define E1000_FEXTNVM_SW_CONFIG_ICH8M (1 << 27) /* Bit redefined for ICH8M :/ */
108 #define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL
110 #define E1000_ICH_RAR_ENTRIES 7
112 #define PHY_PAGE_SHIFT 5
113 #define PHY_REG(page, reg) (((page) << PHY_PAGE_SHIFT) | \
114 ((reg) & MAX_PHY_REG_ADDRESS))
115 #define IGP3_KMRN_DIAG PHY_REG(770, 19) /* KMRN Diagnostic */
116 #define IGP3_VR_CTRL PHY_REG(776, 18) /* Voltage Regulator Control */
118 #define IGP3_KMRN_DIAG_PCS_LOCK_LOSS 0x0002
119 #define IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK 0x0300
120 #define IGP3_VR_CTRL_MODE_SHUTDOWN 0x0200
122 #define HV_LED_CONFIG PHY_REG(768, 30) /* LED Configuration */
124 #define SW_FLAG_TIMEOUT 1000 /* SW Semaphore flag timeout in milliseconds */
126 /* SMBus Address Phy Register */
127 #define HV_SMB_ADDR PHY_REG(768, 26)
128 #define HV_SMB_ADDR_MASK 0x007F
129 #define HV_SMB_ADDR_PEC_EN 0x0200
130 #define HV_SMB_ADDR_VALID 0x0080
132 /* PHY Power Management Control */
133 #define HV_PM_CTRL PHY_REG(770, 17)
135 /* PHY Low Power Idle Control */
136 #define I82579_LPI_CTRL PHY_REG(772, 20)
137 #define I82579_LPI_CTRL_ENABLE_MASK 0x6000
139 /* Strapping Option Register - RO */
140 #define E1000_STRAP 0x0000C
141 #define E1000_STRAP_SMBUS_ADDRESS_MASK 0x00FE0000
142 #define E1000_STRAP_SMBUS_ADDRESS_SHIFT 17
144 /* OEM Bits Phy Register */
145 #define HV_OEM_BITS PHY_REG(768, 25)
146 #define HV_OEM_BITS_LPLU 0x0004 /* Low Power Link Up */
147 #define HV_OEM_BITS_GBE_DIS 0x0040 /* Gigabit Disable */
148 #define HV_OEM_BITS_RESTART_AN 0x0400 /* Restart Auto-negotiation */
150 #define E1000_NVM_K1_CONFIG 0x1B /* NVM K1 Config Word */
151 #define E1000_NVM_K1_ENABLE 0x1 /* NVM Enable K1 bit */
153 /* KMRN Mode Control */
154 #define HV_KMRN_MODE_CTRL PHY_REG(769, 16)
155 #define HV_KMRN_MDIO_SLOW 0x0400
157 /* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */
158 /* Offset 04h HSFSTS */
159 union ich8_hws_flash_status {
161 u16 flcdone :1; /* bit 0 Flash Cycle Done */
162 u16 flcerr :1; /* bit 1 Flash Cycle Error */
163 u16 dael :1; /* bit 2 Direct Access error Log */
164 u16 berasesz :2; /* bit 4:3 Sector Erase Size */
165 u16 flcinprog :1; /* bit 5 flash cycle in Progress */
166 u16 reserved1 :2; /* bit 13:6 Reserved */
167 u16 reserved2 :6; /* bit 13:6 Reserved */
168 u16 fldesvalid :1; /* bit 14 Flash Descriptor Valid */
169 u16 flockdn :1; /* bit 15 Flash Config Lock-Down */
174 /* ICH GbE Flash Hardware Sequencing Flash control Register bit breakdown */
175 /* Offset 06h FLCTL */
176 union ich8_hws_flash_ctrl {
177 struct ich8_hsflctl {
178 u16 flcgo :1; /* 0 Flash Cycle Go */
179 u16 flcycle :2; /* 2:1 Flash Cycle */
180 u16 reserved :5; /* 7:3 Reserved */
181 u16 fldbcount :2; /* 9:8 Flash Data Byte Count */
182 u16 flockdn :6; /* 15:10 Reserved */
187 /* ICH Flash Region Access Permissions */
188 union ich8_hws_flash_regacc {
190 u32 grra :8; /* 0:7 GbE region Read Access */
191 u32 grwa :8; /* 8:15 GbE region Write Access */
192 u32 gmrag :8; /* 23:16 GbE Master Read Access Grant */
193 u32 gmwag :8; /* 31:24 GbE Master Write Access Grant */
198 /* ICH Flash Protected Region */
199 union ich8_flash_protected_range {
201 u32 base:13; /* 0:12 Protected Range Base */
202 u32 reserved1:2; /* 13:14 Reserved */
203 u32 rpe:1; /* 15 Read Protection Enable */
204 u32 limit:13; /* 16:28 Protected Range Limit */
205 u32 reserved2:2; /* 29:30 Reserved */
206 u32 wpe:1; /* 31 Write Protection Enable */
211 static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw);
212 static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw);
213 static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw);
214 static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank);
215 static s32 e1000_retry_write_flash_byte_ich8lan(struct e1000_hw *hw,
216 u32 offset, u8 byte);
217 static s32 e1000_read_flash_byte_ich8lan(struct e1000_hw *hw, u32 offset,
219 static s32 e1000_read_flash_word_ich8lan(struct e1000_hw *hw, u32 offset,
221 static s32 e1000_read_flash_data_ich8lan(struct e1000_hw *hw, u32 offset,
223 static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw);
224 static s32 e1000_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw);
225 static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw);
226 static s32 e1000_cleanup_led_ich8lan(struct e1000_hw *hw);
227 static s32 e1000_led_on_ich8lan(struct e1000_hw *hw);
228 static s32 e1000_led_off_ich8lan(struct e1000_hw *hw);
229 static s32 e1000_id_led_init_pchlan(struct e1000_hw *hw);
230 static s32 e1000_setup_led_pchlan(struct e1000_hw *hw);
231 static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw);
232 static s32 e1000_led_on_pchlan(struct e1000_hw *hw);
233 static s32 e1000_led_off_pchlan(struct e1000_hw *hw);
234 static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active);
235 static void e1000_power_down_phy_copper_ich8lan(struct e1000_hw *hw);
236 static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw);
237 static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link);
238 static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw);
239 static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw);
240 static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw);
242 static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg)
244 return readw(hw->flash_address + reg);
247 static inline u32 __er32flash(struct e1000_hw *hw, unsigned long reg)
249 return readl(hw->flash_address + reg);
252 static inline void __ew16flash(struct e1000_hw *hw, unsigned long reg, u16 val)
254 writew(val, hw->flash_address + reg);
257 static inline void __ew32flash(struct e1000_hw *hw, unsigned long reg, u32 val)
259 writel(val, hw->flash_address + reg);
262 #define er16flash(reg) __er16flash(hw, (reg))
263 #define er32flash(reg) __er32flash(hw, (reg))
264 #define ew16flash(reg,val) __ew16flash(hw, (reg), (val))
265 #define ew32flash(reg,val) __ew32flash(hw, (reg), (val))
268 * e1000_init_phy_params_pchlan - Initialize PHY function pointers
269 * @hw: pointer to the HW structure
271 * Initialize family-specific PHY parameters and function pointers.
273 static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
275 struct e1000_phy_info *phy = &hw->phy;
280 phy->reset_delay_us = 100;
282 phy->ops.read_reg = e1000_read_phy_reg_hv;
283 phy->ops.read_reg_locked = e1000_read_phy_reg_hv_locked;
284 phy->ops.set_d0_lplu_state = e1000_set_lplu_state_pchlan;
285 phy->ops.set_d3_lplu_state = e1000_set_lplu_state_pchlan;
286 phy->ops.write_reg = e1000_write_phy_reg_hv;
287 phy->ops.write_reg_locked = e1000_write_phy_reg_hv_locked;
288 phy->ops.power_up = e1000_power_up_phy_copper;
289 phy->ops.power_down = e1000_power_down_phy_copper_ich8lan;
290 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
293 * The MAC-PHY interconnect may still be in SMBus mode
294 * after Sx->S0. If the manageability engine (ME) is
295 * disabled, then toggle the LANPHYPC Value bit to force
296 * the interconnect to PCIe mode.
298 if (!(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) {
300 ctrl |= E1000_CTRL_LANPHYPC_OVERRIDE;
301 ctrl &= ~E1000_CTRL_LANPHYPC_VALUE;
304 ctrl &= ~E1000_CTRL_LANPHYPC_OVERRIDE;
310 * Reset the PHY before any acccess to it. Doing so, ensures that
311 * the PHY is in a known good state before we read/write PHY registers.
312 * The generic reset is sufficient here, because we haven't determined
315 ret_val = e1000e_phy_hw_reset_generic(hw);
319 phy->id = e1000_phy_unknown;
320 ret_val = e1000e_get_phy_id(hw);
323 if ((phy->id == 0) || (phy->id == PHY_REVISION_MASK)) {
325 * In case the PHY needs to be in mdio slow mode (eg. 82577),
326 * set slow mode and try to get the PHY id again.
328 ret_val = e1000_set_mdio_slow_mode_hv(hw);
331 ret_val = e1000e_get_phy_id(hw);
335 phy->type = e1000e_get_phy_type_from_id(phy->id);
338 case e1000_phy_82577:
339 case e1000_phy_82579:
340 phy->ops.check_polarity = e1000_check_polarity_82577;
341 phy->ops.force_speed_duplex =
342 e1000_phy_force_speed_duplex_82577;
343 phy->ops.get_cable_length = e1000_get_cable_length_82577;
344 phy->ops.get_info = e1000_get_phy_info_82577;
345 phy->ops.commit = e1000e_phy_sw_reset;
347 case e1000_phy_82578:
348 phy->ops.check_polarity = e1000_check_polarity_m88;
349 phy->ops.force_speed_duplex = e1000e_phy_force_speed_duplex_m88;
350 phy->ops.get_cable_length = e1000e_get_cable_length_m88;
351 phy->ops.get_info = e1000e_get_phy_info_m88;
354 ret_val = -E1000_ERR_PHY;
363 * e1000_init_phy_params_ich8lan - Initialize PHY function pointers
364 * @hw: pointer to the HW structure
366 * Initialize family-specific PHY parameters and function pointers.
368 static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw)
370 struct e1000_phy_info *phy = &hw->phy;
375 phy->reset_delay_us = 100;
377 phy->ops.power_up = e1000_power_up_phy_copper;
378 phy->ops.power_down = e1000_power_down_phy_copper_ich8lan;
381 * We may need to do this twice - once for IGP and if that fails,
382 * we'll set BM func pointers and try again
384 ret_val = e1000e_determine_phy_address(hw);
386 phy->ops.write_reg = e1000e_write_phy_reg_bm;
387 phy->ops.read_reg = e1000e_read_phy_reg_bm;
388 ret_val = e1000e_determine_phy_address(hw);
390 e_dbg("Cannot determine PHY addr. Erroring out\n");
396 while ((e1000_phy_unknown == e1000e_get_phy_type_from_id(phy->id)) &&
399 ret_val = e1000e_get_phy_id(hw);
406 case IGP03E1000_E_PHY_ID:
407 phy->type = e1000_phy_igp_3;
408 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
409 phy->ops.read_reg_locked = e1000e_read_phy_reg_igp_locked;
410 phy->ops.write_reg_locked = e1000e_write_phy_reg_igp_locked;
411 phy->ops.get_info = e1000e_get_phy_info_igp;
412 phy->ops.check_polarity = e1000_check_polarity_igp;
413 phy->ops.force_speed_duplex = e1000e_phy_force_speed_duplex_igp;
416 case IFE_PLUS_E_PHY_ID:
418 phy->type = e1000_phy_ife;
419 phy->autoneg_mask = E1000_ALL_NOT_GIG;
420 phy->ops.get_info = e1000_get_phy_info_ife;
421 phy->ops.check_polarity = e1000_check_polarity_ife;
422 phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_ife;
424 case BME1000_E_PHY_ID:
425 phy->type = e1000_phy_bm;
426 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
427 phy->ops.read_reg = e1000e_read_phy_reg_bm;
428 phy->ops.write_reg = e1000e_write_phy_reg_bm;
429 phy->ops.commit = e1000e_phy_sw_reset;
430 phy->ops.get_info = e1000e_get_phy_info_m88;
431 phy->ops.check_polarity = e1000_check_polarity_m88;
432 phy->ops.force_speed_duplex = e1000e_phy_force_speed_duplex_m88;
435 return -E1000_ERR_PHY;
443 * e1000_init_nvm_params_ich8lan - Initialize NVM function pointers
444 * @hw: pointer to the HW structure
446 * Initialize family-specific NVM parameters and function
449 static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw)
451 struct e1000_nvm_info *nvm = &hw->nvm;
452 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
453 u32 gfpreg, sector_base_addr, sector_end_addr;
456 /* Can't read flash registers if the register set isn't mapped. */
457 if (!hw->flash_address) {
458 e_dbg("ERROR: Flash registers not mapped\n");
459 return -E1000_ERR_CONFIG;
462 nvm->type = e1000_nvm_flash_sw;
464 gfpreg = er32flash(ICH_FLASH_GFPREG);
467 * sector_X_addr is a "sector"-aligned address (4096 bytes)
468 * Add 1 to sector_end_addr since this sector is included in
471 sector_base_addr = gfpreg & FLASH_GFPREG_BASE_MASK;
472 sector_end_addr = ((gfpreg >> 16) & FLASH_GFPREG_BASE_MASK) + 1;
474 /* flash_base_addr is byte-aligned */
475 nvm->flash_base_addr = sector_base_addr << FLASH_SECTOR_ADDR_SHIFT;
478 * find total size of the NVM, then cut in half since the total
479 * size represents two separate NVM banks.
481 nvm->flash_bank_size = (sector_end_addr - sector_base_addr)
482 << FLASH_SECTOR_ADDR_SHIFT;
483 nvm->flash_bank_size /= 2;
484 /* Adjust to word count */
485 nvm->flash_bank_size /= sizeof(u16);
487 nvm->word_size = E1000_ICH8_SHADOW_RAM_WORDS;
489 /* Clear shadow ram */
490 for (i = 0; i < nvm->word_size; i++) {
491 dev_spec->shadow_ram[i].modified = false;
492 dev_spec->shadow_ram[i].value = 0xFFFF;
499 * e1000_init_mac_params_ich8lan - Initialize MAC function pointers
500 * @hw: pointer to the HW structure
502 * Initialize family-specific MAC parameters and function
505 static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter)
507 struct e1000_hw *hw = &adapter->hw;
508 struct e1000_mac_info *mac = &hw->mac;
510 /* Set media type function pointer */
511 hw->phy.media_type = e1000_media_type_copper;
513 /* Set mta register count */
514 mac->mta_reg_count = 32;
515 /* Set rar entry count */
516 mac->rar_entry_count = E1000_ICH_RAR_ENTRIES;
517 if (mac->type == e1000_ich8lan)
518 mac->rar_entry_count--;
520 mac->has_fwsm = true;
521 /* ARC subsystem not supported */
522 mac->arc_subsystem_valid = false;
523 /* Adaptive IFS supported */
524 mac->adaptive_ifs = true;
531 /* check management mode */
532 mac->ops.check_mng_mode = e1000_check_mng_mode_ich8lan;
534 mac->ops.id_led_init = e1000e_id_led_init;
536 mac->ops.setup_led = e1000e_setup_led_generic;
538 mac->ops.cleanup_led = e1000_cleanup_led_ich8lan;
539 /* turn on/off LED */
540 mac->ops.led_on = e1000_led_on_ich8lan;
541 mac->ops.led_off = e1000_led_off_ich8lan;
545 /* check management mode */
546 mac->ops.check_mng_mode = e1000_check_mng_mode_pchlan;
548 mac->ops.id_led_init = e1000_id_led_init_pchlan;
550 mac->ops.setup_led = e1000_setup_led_pchlan;
552 mac->ops.cleanup_led = e1000_cleanup_led_pchlan;
553 /* turn on/off LED */
554 mac->ops.led_on = e1000_led_on_pchlan;
555 mac->ops.led_off = e1000_led_off_pchlan;
561 /* Enable PCS Lock-loss workaround for ICH8 */
562 if (mac->type == e1000_ich8lan)
563 e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, true);
565 /* Disable PHY configuration by hardware, config by software */
566 if (mac->type == e1000_pch2lan) {
567 u32 extcnf_ctrl = er32(EXTCNF_CTRL);
569 extcnf_ctrl |= E1000_EXTCNF_CTRL_GATE_PHY_CFG;
570 ew32(EXTCNF_CTRL, extcnf_ctrl);
577 * e1000_set_eee_pchlan - Enable/disable EEE support
578 * @hw: pointer to the HW structure
580 * Enable/disable EEE based on setting in dev_spec structure. The bits in
581 * the LPI Control register will remain set only if/when link is up.
583 static s32 e1000_set_eee_pchlan(struct e1000_hw *hw)
588 if (hw->phy.type != e1000_phy_82579)
591 ret_val = e1e_rphy(hw, I82579_LPI_CTRL, &phy_reg);
595 if (hw->dev_spec.ich8lan.eee_disable)
596 phy_reg &= ~I82579_LPI_CTRL_ENABLE_MASK;
598 phy_reg |= I82579_LPI_CTRL_ENABLE_MASK;
600 ret_val = e1e_wphy(hw, I82579_LPI_CTRL, phy_reg);
606 * e1000_check_for_copper_link_ich8lan - Check for link (Copper)
607 * @hw: pointer to the HW structure
609 * Checks to see of the link status of the hardware has changed. If a
610 * change in link status has been detected, then we read the PHY registers
611 * to get the current speed/duplex if link exists.
613 static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
615 struct e1000_mac_info *mac = &hw->mac;
620 * We only want to go out to the PHY registers to see if Auto-Neg
621 * has completed and/or if our link status has changed. The
622 * get_link_status flag is set upon receiving a Link Status
623 * Change or Rx Sequence Error interrupt.
625 if (!mac->get_link_status) {
631 * First we want to see if the MII Status Register reports
632 * link. If so, then we want to get the current speed/duplex
635 ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link);
639 if (hw->mac.type == e1000_pchlan) {
640 ret_val = e1000_k1_gig_workaround_hv(hw, link);
646 goto out; /* No link detected */
648 mac->get_link_status = false;
650 if (hw->phy.type == e1000_phy_82578) {
651 ret_val = e1000_link_stall_workaround_hv(hw);
657 * Check if there was DownShift, must be checked
658 * immediately after link-up
660 e1000e_check_downshift(hw);
662 /* Enable/Disable EEE after link up */
663 ret_val = e1000_set_eee_pchlan(hw);
668 * If we are forcing speed/duplex, then we simply return since
669 * we have already determined whether we have link or not.
672 ret_val = -E1000_ERR_CONFIG;
677 * Auto-Neg is enabled. Auto Speed Detection takes care
678 * of MAC speed/duplex configuration. So we only need to
679 * configure Collision Distance in the MAC.
681 e1000e_config_collision_dist(hw);
684 * Configure Flow Control now that Auto-Neg has completed.
685 * First, we need to restore the desired flow control
686 * settings because we may have had to re-autoneg with a
687 * different link partner.
689 ret_val = e1000e_config_fc_after_link_up(hw);
691 e_dbg("Error configuring flow control\n");
697 static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
699 struct e1000_hw *hw = &adapter->hw;
702 rc = e1000_init_mac_params_ich8lan(adapter);
706 rc = e1000_init_nvm_params_ich8lan(hw);
710 switch (hw->mac.type) {
714 rc = e1000_init_phy_params_ich8lan(hw);
718 rc = e1000_init_phy_params_pchlan(hw);
726 if (adapter->hw.phy.type == e1000_phy_ife) {
727 adapter->flags &= ~FLAG_HAS_JUMBO_FRAMES;
728 adapter->max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN;
731 if ((adapter->hw.mac.type == e1000_ich8lan) &&
732 (adapter->hw.phy.type == e1000_phy_igp_3))
733 adapter->flags |= FLAG_LSC_GIG_SPEED_DROP;
735 /* Disable EEE by default until IEEE802.3az spec is finalized */
736 if (adapter->flags2 & FLAG2_HAS_EEE)
737 adapter->hw.dev_spec.ich8lan.eee_disable = true;
742 static DEFINE_MUTEX(nvm_mutex);
745 * e1000_acquire_nvm_ich8lan - Acquire NVM mutex
746 * @hw: pointer to the HW structure
748 * Acquires the mutex for performing NVM operations.
750 static s32 e1000_acquire_nvm_ich8lan(struct e1000_hw *hw)
752 mutex_lock(&nvm_mutex);
758 * e1000_release_nvm_ich8lan - Release NVM mutex
759 * @hw: pointer to the HW structure
761 * Releases the mutex used while performing NVM operations.
763 static void e1000_release_nvm_ich8lan(struct e1000_hw *hw)
765 mutex_unlock(&nvm_mutex);
768 static DEFINE_MUTEX(swflag_mutex);
771 * e1000_acquire_swflag_ich8lan - Acquire software control flag
772 * @hw: pointer to the HW structure
774 * Acquires the software control flag for performing PHY and select
777 static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
779 u32 extcnf_ctrl, timeout = PHY_CFG_TIMEOUT;
782 mutex_lock(&swflag_mutex);
785 extcnf_ctrl = er32(EXTCNF_CTRL);
786 if (!(extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG))
794 e_dbg("SW/FW/HW has locked the resource for too long.\n");
795 ret_val = -E1000_ERR_CONFIG;
799 timeout = SW_FLAG_TIMEOUT;
801 extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG;
802 ew32(EXTCNF_CTRL, extcnf_ctrl);
805 extcnf_ctrl = er32(EXTCNF_CTRL);
806 if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)
814 e_dbg("Failed to acquire the semaphore.\n");
815 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
816 ew32(EXTCNF_CTRL, extcnf_ctrl);
817 ret_val = -E1000_ERR_CONFIG;
823 mutex_unlock(&swflag_mutex);
829 * e1000_release_swflag_ich8lan - Release software control flag
830 * @hw: pointer to the HW structure
832 * Releases the software control flag for performing PHY and select
835 static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
839 extcnf_ctrl = er32(EXTCNF_CTRL);
840 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
841 ew32(EXTCNF_CTRL, extcnf_ctrl);
843 mutex_unlock(&swflag_mutex);
847 * e1000_check_mng_mode_ich8lan - Checks management mode
848 * @hw: pointer to the HW structure
850 * This checks if the adapter has any manageability enabled.
851 * This is a function pointer entry point only called by read/write
852 * routines for the PHY and NVM parts.
854 static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw)
859 return (fwsm & E1000_ICH_FWSM_FW_VALID) &&
860 ((fwsm & E1000_FWSM_MODE_MASK) ==
861 (E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT));
865 * e1000_check_mng_mode_pchlan - Checks management mode
866 * @hw: pointer to the HW structure
868 * This checks if the adapter has iAMT enabled.
869 * This is a function pointer entry point only called by read/write
870 * routines for the PHY and NVM parts.
872 static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw)
877 return (fwsm & E1000_ICH_FWSM_FW_VALID) &&
878 (fwsm & (E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT));
882 * e1000_check_reset_block_ich8lan - Check if PHY reset is blocked
883 * @hw: pointer to the HW structure
885 * Checks if firmware is blocking the reset of the PHY.
886 * This is a function pointer entry point only called by
889 static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw)
895 return (fwsm & E1000_ICH_FWSM_RSPCIPHY) ? 0 : E1000_BLK_PHY_RESET;
899 * e1000_write_smbus_addr - Write SMBus address to PHY needed during Sx states
900 * @hw: pointer to the HW structure
902 * Assumes semaphore already acquired.
905 static s32 e1000_write_smbus_addr(struct e1000_hw *hw)
908 u32 strap = er32(STRAP);
911 strap &= E1000_STRAP_SMBUS_ADDRESS_MASK;
913 ret_val = e1000_read_phy_reg_hv_locked(hw, HV_SMB_ADDR, &phy_data);
917 phy_data &= ~HV_SMB_ADDR_MASK;
918 phy_data |= (strap >> E1000_STRAP_SMBUS_ADDRESS_SHIFT);
919 phy_data |= HV_SMB_ADDR_PEC_EN | HV_SMB_ADDR_VALID;
920 ret_val = e1000_write_phy_reg_hv_locked(hw, HV_SMB_ADDR, phy_data);
927 * e1000_sw_lcd_config_ich8lan - SW-based LCD Configuration
928 * @hw: pointer to the HW structure
930 * SW should configure the LCD from the NVM extended configuration region
931 * as a workaround for certain parts.
933 static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw)
935 struct e1000_adapter *adapter = hw->adapter;
936 struct e1000_phy_info *phy = &hw->phy;
937 u32 i, data, cnf_size, cnf_base_addr, sw_cfg_mask;
939 u16 word_addr, reg_data, reg_addr, phy_page = 0;
942 * Initialize the PHY from the NVM on ICH platforms. This
943 * is needed due to an issue where the NVM configuration is
944 * not properly autoloaded after power transitions.
945 * Therefore, after each PHY reset, we will load the
946 * configuration data out of the NVM manually.
948 switch (hw->mac.type) {
950 if (phy->type != e1000_phy_igp_3)
953 if (adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_AMT) {
954 sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG;
960 sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M;
966 ret_val = hw->phy.ops.acquire(hw);
970 data = er32(FEXTNVM);
971 if (!(data & sw_cfg_mask))
975 * Make sure HW does not configure LCD from PHY
976 * extended configuration before SW configuration
978 data = er32(EXTCNF_CTRL);
979 if (!(hw->mac.type == e1000_pch2lan)) {
980 if (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE)
984 cnf_size = er32(EXTCNF_SIZE);
985 cnf_size &= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK;
986 cnf_size >>= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT;
990 cnf_base_addr = data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK;
991 cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT;
993 if ((!(data & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) &&
994 (hw->mac.type == e1000_pchlan)) ||
995 (hw->mac.type == e1000_pch2lan)) {
997 * HW configures the SMBus address and LEDs when the
998 * OEM and LCD Write Enable bits are set in the NVM.
999 * When both NVM bits are cleared, SW will configure
1002 ret_val = e1000_write_smbus_addr(hw);
1006 data = er32(LEDCTL);
1007 ret_val = e1000_write_phy_reg_hv_locked(hw, HV_LED_CONFIG,
1013 /* Configure LCD from extended configuration region. */
1015 /* cnf_base_addr is in DWORD */
1016 word_addr = (u16)(cnf_base_addr << 1);
1018 for (i = 0; i < cnf_size; i++) {
1019 ret_val = e1000_read_nvm(hw, (word_addr + i * 2), 1,
1024 ret_val = e1000_read_nvm(hw, (word_addr + i * 2 + 1),
1029 /* Save off the PHY page for future writes. */
1030 if (reg_addr == IGP01E1000_PHY_PAGE_SELECT) {
1031 phy_page = reg_data;
1035 reg_addr &= PHY_REG_MASK;
1036 reg_addr |= phy_page;
1038 ret_val = phy->ops.write_reg_locked(hw, (u32)reg_addr,
1045 hw->phy.ops.release(hw);
1050 * e1000_k1_gig_workaround_hv - K1 Si workaround
1051 * @hw: pointer to the HW structure
1052 * @link: link up bool flag
1054 * If K1 is enabled for 1Gbps, the MAC might stall when transitioning
1055 * from a lower speed. This workaround disables K1 whenever link is at 1Gig
1056 * If link is down, the function will restore the default K1 setting located
1059 static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link)
1063 bool k1_enable = hw->dev_spec.ich8lan.nvm_k1_enabled;
1065 if (hw->mac.type != e1000_pchlan)
1068 /* Wrap the whole flow with the sw flag */
1069 ret_val = hw->phy.ops.acquire(hw);
1073 /* Disable K1 when link is 1Gbps, otherwise use the NVM setting */
1075 if (hw->phy.type == e1000_phy_82578) {
1076 ret_val = hw->phy.ops.read_reg_locked(hw, BM_CS_STATUS,
1081 status_reg &= BM_CS_STATUS_LINK_UP |
1082 BM_CS_STATUS_RESOLVED |
1083 BM_CS_STATUS_SPEED_MASK;
1085 if (status_reg == (BM_CS_STATUS_LINK_UP |
1086 BM_CS_STATUS_RESOLVED |
1087 BM_CS_STATUS_SPEED_1000))
1091 if (hw->phy.type == e1000_phy_82577) {
1092 ret_val = hw->phy.ops.read_reg_locked(hw, HV_M_STATUS,
1097 status_reg &= HV_M_STATUS_LINK_UP |
1098 HV_M_STATUS_AUTONEG_COMPLETE |
1099 HV_M_STATUS_SPEED_MASK;
1101 if (status_reg == (HV_M_STATUS_LINK_UP |
1102 HV_M_STATUS_AUTONEG_COMPLETE |
1103 HV_M_STATUS_SPEED_1000))
1107 /* Link stall fix for link up */
1108 ret_val = hw->phy.ops.write_reg_locked(hw, PHY_REG(770, 19),
1114 /* Link stall fix for link down */
1115 ret_val = hw->phy.ops.write_reg_locked(hw, PHY_REG(770, 19),
1121 ret_val = e1000_configure_k1_ich8lan(hw, k1_enable);
1124 hw->phy.ops.release(hw);
1130 * e1000_configure_k1_ich8lan - Configure K1 power state
1131 * @hw: pointer to the HW structure
1132 * @enable: K1 state to configure
1134 * Configure the K1 power state based on the provided parameter.
1135 * Assumes semaphore already acquired.
1137 * Success returns 0, Failure returns -E1000_ERR_PHY (-2)
1139 s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable)
1147 ret_val = e1000e_read_kmrn_reg_locked(hw,
1148 E1000_KMRNCTRLSTA_K1_CONFIG,
1154 kmrn_reg |= E1000_KMRNCTRLSTA_K1_ENABLE;
1156 kmrn_reg &= ~E1000_KMRNCTRLSTA_K1_ENABLE;
1158 ret_val = e1000e_write_kmrn_reg_locked(hw,
1159 E1000_KMRNCTRLSTA_K1_CONFIG,
1165 ctrl_ext = er32(CTRL_EXT);
1166 ctrl_reg = er32(CTRL);
1168 reg = ctrl_reg & ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100);
1169 reg |= E1000_CTRL_FRCSPD;
1172 ew32(CTRL_EXT, ctrl_ext | E1000_CTRL_EXT_SPD_BYPS);
1174 ew32(CTRL, ctrl_reg);
1175 ew32(CTRL_EXT, ctrl_ext);
1183 * e1000_oem_bits_config_ich8lan - SW-based LCD Configuration
1184 * @hw: pointer to the HW structure
1185 * @d0_state: boolean if entering d0 or d3 device state
1187 * SW will configure Gbe Disable and LPLU based on the NVM. The four bits are
1188 * collectively called OEM bits. The OEM Write Enable bit and SW Config bit
1189 * in NVM determines whether HW should configure LPLU and Gbe Disable.
1191 static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state)
1197 if ((hw->mac.type != e1000_pch2lan) && (hw->mac.type != e1000_pchlan))
1200 ret_val = hw->phy.ops.acquire(hw);
1204 if (!(hw->mac.type == e1000_pch2lan)) {
1205 mac_reg = er32(EXTCNF_CTRL);
1206 if (mac_reg & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE)
1210 mac_reg = er32(FEXTNVM);
1211 if (!(mac_reg & E1000_FEXTNVM_SW_CONFIG_ICH8M))
1214 mac_reg = er32(PHY_CTRL);
1216 ret_val = hw->phy.ops.read_reg_locked(hw, HV_OEM_BITS, &oem_reg);
1220 oem_reg &= ~(HV_OEM_BITS_GBE_DIS | HV_OEM_BITS_LPLU);
1223 if (mac_reg & E1000_PHY_CTRL_GBE_DISABLE)
1224 oem_reg |= HV_OEM_BITS_GBE_DIS;
1226 if (mac_reg & E1000_PHY_CTRL_D0A_LPLU)
1227 oem_reg |= HV_OEM_BITS_LPLU;
1229 if (mac_reg & E1000_PHY_CTRL_NOND0A_GBE_DISABLE)
1230 oem_reg |= HV_OEM_BITS_GBE_DIS;
1232 if (mac_reg & E1000_PHY_CTRL_NOND0A_LPLU)
1233 oem_reg |= HV_OEM_BITS_LPLU;
1235 /* Restart auto-neg to activate the bits */
1236 if (!e1000_check_reset_block(hw))
1237 oem_reg |= HV_OEM_BITS_RESTART_AN;
1238 ret_val = hw->phy.ops.write_reg_locked(hw, HV_OEM_BITS, oem_reg);
1241 hw->phy.ops.release(hw);
1248 * e1000_set_mdio_slow_mode_hv - Set slow MDIO access mode
1249 * @hw: pointer to the HW structure
1251 static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw)
1256 ret_val = e1e_rphy(hw, HV_KMRN_MODE_CTRL, &data);
1260 data |= HV_KMRN_MDIO_SLOW;
1262 ret_val = e1e_wphy(hw, HV_KMRN_MODE_CTRL, data);
1268 * e1000_hv_phy_workarounds_ich8lan - A series of Phy workarounds to be
1269 * done after every PHY reset.
1271 static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw)
1276 if (hw->mac.type != e1000_pchlan)
1279 /* Set MDIO slow mode before any other MDIO access */
1280 if (hw->phy.type == e1000_phy_82577) {
1281 ret_val = e1000_set_mdio_slow_mode_hv(hw);
1286 if (((hw->phy.type == e1000_phy_82577) &&
1287 ((hw->phy.revision == 1) || (hw->phy.revision == 2))) ||
1288 ((hw->phy.type == e1000_phy_82578) && (hw->phy.revision == 1))) {
1289 /* Disable generation of early preamble */
1290 ret_val = e1e_wphy(hw, PHY_REG(769, 25), 0x4431);
1294 /* Preamble tuning for SSC */
1295 ret_val = e1e_wphy(hw, PHY_REG(770, 16), 0xA204);
1300 if (hw->phy.type == e1000_phy_82578) {
1302 * Return registers to default by doing a soft reset then
1303 * writing 0x3140 to the control register.
1305 if (hw->phy.revision < 2) {
1306 e1000e_phy_sw_reset(hw);
1307 ret_val = e1e_wphy(hw, PHY_CONTROL, 0x3140);
1312 ret_val = hw->phy.ops.acquire(hw);
1317 ret_val = e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, 0);
1318 hw->phy.ops.release(hw);
1323 * Configure the K1 Si workaround during phy reset assuming there is
1324 * link so that it disables K1 if link is in 1Gbps.
1326 ret_val = e1000_k1_gig_workaround_hv(hw, true);
1330 /* Workaround for link disconnects on a busy hub in half duplex */
1331 ret_val = hw->phy.ops.acquire(hw);
1334 ret_val = hw->phy.ops.read_reg_locked(hw,
1335 PHY_REG(BM_PORT_CTRL_PAGE, 17),
1339 ret_val = hw->phy.ops.write_reg_locked(hw,
1340 PHY_REG(BM_PORT_CTRL_PAGE, 17),
1343 hw->phy.ops.release(hw);
1349 * e1000_copy_rx_addrs_to_phy_ich8lan - Copy Rx addresses from MAC to PHY
1350 * @hw: pointer to the HW structure
1352 void e1000_copy_rx_addrs_to_phy_ich8lan(struct e1000_hw *hw)
1357 /* Copy both RAL/H (rar_entry_count) and SHRAL/H (+4) to PHY */
1358 for (i = 0; i < (hw->mac.rar_entry_count + 4); i++) {
1359 mac_reg = er32(RAL(i));
1360 e1e_wphy(hw, BM_RAR_L(i), (u16)(mac_reg & 0xFFFF));
1361 e1e_wphy(hw, BM_RAR_M(i), (u16)((mac_reg >> 16) & 0xFFFF));
1362 mac_reg = er32(RAH(i));
1363 e1e_wphy(hw, BM_RAR_H(i), (u16)(mac_reg & 0xFFFF));
1364 e1e_wphy(hw, BM_RAR_CTRL(i), (u16)((mac_reg >> 16) & 0x8000));
1368 static u32 e1000_calc_rx_da_crc(u8 mac[])
1370 u32 poly = 0xEDB88320; /* Polynomial for 802.3 CRC calculation */
1371 u32 i, j, mask, crc;
1374 for (i = 0; i < 6; i++) {
1376 for (j = 8; j > 0; j--) {
1377 mask = (crc & 1) * (-1);
1378 crc = (crc >> 1) ^ (poly & mask);
1385 * e1000_lv_jumbo_workaround_ich8lan - required for jumbo frame operation
1387 * @hw: pointer to the HW structure
1388 * @enable: flag to enable/disable workaround when enabling/disabling jumbos
1390 s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable)
1397 if (hw->mac.type != e1000_pch2lan)
1400 /* disable Rx path while enabling/disabling workaround */
1401 e1e_rphy(hw, PHY_REG(769, 20), &phy_reg);
1402 ret_val = e1e_wphy(hw, PHY_REG(769, 20), phy_reg | (1 << 14));
1408 * Write Rx addresses (rar_entry_count for RAL/H, +4 for
1409 * SHRAL/H) and initial CRC values to the MAC
1411 for (i = 0; i < (hw->mac.rar_entry_count + 4); i++) {
1412 u8 mac_addr[ETH_ALEN] = {0};
1413 u32 addr_high, addr_low;
1415 addr_high = er32(RAH(i));
1416 if (!(addr_high & E1000_RAH_AV))
1418 addr_low = er32(RAL(i));
1419 mac_addr[0] = (addr_low & 0xFF);
1420 mac_addr[1] = ((addr_low >> 8) & 0xFF);
1421 mac_addr[2] = ((addr_low >> 16) & 0xFF);
1422 mac_addr[3] = ((addr_low >> 24) & 0xFF);
1423 mac_addr[4] = (addr_high & 0xFF);
1424 mac_addr[5] = ((addr_high >> 8) & 0xFF);
1427 e1000_calc_rx_da_crc(mac_addr));
1430 /* Write Rx addresses to the PHY */
1431 e1000_copy_rx_addrs_to_phy_ich8lan(hw);
1433 /* Enable jumbo frame workaround in the MAC */
1434 mac_reg = er32(FFLT_DBG);
1435 mac_reg &= ~(1 << 14);
1436 mac_reg |= (7 << 15);
1437 ew32(FFLT_DBG, mac_reg);
1439 mac_reg = er32(RCTL);
1440 mac_reg |= E1000_RCTL_SECRC;
1441 ew32(RCTL, mac_reg);
1443 ret_val = e1000e_read_kmrn_reg(hw,
1444 E1000_KMRNCTRLSTA_CTRL_OFFSET,
1448 ret_val = e1000e_write_kmrn_reg(hw,
1449 E1000_KMRNCTRLSTA_CTRL_OFFSET,
1453 ret_val = e1000e_read_kmrn_reg(hw,
1454 E1000_KMRNCTRLSTA_HD_CTRL,
1458 data &= ~(0xF << 8);
1460 ret_val = e1000e_write_kmrn_reg(hw,
1461 E1000_KMRNCTRLSTA_HD_CTRL,
1466 /* Enable jumbo frame workaround in the PHY */
1467 e1e_rphy(hw, PHY_REG(769, 20), &data);
1468 ret_val = e1e_wphy(hw, PHY_REG(769, 20), data & ~(1 << 14));
1471 e1e_rphy(hw, PHY_REG(769, 23), &data);
1472 data &= ~(0x7F << 5);
1473 data |= (0x37 << 5);
1474 ret_val = e1e_wphy(hw, PHY_REG(769, 23), data);
1477 e1e_rphy(hw, PHY_REG(769, 16), &data);
1480 ret_val = e1e_wphy(hw, PHY_REG(769, 16), data);
1483 e1e_rphy(hw, PHY_REG(776, 20), &data);
1484 data &= ~(0x3FF << 2);
1485 data |= (0x1A << 2);
1486 ret_val = e1e_wphy(hw, PHY_REG(776, 20), data);
1489 ret_val = e1e_wphy(hw, PHY_REG(776, 23), 0xFE00);
1492 e1e_rphy(hw, HV_PM_CTRL, &data);
1493 ret_val = e1e_wphy(hw, HV_PM_CTRL, data | (1 << 10));
1497 /* Write MAC register values back to h/w defaults */
1498 mac_reg = er32(FFLT_DBG);
1499 mac_reg &= ~(0xF << 14);
1500 ew32(FFLT_DBG, mac_reg);
1502 mac_reg = er32(RCTL);
1503 mac_reg &= ~E1000_RCTL_SECRC;
1504 ew32(FFLT_DBG, mac_reg);
1506 ret_val = e1000e_read_kmrn_reg(hw,
1507 E1000_KMRNCTRLSTA_CTRL_OFFSET,
1511 ret_val = e1000e_write_kmrn_reg(hw,
1512 E1000_KMRNCTRLSTA_CTRL_OFFSET,
1516 ret_val = e1000e_read_kmrn_reg(hw,
1517 E1000_KMRNCTRLSTA_HD_CTRL,
1521 data &= ~(0xF << 8);
1523 ret_val = e1000e_write_kmrn_reg(hw,
1524 E1000_KMRNCTRLSTA_HD_CTRL,
1529 /* Write PHY register values back to h/w defaults */
1530 e1e_rphy(hw, PHY_REG(769, 20), &data);
1531 ret_val = e1e_wphy(hw, PHY_REG(769, 20), data & ~(1 << 14));
1534 e1e_rphy(hw, PHY_REG(769, 23), &data);
1535 data &= ~(0x7F << 5);
1536 ret_val = e1e_wphy(hw, PHY_REG(769, 23), data);
1539 e1e_rphy(hw, PHY_REG(769, 16), &data);
1542 ret_val = e1e_wphy(hw, PHY_REG(769, 16), data);
1545 e1e_rphy(hw, PHY_REG(776, 20), &data);
1546 data &= ~(0x3FF << 2);
1548 ret_val = e1e_wphy(hw, PHY_REG(776, 20), data);
1551 ret_val = e1e_wphy(hw, PHY_REG(776, 23), 0x7E00);
1554 e1e_rphy(hw, HV_PM_CTRL, &data);
1555 ret_val = e1e_wphy(hw, HV_PM_CTRL, data & ~(1 << 10));
1560 /* re-enable Rx path after enabling/disabling workaround */
1561 ret_val = e1e_wphy(hw, PHY_REG(769, 20), phy_reg & ~(1 << 14));
1568 * e1000_lv_phy_workarounds_ich8lan - A series of Phy workarounds to be
1569 * done after every PHY reset.
1571 static s32 e1000_lv_phy_workarounds_ich8lan(struct e1000_hw *hw)
1575 if (hw->mac.type != e1000_pch2lan)
1578 /* Set MDIO slow mode before any other MDIO access */
1579 ret_val = e1000_set_mdio_slow_mode_hv(hw);
1586 * e1000_lan_init_done_ich8lan - Check for PHY config completion
1587 * @hw: pointer to the HW structure
1589 * Check the appropriate indication the MAC has finished configuring the
1590 * PHY after a software reset.
1592 static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw)
1594 u32 data, loop = E1000_ICH8_LAN_INIT_TIMEOUT;
1596 /* Wait for basic configuration completes before proceeding */
1598 data = er32(STATUS);
1599 data &= E1000_STATUS_LAN_INIT_DONE;
1601 } while ((!data) && --loop);
1604 * If basic configuration is incomplete before the above loop
1605 * count reaches 0, loading the configuration from NVM will
1606 * leave the PHY in a bad state possibly resulting in no link.
1609 e_dbg("LAN_INIT_DONE not set, increase timeout\n");
1611 /* Clear the Init Done bit for the next init event */
1612 data = er32(STATUS);
1613 data &= ~E1000_STATUS_LAN_INIT_DONE;
1618 * e1000_post_phy_reset_ich8lan - Perform steps required after a PHY reset
1619 * @hw: pointer to the HW structure
1621 static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw)
1626 if (e1000_check_reset_block(hw))
1629 /* Perform any necessary post-reset workarounds */
1630 switch (hw->mac.type) {
1632 ret_val = e1000_hv_phy_workarounds_ich8lan(hw);
1637 ret_val = e1000_lv_phy_workarounds_ich8lan(hw);
1645 /* Dummy read to clear the phy wakeup bit after lcd reset */
1646 if (hw->mac.type >= e1000_pchlan)
1647 e1e_rphy(hw, BM_WUC, ®);
1649 /* Configure the LCD with the extended configuration region in NVM */
1650 ret_val = e1000_sw_lcd_config_ich8lan(hw);
1654 /* Configure the LCD with the OEM bits in NVM */
1655 ret_val = e1000_oem_bits_config_ich8lan(hw, true);
1662 * e1000_phy_hw_reset_ich8lan - Performs a PHY reset
1663 * @hw: pointer to the HW structure
1666 * This is a function pointer entry point called by drivers
1667 * or other shared routines.
1669 static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw)
1673 ret_val = e1000e_phy_hw_reset_generic(hw);
1677 ret_val = e1000_post_phy_reset_ich8lan(hw);
1684 * e1000_set_lplu_state_pchlan - Set Low Power Link Up state
1685 * @hw: pointer to the HW structure
1686 * @active: true to enable LPLU, false to disable
1688 * Sets the LPLU state according to the active flag. For PCH, if OEM write
1689 * bit are disabled in the NVM, writing the LPLU bits in the MAC will not set
1690 * the phy speed. This function will manually set the LPLU bit and restart
1691 * auto-neg as hw would do. D3 and D0 LPLU will call the same function
1692 * since it configures the same bit.
1694 static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active)
1699 ret_val = e1e_rphy(hw, HV_OEM_BITS, &oem_reg);
1704 oem_reg |= HV_OEM_BITS_LPLU;
1706 oem_reg &= ~HV_OEM_BITS_LPLU;
1708 oem_reg |= HV_OEM_BITS_RESTART_AN;
1709 ret_val = e1e_wphy(hw, HV_OEM_BITS, oem_reg);
1716 * e1000_set_d0_lplu_state_ich8lan - Set Low Power Linkup D0 state
1717 * @hw: pointer to the HW structure
1718 * @active: true to enable LPLU, false to disable
1720 * Sets the LPLU D0 state according to the active flag. When
1721 * activating LPLU this function also disables smart speed
1722 * and vice versa. LPLU will not be activated unless the
1723 * device autonegotiation advertisement meets standards of
1724 * either 10 or 10/100 or 10/100/1000 at all duplexes.
1725 * This is a function pointer entry point only called by
1726 * PHY setup routines.
1728 static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active)
1730 struct e1000_phy_info *phy = &hw->phy;
1735 if (phy->type == e1000_phy_ife)
1738 phy_ctrl = er32(PHY_CTRL);
1741 phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU;
1742 ew32(PHY_CTRL, phy_ctrl);
1744 if (phy->type != e1000_phy_igp_3)
1748 * Call gig speed drop workaround on LPLU before accessing
1751 if (hw->mac.type == e1000_ich8lan)
1752 e1000e_gig_downshift_workaround_ich8lan(hw);
1754 /* When LPLU is enabled, we should disable SmartSpeed */
1755 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, &data);
1756 data &= ~IGP01E1000_PSCFR_SMART_SPEED;
1757 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, data);
1761 phy_ctrl &= ~E1000_PHY_CTRL_D0A_LPLU;
1762 ew32(PHY_CTRL, phy_ctrl);
1764 if (phy->type != e1000_phy_igp_3)
1768 * LPLU and SmartSpeed are mutually exclusive. LPLU is used
1769 * during Dx states where the power conservation is most
1770 * important. During driver activity we should enable
1771 * SmartSpeed, so performance is maintained.
1773 if (phy->smart_speed == e1000_smart_speed_on) {
1774 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG,
1779 data |= IGP01E1000_PSCFR_SMART_SPEED;
1780 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG,
1784 } else if (phy->smart_speed == e1000_smart_speed_off) {
1785 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG,
1790 data &= ~IGP01E1000_PSCFR_SMART_SPEED;
1791 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG,
1802 * e1000_set_d3_lplu_state_ich8lan - Set Low Power Linkup D3 state
1803 * @hw: pointer to the HW structure
1804 * @active: true to enable LPLU, false to disable
1806 * Sets the LPLU D3 state according to the active flag. When
1807 * activating LPLU this function also disables smart speed
1808 * and vice versa. LPLU will not be activated unless the
1809 * device autonegotiation advertisement meets standards of
1810 * either 10 or 10/100 or 10/100/1000 at all duplexes.
1811 * This is a function pointer entry point only called by
1812 * PHY setup routines.
1814 static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, bool active)
1816 struct e1000_phy_info *phy = &hw->phy;
1821 phy_ctrl = er32(PHY_CTRL);
1824 phy_ctrl &= ~E1000_PHY_CTRL_NOND0A_LPLU;
1825 ew32(PHY_CTRL, phy_ctrl);
1827 if (phy->type != e1000_phy_igp_3)
1831 * LPLU and SmartSpeed are mutually exclusive. LPLU is used
1832 * during Dx states where the power conservation is most
1833 * important. During driver activity we should enable
1834 * SmartSpeed, so performance is maintained.
1836 if (phy->smart_speed == e1000_smart_speed_on) {
1837 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG,
1842 data |= IGP01E1000_PSCFR_SMART_SPEED;
1843 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG,
1847 } else if (phy->smart_speed == e1000_smart_speed_off) {
1848 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG,
1853 data &= ~IGP01E1000_PSCFR_SMART_SPEED;
1854 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG,
1859 } else if ((phy->autoneg_advertised == E1000_ALL_SPEED_DUPLEX) ||
1860 (phy->autoneg_advertised == E1000_ALL_NOT_GIG) ||
1861 (phy->autoneg_advertised == E1000_ALL_10_SPEED)) {
1862 phy_ctrl |= E1000_PHY_CTRL_NOND0A_LPLU;
1863 ew32(PHY_CTRL, phy_ctrl);
1865 if (phy->type != e1000_phy_igp_3)
1869 * Call gig speed drop workaround on LPLU before accessing
1872 if (hw->mac.type == e1000_ich8lan)
1873 e1000e_gig_downshift_workaround_ich8lan(hw);
1875 /* When LPLU is enabled, we should disable SmartSpeed */
1876 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, &data);
1880 data &= ~IGP01E1000_PSCFR_SMART_SPEED;
1881 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, data);
1888 * e1000_valid_nvm_bank_detect_ich8lan - finds out the valid bank 0 or 1
1889 * @hw: pointer to the HW structure
1890 * @bank: pointer to the variable that returns the active bank
1892 * Reads signature byte from the NVM using the flash access registers.
1893 * Word 0x13 bits 15:14 = 10b indicate a valid signature for that bank.
1895 static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank)
1898 struct e1000_nvm_info *nvm = &hw->nvm;
1899 u32 bank1_offset = nvm->flash_bank_size * sizeof(u16);
1900 u32 act_offset = E1000_ICH_NVM_SIG_WORD * 2 + 1;
1904 switch (hw->mac.type) {
1908 if ((eecd & E1000_EECD_SEC1VAL_VALID_MASK) ==
1909 E1000_EECD_SEC1VAL_VALID_MASK) {
1910 if (eecd & E1000_EECD_SEC1VAL)
1917 e_dbg("Unable to determine valid NVM bank via EEC - "
1918 "reading flash signature\n");
1921 /* set bank to 0 in case flash read fails */
1925 ret_val = e1000_read_flash_byte_ich8lan(hw, act_offset,
1929 if ((sig_byte & E1000_ICH_NVM_VALID_SIG_MASK) ==
1930 E1000_ICH_NVM_SIG_VALUE) {
1936 ret_val = e1000_read_flash_byte_ich8lan(hw, act_offset +
1941 if ((sig_byte & E1000_ICH_NVM_VALID_SIG_MASK) ==
1942 E1000_ICH_NVM_SIG_VALUE) {
1947 e_dbg("ERROR: No valid NVM bank present\n");
1948 return -E1000_ERR_NVM;
1955 * e1000_read_nvm_ich8lan - Read word(s) from the NVM
1956 * @hw: pointer to the HW structure
1957 * @offset: The offset (in bytes) of the word(s) to read.
1958 * @words: Size of data to read in words
1959 * @data: Pointer to the word(s) to read at offset.
1961 * Reads a word(s) from the NVM using the flash access registers.
1963 static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
1966 struct e1000_nvm_info *nvm = &hw->nvm;
1967 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
1973 if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) ||
1975 e_dbg("nvm parameter(s) out of bounds\n");
1976 ret_val = -E1000_ERR_NVM;
1980 nvm->ops.acquire(hw);
1982 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank);
1984 e_dbg("Could not detect valid bank, assuming bank 0\n");
1988 act_offset = (bank) ? nvm->flash_bank_size : 0;
1989 act_offset += offset;
1992 for (i = 0; i < words; i++) {
1993 if ((dev_spec->shadow_ram) &&
1994 (dev_spec->shadow_ram[offset+i].modified)) {
1995 data[i] = dev_spec->shadow_ram[offset+i].value;
1997 ret_val = e1000_read_flash_word_ich8lan(hw,
2006 nvm->ops.release(hw);
2010 e_dbg("NVM read error: %d\n", ret_val);
2016 * e1000_flash_cycle_init_ich8lan - Initialize flash
2017 * @hw: pointer to the HW structure
2019 * This function does initial flash setup so that a new read/write/erase cycle
2022 static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw)
2024 union ich8_hws_flash_status hsfsts;
2025 s32 ret_val = -E1000_ERR_NVM;
2028 hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
2030 /* Check if the flash descriptor is valid */
2031 if (hsfsts.hsf_status.fldesvalid == 0) {
2032 e_dbg("Flash descriptor invalid. "
2033 "SW Sequencing must be used.\n");
2034 return -E1000_ERR_NVM;
2037 /* Clear FCERR and DAEL in hw status by writing 1 */
2038 hsfsts.hsf_status.flcerr = 1;
2039 hsfsts.hsf_status.dael = 1;
2041 ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval);
2044 * Either we should have a hardware SPI cycle in progress
2045 * bit to check against, in order to start a new cycle or
2046 * FDONE bit should be changed in the hardware so that it
2047 * is 1 after hardware reset, which can then be used as an
2048 * indication whether a cycle is in progress or has been
2052 if (hsfsts.hsf_status.flcinprog == 0) {
2054 * There is no cycle running at present,
2055 * so we can start a cycle.
2056 * Begin by setting Flash Cycle Done.
2058 hsfsts.hsf_status.flcdone = 1;
2059 ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval);
2063 * Otherwise poll for sometime so the current
2064 * cycle has a chance to end before giving up.
2066 for (i = 0; i < ICH_FLASH_READ_COMMAND_TIMEOUT; i++) {
2067 hsfsts.regval = __er16flash(hw, ICH_FLASH_HSFSTS);
2068 if (hsfsts.hsf_status.flcinprog == 0) {
2076 * Successful in waiting for previous cycle to timeout,
2077 * now set the Flash Cycle Done.
2079 hsfsts.hsf_status.flcdone = 1;
2080 ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval);
2082 e_dbg("Flash controller busy, cannot get access\n");
2090 * e1000_flash_cycle_ich8lan - Starts flash cycle (read/write/erase)
2091 * @hw: pointer to the HW structure
2092 * @timeout: maximum time to wait for completion
2094 * This function starts a flash cycle and waits for its completion.
2096 static s32 e1000_flash_cycle_ich8lan(struct e1000_hw *hw, u32 timeout)
2098 union ich8_hws_flash_ctrl hsflctl;
2099 union ich8_hws_flash_status hsfsts;
2100 s32 ret_val = -E1000_ERR_NVM;
2103 /* Start a cycle by writing 1 in Flash Cycle Go in Hw Flash Control */
2104 hsflctl.regval = er16flash(ICH_FLASH_HSFCTL);
2105 hsflctl.hsf_ctrl.flcgo = 1;
2106 ew16flash(ICH_FLASH_HSFCTL, hsflctl.regval);
2108 /* wait till FDONE bit is set to 1 */
2110 hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
2111 if (hsfsts.hsf_status.flcdone == 1)
2114 } while (i++ < timeout);
2116 if (hsfsts.hsf_status.flcdone == 1 && hsfsts.hsf_status.flcerr == 0)
2123 * e1000_read_flash_word_ich8lan - Read word from flash
2124 * @hw: pointer to the HW structure
2125 * @offset: offset to data location
2126 * @data: pointer to the location for storing the data
2128 * Reads the flash word at offset into data. Offset is converted
2129 * to bytes before read.
2131 static s32 e1000_read_flash_word_ich8lan(struct e1000_hw *hw, u32 offset,
2134 /* Must convert offset into bytes. */
2137 return e1000_read_flash_data_ich8lan(hw, offset, 2, data);
2141 * e1000_read_flash_byte_ich8lan - Read byte from flash
2142 * @hw: pointer to the HW structure
2143 * @offset: The offset of the byte to read.
2144 * @data: Pointer to a byte to store the value read.
2146 * Reads a single byte from the NVM using the flash access registers.
2148 static s32 e1000_read_flash_byte_ich8lan(struct e1000_hw *hw, u32 offset,
2154 ret_val = e1000_read_flash_data_ich8lan(hw, offset, 1, &word);
2164 * e1000_read_flash_data_ich8lan - Read byte or word from NVM
2165 * @hw: pointer to the HW structure
2166 * @offset: The offset (in bytes) of the byte or word to read.
2167 * @size: Size of data to read, 1=byte 2=word
2168 * @data: Pointer to the word to store the value read.
2170 * Reads a byte or word from the NVM using the flash access registers.
2172 static s32 e1000_read_flash_data_ich8lan(struct e1000_hw *hw, u32 offset,
2175 union ich8_hws_flash_status hsfsts;
2176 union ich8_hws_flash_ctrl hsflctl;
2177 u32 flash_linear_addr;
2179 s32 ret_val = -E1000_ERR_NVM;
2182 if (size < 1 || size > 2 || offset > ICH_FLASH_LINEAR_ADDR_MASK)
2183 return -E1000_ERR_NVM;
2185 flash_linear_addr = (ICH_FLASH_LINEAR_ADDR_MASK & offset) +
2186 hw->nvm.flash_base_addr;
2191 ret_val = e1000_flash_cycle_init_ich8lan(hw);
2195 hsflctl.regval = er16flash(ICH_FLASH_HSFCTL);
2196 /* 0b/1b corresponds to 1 or 2 byte size, respectively. */
2197 hsflctl.hsf_ctrl.fldbcount = size - 1;
2198 hsflctl.hsf_ctrl.flcycle = ICH_CYCLE_READ;
2199 ew16flash(ICH_FLASH_HSFCTL, hsflctl.regval);
2201 ew32flash(ICH_FLASH_FADDR, flash_linear_addr);
2203 ret_val = e1000_flash_cycle_ich8lan(hw,
2204 ICH_FLASH_READ_COMMAND_TIMEOUT);
2207 * Check if FCERR is set to 1, if set to 1, clear it
2208 * and try the whole sequence a few more times, else
2209 * read in (shift in) the Flash Data0, the order is
2210 * least significant byte first msb to lsb
2213 flash_data = er32flash(ICH_FLASH_FDATA0);
2215 *data = (u8)(flash_data & 0x000000FF);
2216 } else if (size == 2) {
2217 *data = (u16)(flash_data & 0x0000FFFF);
2222 * If we've gotten here, then things are probably
2223 * completely hosed, but if the error condition is
2224 * detected, it won't hurt to give it another try...
2225 * ICH_FLASH_CYCLE_REPEAT_COUNT times.
2227 hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
2228 if (hsfsts.hsf_status.flcerr == 1) {
2229 /* Repeat for some time before giving up. */
2231 } else if (hsfsts.hsf_status.flcdone == 0) {
2232 e_dbg("Timeout error - flash cycle "
2233 "did not complete.\n");
2237 } while (count++ < ICH_FLASH_CYCLE_REPEAT_COUNT);
2243 * e1000_write_nvm_ich8lan - Write word(s) to the NVM
2244 * @hw: pointer to the HW structure
2245 * @offset: The offset (in bytes) of the word(s) to write.
2246 * @words: Size of data to write in words
2247 * @data: Pointer to the word(s) to write at offset.
2249 * Writes a byte or word to the NVM using the flash access registers.
2251 static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
2254 struct e1000_nvm_info *nvm = &hw->nvm;
2255 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
2258 if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) ||
2260 e_dbg("nvm parameter(s) out of bounds\n");
2261 return -E1000_ERR_NVM;
2264 nvm->ops.acquire(hw);
2266 for (i = 0; i < words; i++) {
2267 dev_spec->shadow_ram[offset+i].modified = true;
2268 dev_spec->shadow_ram[offset+i].value = data[i];
2271 nvm->ops.release(hw);
2277 * e1000_update_nvm_checksum_ich8lan - Update the checksum for NVM
2278 * @hw: pointer to the HW structure
2280 * The NVM checksum is updated by calling the generic update_nvm_checksum,
2281 * which writes the checksum to the shadow ram. The changes in the shadow
2282 * ram are then committed to the EEPROM by processing each bank at a time
2283 * checking for the modified bit and writing only the pending changes.
2284 * After a successful commit, the shadow ram is cleared and is ready for
2287 static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
2289 struct e1000_nvm_info *nvm = &hw->nvm;
2290 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
2291 u32 i, act_offset, new_bank_offset, old_bank_offset, bank;
2295 ret_val = e1000e_update_nvm_checksum_generic(hw);
2299 if (nvm->type != e1000_nvm_flash_sw)
2302 nvm->ops.acquire(hw);
2305 * We're writing to the opposite bank so if we're on bank 1,
2306 * write to bank 0 etc. We also need to erase the segment that
2307 * is going to be written
2309 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank);
2311 e_dbg("Could not detect valid bank, assuming bank 0\n");
2316 new_bank_offset = nvm->flash_bank_size;
2317 old_bank_offset = 0;
2318 ret_val = e1000_erase_flash_bank_ich8lan(hw, 1);
2322 old_bank_offset = nvm->flash_bank_size;
2323 new_bank_offset = 0;
2324 ret_val = e1000_erase_flash_bank_ich8lan(hw, 0);
2329 for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) {
2331 * Determine whether to write the value stored
2332 * in the other NVM bank or a modified value stored
2335 if (dev_spec->shadow_ram[i].modified) {
2336 data = dev_spec->shadow_ram[i].value;
2338 ret_val = e1000_read_flash_word_ich8lan(hw, i +
2346 * If the word is 0x13, then make sure the signature bits
2347 * (15:14) are 11b until the commit has completed.
2348 * This will allow us to write 10b which indicates the
2349 * signature is valid. We want to do this after the write
2350 * has completed so that we don't mark the segment valid
2351 * while the write is still in progress
2353 if (i == E1000_ICH_NVM_SIG_WORD)
2354 data |= E1000_ICH_NVM_SIG_MASK;
2356 /* Convert offset to bytes. */
2357 act_offset = (i + new_bank_offset) << 1;
2360 /* Write the bytes to the new bank. */
2361 ret_val = e1000_retry_write_flash_byte_ich8lan(hw,
2368 ret_val = e1000_retry_write_flash_byte_ich8lan(hw,
2376 * Don't bother writing the segment valid bits if sector
2377 * programming failed.
2380 /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */
2381 e_dbg("Flash commit failed.\n");
2386 * Finally validate the new segment by setting bit 15:14
2387 * to 10b in word 0x13 , this can be done without an
2388 * erase as well since these bits are 11 to start with
2389 * and we need to change bit 14 to 0b
2391 act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD;
2392 ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data);
2397 ret_val = e1000_retry_write_flash_byte_ich8lan(hw,
2404 * And invalidate the previously valid segment by setting
2405 * its signature word (0x13) high_byte to 0b. This can be
2406 * done without an erase because flash erase sets all bits
2407 * to 1's. We can write 1's to 0's without an erase
2409 act_offset = (old_bank_offset + E1000_ICH_NVM_SIG_WORD) * 2 + 1;
2410 ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0);
2414 /* Great! Everything worked, we can now clear the cached entries. */
2415 for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) {
2416 dev_spec->shadow_ram[i].modified = false;
2417 dev_spec->shadow_ram[i].value = 0xFFFF;
2421 nvm->ops.release(hw);
2424 * Reload the EEPROM, or else modifications will not appear
2425 * until after the next adapter reset.
2428 e1000e_reload_nvm(hw);
2434 e_dbg("NVM update error: %d\n", ret_val);
2440 * e1000_validate_nvm_checksum_ich8lan - Validate EEPROM checksum
2441 * @hw: pointer to the HW structure
2443 * Check to see if checksum needs to be fixed by reading bit 6 in word 0x19.
2444 * If the bit is 0, that the EEPROM had been modified, but the checksum was not
2445 * calculated, in which case we need to calculate the checksum and set bit 6.
2447 static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw)
2453 * Read 0x19 and check bit 6. If this bit is 0, the checksum
2454 * needs to be fixed. This bit is an indication that the NVM
2455 * was prepared by OEM software and did not calculate the
2456 * checksum...a likely scenario.
2458 ret_val = e1000_read_nvm(hw, 0x19, 1, &data);
2462 if ((data & 0x40) == 0) {
2464 ret_val = e1000_write_nvm(hw, 0x19, 1, &data);
2467 ret_val = e1000e_update_nvm_checksum(hw);
2472 return e1000e_validate_nvm_checksum_generic(hw);
2476 * e1000e_write_protect_nvm_ich8lan - Make the NVM read-only
2477 * @hw: pointer to the HW structure
2479 * To prevent malicious write/erase of the NVM, set it to be read-only
2480 * so that the hardware ignores all write/erase cycles of the NVM via
2481 * the flash control registers. The shadow-ram copy of the NVM will
2482 * still be updated, however any updates to this copy will not stick
2483 * across driver reloads.
2485 void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw)
2487 struct e1000_nvm_info *nvm = &hw->nvm;
2488 union ich8_flash_protected_range pr0;
2489 union ich8_hws_flash_status hsfsts;
2492 nvm->ops.acquire(hw);
2494 gfpreg = er32flash(ICH_FLASH_GFPREG);
2496 /* Write-protect GbE Sector of NVM */
2497 pr0.regval = er32flash(ICH_FLASH_PR0);
2498 pr0.range.base = gfpreg & FLASH_GFPREG_BASE_MASK;
2499 pr0.range.limit = ((gfpreg >> 16) & FLASH_GFPREG_BASE_MASK);
2500 pr0.range.wpe = true;
2501 ew32flash(ICH_FLASH_PR0, pr0.regval);
2504 * Lock down a subset of GbE Flash Control Registers, e.g.
2505 * PR0 to prevent the write-protection from being lifted.
2506 * Once FLOCKDN is set, the registers protected by it cannot
2507 * be written until FLOCKDN is cleared by a hardware reset.
2509 hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
2510 hsfsts.hsf_status.flockdn = true;
2511 ew32flash(ICH_FLASH_HSFSTS, hsfsts.regval);
2513 nvm->ops.release(hw);
2517 * e1000_write_flash_data_ich8lan - Writes bytes to the NVM
2518 * @hw: pointer to the HW structure
2519 * @offset: The offset (in bytes) of the byte/word to read.
2520 * @size: Size of data to read, 1=byte 2=word
2521 * @data: The byte(s) to write to the NVM.
2523 * Writes one/two bytes to the NVM using the flash access registers.
2525 static s32 e1000_write_flash_data_ich8lan(struct e1000_hw *hw, u32 offset,
2528 union ich8_hws_flash_status hsfsts;
2529 union ich8_hws_flash_ctrl hsflctl;
2530 u32 flash_linear_addr;
2535 if (size < 1 || size > 2 || data > size * 0xff ||
2536 offset > ICH_FLASH_LINEAR_ADDR_MASK)
2537 return -E1000_ERR_NVM;
2539 flash_linear_addr = (ICH_FLASH_LINEAR_ADDR_MASK & offset) +
2540 hw->nvm.flash_base_addr;
2545 ret_val = e1000_flash_cycle_init_ich8lan(hw);
2549 hsflctl.regval = er16flash(ICH_FLASH_HSFCTL);
2550 /* 0b/1b corresponds to 1 or 2 byte size, respectively. */
2551 hsflctl.hsf_ctrl.fldbcount = size -1;
2552 hsflctl.hsf_ctrl.flcycle = ICH_CYCLE_WRITE;
2553 ew16flash(ICH_FLASH_HSFCTL, hsflctl.regval);
2555 ew32flash(ICH_FLASH_FADDR, flash_linear_addr);
2558 flash_data = (u32)data & 0x00FF;
2560 flash_data = (u32)data;
2562 ew32flash(ICH_FLASH_FDATA0, flash_data);
2565 * check if FCERR is set to 1 , if set to 1, clear it
2566 * and try the whole sequence a few more times else done
2568 ret_val = e1000_flash_cycle_ich8lan(hw,
2569 ICH_FLASH_WRITE_COMMAND_TIMEOUT);
2574 * If we're here, then things are most likely
2575 * completely hosed, but if the error condition
2576 * is detected, it won't hurt to give it another
2577 * try...ICH_FLASH_CYCLE_REPEAT_COUNT times.
2579 hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
2580 if (hsfsts.hsf_status.flcerr == 1)
2581 /* Repeat for some time before giving up. */
2583 if (hsfsts.hsf_status.flcdone == 0) {
2584 e_dbg("Timeout error - flash cycle "
2585 "did not complete.");
2588 } while (count++ < ICH_FLASH_CYCLE_REPEAT_COUNT);
2594 * e1000_write_flash_byte_ich8lan - Write a single byte to NVM
2595 * @hw: pointer to the HW structure
2596 * @offset: The index of the byte to read.
2597 * @data: The byte to write to the NVM.
2599 * Writes a single byte to the NVM using the flash access registers.
2601 static s32 e1000_write_flash_byte_ich8lan(struct e1000_hw *hw, u32 offset,
2604 u16 word = (u16)data;
2606 return e1000_write_flash_data_ich8lan(hw, offset, 1, word);
2610 * e1000_retry_write_flash_byte_ich8lan - Writes a single byte to NVM
2611 * @hw: pointer to the HW structure
2612 * @offset: The offset of the byte to write.
2613 * @byte: The byte to write to the NVM.
2615 * Writes a single byte to the NVM using the flash access registers.
2616 * Goes through a retry algorithm before giving up.
2618 static s32 e1000_retry_write_flash_byte_ich8lan(struct e1000_hw *hw,
2619 u32 offset, u8 byte)
2622 u16 program_retries;
2624 ret_val = e1000_write_flash_byte_ich8lan(hw, offset, byte);
2628 for (program_retries = 0; program_retries < 100; program_retries++) {
2629 e_dbg("Retrying Byte %2.2X at offset %u\n", byte, offset);
2631 ret_val = e1000_write_flash_byte_ich8lan(hw, offset, byte);
2635 if (program_retries == 100)
2636 return -E1000_ERR_NVM;
2642 * e1000_erase_flash_bank_ich8lan - Erase a bank (4k) from NVM
2643 * @hw: pointer to the HW structure
2644 * @bank: 0 for first bank, 1 for second bank, etc.
2646 * Erases the bank specified. Each bank is a 4k block. Banks are 0 based.
2647 * bank N is 4096 * N + flash_reg_addr.
2649 static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank)
2651 struct e1000_nvm_info *nvm = &hw->nvm;
2652 union ich8_hws_flash_status hsfsts;
2653 union ich8_hws_flash_ctrl hsflctl;
2654 u32 flash_linear_addr;
2655 /* bank size is in 16bit words - adjust to bytes */
2656 u32 flash_bank_size = nvm->flash_bank_size * 2;
2659 s32 j, iteration, sector_size;
2661 hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
2664 * Determine HW Sector size: Read BERASE bits of hw flash status
2666 * 00: The Hw sector is 256 bytes, hence we need to erase 16
2667 * consecutive sectors. The start index for the nth Hw sector
2668 * can be calculated as = bank * 4096 + n * 256
2669 * 01: The Hw sector is 4K bytes, hence we need to erase 1 sector.
2670 * The start index for the nth Hw sector can be calculated
2672 * 10: The Hw sector is 8K bytes, nth sector = bank * 8192
2673 * (ich9 only, otherwise error condition)
2674 * 11: The Hw sector is 64K bytes, nth sector = bank * 65536
2676 switch (hsfsts.hsf_status.berasesz) {
2678 /* Hw sector size 256 */
2679 sector_size = ICH_FLASH_SEG_SIZE_256;
2680 iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_256;
2683 sector_size = ICH_FLASH_SEG_SIZE_4K;
2687 sector_size = ICH_FLASH_SEG_SIZE_8K;
2691 sector_size = ICH_FLASH_SEG_SIZE_64K;
2695 return -E1000_ERR_NVM;
2698 /* Start with the base address, then add the sector offset. */
2699 flash_linear_addr = hw->nvm.flash_base_addr;
2700 flash_linear_addr += (bank) ? flash_bank_size : 0;
2702 for (j = 0; j < iteration ; j++) {
2705 ret_val = e1000_flash_cycle_init_ich8lan(hw);
2710 * Write a value 11 (block Erase) in Flash
2711 * Cycle field in hw flash control
2713 hsflctl.regval = er16flash(ICH_FLASH_HSFCTL);
2714 hsflctl.hsf_ctrl.flcycle = ICH_CYCLE_ERASE;
2715 ew16flash(ICH_FLASH_HSFCTL, hsflctl.regval);
2718 * Write the last 24 bits of an index within the
2719 * block into Flash Linear address field in Flash
2722 flash_linear_addr += (j * sector_size);
2723 ew32flash(ICH_FLASH_FADDR, flash_linear_addr);
2725 ret_val = e1000_flash_cycle_ich8lan(hw,
2726 ICH_FLASH_ERASE_COMMAND_TIMEOUT);
2731 * Check if FCERR is set to 1. If 1,
2732 * clear it and try the whole sequence
2733 * a few more times else Done
2735 hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
2736 if (hsfsts.hsf_status.flcerr == 1)
2737 /* repeat for some time before giving up */
2739 else if (hsfsts.hsf_status.flcdone == 0)
2741 } while (++count < ICH_FLASH_CYCLE_REPEAT_COUNT);
2748 * e1000_valid_led_default_ich8lan - Set the default LED settings
2749 * @hw: pointer to the HW structure
2750 * @data: Pointer to the LED settings
2752 * Reads the LED default settings from the NVM to data. If the NVM LED
2753 * settings is all 0's or F's, set the LED default to a valid LED default
2756 static s32 e1000_valid_led_default_ich8lan(struct e1000_hw *hw, u16 *data)
2760 ret_val = e1000_read_nvm(hw, NVM_ID_LED_SETTINGS, 1, data);
2762 e_dbg("NVM Read Error\n");
2766 if (*data == ID_LED_RESERVED_0000 ||
2767 *data == ID_LED_RESERVED_FFFF)
2768 *data = ID_LED_DEFAULT_ICH8LAN;
2774 * e1000_id_led_init_pchlan - store LED configurations
2775 * @hw: pointer to the HW structure
2777 * PCH does not control LEDs via the LEDCTL register, rather it uses
2778 * the PHY LED configuration register.
2780 * PCH also does not have an "always on" or "always off" mode which
2781 * complicates the ID feature. Instead of using the "on" mode to indicate
2782 * in ledctl_mode2 the LEDs to use for ID (see e1000e_id_led_init()),
2783 * use "link_up" mode. The LEDs will still ID on request if there is no
2784 * link based on logic in e1000_led_[on|off]_pchlan().
2786 static s32 e1000_id_led_init_pchlan(struct e1000_hw *hw)
2788 struct e1000_mac_info *mac = &hw->mac;
2790 const u32 ledctl_on = E1000_LEDCTL_MODE_LINK_UP;
2791 const u32 ledctl_off = E1000_LEDCTL_MODE_LINK_UP | E1000_PHY_LED0_IVRT;
2792 u16 data, i, temp, shift;
2794 /* Get default ID LED modes */
2795 ret_val = hw->nvm.ops.valid_led_default(hw, &data);
2799 mac->ledctl_default = er32(LEDCTL);
2800 mac->ledctl_mode1 = mac->ledctl_default;
2801 mac->ledctl_mode2 = mac->ledctl_default;
2803 for (i = 0; i < 4; i++) {
2804 temp = (data >> (i << 2)) & E1000_LEDCTL_LED0_MODE_MASK;
2807 case ID_LED_ON1_DEF2:
2808 case ID_LED_ON1_ON2:
2809 case ID_LED_ON1_OFF2:
2810 mac->ledctl_mode1 &= ~(E1000_PHY_LED0_MASK << shift);
2811 mac->ledctl_mode1 |= (ledctl_on << shift);
2813 case ID_LED_OFF1_DEF2:
2814 case ID_LED_OFF1_ON2:
2815 case ID_LED_OFF1_OFF2:
2816 mac->ledctl_mode1 &= ~(E1000_PHY_LED0_MASK << shift);
2817 mac->ledctl_mode1 |= (ledctl_off << shift);
2824 case ID_LED_DEF1_ON2:
2825 case ID_LED_ON1_ON2:
2826 case ID_LED_OFF1_ON2:
2827 mac->ledctl_mode2 &= ~(E1000_PHY_LED0_MASK << shift);
2828 mac->ledctl_mode2 |= (ledctl_on << shift);
2830 case ID_LED_DEF1_OFF2:
2831 case ID_LED_ON1_OFF2:
2832 case ID_LED_OFF1_OFF2:
2833 mac->ledctl_mode2 &= ~(E1000_PHY_LED0_MASK << shift);
2834 mac->ledctl_mode2 |= (ledctl_off << shift);
2847 * e1000_get_bus_info_ich8lan - Get/Set the bus type and width
2848 * @hw: pointer to the HW structure
2850 * ICH8 use the PCI Express bus, but does not contain a PCI Express Capability
2851 * register, so the the bus width is hard coded.
2853 static s32 e1000_get_bus_info_ich8lan(struct e1000_hw *hw)
2855 struct e1000_bus_info *bus = &hw->bus;
2858 ret_val = e1000e_get_bus_info_pcie(hw);
2861 * ICH devices are "PCI Express"-ish. They have
2862 * a configuration space, but do not contain
2863 * PCI Express Capability registers, so bus width
2864 * must be hardcoded.
2866 if (bus->width == e1000_bus_width_unknown)
2867 bus->width = e1000_bus_width_pcie_x1;
2873 * e1000_reset_hw_ich8lan - Reset the hardware
2874 * @hw: pointer to the HW structure
2876 * Does a full reset of the hardware which includes a reset of the PHY and
2879 static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
2881 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
2887 * Prevent the PCI-E bus from sticking if there is no TLP connection
2888 * on the last TLP read/write transaction when MAC is reset.
2890 ret_val = e1000e_disable_pcie_master(hw);
2892 e_dbg("PCI-E Master disable polling has failed.\n");
2894 e_dbg("Masking off all interrupts\n");
2895 ew32(IMC, 0xffffffff);
2898 * Disable the Transmit and Receive units. Then delay to allow
2899 * any pending transactions to complete before we hit the MAC
2900 * with the global reset.
2903 ew32(TCTL, E1000_TCTL_PSP);
2908 /* Workaround for ICH8 bit corruption issue in FIFO memory */
2909 if (hw->mac.type == e1000_ich8lan) {
2910 /* Set Tx and Rx buffer allocation to 8k apiece. */
2911 ew32(PBA, E1000_PBA_8K);
2912 /* Set Packet Buffer Size to 16k. */
2913 ew32(PBS, E1000_PBS_16K);
2916 if (hw->mac.type == e1000_pchlan) {
2917 /* Save the NVM K1 bit setting*/
2918 ret_val = e1000_read_nvm(hw, E1000_NVM_K1_CONFIG, 1, ®);
2922 if (reg & E1000_NVM_K1_ENABLE)
2923 dev_spec->nvm_k1_enabled = true;
2925 dev_spec->nvm_k1_enabled = false;
2930 if (!e1000_check_reset_block(hw)) {
2932 * Full-chip reset requires MAC and PHY reset at the same
2933 * time to make sure the interface between MAC and the
2934 * external PHY is reset.
2936 ctrl |= E1000_CTRL_PHY_RST;
2938 ret_val = e1000_acquire_swflag_ich8lan(hw);
2939 e_dbg("Issuing a global reset to ich8lan\n");
2940 ew32(CTRL, (ctrl | E1000_CTRL_RST));
2944 e1000_release_swflag_ich8lan(hw);
2946 if (ctrl & E1000_CTRL_PHY_RST) {
2947 ret_val = hw->phy.ops.get_cfg_done(hw);
2951 ret_val = e1000_post_phy_reset_ich8lan(hw);
2957 * For PCH, this write will make sure that any noise
2958 * will be detected as a CRC error and be dropped rather than show up
2959 * as a bad packet to the DMA engine.
2961 if (hw->mac.type == e1000_pchlan)
2962 ew32(CRC_OFFSET, 0x65656565);
2964 ew32(IMC, 0xffffffff);
2967 kab = er32(KABGTXD);
2968 kab |= E1000_KABGTXD_BGSQLBIAS;
2976 * e1000_init_hw_ich8lan - Initialize the hardware
2977 * @hw: pointer to the HW structure
2979 * Prepares the hardware for transmit and receive by doing the following:
2980 * - initialize hardware bits
2981 * - initialize LED identification
2982 * - setup receive address registers
2983 * - setup flow control
2984 * - setup transmit descriptors
2985 * - clear statistics
2987 static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw)
2989 struct e1000_mac_info *mac = &hw->mac;
2990 u32 ctrl_ext, txdctl, snoop;
2994 e1000_initialize_hw_bits_ich8lan(hw);
2996 /* Initialize identification LED */
2997 ret_val = mac->ops.id_led_init(hw);
2999 e_dbg("Error initializing identification LED\n");
3000 /* This is not fatal and we should not stop init due to this */
3002 /* Setup the receive address. */
3003 e1000e_init_rx_addrs(hw, mac->rar_entry_count);
3005 /* Zero out the Multicast HASH table */
3006 e_dbg("Zeroing the MTA\n");
3007 for (i = 0; i < mac->mta_reg_count; i++)
3008 E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0);
3011 * The 82578 Rx buffer will stall if wakeup is enabled in host and
3012 * the ME. Reading the BM_WUC register will clear the host wakeup bit.
3013 * Reset the phy after disabling host wakeup to reset the Rx buffer.
3015 if (hw->phy.type == e1000_phy_82578) {
3016 hw->phy.ops.read_reg(hw, BM_WUC, &i);
3017 ret_val = e1000_phy_hw_reset_ich8lan(hw);
3022 /* Setup link and flow control */
3023 ret_val = e1000_setup_link_ich8lan(hw);
3025 /* Set the transmit descriptor write-back policy for both queues */
3026 txdctl = er32(TXDCTL(0));
3027 txdctl = (txdctl & ~E1000_TXDCTL_WTHRESH) |
3028 E1000_TXDCTL_FULL_TX_DESC_WB;
3029 txdctl = (txdctl & ~E1000_TXDCTL_PTHRESH) |
3030 E1000_TXDCTL_MAX_TX_DESC_PREFETCH;
3031 ew32(TXDCTL(0), txdctl);
3032 txdctl = er32(TXDCTL(1));
3033 txdctl = (txdctl & ~E1000_TXDCTL_WTHRESH) |
3034 E1000_TXDCTL_FULL_TX_DESC_WB;
3035 txdctl = (txdctl & ~E1000_TXDCTL_PTHRESH) |
3036 E1000_TXDCTL_MAX_TX_DESC_PREFETCH;
3037 ew32(TXDCTL(1), txdctl);
3040 * ICH8 has opposite polarity of no_snoop bits.
3041 * By default, we should use snoop behavior.
3043 if (mac->type == e1000_ich8lan)
3044 snoop = PCIE_ICH8_SNOOP_ALL;
3046 snoop = (u32) ~(PCIE_NO_SNOOP_ALL);
3047 e1000e_set_pcie_no_snoop(hw, snoop);
3049 ctrl_ext = er32(CTRL_EXT);
3050 ctrl_ext |= E1000_CTRL_EXT_RO_DIS;
3051 ew32(CTRL_EXT, ctrl_ext);
3054 * Clear all of the statistics registers (clear on read). It is
3055 * important that we do this after we have tried to establish link
3056 * because the symbol error count will increment wildly if there
3059 e1000_clear_hw_cntrs_ich8lan(hw);
3064 * e1000_initialize_hw_bits_ich8lan - Initialize required hardware bits
3065 * @hw: pointer to the HW structure
3067 * Sets/Clears required hardware bits necessary for correctly setting up the
3068 * hardware for transmit and receive.
3070 static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw)
3074 /* Extended Device Control */
3075 reg = er32(CTRL_EXT);
3077 /* Enable PHY low-power state when MAC is at D3 w/o WoL */
3078 if (hw->mac.type >= e1000_pchlan)
3079 reg |= E1000_CTRL_EXT_PHYPDEN;
3080 ew32(CTRL_EXT, reg);
3082 /* Transmit Descriptor Control 0 */
3083 reg = er32(TXDCTL(0));
3085 ew32(TXDCTL(0), reg);
3087 /* Transmit Descriptor Control 1 */
3088 reg = er32(TXDCTL(1));
3090 ew32(TXDCTL(1), reg);
3092 /* Transmit Arbitration Control 0 */
3093 reg = er32(TARC(0));
3094 if (hw->mac.type == e1000_ich8lan)
3095 reg |= (1 << 28) | (1 << 29);
3096 reg |= (1 << 23) | (1 << 24) | (1 << 26) | (1 << 27);
3099 /* Transmit Arbitration Control 1 */
3100 reg = er32(TARC(1));
3101 if (er32(TCTL) & E1000_TCTL_MULR)
3105 reg |= (1 << 24) | (1 << 26) | (1 << 30);
3109 if (hw->mac.type == e1000_ich8lan) {
3116 * work-around descriptor data corruption issue during nfs v2 udp
3117 * traffic, just disable the nfs filtering capability
3120 reg |= (E1000_RFCTL_NFSW_DIS | E1000_RFCTL_NFSR_DIS);
3125 * e1000_setup_link_ich8lan - Setup flow control and link settings
3126 * @hw: pointer to the HW structure
3128 * Determines which flow control settings to use, then configures flow
3129 * control. Calls the appropriate media-specific link configuration
3130 * function. Assuming the adapter has a valid link partner, a valid link
3131 * should be established. Assumes the hardware has previously been reset
3132 * and the transmitter and receiver are not enabled.
3134 static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw)
3138 if (e1000_check_reset_block(hw))
3142 * ICH parts do not have a word in the NVM to determine
3143 * the default flow control setting, so we explicitly
3146 if (hw->fc.requested_mode == e1000_fc_default) {
3147 /* Workaround h/w hang when Tx flow control enabled */
3148 if (hw->mac.type == e1000_pchlan)
3149 hw->fc.requested_mode = e1000_fc_rx_pause;
3151 hw->fc.requested_mode = e1000_fc_full;
3155 * Save off the requested flow control mode for use later. Depending
3156 * on the link partner's capabilities, we may or may not use this mode.
3158 hw->fc.current_mode = hw->fc.requested_mode;
3160 e_dbg("After fix-ups FlowControl is now = %x\n",
3161 hw->fc.current_mode);
3163 /* Continue to configure the copper link. */
3164 ret_val = e1000_setup_copper_link_ich8lan(hw);
3168 ew32(FCTTV, hw->fc.pause_time);
3169 if ((hw->phy.type == e1000_phy_82578) ||
3170 (hw->phy.type == e1000_phy_82579) ||
3171 (hw->phy.type == e1000_phy_82577)) {
3172 ew32(FCRTV_PCH, hw->fc.refresh_time);
3174 ret_val = hw->phy.ops.write_reg(hw,
3175 PHY_REG(BM_PORT_CTRL_PAGE, 27),
3181 return e1000e_set_fc_watermarks(hw);
3185 * e1000_setup_copper_link_ich8lan - Configure MAC/PHY interface
3186 * @hw: pointer to the HW structure
3188 * Configures the kumeran interface to the PHY to wait the appropriate time
3189 * when polling the PHY, then call the generic setup_copper_link to finish
3190 * configuring the copper link.
3192 static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw)
3199 ctrl |= E1000_CTRL_SLU;
3200 ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX);
3204 * Set the mac to wait the maximum time between each iteration
3205 * and increase the max iterations when polling the phy;
3206 * this fixes erroneous timeouts at 10Mbps.
3208 ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_TIMEOUTS, 0xFFFF);
3211 ret_val = e1000e_read_kmrn_reg(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
3216 ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
3221 switch (hw->phy.type) {
3222 case e1000_phy_igp_3:
3223 ret_val = e1000e_copper_link_setup_igp(hw);
3228 case e1000_phy_82578:
3229 ret_val = e1000e_copper_link_setup_m88(hw);
3233 case e1000_phy_82577:
3234 case e1000_phy_82579:
3235 ret_val = e1000_copper_link_setup_82577(hw);
3240 ret_val = hw->phy.ops.read_reg(hw, IFE_PHY_MDIX_CONTROL,
3245 reg_data &= ~IFE_PMC_AUTO_MDIX;
3247 switch (hw->phy.mdix) {
3249 reg_data &= ~IFE_PMC_FORCE_MDIX;
3252 reg_data |= IFE_PMC_FORCE_MDIX;
3256 reg_data |= IFE_PMC_AUTO_MDIX;
3259 ret_val = hw->phy.ops.write_reg(hw, IFE_PHY_MDIX_CONTROL,
3267 return e1000e_setup_copper_link(hw);
3271 * e1000_get_link_up_info_ich8lan - Get current link speed and duplex
3272 * @hw: pointer to the HW structure
3273 * @speed: pointer to store current link speed
3274 * @duplex: pointer to store the current link duplex
3276 * Calls the generic get_speed_and_duplex to retrieve the current link
3277 * information and then calls the Kumeran lock loss workaround for links at
3280 static s32 e1000_get_link_up_info_ich8lan(struct e1000_hw *hw, u16 *speed,
3285 ret_val = e1000e_get_speed_and_duplex_copper(hw, speed, duplex);
3289 if ((hw->mac.type == e1000_ich8lan) &&
3290 (hw->phy.type == e1000_phy_igp_3) &&
3291 (*speed == SPEED_1000)) {
3292 ret_val = e1000_kmrn_lock_loss_workaround_ich8lan(hw);
3299 * e1000_kmrn_lock_loss_workaround_ich8lan - Kumeran workaround
3300 * @hw: pointer to the HW structure
3302 * Work-around for 82566 Kumeran PCS lock loss:
3303 * On link status change (i.e. PCI reset, speed change) and link is up and
3305 * 0) if workaround is optionally disabled do nothing
3306 * 1) wait 1ms for Kumeran link to come up
3307 * 2) check Kumeran Diagnostic register PCS lock loss bit
3308 * 3) if not set the link is locked (all is good), otherwise...
3310 * 5) repeat up to 10 times
3311 * Note: this is only called for IGP3 copper when speed is 1gb.
3313 static s32 e1000_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw)
3315 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
3321 if (!dev_spec->kmrn_lock_loss_workaround_enabled)
3325 * Make sure link is up before proceeding. If not just return.
3326 * Attempting this while link is negotiating fouled up link
3329 ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link);
3333 for (i = 0; i < 10; i++) {
3334 /* read once to clear */
3335 ret_val = e1e_rphy(hw, IGP3_KMRN_DIAG, &data);
3338 /* and again to get new status */
3339 ret_val = e1e_rphy(hw, IGP3_KMRN_DIAG, &data);
3343 /* check for PCS lock */
3344 if (!(data & IGP3_KMRN_DIAG_PCS_LOCK_LOSS))
3347 /* Issue PHY reset */
3348 e1000_phy_hw_reset(hw);
3351 /* Disable GigE link negotiation */
3352 phy_ctrl = er32(PHY_CTRL);
3353 phy_ctrl |= (E1000_PHY_CTRL_GBE_DISABLE |
3354 E1000_PHY_CTRL_NOND0A_GBE_DISABLE);
3355 ew32(PHY_CTRL, phy_ctrl);
3358 * Call gig speed drop workaround on Gig disable before accessing
3361 e1000e_gig_downshift_workaround_ich8lan(hw);
3363 /* unable to acquire PCS lock */
3364 return -E1000_ERR_PHY;
3368 * e1000_set_kmrn_lock_loss_workaround_ich8lan - Set Kumeran workaround state
3369 * @hw: pointer to the HW structure
3370 * @state: boolean value used to set the current Kumeran workaround state
3372 * If ICH8, set the current Kumeran workaround state (enabled - true
3373 * /disabled - false).
3375 void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw,
3378 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
3380 if (hw->mac.type != e1000_ich8lan) {
3381 e_dbg("Workaround applies to ICH8 only.\n");
3385 dev_spec->kmrn_lock_loss_workaround_enabled = state;
3389 * e1000_ipg3_phy_powerdown_workaround_ich8lan - Power down workaround on D3
3390 * @hw: pointer to the HW structure
3392 * Workaround for 82566 power-down on D3 entry:
3393 * 1) disable gigabit link
3394 * 2) write VR power-down enable
3396 * Continue if successful, else issue LCD reset and repeat
3398 void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw)
3404 if (hw->phy.type != e1000_phy_igp_3)
3407 /* Try the workaround twice (if needed) */
3410 reg = er32(PHY_CTRL);
3411 reg |= (E1000_PHY_CTRL_GBE_DISABLE |
3412 E1000_PHY_CTRL_NOND0A_GBE_DISABLE);
3413 ew32(PHY_CTRL, reg);
3416 * Call gig speed drop workaround on Gig disable before
3417 * accessing any PHY registers
3419 if (hw->mac.type == e1000_ich8lan)
3420 e1000e_gig_downshift_workaround_ich8lan(hw);
3422 /* Write VR power-down enable */
3423 e1e_rphy(hw, IGP3_VR_CTRL, &data);
3424 data &= ~IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK;
3425 e1e_wphy(hw, IGP3_VR_CTRL, data | IGP3_VR_CTRL_MODE_SHUTDOWN);
3427 /* Read it back and test */
3428 e1e_rphy(hw, IGP3_VR_CTRL, &data);
3429 data &= IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK;
3430 if ((data == IGP3_VR_CTRL_MODE_SHUTDOWN) || retry)
3433 /* Issue PHY reset and repeat at most one more time */
3435 ew32(CTRL, reg | E1000_CTRL_PHY_RST);
3441 * e1000e_gig_downshift_workaround_ich8lan - WoL from S5 stops working
3442 * @hw: pointer to the HW structure
3444 * Steps to take when dropping from 1Gb/s (eg. link cable removal (LSC),
3445 * LPLU, Gig disable, MDIC PHY reset):
3446 * 1) Set Kumeran Near-end loopback
3447 * 2) Clear Kumeran Near-end loopback
3448 * Should only be called for ICH8[m] devices with IGP_3 Phy.
3450 void e1000e_gig_downshift_workaround_ich8lan(struct e1000_hw *hw)
3455 if ((hw->mac.type != e1000_ich8lan) ||
3456 (hw->phy.type != e1000_phy_igp_3))
3459 ret_val = e1000e_read_kmrn_reg(hw, E1000_KMRNCTRLSTA_DIAG_OFFSET,
3463 reg_data |= E1000_KMRNCTRLSTA_DIAG_NELPBK;
3464 ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_DIAG_OFFSET,
3468 reg_data &= ~E1000_KMRNCTRLSTA_DIAG_NELPBK;
3469 ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_DIAG_OFFSET,
3474 * e1000e_disable_gig_wol_ich8lan - disable gig during WoL
3475 * @hw: pointer to the HW structure
3477 * During S0 to Sx transition, it is possible the link remains at gig
3478 * instead of negotiating to a lower speed. Before going to Sx, set
3479 * 'LPLU Enabled' and 'Gig Disable' to force link speed negotiation
3482 * Should only be called for applicable parts.
3484 void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw)
3489 phy_ctrl = er32(PHY_CTRL);
3490 phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU | E1000_PHY_CTRL_GBE_DISABLE;
3491 ew32(PHY_CTRL, phy_ctrl);
3493 if (hw->mac.type >= e1000_pchlan) {
3494 e1000_oem_bits_config_ich8lan(hw, true);
3495 ret_val = hw->phy.ops.acquire(hw);
3498 e1000_write_smbus_addr(hw);
3499 hw->phy.ops.release(hw);
3504 * e1000_cleanup_led_ich8lan - Restore the default LED operation
3505 * @hw: pointer to the HW structure
3507 * Return the LED back to the default configuration.
3509 static s32 e1000_cleanup_led_ich8lan(struct e1000_hw *hw)
3511 if (hw->phy.type == e1000_phy_ife)
3512 return e1e_wphy(hw, IFE_PHY_SPECIAL_CONTROL_LED, 0);
3514 ew32(LEDCTL, hw->mac.ledctl_default);
3519 * e1000_led_on_ich8lan - Turn LEDs on
3520 * @hw: pointer to the HW structure
3524 static s32 e1000_led_on_ich8lan(struct e1000_hw *hw)
3526 if (hw->phy.type == e1000_phy_ife)
3527 return e1e_wphy(hw, IFE_PHY_SPECIAL_CONTROL_LED,
3528 (IFE_PSCL_PROBE_MODE | IFE_PSCL_PROBE_LEDS_ON));
3530 ew32(LEDCTL, hw->mac.ledctl_mode2);
3535 * e1000_led_off_ich8lan - Turn LEDs off
3536 * @hw: pointer to the HW structure
3538 * Turn off the LEDs.
3540 static s32 e1000_led_off_ich8lan(struct e1000_hw *hw)
3542 if (hw->phy.type == e1000_phy_ife)
3543 return e1e_wphy(hw, IFE_PHY_SPECIAL_CONTROL_LED,
3544 (IFE_PSCL_PROBE_MODE | IFE_PSCL_PROBE_LEDS_OFF));
3546 ew32(LEDCTL, hw->mac.ledctl_mode1);
3551 * e1000_setup_led_pchlan - Configures SW controllable LED
3552 * @hw: pointer to the HW structure
3554 * This prepares the SW controllable LED for use.
3556 static s32 e1000_setup_led_pchlan(struct e1000_hw *hw)
3558 return hw->phy.ops.write_reg(hw, HV_LED_CONFIG,
3559 (u16)hw->mac.ledctl_mode1);
3563 * e1000_cleanup_led_pchlan - Restore the default LED operation
3564 * @hw: pointer to the HW structure
3566 * Return the LED back to the default configuration.
3568 static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw)
3570 return hw->phy.ops.write_reg(hw, HV_LED_CONFIG,
3571 (u16)hw->mac.ledctl_default);
3575 * e1000_led_on_pchlan - Turn LEDs on
3576 * @hw: pointer to the HW structure
3580 static s32 e1000_led_on_pchlan(struct e1000_hw *hw)
3582 u16 data = (u16)hw->mac.ledctl_mode2;
3586 * If no link, then turn LED on by setting the invert bit
3587 * for each LED that's mode is "link_up" in ledctl_mode2.
3589 if (!(er32(STATUS) & E1000_STATUS_LU)) {
3590 for (i = 0; i < 3; i++) {
3591 led = (data >> (i * 5)) & E1000_PHY_LED0_MASK;
3592 if ((led & E1000_PHY_LED0_MODE_MASK) !=
3593 E1000_LEDCTL_MODE_LINK_UP)
3595 if (led & E1000_PHY_LED0_IVRT)
3596 data &= ~(E1000_PHY_LED0_IVRT << (i * 5));
3598 data |= (E1000_PHY_LED0_IVRT << (i * 5));
3602 return hw->phy.ops.write_reg(hw, HV_LED_CONFIG, data);
3606 * e1000_led_off_pchlan - Turn LEDs off
3607 * @hw: pointer to the HW structure
3609 * Turn off the LEDs.
3611 static s32 e1000_led_off_pchlan(struct e1000_hw *hw)
3613 u16 data = (u16)hw->mac.ledctl_mode1;
3617 * If no link, then turn LED off by clearing the invert bit
3618 * for each LED that's mode is "link_up" in ledctl_mode1.
3620 if (!(er32(STATUS) & E1000_STATUS_LU)) {
3621 for (i = 0; i < 3; i++) {
3622 led = (data >> (i * 5)) & E1000_PHY_LED0_MASK;
3623 if ((led & E1000_PHY_LED0_MODE_MASK) !=
3624 E1000_LEDCTL_MODE_LINK_UP)
3626 if (led & E1000_PHY_LED0_IVRT)
3627 data &= ~(E1000_PHY_LED0_IVRT << (i * 5));
3629 data |= (E1000_PHY_LED0_IVRT << (i * 5));
3633 return hw->phy.ops.write_reg(hw, HV_LED_CONFIG, data);
3637 * e1000_get_cfg_done_ich8lan - Read config done bit after Full or PHY reset
3638 * @hw: pointer to the HW structure
3640 * Read appropriate register for the config done bit for completion status
3641 * and configure the PHY through s/w for EEPROM-less parts.
3643 * NOTE: some silicon which is EEPROM-less will fail trying to read the
3644 * config done bit, so only an error is logged and continues. If we were
3645 * to return with error, EEPROM-less silicon would not be able to be reset
3648 static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw)
3654 e1000e_get_cfg_done(hw);
3656 /* Wait for indication from h/w that it has completed basic config */
3657 if (hw->mac.type >= e1000_ich10lan) {
3658 e1000_lan_init_done_ich8lan(hw);
3660 ret_val = e1000e_get_auto_rd_done(hw);
3663 * When auto config read does not complete, do not
3664 * return with an error. This can happen in situations
3665 * where there is no eeprom and prevents getting link.
3667 e_dbg("Auto Read Done did not complete\n");
3672 /* Clear PHY Reset Asserted bit */
3673 status = er32(STATUS);
3674 if (status & E1000_STATUS_PHYRA)
3675 ew32(STATUS, status & ~E1000_STATUS_PHYRA);
3677 e_dbg("PHY Reset Asserted not set - needs delay\n");
3679 /* If EEPROM is not marked present, init the IGP 3 PHY manually */
3680 if (hw->mac.type <= e1000_ich9lan) {
3681 if (((er32(EECD) & E1000_EECD_PRES) == 0) &&
3682 (hw->phy.type == e1000_phy_igp_3)) {
3683 e1000e_phy_init_script_igp3(hw);
3686 if (e1000_valid_nvm_bank_detect_ich8lan(hw, &bank)) {
3687 /* Maybe we should do a basic PHY config */
3688 e_dbg("EEPROM not present\n");
3689 ret_val = -E1000_ERR_CONFIG;
3697 * e1000_power_down_phy_copper_ich8lan - Remove link during PHY power down
3698 * @hw: pointer to the HW structure
3700 * In the case of a PHY power down to save power, or to turn off link during a
3701 * driver unload, or wake on lan is not enabled, remove the link.
3703 static void e1000_power_down_phy_copper_ich8lan(struct e1000_hw *hw)
3705 /* If the management interface is not enabled, then power down */
3706 if (!(hw->mac.ops.check_mng_mode(hw) ||
3707 hw->phy.ops.check_reset_block(hw)))
3708 e1000_power_down_phy_copper(hw);
3712 * e1000_clear_hw_cntrs_ich8lan - Clear statistical counters
3713 * @hw: pointer to the HW structure
3715 * Clears hardware counters specific to the silicon family and calls
3716 * clear_hw_cntrs_generic to clear all general purpose counters.
3718 static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw)
3722 e1000e_clear_hw_cntrs_base(hw);
3738 /* Clear PHY statistics registers */
3739 if ((hw->phy.type == e1000_phy_82578) ||
3740 (hw->phy.type == e1000_phy_82579) ||
3741 (hw->phy.type == e1000_phy_82577)) {
3742 hw->phy.ops.read_reg(hw, HV_SCC_UPPER, &phy_data);
3743 hw->phy.ops.read_reg(hw, HV_SCC_LOWER, &phy_data);
3744 hw->phy.ops.read_reg(hw, HV_ECOL_UPPER, &phy_data);
3745 hw->phy.ops.read_reg(hw, HV_ECOL_LOWER, &phy_data);
3746 hw->phy.ops.read_reg(hw, HV_MCC_UPPER, &phy_data);
3747 hw->phy.ops.read_reg(hw, HV_MCC_LOWER, &phy_data);
3748 hw->phy.ops.read_reg(hw, HV_LATECOL_UPPER, &phy_data);
3749 hw->phy.ops.read_reg(hw, HV_LATECOL_LOWER, &phy_data);
3750 hw->phy.ops.read_reg(hw, HV_COLC_UPPER, &phy_data);
3751 hw->phy.ops.read_reg(hw, HV_COLC_LOWER, &phy_data);
3752 hw->phy.ops.read_reg(hw, HV_DC_UPPER, &phy_data);
3753 hw->phy.ops.read_reg(hw, HV_DC_LOWER, &phy_data);
3754 hw->phy.ops.read_reg(hw, HV_TNCRS_UPPER, &phy_data);
3755 hw->phy.ops.read_reg(hw, HV_TNCRS_LOWER, &phy_data);
3759 static struct e1000_mac_operations ich8_mac_ops = {
3760 .id_led_init = e1000e_id_led_init,
3761 /* check_mng_mode dependent on mac type */
3762 .check_for_link = e1000_check_for_copper_link_ich8lan,
3763 /* cleanup_led dependent on mac type */
3764 .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan,
3765 .get_bus_info = e1000_get_bus_info_ich8lan,
3766 .set_lan_id = e1000_set_lan_id_single_port,
3767 .get_link_up_info = e1000_get_link_up_info_ich8lan,
3768 /* led_on dependent on mac type */
3769 /* led_off dependent on mac type */
3770 .update_mc_addr_list = e1000e_update_mc_addr_list_generic,
3771 .reset_hw = e1000_reset_hw_ich8lan,
3772 .init_hw = e1000_init_hw_ich8lan,
3773 .setup_link = e1000_setup_link_ich8lan,
3774 .setup_physical_interface= e1000_setup_copper_link_ich8lan,
3775 /* id_led_init dependent on mac type */
3778 static struct e1000_phy_operations ich8_phy_ops = {
3779 .acquire = e1000_acquire_swflag_ich8lan,
3780 .check_reset_block = e1000_check_reset_block_ich8lan,
3782 .get_cfg_done = e1000_get_cfg_done_ich8lan,
3783 .get_cable_length = e1000e_get_cable_length_igp_2,
3784 .read_reg = e1000e_read_phy_reg_igp,
3785 .release = e1000_release_swflag_ich8lan,
3786 .reset = e1000_phy_hw_reset_ich8lan,
3787 .set_d0_lplu_state = e1000_set_d0_lplu_state_ich8lan,
3788 .set_d3_lplu_state = e1000_set_d3_lplu_state_ich8lan,
3789 .write_reg = e1000e_write_phy_reg_igp,
3792 static struct e1000_nvm_operations ich8_nvm_ops = {
3793 .acquire = e1000_acquire_nvm_ich8lan,
3794 .read = e1000_read_nvm_ich8lan,
3795 .release = e1000_release_nvm_ich8lan,
3796 .update = e1000_update_nvm_checksum_ich8lan,
3797 .valid_led_default = e1000_valid_led_default_ich8lan,
3798 .validate = e1000_validate_nvm_checksum_ich8lan,
3799 .write = e1000_write_nvm_ich8lan,
3802 struct e1000_info e1000_ich8_info = {
3803 .mac = e1000_ich8lan,
3804 .flags = FLAG_HAS_WOL
3806 | FLAG_RX_CSUM_ENABLED
3807 | FLAG_HAS_CTRLEXT_ON_LOAD
3812 .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN,
3813 .get_variants = e1000_get_variants_ich8lan,
3814 .mac_ops = &ich8_mac_ops,
3815 .phy_ops = &ich8_phy_ops,
3816 .nvm_ops = &ich8_nvm_ops,
3819 struct e1000_info e1000_ich9_info = {
3820 .mac = e1000_ich9lan,
3821 .flags = FLAG_HAS_JUMBO_FRAMES
3824 | FLAG_RX_CSUM_ENABLED
3825 | FLAG_HAS_CTRLEXT_ON_LOAD
3831 .max_hw_frame_size = DEFAULT_JUMBO,
3832 .get_variants = e1000_get_variants_ich8lan,
3833 .mac_ops = &ich8_mac_ops,
3834 .phy_ops = &ich8_phy_ops,
3835 .nvm_ops = &ich8_nvm_ops,
3838 struct e1000_info e1000_ich10_info = {
3839 .mac = e1000_ich10lan,
3840 .flags = FLAG_HAS_JUMBO_FRAMES
3843 | FLAG_RX_CSUM_ENABLED
3844 | FLAG_HAS_CTRLEXT_ON_LOAD
3850 .max_hw_frame_size = DEFAULT_JUMBO,
3851 .get_variants = e1000_get_variants_ich8lan,
3852 .mac_ops = &ich8_mac_ops,
3853 .phy_ops = &ich8_phy_ops,
3854 .nvm_ops = &ich8_nvm_ops,
3857 struct e1000_info e1000_pch_info = {
3858 .mac = e1000_pchlan,
3859 .flags = FLAG_IS_ICH
3861 | FLAG_RX_CSUM_ENABLED
3862 | FLAG_HAS_CTRLEXT_ON_LOAD
3865 | FLAG_HAS_JUMBO_FRAMES
3866 | FLAG_DISABLE_FC_PAUSE_TIME /* errata */
3868 .flags2 = FLAG2_HAS_PHY_STATS,
3870 .max_hw_frame_size = 4096,
3871 .get_variants = e1000_get_variants_ich8lan,
3872 .mac_ops = &ich8_mac_ops,
3873 .phy_ops = &ich8_phy_ops,
3874 .nvm_ops = &ich8_nvm_ops,
3877 struct e1000_info e1000_pch2_info = {
3878 .mac = e1000_pch2lan,
3879 .flags = FLAG_IS_ICH
3881 | FLAG_RX_CSUM_ENABLED
3882 | FLAG_HAS_CTRLEXT_ON_LOAD
3885 | FLAG_HAS_JUMBO_FRAMES
3887 .flags2 = FLAG2_HAS_PHY_STATS
3890 .max_hw_frame_size = DEFAULT_JUMBO,
3891 .get_variants = e1000_get_variants_ich8lan,
3892 .mac_ops = &ich8_mac_ops,
3893 .phy_ops = &ich8_phy_ops,
3894 .nvm_ops = &ich8_nvm_ops,