1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2001 - 2015 Intel Corporation
5 /* 80003ES2LAN Gigabit Ethernet Controller (Copper)
6 * 80003ES2LAN Gigabit Ethernet Controller (Serdes)
11 STATIC s32 e1000_acquire_phy_80003es2lan(struct e1000_hw *hw);
12 STATIC void e1000_release_phy_80003es2lan(struct e1000_hw *hw);
13 STATIC s32 e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw);
14 STATIC void e1000_release_nvm_80003es2lan(struct e1000_hw *hw);
15 STATIC s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
18 STATIC s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
21 STATIC s32 e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset,
22 u16 words, u16 *data);
23 STATIC s32 e1000_get_cfg_done_80003es2lan(struct e1000_hw *hw);
24 STATIC s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw);
25 STATIC s32 e1000_get_cable_length_80003es2lan(struct e1000_hw *hw);
26 STATIC s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed,
28 STATIC s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw);
29 STATIC s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw);
30 STATIC s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw);
31 STATIC void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw);
32 STATIC s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask);
33 STATIC s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex);
34 STATIC s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw);
35 STATIC s32 e1000_cfg_on_link_up_80003es2lan(struct e1000_hw *hw);
36 STATIC s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
38 STATIC s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
40 STATIC void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw);
41 STATIC void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask);
42 STATIC s32 e1000_read_mac_addr_80003es2lan(struct e1000_hw *hw);
43 STATIC void e1000_power_down_phy_copper_80003es2lan(struct e1000_hw *hw);
45 /* A table for the GG82563 cable length where the range is defined
46 * with a lower bound at "index" and the upper bound at
49 STATIC const u16 e1000_gg82563_cable_length_table[] = {
50 0, 60, 115, 150, 150, 60, 115, 150, 180, 180, 0xFF };
51 #define GG82563_CABLE_LENGTH_TABLE_SIZE \
52 (sizeof(e1000_gg82563_cable_length_table) / \
53 sizeof(e1000_gg82563_cable_length_table[0]))
56 * e1000_init_phy_params_80003es2lan - Init ESB2 PHY func ptrs.
57 * @hw: pointer to the HW structure
59 STATIC s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw)
61 struct e1000_phy_info *phy = &hw->phy;
64 DEBUGFUNC("e1000_init_phy_params_80003es2lan");
66 if (hw->phy.media_type != e1000_media_type_copper) {
67 phy->type = e1000_phy_none;
70 phy->ops.power_up = e1000_power_up_phy_copper;
71 phy->ops.power_down = e1000_power_down_phy_copper_80003es2lan;
75 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
76 phy->reset_delay_us = 100;
77 phy->type = e1000_phy_gg82563;
79 phy->ops.acquire = e1000_acquire_phy_80003es2lan;
80 phy->ops.check_polarity = e1000_check_polarity_m88;
81 phy->ops.check_reset_block = e1000_check_reset_block_generic;
82 phy->ops.commit = e1000_phy_sw_reset_generic;
83 phy->ops.get_cfg_done = e1000_get_cfg_done_80003es2lan;
84 phy->ops.get_info = e1000_get_phy_info_m88;
85 phy->ops.release = e1000_release_phy_80003es2lan;
86 phy->ops.reset = e1000_phy_hw_reset_generic;
87 phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic;
89 phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_80003es2lan;
90 phy->ops.get_cable_length = e1000_get_cable_length_80003es2lan;
91 phy->ops.read_reg = e1000_read_phy_reg_gg82563_80003es2lan;
92 phy->ops.write_reg = e1000_write_phy_reg_gg82563_80003es2lan;
94 phy->ops.cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan;
96 /* This can only be done after all function pointers are setup. */
97 ret_val = e1000_get_phy_id(hw);
100 if (phy->id != GG82563_E_PHY_ID)
101 return -E1000_ERR_PHY;
107 * e1000_init_nvm_params_80003es2lan - Init ESB2 NVM func ptrs.
108 * @hw: pointer to the HW structure
110 STATIC s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw)
112 struct e1000_nvm_info *nvm = &hw->nvm;
113 u32 eecd = E1000_READ_REG(hw, E1000_EECD);
116 DEBUGFUNC("e1000_init_nvm_params_80003es2lan");
118 nvm->opcode_bits = 8;
120 switch (nvm->override) {
121 case e1000_nvm_override_spi_large:
123 nvm->address_bits = 16;
125 case e1000_nvm_override_spi_small:
127 nvm->address_bits = 8;
130 nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8;
131 nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? 16 : 8;
135 nvm->type = e1000_nvm_eeprom_spi;
137 size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >>
138 E1000_EECD_SIZE_EX_SHIFT);
140 /* Added to a constant, "size" becomes the left-shift value
141 * for setting word_size.
143 size += NVM_WORD_SIZE_BASE_SHIFT;
145 /* EEPROM access above 16k is unsupported */
148 nvm->word_size = 1 << size;
150 /* Function Pointers */
151 nvm->ops.acquire = e1000_acquire_nvm_80003es2lan;
152 nvm->ops.read = e1000_read_nvm_eerd;
153 nvm->ops.release = e1000_release_nvm_80003es2lan;
154 nvm->ops.update = e1000_update_nvm_checksum_generic;
155 nvm->ops.valid_led_default = e1000_valid_led_default_generic;
156 nvm->ops.validate = e1000_validate_nvm_checksum_generic;
157 nvm->ops.write = e1000_write_nvm_80003es2lan;
159 return E1000_SUCCESS;
163 * e1000_init_mac_params_80003es2lan - Init ESB2 MAC func ptrs.
164 * @hw: pointer to the HW structure
166 STATIC s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw)
168 struct e1000_mac_info *mac = &hw->mac;
170 DEBUGFUNC("e1000_init_mac_params_80003es2lan");
172 /* Set media type and media-dependent function pointers */
173 switch (hw->device_id) {
174 case E1000_DEV_ID_80003ES2LAN_SERDES_DPT:
175 hw->phy.media_type = e1000_media_type_internal_serdes;
176 mac->ops.check_for_link = e1000_check_for_serdes_link_generic;
177 mac->ops.setup_physical_interface =
178 e1000_setup_fiber_serdes_link_generic;
181 hw->phy.media_type = e1000_media_type_copper;
182 mac->ops.check_for_link = e1000_check_for_copper_link_generic;
183 mac->ops.setup_physical_interface =
184 e1000_setup_copper_link_80003es2lan;
188 /* Set mta register count */
189 mac->mta_reg_count = 128;
190 /* Set rar entry count */
191 mac->rar_entry_count = E1000_RAR_ENTRIES;
192 /* Set if part includes ASF firmware */
193 mac->asf_firmware_present = true;
195 mac->has_fwsm = true;
196 /* ARC supported; valid only if manageability features are enabled. */
197 mac->arc_subsystem_valid = !!(E1000_READ_REG(hw, E1000_FWSM) &
198 E1000_FWSM_MODE_MASK);
199 /* Adaptive IFS not supported */
200 mac->adaptive_ifs = false;
202 /* Function pointers */
204 /* bus type/speed/width */
205 mac->ops.get_bus_info = e1000_get_bus_info_pcie_generic;
207 mac->ops.reset_hw = e1000_reset_hw_80003es2lan;
208 /* hw initialization */
209 mac->ops.init_hw = e1000_init_hw_80003es2lan;
211 mac->ops.setup_link = e1000_setup_link_generic;
212 /* check management mode */
213 mac->ops.check_mng_mode = e1000_check_mng_mode_generic;
214 /* multicast address update */
215 mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_generic;
217 mac->ops.write_vfta = e1000_write_vfta_generic;
219 mac->ops.clear_vfta = e1000_clear_vfta_generic;
220 /* read mac address */
221 mac->ops.read_mac_addr = e1000_read_mac_addr_80003es2lan;
223 mac->ops.id_led_init = e1000_id_led_init_generic;
225 mac->ops.blink_led = e1000_blink_led_generic;
227 mac->ops.setup_led = e1000_setup_led_generic;
229 mac->ops.cleanup_led = e1000_cleanup_led_generic;
230 /* turn on/off LED */
231 mac->ops.led_on = e1000_led_on_generic;
232 mac->ops.led_off = e1000_led_off_generic;
233 /* clear hardware counters */
234 mac->ops.clear_hw_cntrs = e1000_clear_hw_cntrs_80003es2lan;
236 mac->ops.get_link_up_info = e1000_get_link_up_info_80003es2lan;
238 /* set lan id for port to determine which phy lock to use */
239 hw->mac.ops.set_lan_id(hw);
241 return E1000_SUCCESS;
245 * e1000_init_function_pointers_80003es2lan - Init ESB2 func ptrs.
246 * @hw: pointer to the HW structure
248 * Called to initialize all function pointers and parameters.
250 void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw)
252 DEBUGFUNC("e1000_init_function_pointers_80003es2lan");
254 hw->mac.ops.init_params = e1000_init_mac_params_80003es2lan;
255 hw->nvm.ops.init_params = e1000_init_nvm_params_80003es2lan;
256 hw->phy.ops.init_params = e1000_init_phy_params_80003es2lan;
260 * e1000_acquire_phy_80003es2lan - Acquire rights to access PHY
261 * @hw: pointer to the HW structure
263 * A wrapper to acquire access rights to the correct PHY.
265 STATIC s32 e1000_acquire_phy_80003es2lan(struct e1000_hw *hw)
269 DEBUGFUNC("e1000_acquire_phy_80003es2lan");
271 mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM;
272 return e1000_acquire_swfw_sync_80003es2lan(hw, mask);
276 * e1000_release_phy_80003es2lan - Release rights to access PHY
277 * @hw: pointer to the HW structure
279 * A wrapper to release access rights to the correct PHY.
281 STATIC void e1000_release_phy_80003es2lan(struct e1000_hw *hw)
285 DEBUGFUNC("e1000_release_phy_80003es2lan");
287 mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM;
288 e1000_release_swfw_sync_80003es2lan(hw, mask);
292 * e1000_acquire_mac_csr_80003es2lan - Acquire right to access Kumeran register
293 * @hw: pointer to the HW structure
295 * Acquire the semaphore to access the Kumeran interface.
298 STATIC s32 e1000_acquire_mac_csr_80003es2lan(struct e1000_hw *hw)
302 DEBUGFUNC("e1000_acquire_mac_csr_80003es2lan");
304 mask = E1000_SWFW_CSR_SM;
306 return e1000_acquire_swfw_sync_80003es2lan(hw, mask);
310 * e1000_release_mac_csr_80003es2lan - Release right to access Kumeran Register
311 * @hw: pointer to the HW structure
313 * Release the semaphore used to access the Kumeran interface
315 STATIC void e1000_release_mac_csr_80003es2lan(struct e1000_hw *hw)
319 DEBUGFUNC("e1000_release_mac_csr_80003es2lan");
321 mask = E1000_SWFW_CSR_SM;
323 e1000_release_swfw_sync_80003es2lan(hw, mask);
327 * e1000_acquire_nvm_80003es2lan - Acquire rights to access NVM
328 * @hw: pointer to the HW structure
330 * Acquire the semaphore to access the EEPROM.
332 STATIC s32 e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw)
336 DEBUGFUNC("e1000_acquire_nvm_80003es2lan");
338 ret_val = e1000_acquire_swfw_sync_80003es2lan(hw, E1000_SWFW_EEP_SM);
342 ret_val = e1000_acquire_nvm_generic(hw);
345 e1000_release_swfw_sync_80003es2lan(hw, E1000_SWFW_EEP_SM);
351 * e1000_release_nvm_80003es2lan - Relinquish rights to access NVM
352 * @hw: pointer to the HW structure
354 * Release the semaphore used to access the EEPROM.
356 STATIC void e1000_release_nvm_80003es2lan(struct e1000_hw *hw)
358 DEBUGFUNC("e1000_release_nvm_80003es2lan");
360 e1000_release_nvm_generic(hw);
361 e1000_release_swfw_sync_80003es2lan(hw, E1000_SWFW_EEP_SM);
365 * e1000_acquire_swfw_sync_80003es2lan - Acquire SW/FW semaphore
366 * @hw: pointer to the HW structure
367 * @mask: specifies which semaphore to acquire
369 * Acquire the SW/FW semaphore to access the PHY or NVM. The mask
370 * will also specify which port we're acquiring the lock for.
372 STATIC s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask)
376 u32 fwmask = mask << 16;
380 DEBUGFUNC("e1000_acquire_swfw_sync_80003es2lan");
382 while (i < timeout) {
383 if (e1000_get_hw_semaphore_generic(hw))
384 return -E1000_ERR_SWFW_SYNC;
386 swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC);
387 if (!(swfw_sync & (fwmask | swmask)))
390 /* Firmware currently using resource (fwmask)
391 * or other software thread using resource (swmask)
393 e1000_put_hw_semaphore_generic(hw);
399 DEBUGOUT("Driver can't access resource, SW_FW_SYNC timeout.\n");
400 return -E1000_ERR_SWFW_SYNC;
404 E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync);
406 e1000_put_hw_semaphore_generic(hw);
408 return E1000_SUCCESS;
412 * e1000_release_swfw_sync_80003es2lan - Release SW/FW semaphore
413 * @hw: pointer to the HW structure
414 * @mask: specifies which semaphore to acquire
416 * Release the SW/FW semaphore used to access the PHY or NVM. The mask
417 * will also specify which port we're releasing the lock for.
419 STATIC void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask)
423 DEBUGFUNC("e1000_release_swfw_sync_80003es2lan");
425 while (e1000_get_hw_semaphore_generic(hw) != E1000_SUCCESS)
428 swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC);
430 E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync);
432 e1000_put_hw_semaphore_generic(hw);
436 * e1000_read_phy_reg_gg82563_80003es2lan - Read GG82563 PHY register
437 * @hw: pointer to the HW structure
438 * @offset: offset of the register to read
439 * @data: pointer to the data returned from the operation
441 * Read the GG82563 PHY register.
443 STATIC s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
444 u32 offset, u16 *data)
450 DEBUGFUNC("e1000_read_phy_reg_gg82563_80003es2lan");
452 ret_val = e1000_acquire_phy_80003es2lan(hw);
456 /* Select Configuration Page */
457 if ((offset & MAX_PHY_REG_ADDRESS) < GG82563_MIN_ALT_REG) {
458 page_select = GG82563_PHY_PAGE_SELECT;
460 /* Use Alternative Page Select register to access
461 * registers 30 and 31
463 page_select = GG82563_PHY_PAGE_SELECT_ALT;
466 temp = (u16)((u16)offset >> GG82563_PAGE_SHIFT);
467 ret_val = e1000_write_phy_reg_mdic(hw, page_select, temp);
469 e1000_release_phy_80003es2lan(hw);
473 if (hw->dev_spec._80003es2lan.mdic_wa_enable) {
474 /* The "ready" bit in the MDIC register may be incorrectly set
475 * before the device has completed the "Page Select" MDI
476 * transaction. So we wait 200us after each MDI command...
480 /* ...and verify the command was successful. */
481 ret_val = e1000_read_phy_reg_mdic(hw, page_select, &temp);
483 if (((u16)offset >> GG82563_PAGE_SHIFT) != temp) {
484 e1000_release_phy_80003es2lan(hw);
485 return -E1000_ERR_PHY;
490 ret_val = e1000_read_phy_reg_mdic(hw,
491 MAX_PHY_REG_ADDRESS & offset,
496 ret_val = e1000_read_phy_reg_mdic(hw,
497 MAX_PHY_REG_ADDRESS & offset,
501 e1000_release_phy_80003es2lan(hw);
507 * e1000_write_phy_reg_gg82563_80003es2lan - Write GG82563 PHY register
508 * @hw: pointer to the HW structure
509 * @offset: offset of the register to read
510 * @data: value to write to the register
512 * Write to the GG82563 PHY register.
514 STATIC s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
515 u32 offset, u16 data)
521 DEBUGFUNC("e1000_write_phy_reg_gg82563_80003es2lan");
523 ret_val = e1000_acquire_phy_80003es2lan(hw);
527 /* Select Configuration Page */
528 if ((offset & MAX_PHY_REG_ADDRESS) < GG82563_MIN_ALT_REG) {
529 page_select = GG82563_PHY_PAGE_SELECT;
531 /* Use Alternative Page Select register to access
532 * registers 30 and 31
534 page_select = GG82563_PHY_PAGE_SELECT_ALT;
537 temp = (u16)((u16)offset >> GG82563_PAGE_SHIFT);
538 ret_val = e1000_write_phy_reg_mdic(hw, page_select, temp);
540 e1000_release_phy_80003es2lan(hw);
544 if (hw->dev_spec._80003es2lan.mdic_wa_enable) {
545 /* The "ready" bit in the MDIC register may be incorrectly set
546 * before the device has completed the "Page Select" MDI
547 * transaction. So we wait 200us after each MDI command...
551 /* ...and verify the command was successful. */
552 ret_val = e1000_read_phy_reg_mdic(hw, page_select, &temp);
554 if (((u16)offset >> GG82563_PAGE_SHIFT) != temp) {
555 e1000_release_phy_80003es2lan(hw);
556 return -E1000_ERR_PHY;
561 ret_val = e1000_write_phy_reg_mdic(hw,
562 MAX_PHY_REG_ADDRESS & offset,
567 ret_val = e1000_write_phy_reg_mdic(hw,
568 MAX_PHY_REG_ADDRESS & offset,
572 e1000_release_phy_80003es2lan(hw);
578 * e1000_write_nvm_80003es2lan - Write to ESB2 NVM
579 * @hw: pointer to the HW structure
580 * @offset: offset of the register to read
581 * @words: number of words to write
582 * @data: buffer of data to write to the NVM
584 * Write "words" of data to the ESB2 NVM.
586 STATIC s32 e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset,
587 u16 words, u16 *data)
589 DEBUGFUNC("e1000_write_nvm_80003es2lan");
591 return e1000_write_nvm_spi(hw, offset, words, data);
595 * e1000_get_cfg_done_80003es2lan - Wait for configuration to complete
596 * @hw: pointer to the HW structure
598 * Wait a specific amount of time for manageability processes to complete.
599 * This is a function pointer entry point called by the phy module.
601 STATIC s32 e1000_get_cfg_done_80003es2lan(struct e1000_hw *hw)
603 s32 timeout = PHY_CFG_TIMEOUT;
604 u32 mask = E1000_NVM_CFG_DONE_PORT_0;
606 DEBUGFUNC("e1000_get_cfg_done_80003es2lan");
608 if (hw->bus.func == 1)
609 mask = E1000_NVM_CFG_DONE_PORT_1;
612 if (E1000_READ_REG(hw, E1000_EEMNGCTL) & mask)
618 DEBUGOUT("MNG configuration cycle has not completed.\n");
619 return -E1000_ERR_RESET;
622 return E1000_SUCCESS;
626 * e1000_phy_force_speed_duplex_80003es2lan - Force PHY speed and duplex
627 * @hw: pointer to the HW structure
629 * Force the speed and duplex settings onto the PHY. This is a
630 * function pointer entry point called by the phy module.
632 STATIC s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)
638 DEBUGFUNC("e1000_phy_force_speed_duplex_80003es2lan");
640 if (!(hw->phy.ops.read_reg))
641 return E1000_SUCCESS;
643 /* Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI
644 * forced whenever speed and duplex are forced.
646 ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
650 phy_data &= ~GG82563_PSCR_CROSSOVER_MODE_AUTO;
651 ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_SPEC_CTRL, phy_data);
655 DEBUGOUT1("GG82563 PSCR: %X\n", phy_data);
657 ret_val = hw->phy.ops.read_reg(hw, PHY_CONTROL, &phy_data);
661 e1000_phy_force_speed_duplex_setup(hw, &phy_data);
663 /* Reset the phy to commit changes. */
664 phy_data |= MII_CR_RESET;
666 ret_val = hw->phy.ops.write_reg(hw, PHY_CONTROL, phy_data);
672 if (hw->phy.autoneg_wait_to_complete) {
673 DEBUGOUT("Waiting for forced speed/duplex link on GG82563 phy.\n");
675 ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
681 /* We didn't get link.
682 * Reset the DSP and cross our fingers.
684 ret_val = e1000_phy_reset_dsp_generic(hw);
690 ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
696 ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL,
701 /* Resetting the phy means we need to verify the TX_CLK corresponds
702 * to the link speed. 10Mbps -> 2.5MHz, else 25MHz.
704 phy_data &= ~GG82563_MSCR_TX_CLK_MASK;
705 if (hw->mac.forced_speed_duplex & E1000_ALL_10_SPEED)
706 phy_data |= GG82563_MSCR_TX_CLK_10MBPS_2_5;
708 phy_data |= GG82563_MSCR_TX_CLK_100MBPS_25;
710 /* In addition, we must re-enable CRS on Tx for both half and full
713 phy_data |= GG82563_MSCR_ASSERT_CRS_ON_TX;
714 ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL,
721 * e1000_get_cable_length_80003es2lan - Set approximate cable length
722 * @hw: pointer to the HW structure
724 * Find the approximate cable length as measured by the GG82563 PHY.
725 * This is a function pointer entry point called by the phy module.
727 STATIC s32 e1000_get_cable_length_80003es2lan(struct e1000_hw *hw)
729 struct e1000_phy_info *phy = &hw->phy;
733 DEBUGFUNC("e1000_get_cable_length_80003es2lan");
735 if (!(hw->phy.ops.read_reg))
736 return E1000_SUCCESS;
738 ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_DSP_DISTANCE, &phy_data);
742 index = phy_data & GG82563_DSPD_CABLE_LENGTH;
744 if (index >= GG82563_CABLE_LENGTH_TABLE_SIZE - 5)
745 return -E1000_ERR_PHY;
747 phy->min_cable_length = e1000_gg82563_cable_length_table[index];
748 phy->max_cable_length = e1000_gg82563_cable_length_table[index + 5];
750 phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2;
752 return E1000_SUCCESS;
756 * e1000_get_link_up_info_80003es2lan - Report speed and duplex
757 * @hw: pointer to the HW structure
758 * @speed: pointer to speed buffer
759 * @duplex: pointer to duplex buffer
761 * Retrieve the current speed and duplex configuration.
763 STATIC s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed,
768 DEBUGFUNC("e1000_get_link_up_info_80003es2lan");
770 if (hw->phy.media_type == e1000_media_type_copper) {
771 ret_val = e1000_get_speed_and_duplex_copper_generic(hw, speed,
773 hw->phy.ops.cfg_on_link_up(hw);
775 ret_val = e1000_get_speed_and_duplex_fiber_serdes_generic(hw,
784 * e1000_reset_hw_80003es2lan - Reset the ESB2 controller
785 * @hw: pointer to the HW structure
787 * Perform a global reset to the ESB2 controller.
789 STATIC s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)
795 DEBUGFUNC("e1000_reset_hw_80003es2lan");
797 /* Prevent the PCI-E bus from sticking if there is no TLP connection
798 * on the last TLP read/write transaction when MAC is reset.
800 ret_val = e1000_disable_pcie_master_generic(hw);
802 DEBUGOUT("PCI-E Master disable polling has failed.\n");
804 DEBUGOUT("Masking off all interrupts\n");
805 E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
807 E1000_WRITE_REG(hw, E1000_RCTL, 0);
808 E1000_WRITE_REG(hw, E1000_TCTL, E1000_TCTL_PSP);
809 E1000_WRITE_FLUSH(hw);
813 ctrl = E1000_READ_REG(hw, E1000_CTRL);
815 ret_val = e1000_acquire_phy_80003es2lan(hw);
819 DEBUGOUT("Issuing a global reset to MAC\n");
820 E1000_WRITE_REG(hw, E1000_CTRL, ctrl | E1000_CTRL_RST);
821 e1000_release_phy_80003es2lan(hw);
823 /* Disable IBIST slave mode (far-end loopback) */
824 ret_val = e1000_read_kmrn_reg_80003es2lan(hw,
825 E1000_KMRNCTRLSTA_INBAND_PARAM, &kum_reg_data);
827 kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE;
828 ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
829 E1000_KMRNCTRLSTA_INBAND_PARAM,
832 DEBUGOUT("Error disabling far-end loopback\n");
834 DEBUGOUT("Error disabling far-end loopback\n");
836 ret_val = e1000_get_auto_rd_done_generic(hw);
838 /* We don't want to continue accessing MAC registers. */
841 /* Clear any pending interrupt events. */
842 E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
843 E1000_READ_REG(hw, E1000_ICR);
845 return e1000_check_alt_mac_addr_generic(hw);
849 * e1000_init_hw_80003es2lan - Initialize the ESB2 controller
850 * @hw: pointer to the HW structure
852 * Initialize the hw bits, LED, VFTA, MTA, link and hw counters.
854 STATIC s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw)
856 struct e1000_mac_info *mac = &hw->mac;
862 DEBUGFUNC("e1000_init_hw_80003es2lan");
864 e1000_initialize_hw_bits_80003es2lan(hw);
866 /* Initialize identification LED */
867 ret_val = mac->ops.id_led_init(hw);
868 /* An error is not fatal and we should not stop init due to this */
870 DEBUGOUT("Error initializing identification LED\n");
872 /* Disabling VLAN filtering */
873 DEBUGOUT("Initializing the IEEE VLAN\n");
874 mac->ops.clear_vfta(hw);
876 /* Setup the receive address. */
877 e1000_init_rx_addrs_generic(hw, mac->rar_entry_count);
879 /* Zero out the Multicast HASH table */
880 DEBUGOUT("Zeroing the MTA\n");
881 for (i = 0; i < mac->mta_reg_count; i++)
882 E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0);
884 /* Setup link and flow control */
885 ret_val = mac->ops.setup_link(hw);
889 /* Disable IBIST slave mode (far-end loopback) */
891 e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
894 kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE;
895 ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
896 E1000_KMRNCTRLSTA_INBAND_PARAM,
899 DEBUGOUT("Error disabling far-end loopback\n");
901 DEBUGOUT("Error disabling far-end loopback\n");
903 /* Set the transmit descriptor write-back policy */
904 reg_data = E1000_READ_REG(hw, E1000_TXDCTL(0));
905 reg_data = ((reg_data & ~E1000_TXDCTL_WTHRESH) |
906 E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC);
907 E1000_WRITE_REG(hw, E1000_TXDCTL(0), reg_data);
909 /* ...for both queues. */
910 reg_data = E1000_READ_REG(hw, E1000_TXDCTL(1));
911 reg_data = ((reg_data & ~E1000_TXDCTL_WTHRESH) |
912 E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC);
913 E1000_WRITE_REG(hw, E1000_TXDCTL(1), reg_data);
915 /* Enable retransmit on late collisions */
916 reg_data = E1000_READ_REG(hw, E1000_TCTL);
917 reg_data |= E1000_TCTL_RTLC;
918 E1000_WRITE_REG(hw, E1000_TCTL, reg_data);
920 /* Configure Gigabit Carry Extend Padding */
921 reg_data = E1000_READ_REG(hw, E1000_TCTL_EXT);
922 reg_data &= ~E1000_TCTL_EXT_GCEX_MASK;
923 reg_data |= DEFAULT_TCTL_EXT_GCEX_80003ES2LAN;
924 E1000_WRITE_REG(hw, E1000_TCTL_EXT, reg_data);
926 /* Configure Transmit Inter-Packet Gap */
927 reg_data = E1000_READ_REG(hw, E1000_TIPG);
928 reg_data &= ~E1000_TIPG_IPGT_MASK;
929 reg_data |= DEFAULT_TIPG_IPGT_1000_80003ES2LAN;
930 E1000_WRITE_REG(hw, E1000_TIPG, reg_data);
932 reg_data = E1000_READ_REG_ARRAY(hw, E1000_FFLT, 0x0001);
933 reg_data &= ~0x00100000;
934 E1000_WRITE_REG_ARRAY(hw, E1000_FFLT, 0x0001, reg_data);
936 /* default to true to enable the MDIC W/A */
937 hw->dev_spec._80003es2lan.mdic_wa_enable = true;
940 e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_OFFSET >>
941 E1000_KMRNCTRLSTA_OFFSET_SHIFT, &i);
943 if ((i & E1000_KMRNCTRLSTA_OPMODE_MASK) ==
944 E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO)
945 hw->dev_spec._80003es2lan.mdic_wa_enable = false;
948 /* Clear all of the statistics registers (clear on read). It is
949 * important that we do this after we have tried to establish link
950 * because the symbol error count will increment wildly if there
953 e1000_clear_hw_cntrs_80003es2lan(hw);
959 * e1000_initialize_hw_bits_80003es2lan - Init hw bits of ESB2
960 * @hw: pointer to the HW structure
962 * Initializes required hardware-dependent bits needed for normal operation.
964 STATIC void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw)
968 DEBUGFUNC("e1000_initialize_hw_bits_80003es2lan");
970 /* Transmit Descriptor Control 0 */
971 reg = E1000_READ_REG(hw, E1000_TXDCTL(0));
973 E1000_WRITE_REG(hw, E1000_TXDCTL(0), reg);
975 /* Transmit Descriptor Control 1 */
976 reg = E1000_READ_REG(hw, E1000_TXDCTL(1));
978 E1000_WRITE_REG(hw, E1000_TXDCTL(1), reg);
980 /* Transmit Arbitration Control 0 */
981 reg = E1000_READ_REG(hw, E1000_TARC(0));
982 reg &= ~(0xF << 27); /* 30:27 */
983 if (hw->phy.media_type != e1000_media_type_copper)
985 E1000_WRITE_REG(hw, E1000_TARC(0), reg);
987 /* Transmit Arbitration Control 1 */
988 reg = E1000_READ_REG(hw, E1000_TARC(1));
989 if (E1000_READ_REG(hw, E1000_TCTL) & E1000_TCTL_MULR)
993 E1000_WRITE_REG(hw, E1000_TARC(1), reg);
995 /* Disable IPv6 extension header parsing because some malformed
996 * IPv6 headers can hang the Rx.
998 reg = E1000_READ_REG(hw, E1000_RFCTL);
999 reg |= (E1000_RFCTL_IPV6_EX_DIS | E1000_RFCTL_NEW_IPV6_EXT_DIS);
1000 E1000_WRITE_REG(hw, E1000_RFCTL, reg);
1006 * e1000_copper_link_setup_gg82563_80003es2lan - Configure GG82563 Link
1007 * @hw: pointer to the HW structure
1009 * Setup some GG82563 PHY registers for obtaining link
1011 STATIC s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw)
1013 struct e1000_phy_info *phy = &hw->phy;
1018 DEBUGFUNC("e1000_copper_link_setup_gg82563_80003es2lan");
1020 ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, &data);
1024 data |= GG82563_MSCR_ASSERT_CRS_ON_TX;
1025 /* Use 25MHz for both link down and 1000Base-T for Tx clock. */
1026 data |= GG82563_MSCR_TX_CLK_1000MBPS_25;
1028 ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, data);
1033 * MDI/MDI-X = 0 (default)
1034 * 0 - Auto for all speeds
1037 * 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes)
1039 ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_SPEC_CTRL, &data);
1043 data &= ~GG82563_PSCR_CROSSOVER_MODE_MASK;
1045 switch (phy->mdix) {
1047 data |= GG82563_PSCR_CROSSOVER_MODE_MDI;
1050 data |= GG82563_PSCR_CROSSOVER_MODE_MDIX;
1054 data |= GG82563_PSCR_CROSSOVER_MODE_AUTO;
1059 * disable_polarity_correction = 0 (default)
1060 * Automatic Correction for Reversed Cable Polarity
1064 data &= ~GG82563_PSCR_POLARITY_REVERSAL_DISABLE;
1065 if (phy->disable_polarity_correction)
1066 data |= GG82563_PSCR_POLARITY_REVERSAL_DISABLE;
1068 ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_SPEC_CTRL, data);
1072 /* SW Reset the PHY so all changes take effect */
1073 ret_val = hw->phy.ops.commit(hw);
1075 DEBUGOUT("Error Resetting the PHY\n");
1079 /* Bypass Rx and Tx FIFO's */
1080 reg = E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL;
1081 data = (E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS |
1082 E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS);
1083 ret_val = e1000_write_kmrn_reg_80003es2lan(hw, reg, data);
1087 reg = E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE;
1088 ret_val = e1000_read_kmrn_reg_80003es2lan(hw, reg, &data);
1091 data |= E1000_KMRNCTRLSTA_OPMODE_E_IDLE;
1092 ret_val = e1000_write_kmrn_reg_80003es2lan(hw, reg, data);
1096 ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_SPEC_CTRL_2, &data);
1100 data &= ~GG82563_PSCR2_REVERSE_AUTO_NEG;
1101 ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_SPEC_CTRL_2, data);
1105 reg = E1000_READ_REG(hw, E1000_CTRL_EXT);
1106 reg &= ~E1000_CTRL_EXT_LINK_MODE_MASK;
1107 E1000_WRITE_REG(hw, E1000_CTRL_EXT, reg);
1109 ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_PWR_MGMT_CTRL, &data);
1113 /* Do not init these registers when the HW is in IAMT mode, since the
1114 * firmware will have already initialized them. We only initialize
1115 * them if the HW is not in IAMT mode.
1117 if (!hw->mac.ops.check_mng_mode(hw)) {
1118 /* Enable Electrical Idle on the PHY */
1119 data |= GG82563_PMCR_ENABLE_ELECTRICAL_IDLE;
1120 ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_PWR_MGMT_CTRL,
1125 ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL,
1130 data &= ~GG82563_KMCR_PASS_FALSE_CARRIER;
1131 ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL,
1137 /* Workaround: Disable padding in Kumeran interface in the MAC
1138 * and in the PHY to avoid CRC errors.
1140 ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_INBAND_CTRL, &data);
1144 data |= GG82563_ICR_DIS_PADDING;
1145 ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_INBAND_CTRL, data);
1149 return E1000_SUCCESS;
1153 * e1000_setup_copper_link_80003es2lan - Setup Copper Link for ESB2
1154 * @hw: pointer to the HW structure
1156 * Essentially a wrapper for setting up all things "copper" related.
1157 * This is a function pointer entry point called by the mac module.
1159 STATIC s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw)
1165 DEBUGFUNC("e1000_setup_copper_link_80003es2lan");
1167 ctrl = E1000_READ_REG(hw, E1000_CTRL);
1168 ctrl |= E1000_CTRL_SLU;
1169 ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX);
1170 E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
1172 /* Set the mac to wait the maximum time between each
1173 * iteration and increase the max iterations when
1174 * polling the phy; this fixes erroneous timeouts at 10Mbps.
1176 ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 4),
1180 ret_val = e1000_read_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9),
1185 ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9),
1190 e1000_read_kmrn_reg_80003es2lan(hw,
1191 E1000_KMRNCTRLSTA_OFFSET_INB_CTRL,
1195 reg_data |= E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING;
1197 e1000_write_kmrn_reg_80003es2lan(hw,
1198 E1000_KMRNCTRLSTA_OFFSET_INB_CTRL,
1203 ret_val = e1000_copper_link_setup_gg82563_80003es2lan(hw);
1207 return e1000_setup_copper_link_generic(hw);
1211 * e1000_cfg_on_link_up_80003es2lan - es2 link configuration after link-up
1212 * @hw: pointer to the HW structure
1214 * Configure the KMRN interface by applying last minute quirks for
1217 STATIC s32 e1000_cfg_on_link_up_80003es2lan(struct e1000_hw *hw)
1219 s32 ret_val = E1000_SUCCESS;
1223 DEBUGFUNC("e1000_configure_on_link_up");
1225 if (hw->phy.media_type == e1000_media_type_copper) {
1226 ret_val = e1000_get_speed_and_duplex_copper_generic(hw, &speed,
1231 if (speed == SPEED_1000)
1232 ret_val = e1000_cfg_kmrn_1000_80003es2lan(hw);
1234 ret_val = e1000_cfg_kmrn_10_100_80003es2lan(hw, duplex);
1241 * e1000_cfg_kmrn_10_100_80003es2lan - Apply "quirks" for 10/100 operation
1242 * @hw: pointer to the HW structure
1243 * @duplex: current duplex setting
1245 * Configure the KMRN interface by applying last minute quirks for
1248 STATIC s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex)
1253 u16 reg_data, reg_data2;
1255 DEBUGFUNC("e1000_configure_kmrn_for_10_100");
1257 reg_data = E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT;
1259 e1000_write_kmrn_reg_80003es2lan(hw,
1260 E1000_KMRNCTRLSTA_OFFSET_HD_CTRL,
1265 /* Configure Transmit Inter-Packet Gap */
1266 tipg = E1000_READ_REG(hw, E1000_TIPG);
1267 tipg &= ~E1000_TIPG_IPGT_MASK;
1268 tipg |= DEFAULT_TIPG_IPGT_10_100_80003ES2LAN;
1269 E1000_WRITE_REG(hw, E1000_TIPG, tipg);
1272 ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL,
1277 ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL,
1282 } while ((reg_data != reg_data2) && (i < GG82563_MAX_KMRN_RETRY));
1284 if (duplex == HALF_DUPLEX)
1285 reg_data |= GG82563_KMCR_PASS_FALSE_CARRIER;
1287 reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER;
1289 return hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data);
1293 * e1000_cfg_kmrn_1000_80003es2lan - Apply "quirks" for gigabit operation
1294 * @hw: pointer to the HW structure
1296 * Configure the KMRN interface by applying last minute quirks for
1297 * gigabit operation.
1299 STATIC s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw)
1302 u16 reg_data, reg_data2;
1306 DEBUGFUNC("e1000_configure_kmrn_for_1000");
1308 reg_data = E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT;
1310 e1000_write_kmrn_reg_80003es2lan(hw,
1311 E1000_KMRNCTRLSTA_OFFSET_HD_CTRL,
1316 /* Configure Transmit Inter-Packet Gap */
1317 tipg = E1000_READ_REG(hw, E1000_TIPG);
1318 tipg &= ~E1000_TIPG_IPGT_MASK;
1319 tipg |= DEFAULT_TIPG_IPGT_1000_80003ES2LAN;
1320 E1000_WRITE_REG(hw, E1000_TIPG, tipg);
1323 ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL,
1328 ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL,
1333 } while ((reg_data != reg_data2) && (i < GG82563_MAX_KMRN_RETRY));
1335 reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER;
1337 return hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data);
1341 * e1000_read_kmrn_reg_80003es2lan - Read kumeran register
1342 * @hw: pointer to the HW structure
1343 * @offset: register offset to be read
1344 * @data: pointer to the read data
1346 * Acquire semaphore, then read the PHY register at offset
1347 * using the kumeran interface. The information retrieved is stored in data.
1348 * Release the semaphore before exiting.
1350 STATIC s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
1356 DEBUGFUNC("e1000_read_kmrn_reg_80003es2lan");
1358 ret_val = e1000_acquire_mac_csr_80003es2lan(hw);
1362 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
1363 E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN;
1364 E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta);
1365 E1000_WRITE_FLUSH(hw);
1369 kmrnctrlsta = E1000_READ_REG(hw, E1000_KMRNCTRLSTA);
1370 *data = (u16)kmrnctrlsta;
1372 e1000_release_mac_csr_80003es2lan(hw);
1378 * e1000_write_kmrn_reg_80003es2lan - Write kumeran register
1379 * @hw: pointer to the HW structure
1380 * @offset: register offset to write to
1381 * @data: data to write at register offset
1383 * Acquire semaphore, then write the data to PHY register
1384 * at the offset using the kumeran interface. Release semaphore
1387 STATIC s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
1393 DEBUGFUNC("e1000_write_kmrn_reg_80003es2lan");
1395 ret_val = e1000_acquire_mac_csr_80003es2lan(hw);
1399 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
1400 E1000_KMRNCTRLSTA_OFFSET) | data;
1401 E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta);
1402 E1000_WRITE_FLUSH(hw);
1406 e1000_release_mac_csr_80003es2lan(hw);
1412 * e1000_read_mac_addr_80003es2lan - Read device MAC address
1413 * @hw: pointer to the HW structure
1415 STATIC s32 e1000_read_mac_addr_80003es2lan(struct e1000_hw *hw)
1419 DEBUGFUNC("e1000_read_mac_addr_80003es2lan");
1421 /* If there's an alternate MAC address place it in RAR0
1422 * so that it will override the Si installed default perm
1425 ret_val = e1000_check_alt_mac_addr_generic(hw);
1429 return e1000_read_mac_addr_generic(hw);
1433 * e1000_power_down_phy_copper_80003es2lan - Remove link during PHY power down
1434 * @hw: pointer to the HW structure
1436 * In the case of a PHY power down to save power, or to turn off link during a
1437 * driver unload, or wake on lan is not enabled, remove the link.
1439 STATIC void e1000_power_down_phy_copper_80003es2lan(struct e1000_hw *hw)
1441 /* If the management interface is not enabled, then power down */
1442 if (!(hw->mac.ops.check_mng_mode(hw) ||
1443 hw->phy.ops.check_reset_block(hw)))
1444 e1000_power_down_phy_copper(hw);
1450 * e1000_clear_hw_cntrs_80003es2lan - Clear device specific hardware counters
1451 * @hw: pointer to the HW structure
1453 * Clears the hardware counters by reading the counter registers.
1455 STATIC void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw)
1457 DEBUGFUNC("e1000_clear_hw_cntrs_80003es2lan");
1459 e1000_clear_hw_cntrs_base_generic(hw);
1461 E1000_READ_REG(hw, E1000_PRC64);
1462 E1000_READ_REG(hw, E1000_PRC127);
1463 E1000_READ_REG(hw, E1000_PRC255);
1464 E1000_READ_REG(hw, E1000_PRC511);
1465 E1000_READ_REG(hw, E1000_PRC1023);
1466 E1000_READ_REG(hw, E1000_PRC1522);
1467 E1000_READ_REG(hw, E1000_PTC64);
1468 E1000_READ_REG(hw, E1000_PTC127);
1469 E1000_READ_REG(hw, E1000_PTC255);
1470 E1000_READ_REG(hw, E1000_PTC511);
1471 E1000_READ_REG(hw, E1000_PTC1023);
1472 E1000_READ_REG(hw, E1000_PTC1522);
1474 E1000_READ_REG(hw, E1000_ALGNERRC);
1475 E1000_READ_REG(hw, E1000_RXERRC);
1476 E1000_READ_REG(hw, E1000_TNCRS);
1477 E1000_READ_REG(hw, E1000_CEXTERR);
1478 E1000_READ_REG(hw, E1000_TSCTC);
1479 E1000_READ_REG(hw, E1000_TSCTFC);
1481 E1000_READ_REG(hw, E1000_MGTPRC);
1482 E1000_READ_REG(hw, E1000_MGTPDC);
1483 E1000_READ_REG(hw, E1000_MGTPTC);
1485 E1000_READ_REG(hw, E1000_IAC);
1486 E1000_READ_REG(hw, E1000_ICRXOC);
1488 E1000_READ_REG(hw, E1000_ICRXPTC);
1489 E1000_READ_REG(hw, E1000_ICRXATC);
1490 E1000_READ_REG(hw, E1000_ICTXPTC);
1491 E1000_READ_REG(hw, E1000_ICTXATC);
1492 E1000_READ_REG(hw, E1000_ICTXQEC);
1493 E1000_READ_REG(hw, E1000_ICTXQMTC);
1494 E1000_READ_REG(hw, E1000_ICRXDMTC);