Lines Matching +full:hw +full:- +full:flow +full:- +full:ctrl
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 1999 - 2018 Intel Corporation. */
22 static s32 e1000_get_phy_id_82571(struct e1000_hw *hw);
23 static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw);
24 static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw);
25 static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw);
26 static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset,
28 static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw);
29 static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw);
30 static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw);
31 static bool e1000_check_mng_mode_82574(struct e1000_hw *hw);
32 static s32 e1000_led_on_82574(struct e1000_hw *hw);
33 static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw);
34 static void e1000_power_down_phy_copper_82571(struct e1000_hw *hw);
35 static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw);
36 static s32 e1000_get_hw_semaphore_82574(struct e1000_hw *hw);
37 static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw);
38 static s32 e1000_set_d0_lplu_state_82574(struct e1000_hw *hw, bool active);
39 static s32 e1000_set_d3_lplu_state_82574(struct e1000_hw *hw, bool active);
42 * e1000_init_phy_params_82571 - Init PHY func ptrs.
43 * @hw: pointer to the HW structure
45 static s32 e1000_init_phy_params_82571(struct e1000_hw *hw) in e1000_init_phy_params_82571() argument
47 struct e1000_phy_info *phy = &hw->phy; in e1000_init_phy_params_82571()
50 if (hw->phy.media_type != e1000_media_type_copper) { in e1000_init_phy_params_82571()
51 phy->type = e1000_phy_none; in e1000_init_phy_params_82571()
55 phy->addr = 1; in e1000_init_phy_params_82571()
56 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; in e1000_init_phy_params_82571()
57 phy->reset_delay_us = 100; in e1000_init_phy_params_82571()
59 phy->ops.power_up = e1000_power_up_phy_copper; in e1000_init_phy_params_82571()
60 phy->ops.power_down = e1000_power_down_phy_copper_82571; in e1000_init_phy_params_82571()
62 switch (hw->mac.type) { in e1000_init_phy_params_82571()
65 phy->type = e1000_phy_igp_2; in e1000_init_phy_params_82571()
68 phy->type = e1000_phy_m88; in e1000_init_phy_params_82571()
72 phy->type = e1000_phy_bm; in e1000_init_phy_params_82571()
73 phy->ops.acquire = e1000_get_hw_semaphore_82574; in e1000_init_phy_params_82571()
74 phy->ops.release = e1000_put_hw_semaphore_82574; in e1000_init_phy_params_82571()
75 phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82574; in e1000_init_phy_params_82571()
76 phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_82574; in e1000_init_phy_params_82571()
79 return -E1000_ERR_PHY; in e1000_init_phy_params_82571()
83 ret_val = e1000_get_phy_id_82571(hw); in e1000_init_phy_params_82571()
90 switch (hw->mac.type) { in e1000_init_phy_params_82571()
93 if (phy->id != IGP01E1000_I_PHY_ID) in e1000_init_phy_params_82571()
94 ret_val = -E1000_ERR_PHY; in e1000_init_phy_params_82571()
97 if (phy->id != M88E1111_I_PHY_ID) in e1000_init_phy_params_82571()
98 ret_val = -E1000_ERR_PHY; in e1000_init_phy_params_82571()
102 if (phy->id != BME1000_E_PHY_ID_R2) in e1000_init_phy_params_82571()
103 ret_val = -E1000_ERR_PHY; in e1000_init_phy_params_82571()
106 ret_val = -E1000_ERR_PHY; in e1000_init_phy_params_82571()
111 e_dbg("PHY ID unknown: type = 0x%08x\n", phy->id); in e1000_init_phy_params_82571()
117 * e1000_init_nvm_params_82571 - Init NVM func ptrs.
118 * @hw: pointer to the HW structure
120 static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw) in e1000_init_nvm_params_82571() argument
122 struct e1000_nvm_info *nvm = &hw->nvm; in e1000_init_nvm_params_82571()
126 nvm->opcode_bits = 8; in e1000_init_nvm_params_82571()
127 nvm->delay_usec = 1; in e1000_init_nvm_params_82571()
128 switch (nvm->override) { in e1000_init_nvm_params_82571()
130 nvm->page_size = 32; in e1000_init_nvm_params_82571()
131 nvm->address_bits = 16; in e1000_init_nvm_params_82571()
134 nvm->page_size = 8; in e1000_init_nvm_params_82571()
135 nvm->address_bits = 8; in e1000_init_nvm_params_82571()
138 nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; in e1000_init_nvm_params_82571()
139 nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? 16 : 8; in e1000_init_nvm_params_82571()
143 switch (hw->mac.type) { in e1000_init_nvm_params_82571()
148 nvm->type = e1000_nvm_flash_hw; in e1000_init_nvm_params_82571()
149 nvm->word_size = 2048; in e1000_init_nvm_params_82571()
159 nvm->type = e1000_nvm_eeprom_spi; in e1000_init_nvm_params_82571()
162 /* Added to a constant, "size" becomes the left-shift value in e1000_init_nvm_params_82571()
170 nvm->word_size = BIT(size); in e1000_init_nvm_params_82571()
175 switch (hw->mac.type) { in e1000_init_nvm_params_82571()
178 nvm->ops.acquire = e1000_get_hw_semaphore_82574; in e1000_init_nvm_params_82571()
179 nvm->ops.release = e1000_put_hw_semaphore_82574; in e1000_init_nvm_params_82571()
189 * e1000_init_mac_params_82571 - Init MAC func ptrs.
190 * @hw: pointer to the HW structure
192 static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) in e1000_init_mac_params_82571() argument
194 struct e1000_mac_info *mac = &hw->mac; in e1000_init_mac_params_82571()
199 /* Set media type and media-dependent function pointers */ in e1000_init_mac_params_82571()
200 switch (hw->adapter->pdev->device) { in e1000_init_mac_params_82571()
204 hw->phy.media_type = e1000_media_type_fiber; in e1000_init_mac_params_82571()
205 mac->ops.setup_physical_interface = in e1000_init_mac_params_82571()
207 mac->ops.check_for_link = e1000e_check_for_fiber_link; in e1000_init_mac_params_82571()
208 mac->ops.get_link_up_info = in e1000_init_mac_params_82571()
215 hw->phy.media_type = e1000_media_type_internal_serdes; in e1000_init_mac_params_82571()
216 mac->ops.setup_physical_interface = in e1000_init_mac_params_82571()
218 mac->ops.check_for_link = e1000_check_for_serdes_link_82571; in e1000_init_mac_params_82571()
219 mac->ops.get_link_up_info = in e1000_init_mac_params_82571()
223 hw->phy.media_type = e1000_media_type_copper; in e1000_init_mac_params_82571()
224 mac->ops.setup_physical_interface = in e1000_init_mac_params_82571()
226 mac->ops.check_for_link = e1000e_check_for_copper_link; in e1000_init_mac_params_82571()
227 mac->ops.get_link_up_info = e1000e_get_speed_and_duplex_copper; in e1000_init_mac_params_82571()
232 mac->mta_reg_count = 128; in e1000_init_mac_params_82571()
234 mac->rar_entry_count = E1000_RAR_ENTRIES; in e1000_init_mac_params_82571()
236 mac->adaptive_ifs = true; in e1000_init_mac_params_82571()
238 /* MAC-specific function pointers */ in e1000_init_mac_params_82571()
239 switch (hw->mac.type) { in e1000_init_mac_params_82571()
241 mac->ops.set_lan_id = e1000_set_lan_id_single_port; in e1000_init_mac_params_82571()
242 mac->ops.check_mng_mode = e1000e_check_mng_mode_generic; in e1000_init_mac_params_82571()
243 mac->ops.led_on = e1000e_led_on_generic; in e1000_init_mac_params_82571()
244 mac->ops.blink_led = e1000e_blink_led_generic; in e1000_init_mac_params_82571()
247 mac->has_fwsm = true; in e1000_init_mac_params_82571()
251 mac->arc_subsystem_valid = !!(er32(FWSM) & in e1000_init_mac_params_82571()
256 mac->ops.set_lan_id = e1000_set_lan_id_single_port; in e1000_init_mac_params_82571()
257 mac->ops.check_mng_mode = e1000_check_mng_mode_82574; in e1000_init_mac_params_82571()
258 mac->ops.led_on = e1000_led_on_82574; in e1000_init_mac_params_82571()
261 mac->ops.check_mng_mode = e1000e_check_mng_mode_generic; in e1000_init_mac_params_82571()
262 mac->ops.led_on = e1000e_led_on_generic; in e1000_init_mac_params_82571()
263 mac->ops.blink_led = e1000e_blink_led_generic; in e1000_init_mac_params_82571()
266 mac->has_fwsm = true; in e1000_init_mac_params_82571()
270 /* Ensure that the inter-port SWSM.SMBI lock bit is clear before in e1000_init_mac_params_82571()
271 * first NVM or PHY access. This should be done for single-port in e1000_init_mac_params_82571()
272 * devices, and for one port only on dual-port devices so that in e1000_init_mac_params_82571()
274 * inter-port accesses to the PHY & NVM. in e1000_init_mac_params_82571()
276 switch (hw->mac.type) { in e1000_init_mac_params_82571()
308 hw->dev_spec.e82571.smb_counter = 0; in e1000_init_mac_params_82571()
315 struct e1000_hw *hw = &adapter->hw; in e1000_get_variants_82571() local
317 struct pci_dev *pdev = adapter->pdev; in e1000_get_variants_82571()
321 rc = e1000_init_mac_params_82571(hw); in e1000_get_variants_82571()
325 rc = e1000_init_nvm_params_82571(hw); in e1000_get_variants_82571()
329 rc = e1000_init_phy_params_82571(hw); in e1000_get_variants_82571()
334 switch (pdev->device) { in e1000_get_variants_82571()
339 adapter->flags |= FLAG_IS_QUAD_PORT; in e1000_get_variants_82571()
342 adapter->flags |= FLAG_IS_QUAD_PORT_A; in e1000_get_variants_82571()
352 switch (adapter->hw.mac.type) { in e1000_get_variants_82571()
355 if (((pdev->device == E1000_DEV_ID_82571EB_FIBER) || in e1000_get_variants_82571()
356 (pdev->device == E1000_DEV_ID_82571EB_SERDES) || in e1000_get_variants_82571()
357 (pdev->device == E1000_DEV_ID_82571EB_COPPER)) && in e1000_get_variants_82571()
359 adapter->flags &= ~FLAG_HAS_WOL; in e1000_get_variants_82571()
361 if (adapter->flags & FLAG_IS_QUAD_PORT && in e1000_get_variants_82571()
362 (!(adapter->flags & FLAG_IS_QUAD_PORT_A))) in e1000_get_variants_82571()
363 adapter->flags &= ~FLAG_HAS_WOL; in e1000_get_variants_82571()
365 if (pdev->device == E1000_DEV_ID_82571EB_SERDES_QUAD) in e1000_get_variants_82571()
366 adapter->flags &= ~FLAG_HAS_WOL; in e1000_get_variants_82571()
369 if (pdev->device == E1000_DEV_ID_82573L) { in e1000_get_variants_82571()
370 adapter->flags |= FLAG_HAS_JUMBO_FRAMES; in e1000_get_variants_82571()
371 adapter->max_hw_frame_size = DEFAULT_JUMBO; in e1000_get_variants_82571()
382 * e1000_get_phy_id_82571 - Retrieve the PHY ID and revision
383 * @hw: pointer to the HW structure
388 static s32 e1000_get_phy_id_82571(struct e1000_hw *hw) in e1000_get_phy_id_82571() argument
390 struct e1000_phy_info *phy = &hw->phy; in e1000_get_phy_id_82571()
394 switch (hw->mac.type) { in e1000_get_phy_id_82571()
402 phy->id = IGP01E1000_I_PHY_ID; in e1000_get_phy_id_82571()
405 return e1000e_get_phy_id(hw); in e1000_get_phy_id_82571()
408 ret_val = e1e_rphy(hw, MII_PHYSID1, &phy_id); in e1000_get_phy_id_82571()
412 phy->id = (u32)(phy_id << 16); in e1000_get_phy_id_82571()
414 ret_val = e1e_rphy(hw, MII_PHYSID2, &phy_id); in e1000_get_phy_id_82571()
418 phy->id |= (u32)(phy_id); in e1000_get_phy_id_82571()
419 phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK); in e1000_get_phy_id_82571()
422 return -E1000_ERR_PHY; in e1000_get_phy_id_82571()
429 * e1000_get_hw_semaphore_82571 - Acquire hardware semaphore
430 * @hw: pointer to the HW structure
432 * Acquire the HW semaphore to access the PHY or NVM
434 static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw) in e1000_get_hw_semaphore_82571() argument
437 s32 sw_timeout = hw->nvm.word_size + 1; in e1000_get_hw_semaphore_82571()
438 s32 fw_timeout = hw->nvm.word_size + 1; in e1000_get_hw_semaphore_82571()
442 * the inter-port SMBI semaphore, there is old code in e1000_get_hw_semaphore_82571()
448 if (hw->dev_spec.e82571.smb_counter > 2) in e1000_get_hw_semaphore_82571()
462 e_dbg("Driver can't access device - SMBI bit is set.\n"); in e1000_get_hw_semaphore_82571()
463 hw->dev_spec.e82571.smb_counter++; in e1000_get_hw_semaphore_82571()
479 e1000_put_hw_semaphore_82571(hw); in e1000_get_hw_semaphore_82571()
481 return -E1000_ERR_NVM; in e1000_get_hw_semaphore_82571()
488 * e1000_put_hw_semaphore_82571 - Release hardware semaphore
489 * @hw: pointer to the HW structure
493 static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw) in e1000_put_hw_semaphore_82571() argument
503 * e1000_get_hw_semaphore_82573 - Acquire hardware semaphore
504 * @hw: pointer to the HW structure
506 * Acquire the HW semaphore during reset.
509 static s32 e1000_get_hw_semaphore_82573(struct e1000_hw *hw) in e1000_get_hw_semaphore_82573() argument
529 e1000_put_hw_semaphore_82573(hw); in e1000_get_hw_semaphore_82573()
531 return -E1000_ERR_PHY; in e1000_get_hw_semaphore_82573()
538 * e1000_put_hw_semaphore_82573 - Release hardware semaphore
539 * @hw: pointer to the HW structure
544 static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw) in e1000_put_hw_semaphore_82573() argument
556 * e1000_get_hw_semaphore_82574 - Acquire hardware semaphore
557 * @hw: pointer to the HW structure
559 * Acquire the HW semaphore to access the PHY or NVM.
562 static s32 e1000_get_hw_semaphore_82574(struct e1000_hw *hw) in e1000_get_hw_semaphore_82574() argument
567 ret_val = e1000_get_hw_semaphore_82573(hw); in e1000_get_hw_semaphore_82574()
574 * e1000_put_hw_semaphore_82574 - Release hardware semaphore
575 * @hw: pointer to the HW structure
580 static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw) in e1000_put_hw_semaphore_82574() argument
582 e1000_put_hw_semaphore_82573(hw); in e1000_put_hw_semaphore_82574()
587 * e1000_set_d0_lplu_state_82574 - Set Low Power Linkup D0 state
588 * @hw: pointer to the HW structure
598 static s32 e1000_set_d0_lplu_state_82574(struct e1000_hw *hw, bool active) in e1000_set_d0_lplu_state_82574() argument
612 * e1000_set_d3_lplu_state_82574 - Sets low power link up state for D3
613 * @hw: pointer to the HW structure
622 static s32 e1000_set_d3_lplu_state_82574(struct e1000_hw *hw, bool active) in e1000_set_d3_lplu_state_82574() argument
628 } else if ((hw->phy.autoneg_advertised == E1000_ALL_SPEED_DUPLEX) || in e1000_set_d3_lplu_state_82574()
629 (hw->phy.autoneg_advertised == E1000_ALL_NOT_GIG) || in e1000_set_d3_lplu_state_82574()
630 (hw->phy.autoneg_advertised == E1000_ALL_10_SPEED)) { in e1000_set_d3_lplu_state_82574()
639 * e1000_acquire_nvm_82571 - Request for access to the EEPROM
640 * @hw: pointer to the HW structure
643 * Then for non-82573 hardware, set the EEPROM access request bit and wait
647 static s32 e1000_acquire_nvm_82571(struct e1000_hw *hw) in e1000_acquire_nvm_82571() argument
651 ret_val = e1000_get_hw_semaphore_82571(hw); in e1000_acquire_nvm_82571()
655 switch (hw->mac.type) { in e1000_acquire_nvm_82571()
659 ret_val = e1000e_acquire_nvm(hw); in e1000_acquire_nvm_82571()
664 e1000_put_hw_semaphore_82571(hw); in e1000_acquire_nvm_82571()
670 * e1000_release_nvm_82571 - Release exclusive access to EEPROM
671 * @hw: pointer to the HW structure
675 static void e1000_release_nvm_82571(struct e1000_hw *hw) in e1000_release_nvm_82571() argument
677 e1000e_release_nvm(hw); in e1000_release_nvm_82571()
678 e1000_put_hw_semaphore_82571(hw); in e1000_release_nvm_82571()
682 * e1000_write_nvm_82571 - Write to EEPROM using appropriate interface
683 * @hw: pointer to the HW structure
688 * For non-82573 silicon, write data to EEPROM at offset using SPI interface.
693 static s32 e1000_write_nvm_82571(struct e1000_hw *hw, u16 offset, u16 words, in e1000_write_nvm_82571() argument
698 switch (hw->mac.type) { in e1000_write_nvm_82571()
702 ret_val = e1000_write_nvm_eewr_82571(hw, offset, words, data); in e1000_write_nvm_82571()
706 ret_val = e1000e_write_nvm_spi(hw, offset, words, data); in e1000_write_nvm_82571()
709 ret_val = -E1000_ERR_NVM; in e1000_write_nvm_82571()
717 * e1000_update_nvm_checksum_82571 - Update EEPROM checksum
718 * @hw: pointer to the HW structure
724 static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw) in e1000_update_nvm_checksum_82571() argument
730 ret_val = e1000e_update_nvm_checksum_generic(hw); in e1000_update_nvm_checksum_82571()
737 if (hw->nvm.type != e1000_nvm_flash_hw) in e1000_update_nvm_checksum_82571()
748 return -E1000_ERR_NVM; in e1000_update_nvm_checksum_82571()
771 return -E1000_ERR_NVM; in e1000_update_nvm_checksum_82571()
777 * e1000_validate_nvm_checksum_82571 - Validate EEPROM checksum
778 * @hw: pointer to the HW structure
783 static s32 e1000_validate_nvm_checksum_82571(struct e1000_hw *hw) in e1000_validate_nvm_checksum_82571() argument
785 if (hw->nvm.type == e1000_nvm_flash_hw) in e1000_validate_nvm_checksum_82571()
786 e1000_fix_nvm_checksum_82571(hw); in e1000_validate_nvm_checksum_82571()
788 return e1000e_validate_nvm_checksum_generic(hw); in e1000_validate_nvm_checksum_82571()
792 * e1000_write_nvm_eewr_82571 - Write to EEPROM for 82573 silicon
793 * @hw: pointer to the HW structure
805 static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset, in e1000_write_nvm_eewr_82571() argument
808 struct e1000_nvm_info *nvm = &hw->nvm; in e1000_write_nvm_eewr_82571()
815 if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || in e1000_write_nvm_eewr_82571()
818 return -E1000_ERR_NVM; in e1000_write_nvm_eewr_82571()
826 ret_val = e1000e_poll_eerd_eewr_done(hw, E1000_NVM_POLL_WRITE); in e1000_write_nvm_eewr_82571()
832 ret_val = e1000e_poll_eerd_eewr_done(hw, E1000_NVM_POLL_WRITE); in e1000_write_nvm_eewr_82571()
841 * e1000_get_cfg_done_82571 - Poll for configuration done
842 * @hw: pointer to the HW structure
846 static s32 e1000_get_cfg_done_82571(struct e1000_hw *hw) in e1000_get_cfg_done_82571() argument
854 timeout--; in e1000_get_cfg_done_82571()
858 return -E1000_ERR_RESET; in e1000_get_cfg_done_82571()
865 * e1000_set_d0_lplu_state_82571 - Set Low Power Linkup D0 state
866 * @hw: pointer to the HW structure
875 static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active) in e1000_set_d0_lplu_state_82571() argument
877 struct e1000_phy_info *phy = &hw->phy; in e1000_set_d0_lplu_state_82571()
881 ret_val = e1e_rphy(hw, IGP02E1000_PHY_POWER_MGMT, &data); in e1000_set_d0_lplu_state_82571()
887 ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data); in e1000_set_d0_lplu_state_82571()
892 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, &data); in e1000_set_d0_lplu_state_82571()
896 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, data); in e1000_set_d0_lplu_state_82571()
901 ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data); in e1000_set_d0_lplu_state_82571()
907 if (phy->smart_speed == e1000_smart_speed_on) { in e1000_set_d0_lplu_state_82571()
908 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_set_d0_lplu_state_82571()
914 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_set_d0_lplu_state_82571()
918 } else if (phy->smart_speed == e1000_smart_speed_off) { in e1000_set_d0_lplu_state_82571()
919 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_set_d0_lplu_state_82571()
925 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_set_d0_lplu_state_82571()
936 * e1000_reset_hw_82571 - Reset hardware
937 * @hw: pointer to the HW structure
941 static s32 e1000_reset_hw_82571(struct e1000_hw *hw) in e1000_reset_hw_82571() argument
943 u32 ctrl, ctrl_ext, eecd, tctl; in e1000_reset_hw_82571() local
946 /* Prevent the PCI-E bus from sticking if there is no TLP connection in e1000_reset_hw_82571()
949 ret_val = e1000e_disable_pcie_master(hw); in e1000_reset_hw_82571()
951 e_dbg("PCI-E Master disable polling has failed.\n"); in e1000_reset_hw_82571()
967 switch (hw->mac.type) { in e1000_reset_hw_82571()
969 ret_val = e1000_get_hw_semaphore_82573(hw); in e1000_reset_hw_82571()
973 ret_val = e1000_get_hw_semaphore_82574(hw); in e1000_reset_hw_82571()
979 ctrl = er32(CTRL); in e1000_reset_hw_82571()
982 ew32(CTRL, ctrl | E1000_CTRL_RST); in e1000_reset_hw_82571()
985 switch (hw->mac.type) { in e1000_reset_hw_82571()
987 /* Release mutex only if the hw semaphore is acquired */ in e1000_reset_hw_82571()
989 e1000_put_hw_semaphore_82573(hw); in e1000_reset_hw_82571()
993 /* Release mutex only if the hw semaphore is acquired */ in e1000_reset_hw_82571()
995 e1000_put_hw_semaphore_82574(hw); in e1000_reset_hw_82571()
1001 if (hw->nvm.type == e1000_nvm_flash_hw) { in e1000_reset_hw_82571()
1009 ret_val = e1000e_get_auto_rd_done(hw); in e1000_reset_hw_82571()
1019 switch (hw->mac.type) { in e1000_reset_hw_82571()
1042 if (hw->mac.type == e1000_82571) { in e1000_reset_hw_82571()
1044 ret_val = e1000_check_alt_mac_addr_generic(hw); in e1000_reset_hw_82571()
1048 e1000e_set_laa_state_82571(hw, true); in e1000_reset_hw_82571()
1052 if (hw->phy.media_type == e1000_media_type_internal_serdes) in e1000_reset_hw_82571()
1053 hw->mac.serdes_link_state = e1000_serdes_link_down; in e1000_reset_hw_82571()
1059 * e1000_init_hw_82571 - Initialize hardware
1060 * @hw: pointer to the HW structure
1064 static s32 e1000_init_hw_82571(struct e1000_hw *hw) in e1000_init_hw_82571() argument
1066 struct e1000_mac_info *mac = &hw->mac; in e1000_init_hw_82571()
1069 u16 i, rar_count = mac->rar_entry_count; in e1000_init_hw_82571()
1071 e1000_initialize_hw_bits_82571(hw); in e1000_init_hw_82571()
1074 ret_val = mac->ops.id_led_init(hw); in e1000_init_hw_82571()
1081 mac->ops.clear_vfta(hw); in e1000_init_hw_82571()
1088 if (e1000e_get_laa_state_82571(hw)) in e1000_init_hw_82571()
1089 rar_count--; in e1000_init_hw_82571()
1090 e1000e_init_rx_addrs(hw, rar_count); in e1000_init_hw_82571()
1094 for (i = 0; i < mac->mta_reg_count; i++) in e1000_init_hw_82571()
1095 E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); in e1000_init_hw_82571()
1097 /* Setup link and flow control */ in e1000_init_hw_82571()
1098 ret_val = mac->ops.setup_link(hw); in e1000_init_hw_82571()
1100 /* Set the transmit descriptor write-back policy */ in e1000_init_hw_82571()
1107 switch (mac->type) { in e1000_init_hw_82571()
1109 e1000e_enable_tx_pkt_filtering(hw); in e1000_init_hw_82571()
1131 e1000_clear_hw_cntrs_82571(hw); in e1000_init_hw_82571()
1137 * e1000_initialize_hw_bits_82571 - Initialize hardware-dependent bits
1138 * @hw: pointer to the HW structure
1140 * Initializes required hardware-dependent bits needed for normal operation.
1142 static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw) in e1000_initialize_hw_bits_82571() argument
1159 switch (hw->mac.type) { in e1000_initialize_hw_bits_82571()
1175 switch (hw->mac.type) { in e1000_initialize_hw_bits_82571()
1191 switch (hw->mac.type) { in e1000_initialize_hw_bits_82571()
1195 reg = er32(CTRL); in e1000_initialize_hw_bits_82571()
1197 ew32(CTRL, reg); in e1000_initialize_hw_bits_82571()
1204 switch (hw->mac.type) { in e1000_initialize_hw_bits_82571()
1217 if (hw->mac.type == e1000_82571) { in e1000_initialize_hw_bits_82571()
1226 if ((hw->mac.type == e1000_82571) || (hw->mac.type == e1000_82572)) { in e1000_initialize_hw_bits_82571()
1235 if (hw->mac.type <= e1000_82573) { in e1000_initialize_hw_bits_82571()
1241 /* PCI-Ex Control Registers */ in e1000_initialize_hw_bits_82571()
1242 switch (hw->mac.type) { in e1000_initialize_hw_bits_82571()
1265 * e1000_clear_vfta_82571 - Clear VLAN filter table
1266 * @hw: pointer to the HW structure
1271 static void e1000_clear_vfta_82571(struct e1000_hw *hw) in e1000_clear_vfta_82571() argument
1278 switch (hw->mac.type) { in e1000_clear_vfta_82571()
1282 if (hw->mng_cookie.vlan_id != 0) { in e1000_clear_vfta_82571()
1283 /* The VFTA is a 4096b bit-field, each identifying in e1000_clear_vfta_82571()
1289 vfta_offset = (hw->mng_cookie.vlan_id >> in e1000_clear_vfta_82571()
1293 BIT(hw->mng_cookie.vlan_id & in e1000_clear_vfta_82571()
1306 E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset, vfta_value); in e1000_clear_vfta_82571()
1312 * e1000_check_mng_mode_82574 - Check manageability is enabled
1313 * @hw: pointer to the HW structure
1318 static bool e1000_check_mng_mode_82574(struct e1000_hw *hw) in e1000_check_mng_mode_82574() argument
1322 e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &data); in e1000_check_mng_mode_82574()
1327 * e1000_led_on_82574 - Turn LED on
1328 * @hw: pointer to the HW structure
1332 static s32 e1000_led_on_82574(struct e1000_hw *hw) in e1000_led_on_82574() argument
1334 u32 ctrl; in e1000_led_on_82574() local
1337 ctrl = hw->mac.ledctl_mode2; in e1000_led_on_82574()
1343 if (((hw->mac.ledctl_mode2 >> (i * 8)) & 0xFF) == in e1000_led_on_82574()
1345 ctrl |= (E1000_LEDCTL_LED0_IVRT << (i * 8)); in e1000_led_on_82574()
1347 ew32(LEDCTL, ctrl); in e1000_led_on_82574()
1353 * e1000_check_phy_82574 - check 82574 phy hung state
1354 * @hw: pointer to the HW structure
1358 bool e1000_check_phy_82574(struct e1000_hw *hw) in e1000_check_phy_82574() argument
1364 /* Read PHY Receive Error counter first, if its is max - all F's then in e1000_check_phy_82574()
1367 ret_val = e1e_rphy(hw, E1000_RECEIVE_ERROR_COUNTER, &receive_errors); in e1000_check_phy_82574()
1371 ret_val = e1e_rphy(hw, E1000_BASE1000T_STATUS, &status_1kbt); in e1000_check_phy_82574()
1383 * e1000_setup_link_82571 - Setup flow control and link settings
1384 * @hw: pointer to the HW structure
1386 * Determines which flow control settings to use, then configures flow
1387 * control. Calls the appropriate media-specific link configuration
1392 static s32 e1000_setup_link_82571(struct e1000_hw *hw) in e1000_setup_link_82571() argument
1395 * the default flow control setting, so we explicitly in e1000_setup_link_82571()
1398 switch (hw->mac.type) { in e1000_setup_link_82571()
1402 if (hw->fc.requested_mode == e1000_fc_default) in e1000_setup_link_82571()
1403 hw->fc.requested_mode = e1000_fc_full; in e1000_setup_link_82571()
1409 return e1000e_setup_link_generic(hw); in e1000_setup_link_82571()
1413 * e1000_setup_copper_link_82571 - Configure copper link settings
1414 * @hw: pointer to the HW structure
1416 * Configures the link for auto-neg or forced speed and duplex. Then we check
1418 * and flow control are called.
1420 static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw) in e1000_setup_copper_link_82571() argument
1422 u32 ctrl; in e1000_setup_copper_link_82571() local
1425 ctrl = er32(CTRL); in e1000_setup_copper_link_82571()
1426 ctrl |= E1000_CTRL_SLU; in e1000_setup_copper_link_82571()
1427 ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); in e1000_setup_copper_link_82571()
1428 ew32(CTRL, ctrl); in e1000_setup_copper_link_82571()
1430 switch (hw->phy.type) { in e1000_setup_copper_link_82571()
1433 ret_val = e1000e_copper_link_setup_m88(hw); in e1000_setup_copper_link_82571()
1436 ret_val = e1000e_copper_link_setup_igp(hw); in e1000_setup_copper_link_82571()
1439 return -E1000_ERR_PHY; in e1000_setup_copper_link_82571()
1445 return e1000e_setup_copper_link(hw); in e1000_setup_copper_link_82571()
1449 * e1000_setup_fiber_serdes_link_82571 - Setup link for fiber/serdes
1450 * @hw: pointer to the HW structure
1452 * Configures collision distance and flow control for fiber and serdes links.
1455 static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw) in e1000_setup_fiber_serdes_link_82571() argument
1457 switch (hw->mac.type) { in e1000_setup_fiber_serdes_link_82571()
1472 return e1000e_setup_fiber_serdes_link(hw); in e1000_setup_fiber_serdes_link_82571()
1476 * e1000_check_for_serdes_link_82571 - Check for link (Serdes)
1477 * @hw: pointer to the HW structure
1494 static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) in e1000_check_for_serdes_link_82571() argument
1496 struct e1000_mac_info *mac = &hw->mac; in e1000_check_for_serdes_link_82571()
1498 u32 ctrl; in e1000_check_for_serdes_link_82571() local
1504 ctrl = er32(CTRL); in e1000_check_for_serdes_link_82571()
1513 switch (mac->serdes_link_state) { in e1000_check_for_serdes_link_82571()
1519 mac->serdes_link_state = in e1000_check_for_serdes_link_82571()
1521 mac->serdes_has_link = false; in e1000_check_for_serdes_link_82571()
1522 e_dbg("AN_UP -> AN_PROG\n"); in e1000_check_for_serdes_link_82571()
1524 mac->serdes_has_link = true; in e1000_check_for_serdes_link_82571()
1529 /* If we are receiving /C/ ordered sets, re-enable in e1000_check_for_serdes_link_82571()
1530 * auto-negotiation in the TXCW register and disable in e1000_check_for_serdes_link_82571()
1532 * attempt to auto-negotiate with our link partner. in e1000_check_for_serdes_link_82571()
1536 ew32(TXCW, mac->txcw); in e1000_check_for_serdes_link_82571()
1537 ew32(CTRL, (ctrl & ~E1000_CTRL_SLU)); in e1000_check_for_serdes_link_82571()
1538 mac->serdes_link_state = in e1000_check_for_serdes_link_82571()
1540 mac->serdes_has_link = false; in e1000_check_for_serdes_link_82571()
1541 e_dbg("FORCED_UP -> AN_PROG\n"); in e1000_check_for_serdes_link_82571()
1543 mac->serdes_has_link = true; in e1000_check_for_serdes_link_82571()
1554 mac->serdes_link_state = in e1000_check_for_serdes_link_82571()
1556 e_dbg("AN_PROG -> AN_UP\n"); in e1000_check_for_serdes_link_82571()
1557 mac->serdes_has_link = true; in e1000_check_for_serdes_link_82571()
1560 mac->serdes_link_state = in e1000_check_for_serdes_link_82571()
1562 e_dbg("AN_PROG -> DOWN\n"); in e1000_check_for_serdes_link_82571()
1569 ew32(TXCW, (mac->txcw & ~E1000_TXCW_ANE)); in e1000_check_for_serdes_link_82571()
1570 ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD); in e1000_check_for_serdes_link_82571()
1571 ew32(CTRL, ctrl); in e1000_check_for_serdes_link_82571()
1573 /* Configure Flow Control after link up. */ in e1000_check_for_serdes_link_82571()
1574 ret_val = e1000e_config_fc_after_link_up(hw); in e1000_check_for_serdes_link_82571()
1576 e_dbg("Error config flow control\n"); in e1000_check_for_serdes_link_82571()
1579 mac->serdes_link_state = in e1000_check_for_serdes_link_82571()
1581 mac->serdes_has_link = true; in e1000_check_for_serdes_link_82571()
1582 e_dbg("AN_PROG -> FORCED_UP\n"); in e1000_check_for_serdes_link_82571()
1592 ew32(TXCW, mac->txcw); in e1000_check_for_serdes_link_82571()
1593 ew32(CTRL, (ctrl & ~E1000_CTRL_SLU)); in e1000_check_for_serdes_link_82571()
1594 mac->serdes_link_state = in e1000_check_for_serdes_link_82571()
1596 mac->serdes_has_link = false; in e1000_check_for_serdes_link_82571()
1597 e_dbg("DOWN -> AN_PROG\n"); in e1000_check_for_serdes_link_82571()
1602 mac->serdes_has_link = false; in e1000_check_for_serdes_link_82571()
1603 mac->serdes_link_state = e1000_serdes_link_down; in e1000_check_for_serdes_link_82571()
1604 e_dbg("ANYSTATE -> DOWN\n"); in e1000_check_for_serdes_link_82571()
1618 mac->serdes_has_link = false; in e1000_check_for_serdes_link_82571()
1619 mac->serdes_link_state = in e1000_check_for_serdes_link_82571()
1621 e_dbg("ANYSTATE -> DOWN\n"); in e1000_check_for_serdes_link_82571()
1630 mac->serdes_link_state = in e1000_check_for_serdes_link_82571()
1632 mac->serdes_has_link = false; in e1000_check_for_serdes_link_82571()
1633 e_dbg("ANYSTATE -> AN_PROG\n"); in e1000_check_for_serdes_link_82571()
1642 * e1000_valid_led_default_82571 - Verify a valid default LED config
1643 * @hw: pointer to the HW structure
1649 static s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data) in e1000_valid_led_default_82571() argument
1653 ret_val = e1000_read_nvm(hw, NVM_ID_LED_SETTINGS, 1, data); in e1000_valid_led_default_82571()
1659 switch (hw->mac.type) { in e1000_valid_led_default_82571()
1677 * e1000e_get_laa_state_82571 - Get locally administered address state
1678 * @hw: pointer to the HW structure
1682 bool e1000e_get_laa_state_82571(struct e1000_hw *hw) in e1000e_get_laa_state_82571() argument
1684 if (hw->mac.type != e1000_82571) in e1000e_get_laa_state_82571()
1687 return hw->dev_spec.e82571.laa_is_present; in e1000e_get_laa_state_82571()
1691 * e1000e_set_laa_state_82571 - Set locally administered address state
1692 * @hw: pointer to the HW structure
1697 void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state) in e1000e_set_laa_state_82571() argument
1699 if (hw->mac.type != e1000_82571) in e1000e_set_laa_state_82571()
1702 hw->dev_spec.e82571.laa_is_present = state; in e1000e_set_laa_state_82571()
1712 hw->mac.ops.rar_set(hw, hw->mac.addr, in e1000e_set_laa_state_82571()
1713 hw->mac.rar_entry_count - 1); in e1000e_set_laa_state_82571()
1717 * e1000_fix_nvm_checksum_82571 - Fix EEPROM checksum
1718 * @hw: pointer to the HW structure
1726 static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw) in e1000_fix_nvm_checksum_82571() argument
1728 struct e1000_nvm_info *nvm = &hw->nvm; in e1000_fix_nvm_checksum_82571()
1732 if (nvm->type != e1000_nvm_flash_hw) in e1000_fix_nvm_checksum_82571()
1736 * 10h-12h. Checksum may need to be fixed. in e1000_fix_nvm_checksum_82571()
1738 ret_val = e1000_read_nvm(hw, 0x10, 1, &data); in e1000_fix_nvm_checksum_82571()
1750 ret_val = e1000_read_nvm(hw, 0x23, 1, &data); in e1000_fix_nvm_checksum_82571()
1756 ret_val = e1000_write_nvm(hw, 0x23, 1, &data); in e1000_fix_nvm_checksum_82571()
1759 ret_val = e1000e_update_nvm_checksum(hw); in e1000_fix_nvm_checksum_82571()
1769 * e1000_read_mac_addr_82571 - Read device MAC address
1770 * @hw: pointer to the HW structure
1772 static s32 e1000_read_mac_addr_82571(struct e1000_hw *hw) in e1000_read_mac_addr_82571() argument
1774 if (hw->mac.type == e1000_82571) { in e1000_read_mac_addr_82571()
1781 ret_val = e1000_check_alt_mac_addr_generic(hw); in e1000_read_mac_addr_82571()
1786 return e1000_read_mac_addr_generic(hw); in e1000_read_mac_addr_82571()
1790 * e1000_power_down_phy_copper_82571 - Remove link during PHY power down
1791 * @hw: pointer to the HW structure
1796 static void e1000_power_down_phy_copper_82571(struct e1000_hw *hw) in e1000_power_down_phy_copper_82571() argument
1798 struct e1000_phy_info *phy = &hw->phy; in e1000_power_down_phy_copper_82571()
1799 struct e1000_mac_info *mac = &hw->mac; in e1000_power_down_phy_copper_82571()
1801 if (!phy->ops.check_reset_block) in e1000_power_down_phy_copper_82571()
1805 if (!(mac->ops.check_mng_mode(hw) || phy->ops.check_reset_block(hw))) in e1000_power_down_phy_copper_82571()
1806 e1000_power_down_phy_copper(hw); in e1000_power_down_phy_copper_82571()
1810 * e1000_clear_hw_cntrs_82571 - Clear device specific hardware counters
1811 * @hw: pointer to the HW structure
1815 static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw) in e1000_clear_hw_cntrs_82571() argument
1817 e1000e_clear_hw_cntrs_base(hw); in e1000_clear_hw_cntrs_82571()