Lines Matching +full:half +full:- +full:duplex +full:- +full:capable

2   SPDX-License-Identifier: BSD-3-Clause
4 Copyright (c) 2001-2020, Intel Corporation
42 * e1000_init_mac_ops_generic - Initialize MAC function pointers
45 * Setups up the function pointers to no-op functions
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
94 * e1000_null_mac_generic - No-op function, return void
104 * e1000_null_link_info - No-op function, return 0
117 * e1000_null_mng_mode - No-op function, return false
127 * e1000_null_update_mc - No-op function, return void
140 * e1000_null_write_vfta - No-op function, return void
153 * e1000_null_rar_set - No-op function, return 0
166 * e1000_null_set_obff_timer - No-op function, return 0
177 * e1000_get_bus_info_pci_generic - Get PCI(x) bus information
182 * bus speed, bus width, type (PCI/PCIx), and PCI(-x) function.
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()
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
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()
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
282 * Determines the LAN function id by reading memory-mapped registers
287 struct e1000_bus_info *bus = &hw->bus; 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
305 struct e1000_bus_info *bus = &hw->bus; 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
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
352 * e1000_write_vfta_generic - Write value to VLAN filter table
369 * e1000_init_rx_addrs_generic - Initialize receive address's
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
400 * can be setup by pre-boot software and must be treated like a permanent
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()
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
503 /* Some bridges will combine consecutive 32-bit writes into in e1000_rar_set_generic()
516 * e1000_hash_mc_addr_generic - Generate a multicast hash value
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
603 memset(&hw->mac.mta_shadow, 0, sizeof(hw->mac.mta_shadow)); 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()
623 * e1000_pcix_mmrbc_workaround_generic - Fix incorrect MMRBC value
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()
660 * e1000_clear_hw_cntrs_base_generic - Clear base hardware counters
709 * e1000_check_for_copper_link_generic - Check for link (Copper)
714 * to get the current speed/duplex if link exists.
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()
733 * link. If so, then we want to get the current speed/duplex 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()
750 /* If we are forcing speed/duplex, then we simply return since 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()
757 * of MAC speed/duplex configuration. So we only need to 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()
775 * e1000_check_for_fiber_link_generic - Check for link (Fiber)
783 struct e1000_mac_info *mac = &hw->mac; 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()
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()
835 mac->serdes_has_link = true; in e1000_check_for_fiber_link_generic()
842 * e1000_check_for_serdes_link_generic - Check for link (Serdes)
850 struct e1000_mac_info *mac = &hw->mac; 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()
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()
900 mac->serdes_has_link = true; 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()
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()
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
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
1004 * control. Calls the appropriate media-specific link configuration
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()
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()
1053 E1000_WRITE_REG(hw, E1000_FCTTV, hw->fc.pause_time); in e1000_setup_link_generic()
1059 * e1000_commit_fc_settings_generic - Configure flow control
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()
1096 * advertise that we are capable of Rx Pause ONLY, we will 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()
1122 mac->txcw = txcw; in e1000_commit_fc_settings_generic()
1128 * e1000_poll_fiber_serdes_link_generic - Poll for link up
1132 * up with auto-negotiation, then the link is forced if a signal is detected.
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()
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
1195 hw->mac.ops.config_collision_dist(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()
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()
1228 * e1000_config_collision_dist_generic - Configure collision distance
1250 * e1000_set_fc_watermarks_generic - Set flow control high/low watermarks
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()
1287 * e1000_force_mac_fc_generic - Force the MAC's flow control settings
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()
1349 * e1000_config_fc_after_link_up_generic - Configures flow control after link
1352 * Checks the status of auto-negotiation after link up to ensure that the
1353 * speed and duplex were not forced. If the link needed to be forced, then
1354 * flow control needs to be forced also. If auto-negotiation is enabled
1360 struct e1000_mac_info *mac = &hw->mac; in e1000_config_fc_after_link_up_generic()
1364 u16 speed, duplex; in e1000_config_fc_after_link_up_generic() local
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()
1377 if (hw->phy.media_type == e1000_media_type_copper) 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()
1508 * negotiated to HALF DUPLEX, flow control should not be 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()
1513 DEBUGOUT("Error getting link speed and duplex\n"); in e1000_config_fc_after_link_up_generic()
1517 if (duplex == HALF_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()
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()
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()
1658 * e1000_get_speed_and_duplex_copper_generic - Retrieve current speed/duplex
1661 * @duplex: stores the current duplex
1663 * Read the status register for the current speed/duplex and store the current
1664 * speed and duplex for copper connections.
1667 u16 *duplex) in e1000_get_speed_and_duplex_copper_generic() argument
1686 *duplex = FULL_DUPLEX; in e1000_get_speed_and_duplex_copper_generic()
1687 DEBUGOUT("Full Duplex\n"); in e1000_get_speed_and_duplex_copper_generic()
1689 *duplex = HALF_DUPLEX; in e1000_get_speed_and_duplex_copper_generic()
1690 DEBUGOUT("Half Duplex\n"); in e1000_get_speed_and_duplex_copper_generic()
1697 * e1000_get_speed_and_duplex_fiber_generic - Retrieve current speed/duplex
1700 * @duplex: stores the current duplex
1702 * Sets the speed and duplex to gigabit full duplex (the only possible option)
1706 u16 *speed, u16 *duplex) in e1000_get_speed_and_duplex_fiber_serdes_generic() argument
1711 *duplex = FULL_DUPLEX; in e1000_get_speed_and_duplex_fiber_serdes_generic()
1717 * e1000_get_auto_rd_done_generic - Check for auto read completion
1737 return -E1000_ERR_RESET; in e1000_get_auto_rd_done_generic()
1744 * e1000_valid_led_default_generic - Verify a valid default LED config
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 -
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
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()
1853 hw->mac.ledctl_default = 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
1878 E1000_WRITE_REG(hw, E1000_LEDCTL, hw->mac.ledctl_default); in e1000_cleanup_led_generic()
1883 * e1000_blink_led_generic - Blink LED
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()
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()
1930 * e1000_led_on_generic - Turn LED on
1941 switch (hw->phy.media_type) { 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
1970 switch (hw->phy.media_type) { 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
1992 * Set the PCI-express register to snoop for events enabled in 'no_snoop'.
2000 if (hw->bus.type != e1000_bus_type_pci_express) in e1000_set_pcie_no_snoop_generic()
2012 * e1000_disable_pcie_master_generic - Disables PCI-express master access
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
2029 if (hw->bus.type != e1000_bus_type_pci_express) 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
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()
2081 * e1000_update_adaptive_generic - Update Adaptive Interframe Spacing
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()
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()
2122 * e1000_validate_mdi_setting_generic - Verify MDI/MDIx settings
2125 * Verify that when not using auto-negotiation that MDI/MDIx is correctly
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
2145 * Validate the MDI/MDIx setting, allowing for auto-crossover during forced
2156 * e1000_write_8bit_ctrl_reg_generic - Write a 8bit CTRL register
2186 return -E1000_ERR_PHY; in e1000_write_8bit_ctrl_reg_generic()
2193 * e1000_get_hw_semaphore - Acquire hardware semaphore
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()
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()
2265 return -E1000_ERR_NVM; in e1000_get_hw_semaphore()
2272 * e1000_put_hw_semaphore - Release hardware semaphore
2292 * e1000_acquire_swfw_sync - Acquire SW/FW semaphore
2312 ret_val = -E1000_ERR_SWFW_SYNC; in e1000_acquire_swfw_sync()
2331 ret_val = -E1000_ERR_SWFW_SYNC; in e1000_acquire_swfw_sync()
2345 * e1000_release_swfw_sync - Release SW/FW semaphore