Lines Matching +full:auto +full:- +full:flow +full:- +full:control
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 1999 - 2018 Intel Corporation. */
9 * e1000e_get_bus_info_pcie - Get PCIe bus information
18 struct pci_dev *pdev = hw->adapter->pdev; in e1000e_get_bus_info_pcie()
19 struct e1000_mac_info *mac = &hw->mac; in e1000e_get_bus_info_pcie()
20 struct e1000_bus_info *bus = &hw->bus; in e1000e_get_bus_info_pcie()
24 bus->width = e1000_bus_width_unknown; in e1000e_get_bus_info_pcie()
27 bus->width = (enum e1000_bus_width)FIELD_GET(PCI_EXP_LNKSTA_NLW, in e1000e_get_bus_info_pcie()
31 mac->ops.set_lan_id(hw); in e1000e_get_bus_info_pcie()
37 * e1000_set_lan_id_multi_port_pcie - Set LAN id for PCIe multiple port devices
41 * Determines the LAN function id by reading memory-mapped registers
46 struct e1000_bus_info *bus = &hw->bus; in e1000_set_lan_id_multi_port_pcie()
53 bus->func = FIELD_GET(E1000_STATUS_FUNC_MASK, reg); in e1000_set_lan_id_multi_port_pcie()
57 * e1000_set_lan_id_single_port - Set LAN id for a single port device
64 struct e1000_bus_info *bus = &hw->bus; in e1000_set_lan_id_single_port()
66 bus->func = 0; in e1000_set_lan_id_single_port()
70 * e1000_clear_vfta_generic - Clear VLAN filter table
87 * e1000_write_vfta_generic - Write value to VLAN filter table
102 * e1000e_init_rx_addrs - Initialize receive address's
118 hw->mac.ops.rar_set(hw, hw->mac.addr, 0); in e1000e_init_rx_addrs()
120 /* Zero out the other (rar_entry_count - 1) receive addresses */ in e1000e_init_rx_addrs()
121 e_dbg("Clearing RAR[1-%u]\n", rar_count - 1); in e1000e_init_rx_addrs()
123 hw->mac.ops.rar_set(hw, mac_addr, i); in e1000e_init_rx_addrs()
127 * e1000_check_alt_mac_addr_generic - Check for alternate MAC addr
131 * can be setup by pre-boot software and must be treated like a permanent
150 if (hw->mac.type == e1000_82573) in e1000_check_alt_mac_addr_generic()
165 if (hw->bus.func == E1000_FUNC_1) in e1000_check_alt_mac_addr_generic()
189 hw->mac.ops.rar_set(hw, alt_mac_addr, 0); in e1000_check_alt_mac_addr_generic()
196 return hw->mac.rar_entry_count; in e1000e_rar_get_count_generic()
200 * e1000e_rar_set_generic - Set receive address register
224 /* Some bridges will combine consecutive 32-bit writes into in e1000e_rar_set_generic()
237 * e1000_hash_mc_addr - Generate a multicast hash value
250 hash_mask = (hw->mac.mta_reg_count * 32) - 1; in e1000_hash_mc_addr()
252 /* For a mc_filter_type of 0, bit_shift is the number of left-shifts in e1000_hash_mc_addr()
262 * left-shifts where the MSB of mc_addr[5] would still fall within in e1000_hash_mc_addr()
265 * remaining number of bits. Thus 8 - bit_shift. The rest of the in e1000_hash_mc_addr()
268 * 8-bit shifting total. in e1000_hash_mc_addr()
271 * mta register count of 128 (thus a 4096-bit vector and 0xFFF mask), in e1000_hash_mc_addr()
283 switch (hw->mac.mc_filter_type) { in e1000_hash_mc_addr()
298 hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) | in e1000_hash_mc_addr()
305 * e1000e_update_mc_addr_list_generic - Update Multicast addresses
320 memset(&hw->mac.mta_shadow, 0, sizeof(hw->mac.mta_shadow)); in e1000e_update_mc_addr_list_generic()
326 hash_reg = (hash_value >> 5) & (hw->mac.mta_reg_count - 1); in e1000e_update_mc_addr_list_generic()
329 hw->mac.mta_shadow[hash_reg] |= BIT(hash_bit); in e1000e_update_mc_addr_list_generic()
334 for (i = hw->mac.mta_reg_count - 1; i >= 0; i--) in e1000e_update_mc_addr_list_generic()
335 E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, hw->mac.mta_shadow[i]); in e1000e_update_mc_addr_list_generic()
340 * e1000e_clear_hw_cntrs_base - Clear base hardware counters
387 * e1000e_check_for_copper_link - Check for link (Copper)
396 struct e1000_mac_info *mac = &hw->mac; in e1000e_check_for_copper_link()
400 /* We only want to go out to the PHY registers to see if Auto-Neg in e1000e_check_for_copper_link()
405 if (!mac->get_link_status) in e1000e_check_for_copper_link()
407 mac->get_link_status = false; in e1000e_check_for_copper_link()
418 * immediately after link-up in e1000e_check_for_copper_link()
425 if (!mac->autoneg) in e1000e_check_for_copper_link()
426 return -E1000_ERR_CONFIG; in e1000e_check_for_copper_link()
428 /* Auto-Neg is enabled. Auto Speed Detection takes care in e1000e_check_for_copper_link()
432 mac->ops.config_collision_dist(hw); in e1000e_check_for_copper_link()
434 /* Configure Flow Control now that Auto-Neg has completed. in e1000e_check_for_copper_link()
435 * First, we need to restore the desired flow control in e1000e_check_for_copper_link()
436 * settings because we may have had to re-autoneg with a in e1000e_check_for_copper_link()
441 e_dbg("Error configuring flow control\n"); in e1000e_check_for_copper_link()
446 mac->get_link_status = true; in e1000e_check_for_copper_link()
451 * e1000e_check_for_fiber_link - Check for link (Fiber)
459 struct e1000_mac_info *mac = &hw->mac; in e1000e_check_for_fiber_link()
469 /* If we don't have link (auto-negotiation failed or link partner in e1000e_check_for_fiber_link()
470 * cannot auto-negotiate), the cable is plugged in (we have signal), in e1000e_check_for_fiber_link()
471 * and our link partner is not trying to auto-negotiate with us (we in e1000e_check_for_fiber_link()
473 * need to give auto-negotiation time to complete, in case the cable in e1000e_check_for_fiber_link()
479 if (!mac->autoneg_failed) { in e1000e_check_for_fiber_link()
480 mac->autoneg_failed = true; in e1000e_check_for_fiber_link()
485 /* Disable auto-negotiation in the TXCW register */ in e1000e_check_for_fiber_link()
486 ew32(TXCW, (mac->txcw & ~E1000_TXCW_ANE)); in e1000e_check_for_fiber_link()
488 /* Force link-up and also force full-duplex. */ in e1000e_check_for_fiber_link()
493 /* Configure Flow Control after forcing link up. */ in e1000e_check_for_fiber_link()
496 e_dbg("Error configuring flow control\n"); in e1000e_check_for_fiber_link()
501 * sets, re-enable auto-negotiation in the TXCW register in e1000e_check_for_fiber_link()
502 * and disable forced link in the Device Control register in e1000e_check_for_fiber_link()
503 * in an attempt to auto-negotiate with our link partner. in e1000e_check_for_fiber_link()
506 ew32(TXCW, mac->txcw); in e1000e_check_for_fiber_link()
509 mac->serdes_has_link = true; in e1000e_check_for_fiber_link()
516 * e1000e_check_for_serdes_link - Check for link (Serdes)
524 struct e1000_mac_info *mac = &hw->mac; in e1000e_check_for_serdes_link()
534 /* If we don't have link (auto-negotiation failed or link partner in e1000e_check_for_serdes_link()
535 * cannot auto-negotiate), and our link partner is not trying to in e1000e_check_for_serdes_link()
536 * auto-negotiate with us (we are receiving idles or data), in e1000e_check_for_serdes_link()
537 * we need to force link up. We also need to give auto-negotiation in e1000e_check_for_serdes_link()
542 if (!mac->autoneg_failed) { in e1000e_check_for_serdes_link()
543 mac->autoneg_failed = true; in e1000e_check_for_serdes_link()
548 /* Disable auto-negotiation in the TXCW register */ in e1000e_check_for_serdes_link()
549 ew32(TXCW, (mac->txcw & ~E1000_TXCW_ANE)); in e1000e_check_for_serdes_link()
551 /* Force link-up and also force full-duplex. */ in e1000e_check_for_serdes_link()
556 /* Configure Flow Control after forcing link up. */ in e1000e_check_for_serdes_link()
559 e_dbg("Error configuring flow control\n"); in e1000e_check_for_serdes_link()
564 * sets, re-enable auto-negotiation in the TXCW register in e1000e_check_for_serdes_link()
565 * and disable forced link in the Device Control register in e1000e_check_for_serdes_link()
566 * in an attempt to auto-negotiate with our link partner. in e1000e_check_for_serdes_link()
569 ew32(TXCW, mac->txcw); in e1000e_check_for_serdes_link()
572 mac->serdes_has_link = true; in e1000e_check_for_serdes_link()
574 /* If we force link for non-auto-negotiation switch, check in e1000e_check_for_serdes_link()
583 mac->serdes_has_link = true; in e1000e_check_for_serdes_link()
584 e_dbg("SERDES: Link up - forced.\n"); in e1000e_check_for_serdes_link()
587 mac->serdes_has_link = false; in e1000e_check_for_serdes_link()
588 e_dbg("SERDES: Link down - force failed.\n"); in e1000e_check_for_serdes_link()
600 mac->serdes_has_link = true; in e1000e_check_for_serdes_link()
601 e_dbg("SERDES: Link up - autoneg completed successfully.\n"); in e1000e_check_for_serdes_link()
603 mac->serdes_has_link = false; in e1000e_check_for_serdes_link()
604 e_dbg("SERDES: Link down - invalid codewords detected in autoneg.\n"); in e1000e_check_for_serdes_link()
607 mac->serdes_has_link = false; in e1000e_check_for_serdes_link()
608 e_dbg("SERDES: Link down - no sync.\n"); in e1000e_check_for_serdes_link()
611 mac->serdes_has_link = false; in e1000e_check_for_serdes_link()
612 e_dbg("SERDES: Link down - autoneg failed\n"); in e1000e_check_for_serdes_link()
620 * e1000_set_default_fc_generic - Set flow control default values
623 * Read the EEPROM for the default values for flow control and store the
632 * that determine the hardware's default PAUSE (flow control) mode, in e1000_set_default_fc_generic()
634 * disabling auto-negotiation, and the direction of the in e1000_set_default_fc_generic()
635 * SW defined pins. If there is no SW over-ride of the flow in e1000_set_default_fc_generic()
636 * control setting, then the variable hw->fc will in e1000_set_default_fc_generic()
647 hw->fc.requested_mode = e1000_fc_none; in e1000_set_default_fc_generic()
649 hw->fc.requested_mode = e1000_fc_tx_pause; in e1000_set_default_fc_generic()
651 hw->fc.requested_mode = e1000_fc_full; in e1000_set_default_fc_generic()
657 * e1000e_setup_link_generic - Setup flow control and link settings
660 * Determines which flow control settings to use, then configures flow
661 * control. Calls the appropriate media-specific link configuration
673 if (hw->phy.ops.check_reset_block && hw->phy.ops.check_reset_block(hw)) in e1000e_setup_link_generic()
676 /* If requested flow control is set to default, set flow control in e1000e_setup_link_generic()
677 * based on the EEPROM flow control settings. in e1000e_setup_link_generic()
679 if (hw->fc.requested_mode == e1000_fc_default) { in e1000e_setup_link_generic()
685 /* Save off the requested flow control mode for use later. Depending in e1000e_setup_link_generic()
688 hw->fc.current_mode = hw->fc.requested_mode; in e1000e_setup_link_generic()
690 e_dbg("After fix-ups FlowControl is now = %x\n", hw->fc.current_mode); in e1000e_setup_link_generic()
693 ret_val = hw->mac.ops.setup_physical_interface(hw); in e1000e_setup_link_generic()
697 /* Initialize the flow control address, type, and PAUSE timer in e1000e_setup_link_generic()
698 * registers to their default values. This is done even if flow in e1000e_setup_link_generic()
699 * control is disabled, because it does not hurt anything to in e1000e_setup_link_generic()
702 e_dbg("Initializing the Flow Control address, type and timer regs\n"); in e1000e_setup_link_generic()
707 ew32(FCTTV, hw->fc.pause_time); in e1000e_setup_link_generic()
713 * e1000_commit_fc_settings_generic - Configure flow control
716 * Write the flow control settings to the Transmit Config Word Register (TXCW)
717 * base on the flow control settings in e1000_mac_info.
721 struct e1000_mac_info *mac = &hw->mac; in e1000_commit_fc_settings_generic()
724 /* Check for a software override of the flow control settings, and in e1000_commit_fc_settings_generic()
725 * setup the device accordingly. If auto-negotiation is enabled, then in e1000_commit_fc_settings_generic()
727 * the Transmit Config Word Register (TXCW) and re-start auto- in e1000_commit_fc_settings_generic()
728 * negotiation. However, if auto-negotiation is disabled, then in e1000_commit_fc_settings_generic()
729 * software will have to manually configure the two flow control enable in e1000_commit_fc_settings_generic()
733 * 0: Flow control is completely disabled in e1000_commit_fc_settings_generic()
734 * 1: Rx flow control is enabled (we can receive pause frames, in e1000_commit_fc_settings_generic()
736 * 2: Tx flow control is enabled (we can send pause frames but we in e1000_commit_fc_settings_generic()
738 * 3: Both Rx and Tx flow control (symmetric) are enabled. in e1000_commit_fc_settings_generic()
740 switch (hw->fc.current_mode) { in e1000_commit_fc_settings_generic()
742 /* Flow control completely disabled by a software over-ride. */ in e1000_commit_fc_settings_generic()
746 /* Rx Flow control is enabled and Tx Flow control is disabled in e1000_commit_fc_settings_generic()
747 * by a software over-ride. Since there really isn't a way to in e1000_commit_fc_settings_generic()
756 /* Tx Flow control is enabled, and Rx Flow control is disabled, in e1000_commit_fc_settings_generic()
757 * by a software over-ride. in e1000_commit_fc_settings_generic()
762 /* Flow control (both Rx and Tx) is enabled by a software in e1000_commit_fc_settings_generic()
763 * over-ride. in e1000_commit_fc_settings_generic()
768 e_dbg("Flow control param set incorrectly\n"); in e1000_commit_fc_settings_generic()
769 return -E1000_ERR_CONFIG; in e1000_commit_fc_settings_generic()
773 mac->txcw = txcw; in e1000_commit_fc_settings_generic()
779 * e1000_poll_fiber_serdes_link_generic - Poll for link up
783 * up with auto-negotiation, then the link is forced if a signal is detected.
787 struct e1000_mac_info *mac = &hw->mac; in e1000_poll_fiber_serdes_link_generic()
792 * serdes media) then poll for a "Link-Up" indication in the Device in e1000_poll_fiber_serdes_link_generic()
793 * Status Register. Time-out if a link isn't seen in 500 milliseconds in e1000_poll_fiber_serdes_link_generic()
794 * seconds (Auto-negotiation should complete in less than 500 in e1000_poll_fiber_serdes_link_generic()
804 e_dbg("Never got a valid link from auto-neg!!!\n"); in e1000_poll_fiber_serdes_link_generic()
805 mac->autoneg_failed = true; in e1000_poll_fiber_serdes_link_generic()
807 * mac->check_for_link. This routine will force the in e1000_poll_fiber_serdes_link_generic()
809 * communicate with non-autonegotiating link partners. in e1000_poll_fiber_serdes_link_generic()
811 ret_val = mac->ops.check_for_link(hw); in e1000_poll_fiber_serdes_link_generic()
816 mac->autoneg_failed = false; in e1000_poll_fiber_serdes_link_generic()
818 mac->autoneg_failed = false; in e1000_poll_fiber_serdes_link_generic()
826 * e1000e_setup_fiber_serdes_link - Setup link for fiber/serdes
829 * Configures collision distance and flow control for fiber and serdes
842 hw->mac.ops.config_collision_dist(hw); in e1000e_setup_fiber_serdes_link()
848 /* Since auto-negotiation is enabled, take the link out of reset (the in e1000e_setup_fiber_serdes_link()
850 * will restart auto-negotiation. If auto-negotiation is successful in e1000e_setup_fiber_serdes_link()
851 * then the link-up status bit will be set and the flow control enable in e1000e_setup_fiber_serdes_link()
854 e_dbg("Auto-negotiation enabled\n"); in e1000e_setup_fiber_serdes_link()
861 * detect a signal. If we have a signal, then poll for a "Link-Up" in e1000e_setup_fiber_serdes_link()
864 if (hw->phy.media_type == e1000_media_type_internal_serdes || in e1000e_setup_fiber_serdes_link()
875 * e1000e_config_collision_dist_generic - Configure collision distance
895 * e1000e_set_fc_watermarks - Set flow control high/low watermarks
898 * Sets the flow control high/low threshold (watermark) registers. If
899 * flow control XON frame transmission is enabled, then set XON frame
906 /* Set the flow control receive threshold registers. Normally, in e1000e_set_fc_watermarks()
912 if (hw->fc.current_mode & e1000_fc_tx_pause) { in e1000e_set_fc_watermarks()
917 fcrtl = hw->fc.low_water; in e1000e_set_fc_watermarks()
918 if (hw->fc.send_xon) in e1000e_set_fc_watermarks()
921 fcrth = hw->fc.high_water; in e1000e_set_fc_watermarks()
930 * e1000e_force_mac_fc - Force the MAC's flow control settings
933 * Force the MAC's flow control settings. Sets the TFCE and RFCE bits in the
934 * device control register to reflect the adapter settings. TFCE and RFCE
945 /* Because we didn't get link via the internal auto-negotiation in e1000e_force_mac_fc()
947 * auto-neg), we have to manually enable/disable transmit an in e1000e_force_mac_fc()
948 * receive flow control. in e1000e_force_mac_fc()
950 * The "Case" statement below enables/disable flow control in e1000e_force_mac_fc()
951 * according to the "hw->fc.current_mode" parameter. in e1000e_force_mac_fc()
954 * 0: Flow control is completely disabled in e1000e_force_mac_fc()
955 * 1: Rx flow control is enabled (we can receive pause in e1000e_force_mac_fc()
957 * 2: Tx flow control is enabled (we can send pause frames in e1000e_force_mac_fc()
959 * 3: Both Rx and Tx flow control (symmetric) is enabled. in e1000e_force_mac_fc()
962 e_dbg("hw->fc.current_mode = %u\n", hw->fc.current_mode); in e1000e_force_mac_fc()
964 switch (hw->fc.current_mode) { in e1000e_force_mac_fc()
980 e_dbg("Flow control param set incorrectly\n"); in e1000e_force_mac_fc()
981 return -E1000_ERR_CONFIG; in e1000e_force_mac_fc()
990 * e1000e_config_fc_after_link_up - Configures flow control after link
993 * Checks the status of auto-negotiation after link up to ensure that the
995 * flow control needs to be forced also. If auto-negotiation is enabled
996 * and did not fail, then we configure flow control based on our link
1001 struct e1000_mac_info *mac = &hw->mac; in e1000e_config_fc_after_link_up()
1007 /* Check for the case where we have fiber media and auto-neg failed in e1000e_config_fc_after_link_up()
1011 if (mac->autoneg_failed) { in e1000e_config_fc_after_link_up()
1012 if (hw->phy.media_type == e1000_media_type_fiber || in e1000e_config_fc_after_link_up()
1013 hw->phy.media_type == e1000_media_type_internal_serdes) in e1000e_config_fc_after_link_up()
1016 if (hw->phy.media_type == e1000_media_type_copper) in e1000e_config_fc_after_link_up()
1021 e_dbg("Error forcing flow control settings\n"); in e1000e_config_fc_after_link_up()
1025 /* Check for the case where we have copper media and auto-neg is in e1000e_config_fc_after_link_up()
1026 * enabled. In this case, we need to check and see if Auto-Neg in e1000e_config_fc_after_link_up()
1028 * flow control configured. in e1000e_config_fc_after_link_up()
1030 if ((hw->phy.media_type == e1000_media_type_copper) && mac->autoneg) { in e1000e_config_fc_after_link_up()
1043 e_dbg("Copper PHY and Auto Neg has not completed.\n"); in e1000e_config_fc_after_link_up()
1048 * read both the Auto Negotiation Advertisement in e1000e_config_fc_after_link_up()
1051 * flow control was negotiated. in e1000e_config_fc_after_link_up()
1060 /* Two bits in the Auto Negotiation Advertisement Register in e1000e_config_fc_after_link_up()
1061 * (Address 4) and two bits in the Auto Negotiation Base in e1000e_config_fc_after_link_up()
1062 * Page Ability Register (Address 5) determine flow control in e1000e_config_fc_after_link_up()
1065 * 1999, describes these PAUSE resolution bits and how flow in e1000e_config_fc_after_link_up()
1066 * control is determined based upon these settings. in e1000e_config_fc_after_link_up()
1071 *-------|---------|-------|---------|-------------------- in e1000e_config_fc_after_link_up()
1082 * Symmetric Flow Control is enabled at both ends. The in e1000e_config_fc_after_link_up()
1085 * For Symmetric Flow Control: in e1000e_config_fc_after_link_up()
1089 *-------|---------|-------|---------|-------------------- in e1000e_config_fc_after_link_up()
1097 * FULL flow control because we could not advertise Rx in e1000e_config_fc_after_link_up()
1101 if (hw->fc.requested_mode == e1000_fc_full) { in e1000e_config_fc_after_link_up()
1102 hw->fc.current_mode = e1000_fc_full; in e1000e_config_fc_after_link_up()
1103 e_dbg("Flow Control = FULL.\n"); in e1000e_config_fc_after_link_up()
1105 hw->fc.current_mode = e1000_fc_rx_pause; in e1000e_config_fc_after_link_up()
1106 e_dbg("Flow Control = Rx PAUSE frames only.\n"); in e1000e_config_fc_after_link_up()
1113 *-------|---------|-------|---------|-------------------- in e1000e_config_fc_after_link_up()
1120 hw->fc.current_mode = e1000_fc_tx_pause; in e1000e_config_fc_after_link_up()
1121 e_dbg("Flow Control = Tx PAUSE frames only.\n"); in e1000e_config_fc_after_link_up()
1127 *-------|---------|-------|---------|-------------------- in e1000e_config_fc_after_link_up()
1134 hw->fc.current_mode = e1000_fc_rx_pause; in e1000e_config_fc_after_link_up()
1135 e_dbg("Flow Control = Rx PAUSE frames only.\n"); in e1000e_config_fc_after_link_up()
1137 /* Per the IEEE spec, at this point flow control in e1000e_config_fc_after_link_up()
1140 hw->fc.current_mode = e1000_fc_none; in e1000e_config_fc_after_link_up()
1141 e_dbg("Flow Control = NONE.\n"); in e1000e_config_fc_after_link_up()
1144 /* Now we need to do one last check... If we auto- in e1000e_config_fc_after_link_up()
1145 * negotiated to HALF DUPLEX, flow control should not be in e1000e_config_fc_after_link_up()
1148 ret_val = mac->ops.get_link_up_info(hw, &speed, &duplex); in e1000e_config_fc_after_link_up()
1155 hw->fc.current_mode = e1000_fc_none; in e1000e_config_fc_after_link_up()
1158 * controller to use the correct flow control settings. in e1000e_config_fc_after_link_up()
1162 e_dbg("Error forcing flow control settings\n"); in e1000e_config_fc_after_link_up()
1167 /* Check for the case where we have SerDes media and auto-neg is in e1000e_config_fc_after_link_up()
1168 * enabled. In this case, we need to check and see if Auto-Neg in e1000e_config_fc_after_link_up()
1170 * flow control configured. in e1000e_config_fc_after_link_up()
1172 if ((hw->phy.media_type == e1000_media_type_internal_serdes) && in e1000e_config_fc_after_link_up()
1173 mac->autoneg) { in e1000e_config_fc_after_link_up()
1180 e_dbg("PCS Auto Neg has not completed.\n"); in e1000e_config_fc_after_link_up()
1185 * read both the Auto Negotiation Advertisement in e1000e_config_fc_after_link_up()
1188 * flow control was negotiated. in e1000e_config_fc_after_link_up()
1193 /* Two bits in the Auto Negotiation Advertisement Register in e1000e_config_fc_after_link_up()
1194 * (PCS_ANADV) and two bits in the Auto Negotiation Base in e1000e_config_fc_after_link_up()
1195 * Page Ability Register (PCS_LPAB) determine flow control in e1000e_config_fc_after_link_up()
1198 * 1999, describes these PAUSE resolution bits and how flow in e1000e_config_fc_after_link_up()
1199 * control is determined based upon these settings. in e1000e_config_fc_after_link_up()
1204 *-------|---------|-------|---------|-------------------- in e1000e_config_fc_after_link_up()
1215 * Symmetric Flow Control is enabled at both ends. The in e1000e_config_fc_after_link_up()
1218 * For Symmetric Flow Control: in e1000e_config_fc_after_link_up()
1222 *-------|---------|-------|---------|-------------------- in e1000e_config_fc_after_link_up()
1230 * FULL flow control because we could not advertise Rx in e1000e_config_fc_after_link_up()
1234 if (hw->fc.requested_mode == e1000_fc_full) { in e1000e_config_fc_after_link_up()
1235 hw->fc.current_mode = e1000_fc_full; in e1000e_config_fc_after_link_up()
1236 e_dbg("Flow Control = FULL.\n"); in e1000e_config_fc_after_link_up()
1238 hw->fc.current_mode = e1000_fc_rx_pause; in e1000e_config_fc_after_link_up()
1239 e_dbg("Flow Control = Rx PAUSE frames only.\n"); in e1000e_config_fc_after_link_up()
1246 *-------|---------|-------|---------|-------------------- in e1000e_config_fc_after_link_up()
1253 hw->fc.current_mode = e1000_fc_tx_pause; in e1000e_config_fc_after_link_up()
1254 e_dbg("Flow Control = Tx PAUSE frames only.\n"); in e1000e_config_fc_after_link_up()
1260 *-------|---------|-------|---------|-------------------- in e1000e_config_fc_after_link_up()
1267 hw->fc.current_mode = e1000_fc_rx_pause; in e1000e_config_fc_after_link_up()
1268 e_dbg("Flow Control = Rx PAUSE frames only.\n"); in e1000e_config_fc_after_link_up()
1270 /* Per the IEEE spec, at this point flow control in e1000e_config_fc_after_link_up()
1273 hw->fc.current_mode = e1000_fc_none; in e1000e_config_fc_after_link_up()
1274 e_dbg("Flow Control = NONE.\n"); in e1000e_config_fc_after_link_up()
1278 * controller to use the correct flow control settings. in e1000e_config_fc_after_link_up()
1286 e_dbg("Error forcing flow control settings\n"); in e1000e_config_fc_after_link_up()
1295 * e1000e_get_speed_and_duplex_copper - Retrieve current speed/duplex
1329 * e1000e_get_speed_and_duplex_fiber_serdes - Retrieve current speed/duplex
1347 * e1000e_get_hw_semaphore - Acquire hardware semaphore
1355 s32 timeout = hw->nvm.word_size + 1; in e1000e_get_hw_semaphore()
1369 e_dbg("Driver can't access device - SMBI bit is set.\n"); in e1000e_get_hw_semaphore()
1370 return -E1000_ERR_NVM; in e1000e_get_hw_semaphore()
1389 return -E1000_ERR_NVM; in e1000e_get_hw_semaphore()
1396 * e1000e_put_hw_semaphore - Release hardware semaphore
1411 * e1000e_get_auto_rd_done - Check for auto read completion
1414 * Check EEPROM for Auto Read done bit.
1428 e_dbg("Auto read by HW from NVM has not completed.\n"); in e1000e_get_auto_rd_done()
1429 return -E1000_ERR_RESET; in e1000e_get_auto_rd_done()
1436 * e1000e_valid_led_default - Verify a valid default LED config
1460 * e1000e_id_led_init_generic -
1466 struct e1000_mac_info *mac = &hw->mac; in e1000e_id_led_init_generic()
1474 ret_val = hw->nvm.ops.valid_led_default(hw, &data); in e1000e_id_led_init_generic()
1478 mac->ledctl_default = er32(LEDCTL); in e1000e_id_led_init_generic()
1479 mac->ledctl_mode1 = mac->ledctl_default; in e1000e_id_led_init_generic()
1480 mac->ledctl_mode2 = mac->ledctl_default; in e1000e_id_led_init_generic()
1488 mac->ledctl_mode1 &= ~(ledctl_mask << (i << 3)); in e1000e_id_led_init_generic()
1489 mac->ledctl_mode1 |= ledctl_on << (i << 3); in e1000e_id_led_init_generic()
1494 mac->ledctl_mode1 &= ~(ledctl_mask << (i << 3)); in e1000e_id_led_init_generic()
1495 mac->ledctl_mode1 |= ledctl_off << (i << 3); in e1000e_id_led_init_generic()
1505 mac->ledctl_mode2 &= ~(ledctl_mask << (i << 3)); in e1000e_id_led_init_generic()
1506 mac->ledctl_mode2 |= ledctl_on << (i << 3); in e1000e_id_led_init_generic()
1511 mac->ledctl_mode2 &= ~(ledctl_mask << (i << 3)); in e1000e_id_led_init_generic()
1512 mac->ledctl_mode2 |= ledctl_off << (i << 3); in e1000e_id_led_init_generic()
1524 * e1000e_setup_led_generic - Configures SW controllable LED
1534 if (hw->mac.ops.setup_led != e1000e_setup_led_generic) in e1000e_setup_led_generic()
1535 return -E1000_ERR_CONFIG; in e1000e_setup_led_generic()
1537 if (hw->phy.media_type == e1000_media_type_fiber) { in e1000e_setup_led_generic()
1539 hw->mac.ledctl_default = ledctl; in e1000e_setup_led_generic()
1546 } else if (hw->phy.media_type == e1000_media_type_copper) { in e1000e_setup_led_generic()
1547 ew32(LEDCTL, hw->mac.ledctl_mode1); in e1000e_setup_led_generic()
1554 * e1000e_cleanup_led_generic - Set LED config to default operation
1562 ew32(LEDCTL, hw->mac.ledctl_default); in e1000e_cleanup_led_generic()
1567 * e1000e_blink_led_generic - Blink LED
1577 if (hw->phy.media_type == e1000_media_type_fiber) { in e1000e_blink_led_generic()
1578 /* always blink LED0 for PCI-E fiber */ in e1000e_blink_led_generic()
1588 ledctl_blink = hw->mac.ledctl_mode2; in e1000e_blink_led_generic()
1590 u32 mode = (hw->mac.ledctl_mode2 >> i) & in e1000e_blink_led_generic()
1592 u32 led_default = hw->mac.ledctl_default >> i; in e1000e_blink_led_generic()
1612 * e1000e_led_on_generic - Turn LED on
1621 switch (hw->phy.media_type) { in e1000e_led_on_generic()
1629 ew32(LEDCTL, hw->mac.ledctl_mode2); in e1000e_led_on_generic()
1639 * e1000e_led_off_generic - Turn LED off
1648 switch (hw->phy.media_type) { in e1000e_led_off_generic()
1656 ew32(LEDCTL, hw->mac.ledctl_mode1); in e1000e_led_off_generic()
1666 * e1000e_set_pcie_no_snoop - Set PCI-express capabilities
1670 * Set the PCI-express register to snoop for events enabled in 'no_snoop'.
1685 * e1000e_disable_pcie_master - Disables PCI-express master access
1688 * Returns 0 if successful, else returns -10
1689 * (-E1000_ERR_MASTER_REQUESTS_PENDING) if master disable bit has not caused
1692 * Disables PCI-Express master access and verifies there are no pending
1708 timeout--; in e1000e_disable_pcie_master()
1713 return -E1000_ERR_MASTER_REQUESTS_PENDING; in e1000e_disable_pcie_master()
1720 * e1000e_reset_adaptive - Reset Adaptive Interframe Spacing
1727 struct e1000_mac_info *mac = &hw->mac; in e1000e_reset_adaptive()
1729 if (!mac->adaptive_ifs) { in e1000e_reset_adaptive()
1734 mac->current_ifs_val = 0; in e1000e_reset_adaptive()
1735 mac->ifs_min_val = IFS_MIN; in e1000e_reset_adaptive()
1736 mac->ifs_max_val = IFS_MAX; in e1000e_reset_adaptive()
1737 mac->ifs_step_size = IFS_STEP; in e1000e_reset_adaptive()
1738 mac->ifs_ratio = IFS_RATIO; in e1000e_reset_adaptive()
1740 mac->in_ifs_mode = false; in e1000e_reset_adaptive()
1745 * e1000e_update_adaptive - Update Adaptive Interframe Spacing
1753 struct e1000_mac_info *mac = &hw->mac; in e1000e_update_adaptive()
1755 if (!mac->adaptive_ifs) { in e1000e_update_adaptive()
1760 if ((mac->collision_delta * mac->ifs_ratio) > mac->tx_packet_delta) { in e1000e_update_adaptive()
1761 if (mac->tx_packet_delta > MIN_NUM_XMITS) { in e1000e_update_adaptive()
1762 mac->in_ifs_mode = true; in e1000e_update_adaptive()
1763 if (mac->current_ifs_val < mac->ifs_max_val) { in e1000e_update_adaptive()
1764 if (!mac->current_ifs_val) in e1000e_update_adaptive()
1765 mac->current_ifs_val = mac->ifs_min_val; in e1000e_update_adaptive()
1767 mac->current_ifs_val += in e1000e_update_adaptive()
1768 mac->ifs_step_size; in e1000e_update_adaptive()
1769 ew32(AIT, mac->current_ifs_val); in e1000e_update_adaptive()
1773 if (mac->in_ifs_mode && in e1000e_update_adaptive()
1774 (mac->tx_packet_delta <= MIN_NUM_XMITS)) { in e1000e_update_adaptive()
1775 mac->current_ifs_val = 0; in e1000e_update_adaptive()
1776 mac->in_ifs_mode = false; in e1000e_update_adaptive()