Lines Matching +full:hw +full:- +full:blink

2   SPDX-License-Identifier: BSD-3-Clause
4 Copyright (c) 2001-2020, Intel Corporation
37 static s32 e1000_validate_mdi_setting_generic(struct e1000_hw *hw);
38 static void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw);
39 static void e1000_config_collision_dist_generic(struct e1000_hw *hw);
42 * e1000_init_mac_ops_generic - Initialize MAC function pointers
43 * @hw: pointer to the HW structure
45 * Setups up the function pointers to no-op functions
47 void e1000_init_mac_ops_generic(struct e1000_hw *hw) in e1000_init_mac_ops_generic() argument
49 struct e1000_mac_info *mac = &hw->mac; in e1000_init_mac_ops_generic()
53 mac->ops.init_params = e1000_null_ops_generic; in e1000_init_mac_ops_generic()
54 mac->ops.init_hw = e1000_null_ops_generic; in e1000_init_mac_ops_generic()
55 mac->ops.reset_hw = e1000_null_ops_generic; in e1000_init_mac_ops_generic()
56 mac->ops.setup_physical_interface = e1000_null_ops_generic; in e1000_init_mac_ops_generic()
57 mac->ops.get_bus_info = e1000_null_ops_generic; in e1000_init_mac_ops_generic()
58 mac->ops.set_lan_id = e1000_set_lan_id_multi_port_pcie; in e1000_init_mac_ops_generic()
59 mac->ops.read_mac_addr = e1000_read_mac_addr_generic; in e1000_init_mac_ops_generic()
60 mac->ops.config_collision_dist = e1000_config_collision_dist_generic; in e1000_init_mac_ops_generic()
61 mac->ops.clear_hw_cntrs = e1000_null_mac_generic; in e1000_init_mac_ops_generic()
63 mac->ops.cleanup_led = e1000_null_ops_generic; in e1000_init_mac_ops_generic()
64 mac->ops.setup_led = e1000_null_ops_generic; in e1000_init_mac_ops_generic()
65 mac->ops.blink_led = e1000_null_ops_generic; in e1000_init_mac_ops_generic()
66 mac->ops.led_on = e1000_null_ops_generic; in e1000_init_mac_ops_generic()
67 mac->ops.led_off = e1000_null_ops_generic; in e1000_init_mac_ops_generic()
69 mac->ops.setup_link = e1000_null_ops_generic; in e1000_init_mac_ops_generic()
70 mac->ops.get_link_up_info = e1000_null_link_info; in e1000_init_mac_ops_generic()
71 mac->ops.check_for_link = e1000_null_ops_generic; in e1000_init_mac_ops_generic()
72 mac->ops.set_obff_timer = e1000_null_set_obff_timer; in e1000_init_mac_ops_generic()
74 mac->ops.check_mng_mode = e1000_null_mng_mode; in e1000_init_mac_ops_generic()
76 mac->ops.update_mc_addr_list = e1000_null_update_mc; in e1000_init_mac_ops_generic()
77 mac->ops.clear_vfta = e1000_null_mac_generic; in e1000_init_mac_ops_generic()
78 mac->ops.write_vfta = e1000_null_write_vfta; in e1000_init_mac_ops_generic()
79 mac->ops.rar_set = e1000_rar_set_generic; in e1000_init_mac_ops_generic()
80 mac->ops.validate_mdi_setting = e1000_validate_mdi_setting_generic; in e1000_init_mac_ops_generic()
84 * e1000_null_ops_generic - No-op function, returns 0
85 * @hw: pointer to the HW structure
87 s32 e1000_null_ops_generic(struct e1000_hw E1000_UNUSEDARG *hw) in e1000_null_ops_generic() argument
94 * e1000_null_mac_generic - No-op function, return void
95 * @hw: pointer to the HW structure
97 void e1000_null_mac_generic(struct e1000_hw E1000_UNUSEDARG *hw) in e1000_null_mac_generic() argument
104 * e1000_null_link_info - No-op function, return 0
105 * @hw: pointer to the HW structure
109 s32 e1000_null_link_info(struct e1000_hw E1000_UNUSEDARG *hw, in e1000_null_link_info() argument
117 * e1000_null_mng_mode - No-op function, return false
118 * @hw: pointer to the HW structure
120 bool e1000_null_mng_mode(struct e1000_hw E1000_UNUSEDARG *hw) in e1000_null_mng_mode() argument
127 * e1000_null_update_mc - No-op function, return void
128 * @hw: pointer to the HW structure
132 void e1000_null_update_mc(struct e1000_hw E1000_UNUSEDARG *hw, in e1000_null_update_mc() argument
140 * e1000_null_write_vfta - No-op function, return void
141 * @hw: pointer to the HW structure
145 void e1000_null_write_vfta(struct e1000_hw E1000_UNUSEDARG *hw, in e1000_null_write_vfta() argument
153 * e1000_null_rar_set - No-op function, return 0
154 * @hw: pointer to the HW structure
158 int e1000_null_rar_set(struct e1000_hw E1000_UNUSEDARG *hw, in e1000_null_rar_set() argument
166 * e1000_null_set_obff_timer - No-op function, return 0
167 * @hw: pointer to the HW structure
169 s32 e1000_null_set_obff_timer(struct e1000_hw E1000_UNUSEDARG *hw, in e1000_null_set_obff_timer() argument
177 * e1000_get_bus_info_pci_generic - Get PCI(x) bus information
178 * @hw: pointer to the HW structure
182 * bus speed, bus width, type (PCI/PCIx), and PCI(-x) function.
184 s32 e1000_get_bus_info_pci_generic(struct e1000_hw *hw) in e1000_get_bus_info_pci_generic() argument
186 struct e1000_mac_info *mac = &hw->mac; in e1000_get_bus_info_pci_generic()
187 struct e1000_bus_info *bus = &hw->bus; in e1000_get_bus_info_pci_generic()
188 u32 status = E1000_READ_REG(hw, E1000_STATUS); in e1000_get_bus_info_pci_generic()
193 /* PCI or PCI-X? */ in e1000_get_bus_info_pci_generic()
194 bus->type = (status & E1000_STATUS_PCIX_MODE) in e1000_get_bus_info_pci_generic()
199 if (bus->type == e1000_bus_type_pci) { in e1000_get_bus_info_pci_generic()
200 bus->speed = (status & E1000_STATUS_PCI66) in e1000_get_bus_info_pci_generic()
206 bus->speed = e1000_bus_speed_66; in e1000_get_bus_info_pci_generic()
209 bus->speed = e1000_bus_speed_100; in e1000_get_bus_info_pci_generic()
212 bus->speed = e1000_bus_speed_133; in e1000_get_bus_info_pci_generic()
215 bus->speed = e1000_bus_speed_reserved; in e1000_get_bus_info_pci_generic()
221 bus->width = (status & E1000_STATUS_BUS64) in e1000_get_bus_info_pci_generic()
225 /* Which PCI(-X) function? */ in e1000_get_bus_info_pci_generic()
226 mac->ops.set_lan_id(hw); in e1000_get_bus_info_pci_generic()
232 * e1000_get_bus_info_pcie_generic - Get PCIe bus information
233 * @hw: pointer to the HW structure
239 s32 e1000_get_bus_info_pcie_generic(struct e1000_hw *hw) in e1000_get_bus_info_pcie_generic() argument
241 struct e1000_mac_info *mac = &hw->mac; in e1000_get_bus_info_pcie_generic()
242 struct e1000_bus_info *bus = &hw->bus; in e1000_get_bus_info_pcie_generic()
248 bus->type = e1000_bus_type_pci_express; in e1000_get_bus_info_pcie_generic()
250 ret_val = e1000_read_pcie_cap_reg(hw, PCIE_LINK_STATUS, in e1000_get_bus_info_pcie_generic()
253 bus->width = e1000_bus_width_unknown; in e1000_get_bus_info_pcie_generic()
254 bus->speed = e1000_bus_speed_unknown; in e1000_get_bus_info_pcie_generic()
258 bus->speed = e1000_bus_speed_2500; in e1000_get_bus_info_pcie_generic()
261 bus->speed = e1000_bus_speed_5000; in e1000_get_bus_info_pcie_generic()
264 bus->speed = e1000_bus_speed_unknown; in e1000_get_bus_info_pcie_generic()
268 bus->width = (enum e1000_bus_width)((pcie_link_status & in e1000_get_bus_info_pcie_generic()
272 mac->ops.set_lan_id(hw); in e1000_get_bus_info_pcie_generic()
278 * e1000_set_lan_id_multi_port_pcie - Set LAN id for PCIe multiple port devices
280 * @hw: pointer to the HW structure
282 * Determines the LAN function id by reading memory-mapped registers
285 static void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw) in e1000_set_lan_id_multi_port_pcie() argument
287 struct e1000_bus_info *bus = &hw->bus; in e1000_set_lan_id_multi_port_pcie()
293 reg = E1000_READ_REG(hw, E1000_STATUS); in e1000_set_lan_id_multi_port_pcie()
294 bus->func = (reg & E1000_STATUS_FUNC_MASK) >> E1000_STATUS_FUNC_SHIFT; in e1000_set_lan_id_multi_port_pcie()
298 * e1000_set_lan_id_multi_port_pci - Set LAN id for PCI multiple port devices
299 * @hw: pointer to the HW structure
303 void e1000_set_lan_id_multi_port_pci(struct e1000_hw *hw) in e1000_set_lan_id_multi_port_pci() argument
305 struct e1000_bus_info *bus = &hw->bus; in e1000_set_lan_id_multi_port_pci()
309 e1000_read_pci_cfg(hw, PCI_HEADER_TYPE_REGISTER, &pci_header_type); in e1000_set_lan_id_multi_port_pci()
311 status = E1000_READ_REG(hw, E1000_STATUS); in e1000_set_lan_id_multi_port_pci()
312 bus->func = (status & E1000_STATUS_FUNC_MASK) in e1000_set_lan_id_multi_port_pci()
315 bus->func = 0; in e1000_set_lan_id_multi_port_pci()
320 * e1000_set_lan_id_single_port - Set LAN id for a single port device
321 * @hw: pointer to the HW structure
325 void e1000_set_lan_id_single_port(struct e1000_hw *hw) in e1000_set_lan_id_single_port() argument
327 struct e1000_bus_info *bus = &hw->bus; in e1000_set_lan_id_single_port()
329 bus->func = 0; in e1000_set_lan_id_single_port()
333 * e1000_clear_vfta_generic - Clear VLAN filter table
334 * @hw: pointer to the HW structure
339 void e1000_clear_vfta_generic(struct e1000_hw *hw) in e1000_clear_vfta_generic() argument
346 E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset, 0); in e1000_clear_vfta_generic()
347 E1000_WRITE_FLUSH(hw); in e1000_clear_vfta_generic()
352 * e1000_write_vfta_generic - Write value to VLAN filter table
353 * @hw: pointer to the HW structure
360 void e1000_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value) in e1000_write_vfta_generic() argument
364 E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset, value); in e1000_write_vfta_generic()
365 E1000_WRITE_FLUSH(hw); in e1000_write_vfta_generic()
369 * e1000_init_rx_addrs_generic - Initialize receive address's
370 * @hw: pointer to the HW structure
377 void e1000_init_rx_addrs_generic(struct e1000_hw *hw, u16 rar_count) in e1000_init_rx_addrs_generic() argument
387 hw->mac.ops.rar_set(hw, hw->mac.addr, 0); in e1000_init_rx_addrs_generic()
389 /* Zero out the other (rar_entry_count - 1) receive addresses */ in e1000_init_rx_addrs_generic()
390 DEBUGOUT1("Clearing RAR[1-%u]\n", rar_count-1); in e1000_init_rx_addrs_generic()
392 hw->mac.ops.rar_set(hw, mac_addr, i); in e1000_init_rx_addrs_generic()
396 * e1000_check_alt_mac_addr_generic - Check for alternate MAC addr
397 * @hw: pointer to the HW structure
400 * can be setup by pre-boot software and must be treated like a permanent
407 s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw) in e1000_check_alt_mac_addr_generic() argument
416 ret_val = hw->nvm.ops.read(hw, NVM_COMPAT, 1, &nvm_data); in e1000_check_alt_mac_addr_generic()
421 if ((hw->mac.type < e1000_82571) || (hw->mac.type == e1000_82573)) in e1000_check_alt_mac_addr_generic()
427 if (hw->mac.type >= e1000_82580) in e1000_check_alt_mac_addr_generic()
430 ret_val = hw->nvm.ops.read(hw, NVM_ALT_MAC_ADDR_PTR, 1, in e1000_check_alt_mac_addr_generic()
442 if (hw->bus.func == E1000_FUNC_1) in e1000_check_alt_mac_addr_generic()
444 if (hw->bus.func == E1000_FUNC_2) in e1000_check_alt_mac_addr_generic()
447 if (hw->bus.func == E1000_FUNC_3) in e1000_check_alt_mac_addr_generic()
451 ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); in e1000_check_alt_mac_addr_generic()
468 * same as the normal permanent MAC address stored by the HW into the in e1000_check_alt_mac_addr_generic()
471 hw->mac.ops.rar_set(hw, alt_mac_addr, 0); in e1000_check_alt_mac_addr_generic()
477 * e1000_rar_set_generic - Set receive address register
478 * @hw: pointer to the HW structure
485 int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index) in e1000_rar_set_generic() argument
491 /* HW expects these in little endian so we reverse the byte order in e1000_rar_set_generic()
503 /* Some bridges will combine consecutive 32-bit writes into in e1000_rar_set_generic()
507 E1000_WRITE_REG(hw, E1000_RAL(index), rar_low); in e1000_rar_set_generic()
508 E1000_WRITE_FLUSH(hw); in e1000_rar_set_generic()
509 E1000_WRITE_REG(hw, E1000_RAH(index), rar_high); in e1000_rar_set_generic()
510 E1000_WRITE_FLUSH(hw); in e1000_rar_set_generic()
516 * e1000_hash_mc_addr_generic - Generate a multicast hash value
517 * @hw: pointer to the HW structure
523 u32 e1000_hash_mc_addr_generic(struct e1000_hw *hw, u8 *mc_addr) in e1000_hash_mc_addr_generic() argument
531 hash_mask = (hw->mac.mta_reg_count * 32) - 1; in e1000_hash_mc_addr_generic()
533 /* For a mc_filter_type of 0, bit_shift is the number of left-shifts in e1000_hash_mc_addr_generic()
543 * left-shifts where the MSB of mc_addr[5] would still fall within in e1000_hash_mc_addr_generic()
546 * remaining number of bits. Thus 8 - bit_shift. The rest of the in e1000_hash_mc_addr_generic()
549 * 8-bit shifting total. in e1000_hash_mc_addr_generic()
552 * mta register count of 128 (thus a 4096-bit vector and 0xFFF mask), in e1000_hash_mc_addr_generic()
564 switch (hw->mac.mc_filter_type) { in e1000_hash_mc_addr_generic()
579 hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) | in e1000_hash_mc_addr_generic()
586 * e1000_update_mc_addr_list_generic - Update Multicast addresses
587 * @hw: pointer to the HW structure
594 void e1000_update_mc_addr_list_generic(struct e1000_hw *hw, in e1000_update_mc_addr_list_generic() argument
603 memset(&hw->mac.mta_shadow, 0, sizeof(hw->mac.mta_shadow)); in e1000_update_mc_addr_list_generic()
607 hash_value = e1000_hash_mc_addr_generic(hw, mc_addr_list); in e1000_update_mc_addr_list_generic()
609 hash_reg = (hash_value >> 5) & (hw->mac.mta_reg_count - 1); in e1000_update_mc_addr_list_generic()
612 hw->mac.mta_shadow[hash_reg] |= (1 << hash_bit); in e1000_update_mc_addr_list_generic()
617 for (i = hw->mac.mta_reg_count - 1; i >= 0; i--) in e1000_update_mc_addr_list_generic()
618 E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, hw->mac.mta_shadow[i]); in e1000_update_mc_addr_list_generic()
619 E1000_WRITE_FLUSH(hw); in e1000_update_mc_addr_list_generic()
623 * e1000_pcix_mmrbc_workaround_generic - Fix incorrect MMRBC value
624 * @hw: pointer to the HW structure
631 void e1000_pcix_mmrbc_workaround_generic(struct e1000_hw *hw) in e1000_pcix_mmrbc_workaround_generic() argument
640 /* Workaround for PCI-X issue when BIOS sets MMRBC incorrectly */ in e1000_pcix_mmrbc_workaround_generic()
641 if (hw->bus.type != e1000_bus_type_pcix) in e1000_pcix_mmrbc_workaround_generic()
644 e1000_read_pci_cfg(hw, PCIX_COMMAND_REGISTER, &pcix_cmd); in e1000_pcix_mmrbc_workaround_generic()
645 e1000_read_pci_cfg(hw, PCIX_STATUS_REGISTER_HI, &pcix_stat_hi_word); in e1000_pcix_mmrbc_workaround_generic()
655 e1000_write_pci_cfg(hw, PCIX_COMMAND_REGISTER, &pcix_cmd); in e1000_pcix_mmrbc_workaround_generic()
660 * e1000_clear_hw_cntrs_base_generic - Clear base hardware counters
661 * @hw: pointer to the HW structure
665 void e1000_clear_hw_cntrs_base_generic(struct e1000_hw *hw) in e1000_clear_hw_cntrs_base_generic() argument
669 E1000_READ_REG(hw, E1000_CRCERRS); in e1000_clear_hw_cntrs_base_generic()
670 E1000_READ_REG(hw, E1000_SYMERRS); in e1000_clear_hw_cntrs_base_generic()
671 E1000_READ_REG(hw, E1000_MPC); in e1000_clear_hw_cntrs_base_generic()
672 E1000_READ_REG(hw, E1000_SCC); in e1000_clear_hw_cntrs_base_generic()
673 E1000_READ_REG(hw, E1000_ECOL); in e1000_clear_hw_cntrs_base_generic()
674 E1000_READ_REG(hw, E1000_MCC); in e1000_clear_hw_cntrs_base_generic()
675 E1000_READ_REG(hw, E1000_LATECOL); in e1000_clear_hw_cntrs_base_generic()
676 E1000_READ_REG(hw, E1000_COLC); in e1000_clear_hw_cntrs_base_generic()
677 E1000_READ_REG(hw, E1000_DC); in e1000_clear_hw_cntrs_base_generic()
678 E1000_READ_REG(hw, E1000_SEC); in e1000_clear_hw_cntrs_base_generic()
679 E1000_READ_REG(hw, E1000_RLEC); in e1000_clear_hw_cntrs_base_generic()
680 E1000_READ_REG(hw, E1000_XONRXC); in e1000_clear_hw_cntrs_base_generic()
681 E1000_READ_REG(hw, E1000_XONTXC); in e1000_clear_hw_cntrs_base_generic()
682 E1000_READ_REG(hw, E1000_XOFFRXC); in e1000_clear_hw_cntrs_base_generic()
683 E1000_READ_REG(hw, E1000_XOFFTXC); in e1000_clear_hw_cntrs_base_generic()
684 E1000_READ_REG(hw, E1000_FCRUC); in e1000_clear_hw_cntrs_base_generic()
685 E1000_READ_REG(hw, E1000_GPRC); in e1000_clear_hw_cntrs_base_generic()
686 E1000_READ_REG(hw, E1000_BPRC); in e1000_clear_hw_cntrs_base_generic()
687 E1000_READ_REG(hw, E1000_MPRC); in e1000_clear_hw_cntrs_base_generic()
688 E1000_READ_REG(hw, E1000_GPTC); in e1000_clear_hw_cntrs_base_generic()
689 E1000_READ_REG(hw, E1000_GORCL); in e1000_clear_hw_cntrs_base_generic()
690 E1000_READ_REG(hw, E1000_GORCH); in e1000_clear_hw_cntrs_base_generic()
691 E1000_READ_REG(hw, E1000_GOTCL); in e1000_clear_hw_cntrs_base_generic()
692 E1000_READ_REG(hw, E1000_GOTCH); in e1000_clear_hw_cntrs_base_generic()
693 E1000_READ_REG(hw, E1000_RNBC); in e1000_clear_hw_cntrs_base_generic()
694 E1000_READ_REG(hw, E1000_RUC); in e1000_clear_hw_cntrs_base_generic()
695 E1000_READ_REG(hw, E1000_RFC); in e1000_clear_hw_cntrs_base_generic()
696 E1000_READ_REG(hw, E1000_ROC); in e1000_clear_hw_cntrs_base_generic()
697 E1000_READ_REG(hw, E1000_RJC); in e1000_clear_hw_cntrs_base_generic()
698 E1000_READ_REG(hw, E1000_TORL); in e1000_clear_hw_cntrs_base_generic()
699 E1000_READ_REG(hw, E1000_TORH); in e1000_clear_hw_cntrs_base_generic()
700 E1000_READ_REG(hw, E1000_TOTL); in e1000_clear_hw_cntrs_base_generic()
701 E1000_READ_REG(hw, E1000_TOTH); in e1000_clear_hw_cntrs_base_generic()
702 E1000_READ_REG(hw, E1000_TPR); in e1000_clear_hw_cntrs_base_generic()
703 E1000_READ_REG(hw, E1000_TPT); in e1000_clear_hw_cntrs_base_generic()
704 E1000_READ_REG(hw, E1000_MPTC); in e1000_clear_hw_cntrs_base_generic()
705 E1000_READ_REG(hw, E1000_BPTC); in e1000_clear_hw_cntrs_base_generic()
709 * e1000_check_for_copper_link_generic - Check for link (Copper)
710 * @hw: pointer to the HW structure
716 s32 e1000_check_for_copper_link_generic(struct e1000_hw *hw) in e1000_check_for_copper_link_generic() argument
718 struct e1000_mac_info *mac = &hw->mac; in e1000_check_for_copper_link_generic()
724 /* We only want to go out to the PHY registers to see if Auto-Neg in e1000_check_for_copper_link_generic()
729 if (!mac->get_link_status) in e1000_check_for_copper_link_generic()
736 ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link); in e1000_check_for_copper_link_generic()
743 mac->get_link_status = false; in e1000_check_for_copper_link_generic()
746 * immediately after link-up in e1000_check_for_copper_link_generic()
748 e1000_check_downshift_generic(hw); in e1000_check_for_copper_link_generic()
753 if (!mac->autoneg) in e1000_check_for_copper_link_generic()
754 return -E1000_ERR_CONFIG; in e1000_check_for_copper_link_generic()
756 /* Auto-Neg is enabled. Auto Speed Detection takes care in e1000_check_for_copper_link_generic()
760 mac->ops.config_collision_dist(hw); in e1000_check_for_copper_link_generic()
762 /* Configure Flow Control now that Auto-Neg has completed. in e1000_check_for_copper_link_generic()
764 * settings because we may have had to re-autoneg with a in e1000_check_for_copper_link_generic()
767 ret_val = e1000_config_fc_after_link_up_generic(hw); in e1000_check_for_copper_link_generic()
775 * e1000_check_for_fiber_link_generic - Check for link (Fiber)
776 * @hw: pointer to the HW structure
781 s32 e1000_check_for_fiber_link_generic(struct e1000_hw *hw) in e1000_check_for_fiber_link_generic() argument
783 struct e1000_mac_info *mac = &hw->mac; in e1000_check_for_fiber_link_generic()
791 ctrl = E1000_READ_REG(hw, E1000_CTRL); in e1000_check_for_fiber_link_generic()
792 status = E1000_READ_REG(hw, E1000_STATUS); in e1000_check_for_fiber_link_generic()
793 rxcw = E1000_READ_REG(hw, E1000_RXCW); in e1000_check_for_fiber_link_generic()
795 /* If we don't have link (auto-negotiation failed or link partner in e1000_check_for_fiber_link_generic()
796 * cannot auto-negotiate), the cable is plugged in (we have signal), in e1000_check_for_fiber_link_generic()
797 * and our link partner is not trying to auto-negotiate with us (we in e1000_check_for_fiber_link_generic()
799 * need to give auto-negotiation time to complete, in case the cable in e1000_check_for_fiber_link_generic()
805 if (!mac->autoneg_failed) { in e1000_check_for_fiber_link_generic()
806 mac->autoneg_failed = true; in e1000_check_for_fiber_link_generic()
811 /* Disable auto-negotiation in the TXCW register */ in e1000_check_for_fiber_link_generic()
812 E1000_WRITE_REG(hw, E1000_TXCW, (mac->txcw & ~E1000_TXCW_ANE)); in e1000_check_for_fiber_link_generic()
814 /* Force link-up and also force full-duplex. */ in e1000_check_for_fiber_link_generic()
815 ctrl = E1000_READ_REG(hw, E1000_CTRL); in e1000_check_for_fiber_link_generic()
817 E1000_WRITE_REG(hw, E1000_CTRL, ctrl); in e1000_check_for_fiber_link_generic()
820 ret_val = e1000_config_fc_after_link_up_generic(hw); in e1000_check_for_fiber_link_generic()
827 * sets, re-enable auto-negotiation in the TXCW register in e1000_check_for_fiber_link_generic()
829 * in an attempt to auto-negotiate with our link partner. in e1000_check_for_fiber_link_generic()
832 E1000_WRITE_REG(hw, E1000_TXCW, mac->txcw); in e1000_check_for_fiber_link_generic()
833 E1000_WRITE_REG(hw, E1000_CTRL, (ctrl & ~E1000_CTRL_SLU)); in e1000_check_for_fiber_link_generic()
835 mac->serdes_has_link = true; in e1000_check_for_fiber_link_generic()
842 * e1000_check_for_serdes_link_generic - Check for link (Serdes)
843 * @hw: pointer to the HW structure
848 s32 e1000_check_for_serdes_link_generic(struct e1000_hw *hw) in e1000_check_for_serdes_link_generic() argument
850 struct e1000_mac_info *mac = &hw->mac; in e1000_check_for_serdes_link_generic()
858 ctrl = E1000_READ_REG(hw, E1000_CTRL); in e1000_check_for_serdes_link_generic()
859 status = E1000_READ_REG(hw, E1000_STATUS); in e1000_check_for_serdes_link_generic()
860 rxcw = E1000_READ_REG(hw, E1000_RXCW); in e1000_check_for_serdes_link_generic()
862 /* If we don't have link (auto-negotiation failed or link partner in e1000_check_for_serdes_link_generic()
863 * cannot auto-negotiate), and our link partner is not trying to in e1000_check_for_serdes_link_generic()
864 * auto-negotiate with us (we are receiving idles or data), in e1000_check_for_serdes_link_generic()
865 * we need to force link up. We also need to give auto-negotiation in e1000_check_for_serdes_link_generic()
870 if (!mac->autoneg_failed) { in e1000_check_for_serdes_link_generic()
871 mac->autoneg_failed = true; in e1000_check_for_serdes_link_generic()
876 /* Disable auto-negotiation in the TXCW register */ in e1000_check_for_serdes_link_generic()
877 E1000_WRITE_REG(hw, E1000_TXCW, (mac->txcw & ~E1000_TXCW_ANE)); in e1000_check_for_serdes_link_generic()
879 /* Force link-up and also force full-duplex. */ in e1000_check_for_serdes_link_generic()
880 ctrl = E1000_READ_REG(hw, E1000_CTRL); in e1000_check_for_serdes_link_generic()
882 E1000_WRITE_REG(hw, E1000_CTRL, ctrl); in e1000_check_for_serdes_link_generic()
885 ret_val = e1000_config_fc_after_link_up_generic(hw); in e1000_check_for_serdes_link_generic()
892 * sets, re-enable auto-negotiation in the TXCW register in e1000_check_for_serdes_link_generic()
894 * in an attempt to auto-negotiate with our link partner. in e1000_check_for_serdes_link_generic()
897 E1000_WRITE_REG(hw, E1000_TXCW, mac->txcw); in e1000_check_for_serdes_link_generic()
898 E1000_WRITE_REG(hw, E1000_CTRL, (ctrl & ~E1000_CTRL_SLU)); in e1000_check_for_serdes_link_generic()
900 mac->serdes_has_link = true; in e1000_check_for_serdes_link_generic()
901 } else if (!(E1000_TXCW_ANE & E1000_READ_REG(hw, E1000_TXCW))) { in e1000_check_for_serdes_link_generic()
902 /* If we force link for non-auto-negotiation switch, check in e1000_check_for_serdes_link_generic()
908 rxcw = E1000_READ_REG(hw, E1000_RXCW); in e1000_check_for_serdes_link_generic()
911 mac->serdes_has_link = true; in e1000_check_for_serdes_link_generic()
912 DEBUGOUT("SERDES: Link up - forced.\n"); in e1000_check_for_serdes_link_generic()
915 mac->serdes_has_link = false; in e1000_check_for_serdes_link_generic()
916 DEBUGOUT("SERDES: Link down - force failed.\n"); in e1000_check_for_serdes_link_generic()
920 if (E1000_TXCW_ANE & E1000_READ_REG(hw, E1000_TXCW)) { in e1000_check_for_serdes_link_generic()
921 status = E1000_READ_REG(hw, E1000_STATUS); in e1000_check_for_serdes_link_generic()
925 rxcw = E1000_READ_REG(hw, E1000_RXCW); in e1000_check_for_serdes_link_generic()
928 mac->serdes_has_link = true; in e1000_check_for_serdes_link_generic()
929 DEBUGOUT("SERDES: Link up - autoneg completed successfully.\n"); in e1000_check_for_serdes_link_generic()
931 mac->serdes_has_link = false; in e1000_check_for_serdes_link_generic()
932 DEBUGOUT("SERDES: Link down - invalid codewords detected in autoneg.\n"); in e1000_check_for_serdes_link_generic()
935 mac->serdes_has_link = false; in e1000_check_for_serdes_link_generic()
936 DEBUGOUT("SERDES: Link down - no sync.\n"); in e1000_check_for_serdes_link_generic()
939 mac->serdes_has_link = false; in e1000_check_for_serdes_link_generic()
940 DEBUGOUT("SERDES: Link down - autoneg failed\n"); in e1000_check_for_serdes_link_generic()
948 * e1000_set_default_fc_generic - Set flow control default values
949 * @hw: pointer to the HW structure
954 s32 e1000_set_default_fc_generic(struct e1000_hw *hw) in e1000_set_default_fc_generic() argument
964 * a bit that determines whether the HW defaults to enabling or in e1000_set_default_fc_generic()
965 * disabling auto-negotiation, and the direction of the in e1000_set_default_fc_generic()
966 * SW defined pins. If there is no SW over-ride of the flow in e1000_set_default_fc_generic()
967 * control setting, then the variable hw->fc will in e1000_set_default_fc_generic()
970 if (hw->mac.type == e1000_i350) { in e1000_set_default_fc_generic()
971 nvm_offset = NVM_82580_LAN_FUNC_OFFSET(hw->bus.func); in e1000_set_default_fc_generic()
972 ret_val = hw->nvm.ops.read(hw, in e1000_set_default_fc_generic()
977 ret_val = hw->nvm.ops.read(hw, in e1000_set_default_fc_generic()
989 hw->fc.requested_mode = e1000_fc_none; in e1000_set_default_fc_generic()
992 hw->fc.requested_mode = e1000_fc_tx_pause; in e1000_set_default_fc_generic()
994 hw->fc.requested_mode = e1000_fc_full; in e1000_set_default_fc_generic()
1000 * e1000_setup_link_generic - Setup flow control and link settings
1001 * @hw: pointer to the HW structure
1004 * control. Calls the appropriate media-specific link configuration
1009 s32 e1000_setup_link_generic(struct e1000_hw *hw) in e1000_setup_link_generic() argument
1018 if (hw->phy.ops.check_reset_block && hw->phy.ops.check_reset_block(hw)) in e1000_setup_link_generic()
1024 if (hw->fc.requested_mode == e1000_fc_default) { in e1000_setup_link_generic()
1025 ret_val = e1000_set_default_fc_generic(hw); in e1000_setup_link_generic()
1033 hw->fc.current_mode = hw->fc.requested_mode; in e1000_setup_link_generic()
1035 DEBUGOUT1("After fix-ups FlowControl is now = %x\n", in e1000_setup_link_generic()
1036 hw->fc.current_mode); in e1000_setup_link_generic()
1039 ret_val = hw->mac.ops.setup_physical_interface(hw); in e1000_setup_link_generic()
1049 E1000_WRITE_REG(hw, E1000_FCT, FLOW_CONTROL_TYPE); in e1000_setup_link_generic()
1050 E1000_WRITE_REG(hw, E1000_FCAH, FLOW_CONTROL_ADDRESS_HIGH); in e1000_setup_link_generic()
1051 E1000_WRITE_REG(hw, E1000_FCAL, FLOW_CONTROL_ADDRESS_LOW); in e1000_setup_link_generic()
1053 E1000_WRITE_REG(hw, E1000_FCTTV, hw->fc.pause_time); in e1000_setup_link_generic()
1055 return e1000_set_fc_watermarks_generic(hw); in e1000_setup_link_generic()
1059 * e1000_commit_fc_settings_generic - Configure flow control
1060 * @hw: pointer to the HW structure
1065 s32 e1000_commit_fc_settings_generic(struct e1000_hw *hw) in e1000_commit_fc_settings_generic() argument
1067 struct e1000_mac_info *mac = &hw->mac; in e1000_commit_fc_settings_generic()
1073 * setup the device accordingly. If auto-negotiation is enabled, then in e1000_commit_fc_settings_generic()
1075 * the Transmit Config Word Register (TXCW) and re-start auto- in e1000_commit_fc_settings_generic()
1076 * negotiation. However, if auto-negotiation is disabled, then in e1000_commit_fc_settings_generic()
1088 switch (hw->fc.current_mode) { in e1000_commit_fc_settings_generic()
1090 /* Flow control completely disabled by a software over-ride. */ in e1000_commit_fc_settings_generic()
1095 * by a software over-ride. Since there really isn't a way to in e1000_commit_fc_settings_generic()
1105 * by a software over-ride. in e1000_commit_fc_settings_generic()
1111 * over-ride. in e1000_commit_fc_settings_generic()
1117 return -E1000_ERR_CONFIG; in e1000_commit_fc_settings_generic()
1121 E1000_WRITE_REG(hw, E1000_TXCW, txcw); in e1000_commit_fc_settings_generic()
1122 mac->txcw = txcw; in e1000_commit_fc_settings_generic()
1128 * e1000_poll_fiber_serdes_link_generic - Poll for link up
1129 * @hw: pointer to the HW structure
1132 * up with auto-negotiation, then the link is forced if a signal is detected.
1134 s32 e1000_poll_fiber_serdes_link_generic(struct e1000_hw *hw) in e1000_poll_fiber_serdes_link_generic() argument
1136 struct e1000_mac_info *mac = &hw->mac; in e1000_poll_fiber_serdes_link_generic()
1143 * serdes media) then poll for a "Link-Up" indication in the Device in e1000_poll_fiber_serdes_link_generic()
1144 * Status Register. Time-out if a link isn't seen in 500 milliseconds in e1000_poll_fiber_serdes_link_generic()
1145 * seconds (Auto-negotiation should complete in less than 500 in e1000_poll_fiber_serdes_link_generic()
1150 status = E1000_READ_REG(hw, E1000_STATUS); in e1000_poll_fiber_serdes_link_generic()
1155 DEBUGOUT("Never got a valid link from auto-neg!!!\n"); in e1000_poll_fiber_serdes_link_generic()
1156 mac->autoneg_failed = true; in e1000_poll_fiber_serdes_link_generic()
1158 * mac->check_for_link. This routine will force the in e1000_poll_fiber_serdes_link_generic()
1160 * communicate with non-autonegotiating link partners. in e1000_poll_fiber_serdes_link_generic()
1162 ret_val = mac->ops.check_for_link(hw); in e1000_poll_fiber_serdes_link_generic()
1167 mac->autoneg_failed = false; in e1000_poll_fiber_serdes_link_generic()
1169 mac->autoneg_failed = false; in e1000_poll_fiber_serdes_link_generic()
1177 * e1000_setup_fiber_serdes_link_generic - Setup link for fiber/serdes
1178 * @hw: pointer to the HW structure
1183 s32 e1000_setup_fiber_serdes_link_generic(struct e1000_hw *hw) in e1000_setup_fiber_serdes_link_generic() argument
1190 ctrl = E1000_READ_REG(hw, E1000_CTRL); in e1000_setup_fiber_serdes_link_generic()
1195 hw->mac.ops.config_collision_dist(hw); in e1000_setup_fiber_serdes_link_generic()
1197 ret_val = e1000_commit_fc_settings_generic(hw); in e1000_setup_fiber_serdes_link_generic()
1201 /* Since auto-negotiation is enabled, take the link out of reset (the in e1000_setup_fiber_serdes_link_generic()
1203 * will restart auto-negotiation. If auto-negotiation is successful in e1000_setup_fiber_serdes_link_generic()
1204 * then the link-up status bit will be set and the flow control enable in e1000_setup_fiber_serdes_link_generic()
1207 DEBUGOUT("Auto-negotiation enabled\n"); in e1000_setup_fiber_serdes_link_generic()
1209 E1000_WRITE_REG(hw, E1000_CTRL, ctrl); in e1000_setup_fiber_serdes_link_generic()
1210 E1000_WRITE_FLUSH(hw); in e1000_setup_fiber_serdes_link_generic()
1214 * detect a signal. If we have a signal, then poll for a "Link-Up" in e1000_setup_fiber_serdes_link_generic()
1217 if (hw->phy.media_type == e1000_media_type_internal_serdes || in e1000_setup_fiber_serdes_link_generic()
1218 (E1000_READ_REG(hw, E1000_CTRL) & E1000_CTRL_SWDPIN1)) { in e1000_setup_fiber_serdes_link_generic()
1219 ret_val = e1000_poll_fiber_serdes_link_generic(hw); in e1000_setup_fiber_serdes_link_generic()
1228 * e1000_config_collision_dist_generic - Configure collision distance
1229 * @hw: pointer to the HW structure
1234 static void e1000_config_collision_dist_generic(struct e1000_hw *hw) in e1000_config_collision_dist_generic() argument
1240 tctl = E1000_READ_REG(hw, E1000_TCTL); in e1000_config_collision_dist_generic()
1245 E1000_WRITE_REG(hw, E1000_TCTL, tctl); in e1000_config_collision_dist_generic()
1246 E1000_WRITE_FLUSH(hw); in e1000_config_collision_dist_generic()
1250 * e1000_set_fc_watermarks_generic - Set flow control high/low watermarks
1251 * @hw: pointer to the HW structure
1257 s32 e1000_set_fc_watermarks_generic(struct e1000_hw *hw) in e1000_set_fc_watermarks_generic() argument
1269 if (hw->fc.current_mode & e1000_fc_tx_pause) { in e1000_set_fc_watermarks_generic()
1274 fcrtl = hw->fc.low_water; in e1000_set_fc_watermarks_generic()
1275 if (hw->fc.send_xon) in e1000_set_fc_watermarks_generic()
1278 fcrth = hw->fc.high_water; in e1000_set_fc_watermarks_generic()
1280 E1000_WRITE_REG(hw, E1000_FCRTL, fcrtl); in e1000_set_fc_watermarks_generic()
1281 E1000_WRITE_REG(hw, E1000_FCRTH, fcrth); in e1000_set_fc_watermarks_generic()
1287 * e1000_force_mac_fc_generic - Force the MAC's flow control settings
1288 * @hw: pointer to the HW structure
1296 s32 e1000_force_mac_fc_generic(struct e1000_hw *hw) in e1000_force_mac_fc_generic() argument
1302 ctrl = E1000_READ_REG(hw, E1000_CTRL); in e1000_force_mac_fc_generic()
1304 /* Because we didn't get link via the internal auto-negotiation in e1000_force_mac_fc_generic()
1306 * auto-neg), we have to manually enable/disable transmit an in e1000_force_mac_fc_generic()
1310 * according to the "hw->fc.current_mode" parameter. in e1000_force_mac_fc_generic()
1321 DEBUGOUT1("hw->fc.current_mode = %u\n", hw->fc.current_mode); in e1000_force_mac_fc_generic()
1323 switch (hw->fc.current_mode) { in e1000_force_mac_fc_generic()
1340 return -E1000_ERR_CONFIG; in e1000_force_mac_fc_generic()
1343 E1000_WRITE_REG(hw, E1000_CTRL, ctrl); in e1000_force_mac_fc_generic()
1349 * e1000_config_fc_after_link_up_generic - Configures flow control after link
1350 * @hw: pointer to the HW structure
1352 * Checks the status of auto-negotiation after link up to ensure that the
1354 * flow control needs to be forced also. If auto-negotiation is enabled
1358 s32 e1000_config_fc_after_link_up_generic(struct e1000_hw *hw) in e1000_config_fc_after_link_up_generic() argument
1360 struct e1000_mac_info *mac = &hw->mac; in e1000_config_fc_after_link_up_generic()
1368 /* Check for the case where we have fiber media and auto-neg failed in e1000_config_fc_after_link_up_generic()
1372 if (mac->autoneg_failed) { in e1000_config_fc_after_link_up_generic()
1373 if (hw->phy.media_type == e1000_media_type_fiber || in e1000_config_fc_after_link_up_generic()
1374 hw->phy.media_type == e1000_media_type_internal_serdes) in e1000_config_fc_after_link_up_generic()
1375 ret_val = e1000_force_mac_fc_generic(hw); in e1000_config_fc_after_link_up_generic()
1377 if (hw->phy.media_type == e1000_media_type_copper) in e1000_config_fc_after_link_up_generic()
1378 ret_val = e1000_force_mac_fc_generic(hw); in e1000_config_fc_after_link_up_generic()
1386 /* Check for the case where we have copper media and auto-neg is in e1000_config_fc_after_link_up_generic()
1387 * enabled. In this case, we need to check and see if Auto-Neg in e1000_config_fc_after_link_up_generic()
1391 if ((hw->phy.media_type == e1000_media_type_copper) && mac->autoneg) { in e1000_config_fc_after_link_up_generic()
1396 ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_config_fc_after_link_up_generic()
1399 ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_config_fc_after_link_up_generic()
1414 ret_val = hw->phy.ops.read_reg(hw, PHY_AUTONEG_ADV, in e1000_config_fc_after_link_up_generic()
1418 ret_val = hw->phy.ops.read_reg(hw, PHY_LP_ABILITY, in e1000_config_fc_after_link_up_generic()
1434 *-------|---------|-------|---------|-------------------- in e1000_config_fc_after_link_up_generic()
1452 *-------|---------|-------|---------|-------------------- in e1000_config_fc_after_link_up_generic()
1464 if (hw->fc.requested_mode == e1000_fc_full) { in e1000_config_fc_after_link_up_generic()
1465 hw->fc.current_mode = e1000_fc_full; in e1000_config_fc_after_link_up_generic()
1468 hw->fc.current_mode = e1000_fc_rx_pause; in e1000_config_fc_after_link_up_generic()
1476 *-------|---------|-------|---------|-------------------- in e1000_config_fc_after_link_up_generic()
1483 hw->fc.current_mode = e1000_fc_tx_pause; in e1000_config_fc_after_link_up_generic()
1490 *-------|---------|-------|---------|-------------------- in e1000_config_fc_after_link_up_generic()
1497 hw->fc.current_mode = e1000_fc_rx_pause; in e1000_config_fc_after_link_up_generic()
1503 hw->fc.current_mode = e1000_fc_none; in e1000_config_fc_after_link_up_generic()
1507 /* Now we need to do one last check... If we auto- in e1000_config_fc_after_link_up_generic()
1511 ret_val = mac->ops.get_link_up_info(hw, &speed, &duplex); in e1000_config_fc_after_link_up_generic()
1518 hw->fc.current_mode = e1000_fc_none; in e1000_config_fc_after_link_up_generic()
1523 ret_val = e1000_force_mac_fc_generic(hw); in e1000_config_fc_after_link_up_generic()
1530 /* Check for the case where we have SerDes media and auto-neg is in e1000_config_fc_after_link_up_generic()
1531 * enabled. In this case, we need to check and see if Auto-Neg in e1000_config_fc_after_link_up_generic()
1535 if ((hw->phy.media_type == e1000_media_type_internal_serdes) && in e1000_config_fc_after_link_up_generic()
1536 mac->autoneg) { in e1000_config_fc_after_link_up_generic()
1540 pcs_status_reg = E1000_READ_REG(hw, E1000_PCS_LSTAT); in e1000_config_fc_after_link_up_generic()
1553 pcs_adv_reg = E1000_READ_REG(hw, E1000_PCS_ANADV); in e1000_config_fc_after_link_up_generic()
1554 pcs_lp_ability_reg = E1000_READ_REG(hw, E1000_PCS_LPAB); in e1000_config_fc_after_link_up_generic()
1567 *-------|---------|-------|---------|-------------------- in e1000_config_fc_after_link_up_generic()
1585 *-------|---------|-------|---------|-------------------- in e1000_config_fc_after_link_up_generic()
1597 if (hw->fc.requested_mode == e1000_fc_full) { in e1000_config_fc_after_link_up_generic()
1598 hw->fc.current_mode = e1000_fc_full; in e1000_config_fc_after_link_up_generic()
1601 hw->fc.current_mode = e1000_fc_rx_pause; in e1000_config_fc_after_link_up_generic()
1609 *-------|---------|-------|---------|-------------------- in e1000_config_fc_after_link_up_generic()
1616 hw->fc.current_mode = e1000_fc_tx_pause; in e1000_config_fc_after_link_up_generic()
1623 *-------|---------|-------|---------|-------------------- in e1000_config_fc_after_link_up_generic()
1630 hw->fc.current_mode = e1000_fc_rx_pause; in e1000_config_fc_after_link_up_generic()
1636 hw->fc.current_mode = e1000_fc_none; in e1000_config_fc_after_link_up_generic()
1643 pcs_ctrl_reg = E1000_READ_REG(hw, E1000_PCS_LCTL); in e1000_config_fc_after_link_up_generic()
1645 E1000_WRITE_REG(hw, E1000_PCS_LCTL, pcs_ctrl_reg); in e1000_config_fc_after_link_up_generic()
1647 ret_val = e1000_force_mac_fc_generic(hw); in e1000_config_fc_after_link_up_generic()
1658 * e1000_get_speed_and_duplex_copper_generic - Retrieve current speed/duplex
1659 * @hw: pointer to the HW structure
1666 s32 e1000_get_speed_and_duplex_copper_generic(struct e1000_hw *hw, u16 *speed, in e1000_get_speed_and_duplex_copper_generic() argument
1673 status = E1000_READ_REG(hw, E1000_STATUS); in e1000_get_speed_and_duplex_copper_generic()
1697 * e1000_get_speed_and_duplex_fiber_generic - Retrieve current speed/duplex
1698 * @hw: pointer to the HW structure
1705 s32 e1000_get_speed_and_duplex_fiber_serdes_generic(struct e1000_hw E1000_UNUSEDARG *hw, in e1000_get_speed_and_duplex_fiber_serdes_generic() argument
1717 * e1000_get_auto_rd_done_generic - Check for auto read completion
1718 * @hw: pointer to the HW structure
1722 s32 e1000_get_auto_rd_done_generic(struct e1000_hw *hw) in e1000_get_auto_rd_done_generic() argument
1729 if (E1000_READ_REG(hw, E1000_EECD) & E1000_EECD_AUTO_RD) in e1000_get_auto_rd_done_generic()
1736 DEBUGOUT("Auto read by HW from NVM has not completed.\n"); in e1000_get_auto_rd_done_generic()
1737 return -E1000_ERR_RESET; in e1000_get_auto_rd_done_generic()
1744 * e1000_valid_led_default_generic - Verify a valid default LED config
1745 * @hw: pointer to the HW structure
1751 s32 e1000_valid_led_default_generic(struct e1000_hw *hw, u16 *data) in e1000_valid_led_default_generic() argument
1757 ret_val = hw->nvm.ops.read(hw, NVM_ID_LED_SETTINGS, 1, data); in e1000_valid_led_default_generic()
1770 * e1000_id_led_init_generic -
1771 * @hw: pointer to the HW structure
1774 s32 e1000_id_led_init_generic(struct e1000_hw *hw) in e1000_id_led_init_generic() argument
1776 struct e1000_mac_info *mac = &hw->mac; in e1000_id_led_init_generic()
1786 ret_val = hw->nvm.ops.valid_led_default(hw, &data); in e1000_id_led_init_generic()
1790 mac->ledctl_default = E1000_READ_REG(hw, E1000_LEDCTL); in e1000_id_led_init_generic()
1791 mac->ledctl_mode1 = mac->ledctl_default; in e1000_id_led_init_generic()
1792 mac->ledctl_mode2 = mac->ledctl_default; in e1000_id_led_init_generic()
1800 mac->ledctl_mode1 &= ~(ledctl_mask << (i << 3)); in e1000_id_led_init_generic()
1801 mac->ledctl_mode1 |= ledctl_on << (i << 3); in e1000_id_led_init_generic()
1806 mac->ledctl_mode1 &= ~(ledctl_mask << (i << 3)); in e1000_id_led_init_generic()
1807 mac->ledctl_mode1 |= ledctl_off << (i << 3); in e1000_id_led_init_generic()
1817 mac->ledctl_mode2 &= ~(ledctl_mask << (i << 3)); in e1000_id_led_init_generic()
1818 mac->ledctl_mode2 |= ledctl_on << (i << 3); in e1000_id_led_init_generic()
1823 mac->ledctl_mode2 &= ~(ledctl_mask << (i << 3)); in e1000_id_led_init_generic()
1824 mac->ledctl_mode2 |= ledctl_off << (i << 3); in e1000_id_led_init_generic()
1836 * e1000_setup_led_generic - Configures SW controllable LED
1837 * @hw: pointer to the HW structure
1842 s32 e1000_setup_led_generic(struct e1000_hw *hw) in e1000_setup_led_generic() argument
1848 if (hw->mac.ops.setup_led != e1000_setup_led_generic) in e1000_setup_led_generic()
1849 return -E1000_ERR_CONFIG; in e1000_setup_led_generic()
1851 if (hw->phy.media_type == e1000_media_type_fiber) { in e1000_setup_led_generic()
1852 ledctl = E1000_READ_REG(hw, E1000_LEDCTL); in e1000_setup_led_generic()
1853 hw->mac.ledctl_default = ledctl; in e1000_setup_led_generic()
1859 E1000_WRITE_REG(hw, E1000_LEDCTL, ledctl); in e1000_setup_led_generic()
1860 } else if (hw->phy.media_type == e1000_media_type_copper) { in e1000_setup_led_generic()
1861 E1000_WRITE_REG(hw, E1000_LEDCTL, hw->mac.ledctl_mode1); in e1000_setup_led_generic()
1868 * e1000_cleanup_led_generic - Set LED config to default operation
1869 * @hw: pointer to the HW structure
1874 s32 e1000_cleanup_led_generic(struct e1000_hw *hw) in e1000_cleanup_led_generic() argument
1878 E1000_WRITE_REG(hw, E1000_LEDCTL, hw->mac.ledctl_default); in e1000_cleanup_led_generic()
1883 * e1000_blink_led_generic - Blink LED
1884 * @hw: pointer to the HW structure
1886 * Blink the LEDs which are set to be on.
1888 s32 e1000_blink_led_generic(struct e1000_hw *hw) in e1000_blink_led_generic() argument
1895 if (hw->phy.media_type == e1000_media_type_fiber) { in e1000_blink_led_generic()
1896 /* always blink LED0 for PCI-E fiber */ in e1000_blink_led_generic()
1900 /* Set the blink bit for each LED that's "on" (0x0E) in e1000_blink_led_generic()
1901 * (or "off" if inverted) in ledctl_mode2. The blink in e1000_blink_led_generic()
1906 ledctl_blink = hw->mac.ledctl_mode2; in e1000_blink_led_generic()
1908 u32 mode = (hw->mac.ledctl_mode2 >> i) & in e1000_blink_led_generic()
1910 u32 led_default = hw->mac.ledctl_default >> i; in e1000_blink_led_generic()
1924 E1000_WRITE_REG(hw, E1000_LEDCTL, ledctl_blink); in e1000_blink_led_generic()
1930 * e1000_led_on_generic - Turn LED on
1931 * @hw: pointer to the HW structure
1935 s32 e1000_led_on_generic(struct e1000_hw *hw) in e1000_led_on_generic() argument
1941 switch (hw->phy.media_type) { in e1000_led_on_generic()
1943 ctrl = E1000_READ_REG(hw, E1000_CTRL); in e1000_led_on_generic()
1946 E1000_WRITE_REG(hw, E1000_CTRL, ctrl); in e1000_led_on_generic()
1949 E1000_WRITE_REG(hw, E1000_LEDCTL, hw->mac.ledctl_mode2); in e1000_led_on_generic()
1959 * e1000_led_off_generic - Turn LED off
1960 * @hw: pointer to the HW structure
1964 s32 e1000_led_off_generic(struct e1000_hw *hw) in e1000_led_off_generic() argument
1970 switch (hw->phy.media_type) { in e1000_led_off_generic()
1972 ctrl = E1000_READ_REG(hw, E1000_CTRL); in e1000_led_off_generic()
1975 E1000_WRITE_REG(hw, E1000_CTRL, ctrl); in e1000_led_off_generic()
1978 E1000_WRITE_REG(hw, E1000_LEDCTL, hw->mac.ledctl_mode1); in e1000_led_off_generic()
1988 * e1000_set_pcie_no_snoop_generic - Set PCI-express capabilities
1989 * @hw: pointer to the HW structure
1992 * Set the PCI-express register to snoop for events enabled in 'no_snoop'.
1994 void e1000_set_pcie_no_snoop_generic(struct e1000_hw *hw, u32 no_snoop) in e1000_set_pcie_no_snoop_generic() argument
2000 if (hw->bus.type != e1000_bus_type_pci_express) in e1000_set_pcie_no_snoop_generic()
2004 gcr = E1000_READ_REG(hw, E1000_GCR); in e1000_set_pcie_no_snoop_generic()
2007 E1000_WRITE_REG(hw, E1000_GCR, gcr); in e1000_set_pcie_no_snoop_generic()
2012 * e1000_disable_pcie_master_generic - Disables PCI-express master access
2013 * @hw: pointer to the HW structure
2015 * Returns E1000_SUCCESS if successful, else returns -10
2016 * (-E1000_ERR_MASTER_REQUESTS_PENDING) if master disable bit has not caused
2019 * Disables PCI-Express master access and verifies there are no pending
2022 s32 e1000_disable_pcie_master_generic(struct e1000_hw *hw) in e1000_disable_pcie_master_generic() argument
2029 if (hw->bus.type != e1000_bus_type_pci_express) in e1000_disable_pcie_master_generic()
2032 ctrl = E1000_READ_REG(hw, E1000_CTRL); in e1000_disable_pcie_master_generic()
2034 E1000_WRITE_REG(hw, E1000_CTRL, ctrl); in e1000_disable_pcie_master_generic()
2037 if (!(E1000_READ_REG(hw, E1000_STATUS) & in e1000_disable_pcie_master_generic()
2039 E1000_REMOVED(hw->hw_addr)) in e1000_disable_pcie_master_generic()
2042 timeout--; in e1000_disable_pcie_master_generic()
2047 return -E1000_ERR_MASTER_REQUESTS_PENDING; in e1000_disable_pcie_master_generic()
2054 * e1000_reset_adaptive_generic - Reset Adaptive Interframe Spacing
2055 * @hw: pointer to the HW structure
2059 void e1000_reset_adaptive_generic(struct e1000_hw *hw) in e1000_reset_adaptive_generic() argument
2061 struct e1000_mac_info *mac = &hw->mac; in e1000_reset_adaptive_generic()
2065 if (!mac->adaptive_ifs) { in e1000_reset_adaptive_generic()
2070 mac->current_ifs_val = 0; in e1000_reset_adaptive_generic()
2071 mac->ifs_min_val = IFS_MIN; in e1000_reset_adaptive_generic()
2072 mac->ifs_max_val = IFS_MAX; in e1000_reset_adaptive_generic()
2073 mac->ifs_step_size = IFS_STEP; in e1000_reset_adaptive_generic()
2074 mac->ifs_ratio = IFS_RATIO; in e1000_reset_adaptive_generic()
2076 mac->in_ifs_mode = false; in e1000_reset_adaptive_generic()
2077 E1000_WRITE_REG(hw, E1000_AIT, 0); in e1000_reset_adaptive_generic()
2081 * e1000_update_adaptive_generic - Update Adaptive Interframe Spacing
2082 * @hw: pointer to the HW structure
2087 void e1000_update_adaptive_generic(struct e1000_hw *hw) in e1000_update_adaptive_generic() argument
2089 struct e1000_mac_info *mac = &hw->mac; in e1000_update_adaptive_generic()
2093 if (!mac->adaptive_ifs) { in e1000_update_adaptive_generic()
2098 if ((mac->collision_delta * mac->ifs_ratio) > mac->tx_packet_delta) { in e1000_update_adaptive_generic()
2099 if (mac->tx_packet_delta > MIN_NUM_XMITS) { in e1000_update_adaptive_generic()
2100 mac->in_ifs_mode = true; in e1000_update_adaptive_generic()
2101 if (mac->current_ifs_val < mac->ifs_max_val) { in e1000_update_adaptive_generic()
2102 if (!mac->current_ifs_val) in e1000_update_adaptive_generic()
2103 mac->current_ifs_val = mac->ifs_min_val; in e1000_update_adaptive_generic()
2105 mac->current_ifs_val += in e1000_update_adaptive_generic()
2106 mac->ifs_step_size; in e1000_update_adaptive_generic()
2107 E1000_WRITE_REG(hw, E1000_AIT, in e1000_update_adaptive_generic()
2108 mac->current_ifs_val); in e1000_update_adaptive_generic()
2112 if (mac->in_ifs_mode && in e1000_update_adaptive_generic()
2113 (mac->tx_packet_delta <= MIN_NUM_XMITS)) { in e1000_update_adaptive_generic()
2114 mac->current_ifs_val = 0; in e1000_update_adaptive_generic()
2115 mac->in_ifs_mode = false; in e1000_update_adaptive_generic()
2116 E1000_WRITE_REG(hw, E1000_AIT, 0); in e1000_update_adaptive_generic()
2122 * e1000_validate_mdi_setting_generic - Verify MDI/MDIx settings
2123 * @hw: pointer to the HW structure
2125 * Verify that when not using auto-negotiation that MDI/MDIx is correctly
2128 static s32 e1000_validate_mdi_setting_generic(struct e1000_hw *hw) in e1000_validate_mdi_setting_generic() argument
2132 if (!hw->mac.autoneg && (hw->phy.mdix == 0 || hw->phy.mdix == 3)) { in e1000_validate_mdi_setting_generic()
2134 hw->phy.mdix = 1; in e1000_validate_mdi_setting_generic()
2135 return -E1000_ERR_CONFIG; in e1000_validate_mdi_setting_generic()
2142 * e1000_validate_mdi_setting_crossover_generic - Verify MDI/MDIx settings
2143 * @hw: pointer to the HW structure
2145 * Validate the MDI/MDIx setting, allowing for auto-crossover during forced
2148 s32 e1000_validate_mdi_setting_crossover_generic(struct e1000_hw E1000_UNUSEDARG *hw) in e1000_validate_mdi_setting_crossover_generic() argument
2156 * e1000_write_8bit_ctrl_reg_generic - Write a 8bit CTRL register
2157 * @hw: pointer to the HW structure
2166 s32 e1000_write_8bit_ctrl_reg_generic(struct e1000_hw *hw, u32 reg, in e1000_write_8bit_ctrl_reg_generic() argument
2175 E1000_WRITE_REG(hw, reg, regvalue); in e1000_write_8bit_ctrl_reg_generic()
2180 regvalue = E1000_READ_REG(hw, reg); in e1000_write_8bit_ctrl_reg_generic()
2186 return -E1000_ERR_PHY; in e1000_write_8bit_ctrl_reg_generic()
2193 * e1000_get_hw_semaphore - Acquire hardware semaphore
2194 * @hw: pointer to the HW structure
2196 * Acquire the HW semaphore to access the PHY or NVM
2198 s32 e1000_get_hw_semaphore(struct e1000_hw *hw) in e1000_get_hw_semaphore() argument
2201 s32 fw_timeout = hw->nvm.word_size + 1; in e1000_get_hw_semaphore()
2202 s32 sw_timeout = hw->nvm.word_size + 1; in e1000_get_hw_semaphore()
2209 * the inter-port SMBI semaphore, there is old code in e1000_get_hw_semaphore()
2215 if (hw->dev_spec._82571.smb_counter > 2) in e1000_get_hw_semaphore()
2221 swsm = E1000_READ_REG(hw, E1000_SWSM); in e1000_get_hw_semaphore()
2230 DEBUGOUT("Driver can't access device - SMBI bit is set.\n"); in e1000_get_hw_semaphore()
2231 hw->dev_spec._82571.smb_counter++; in e1000_get_hw_semaphore()
2237 if (hw->dev_spec._82575.clear_semaphore_once) { in e1000_get_hw_semaphore()
2238 hw->dev_spec._82575.clear_semaphore_once = false; in e1000_get_hw_semaphore()
2239 e1000_put_hw_semaphore(hw); in e1000_get_hw_semaphore()
2241 swsm = E1000_READ_REG(hw, E1000_SWSM); in e1000_get_hw_semaphore()
2251 swsm = E1000_READ_REG(hw, E1000_SWSM); in e1000_get_hw_semaphore()
2252 E1000_WRITE_REG(hw, E1000_SWSM, swsm | E1000_SWSM_SWESMBI); in e1000_get_hw_semaphore()
2255 if (E1000_READ_REG(hw, E1000_SWSM) & E1000_SWSM_SWESMBI) in e1000_get_hw_semaphore()
2263 e1000_put_hw_semaphore(hw); in e1000_get_hw_semaphore()
2265 return -E1000_ERR_NVM; in e1000_get_hw_semaphore()
2272 * e1000_put_hw_semaphore - Release hardware semaphore
2273 * @hw: pointer to the HW structure
2277 void e1000_put_hw_semaphore(struct e1000_hw *hw) in e1000_put_hw_semaphore() argument
2283 swsm = E1000_READ_REG(hw, E1000_SWSM); in e1000_put_hw_semaphore()
2287 E1000_WRITE_REG(hw, E1000_SWSM, swsm); in e1000_put_hw_semaphore()
2292 * e1000_acquire_swfw_sync - Acquire SW/FW semaphore
2293 * @hw: pointer to the HW structure
2300 e1000_acquire_swfw_sync(struct e1000_hw *hw, u16 mask) in e1000_acquire_swfw_sync() argument
2311 if (e1000_get_hw_semaphore(hw)) { in e1000_acquire_swfw_sync()
2312 ret_val = -E1000_ERR_SWFW_SYNC; in e1000_acquire_swfw_sync()
2316 swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); in e1000_acquire_swfw_sync()
2324 e1000_put_hw_semaphore(hw); in e1000_acquire_swfw_sync()
2331 ret_val = -E1000_ERR_SWFW_SYNC; in e1000_acquire_swfw_sync()
2336 E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); in e1000_acquire_swfw_sync()
2338 e1000_put_hw_semaphore(hw); in e1000_acquire_swfw_sync()
2345 * e1000_release_swfw_sync - Release SW/FW semaphore
2346 * @hw: pointer to the HW structure
2353 e1000_release_swfw_sync(struct e1000_hw *hw, u16 mask) in e1000_release_swfw_sync() argument
2359 while (e1000_get_hw_semaphore(hw) != E1000_SUCCESS) in e1000_release_swfw_sync()
2362 swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); in e1000_release_swfw_sync()
2364 E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); in e1000_release_swfw_sync()
2366 e1000_put_hw_semaphore(hw); in e1000_release_swfw_sync()