Lines Matching +full:current +full:- +full:speed
1 /*-
4 * SPDX-License-Identifier: BSD-3-Clause
13 * igc_init_mac_ops_generic - Initialize MAC function pointers
16 * Setups up the function pointers to no-op functions
20 struct igc_mac_info *mac = &hw->mac; in igc_init_mac_ops_generic()
24 mac->ops.init_params = igc_null_ops_generic; in igc_init_mac_ops_generic()
25 mac->ops.config_collision_dist = igc_config_collision_dist_generic; in igc_init_mac_ops_generic()
26 mac->ops.rar_set = igc_rar_set_generic; in igc_init_mac_ops_generic()
30 * igc_null_ops_generic - No-op function, returns 0
40 * igc_null_mac_generic - No-op function, return void
50 * igc_null_link_info - No-op function, return 0
63 * igc_null_mng_mode - No-op function, return false
73 * igc_null_update_mc - No-op function, return void
86 * igc_null_write_vfta - No-op function, return void
99 * igc_null_rar_set - No-op function, return 0
112 * igc_set_lan_id_single_port - Set LAN id for a single port device
119 struct igc_bus_info *bus = &hw->bus; in igc_set_lan_id_single_port()
121 bus->func = 0; in igc_set_lan_id_single_port()
125 * igc_clear_vfta_generic - Clear VLAN filter table
144 * igc_write_vfta_generic - Write value to VLAN filter table
161 * igc_init_rx_addrs_generic - Initialize receive address's
179 hw->mac.ops.rar_set(hw, hw->mac.addr, 0); in igc_init_rx_addrs_generic()
181 /* Zero out the other (rar_entry_count - 1) receive addresses */ in igc_init_rx_addrs_generic()
182 DEBUGOUT1("Clearing RAR[1-%u]\n", rar_count-1); in igc_init_rx_addrs_generic()
184 hw->mac.ops.rar_set(hw, mac_addr, i); in igc_init_rx_addrs_generic()
188 * igc_check_alt_mac_addr_generic - Check for alternate MAC addr
192 * can be setup by pre-boot software and must be treated like a permanent
208 ret_val = hw->nvm.ops.read(hw, NVM_COMPAT, 1, &nvm_data); in igc_check_alt_mac_addr_generic()
213 ret_val = hw->nvm.ops.read(hw, NVM_ALT_MAC_ADDR_PTR, 1, in igc_check_alt_mac_addr_generic()
225 if (hw->bus.func == IGC_FUNC_1) in igc_check_alt_mac_addr_generic()
229 ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); in igc_check_alt_mac_addr_generic()
249 hw->mac.ops.rar_set(hw, alt_mac_addr, 0); in igc_check_alt_mac_addr_generic()
255 * igc_rar_set_generic - Set receive address register
281 /* Some bridges will combine consecutive 32-bit writes into in igc_rar_set_generic()
294 * igc_hash_mc_addr_generic - Generate a multicast hash value
309 hash_mask = (hw->mac.mta_reg_count * 32) - 1; in igc_hash_mc_addr_generic()
311 /* For a mc_filter_type of 0, bit_shift is the number of left-shifts in igc_hash_mc_addr_generic()
321 * left-shifts where the MSB of mc_addr[5] would still fall within in igc_hash_mc_addr_generic()
324 * remaining number of bits. Thus 8 - bit_shift. The rest of the in igc_hash_mc_addr_generic()
327 * 8-bit shifting total. in igc_hash_mc_addr_generic()
330 * mta register count of 128 (thus a 4096-bit vector and 0xFFF mask), in igc_hash_mc_addr_generic()
342 switch (hw->mac.mc_filter_type) { in igc_hash_mc_addr_generic()
357 hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) | in igc_hash_mc_addr_generic()
364 * igc_update_mc_addr_list_generic - Update Multicast addresses
381 memset(&hw->mac.mta_shadow, 0, sizeof(hw->mac.mta_shadow)); in igc_update_mc_addr_list_generic()
387 hash_reg = (hash_value >> 5) & (hw->mac.mta_reg_count - 1); in igc_update_mc_addr_list_generic()
390 hw->mac.mta_shadow[hash_reg] |= (1 << hash_bit); in igc_update_mc_addr_list_generic()
395 for (i = hw->mac.mta_reg_count - 1; i >= 0; i--) in igc_update_mc_addr_list_generic()
396 IGC_WRITE_REG_ARRAY(hw, IGC_MTA, i, hw->mac.mta_shadow[i]); in igc_update_mc_addr_list_generic()
401 * igc_clear_hw_cntrs_base_generic - Clear base hardware counters
452 * igc_check_for_copper_link_generic - Check for link (Copper)
457 * to get the current speed/duplex if link exists.
461 struct igc_mac_info *mac = &hw->mac; in igc_check_for_copper_link_generic()
467 /* We only want to go out to the PHY registers to see if Auto-Neg in igc_check_for_copper_link_generic()
472 if (!mac->get_link_status) in igc_check_for_copper_link_generic()
476 * link. If so, then we want to get the current speed/duplex in igc_check_for_copper_link_generic()
486 mac->get_link_status = false; in igc_check_for_copper_link_generic()
489 * immediately after link-up in igc_check_for_copper_link_generic()
493 /* If we are forcing speed/duplex, then we simply return since in igc_check_for_copper_link_generic()
496 if (!mac->autoneg) in igc_check_for_copper_link_generic()
497 return -IGC_ERR_CONFIG; in igc_check_for_copper_link_generic()
499 /* Auto-Neg is enabled. Auto Speed Detection takes care in igc_check_for_copper_link_generic()
500 * of MAC speed/duplex configuration. So we only need to in igc_check_for_copper_link_generic()
503 mac->ops.config_collision_dist(hw); in igc_check_for_copper_link_generic()
505 /* Configure Flow Control now that Auto-Neg has completed. in igc_check_for_copper_link_generic()
507 * settings because we may have had to re-autoneg with a in igc_check_for_copper_link_generic()
518 * igc_setup_link_generic - Setup flow control and link settings
522 * control. Calls the appropriate media-specific link configuration
536 if (hw->phy.ops.check_reset_block && hw->phy.ops.check_reset_block(hw)) in igc_setup_link_generic()
542 if (hw->fc.requested_mode == igc_fc_default) { in igc_setup_link_generic()
543 hw->fc.requested_mode = igc_fc_full; in igc_setup_link_generic()
549 hw->fc.current_mode = hw->fc.requested_mode; in igc_setup_link_generic()
551 DEBUGOUT1("After fix-ups FlowControl is now = %x\n", in igc_setup_link_generic()
552 hw->fc.current_mode); in igc_setup_link_generic()
555 ret_val = hw->mac.ops.setup_physical_interface(hw); in igc_setup_link_generic()
569 IGC_WRITE_REG(hw, IGC_FCTTV, hw->fc.pause_time); in igc_setup_link_generic()
575 * igc_config_collision_dist_generic - Configure collision distance
597 * igc_set_fc_watermarks_generic - Set flow control high/low watermarks
616 if (hw->fc.current_mode & igc_fc_tx_pause) { in igc_set_fc_watermarks_generic()
621 fcrtl = hw->fc.low_water; in igc_set_fc_watermarks_generic()
622 if (hw->fc.send_xon) in igc_set_fc_watermarks_generic()
625 fcrth = hw->fc.high_water; in igc_set_fc_watermarks_generic()
634 * igc_force_mac_fc_generic - Force the MAC's flow control settings
651 /* Because we didn't get link via the internal auto-negotiation in igc_force_mac_fc_generic()
653 * auto-neg), we have to manually enable/disable transmit an in igc_force_mac_fc_generic()
657 * according to the "hw->fc.current_mode" parameter. in igc_force_mac_fc_generic()
668 DEBUGOUT1("hw->fc.current_mode = %u\n", hw->fc.current_mode); in igc_force_mac_fc_generic()
670 switch (hw->fc.current_mode) { in igc_force_mac_fc_generic()
687 return -IGC_ERR_CONFIG; in igc_force_mac_fc_generic()
696 * igc_config_fc_after_link_up_generic - Configures flow control after link
699 * Checks the status of auto-negotiation after link up to ensure that the
700 * speed and duplex were not forced. If the link needed to be forced, then
701 * flow control needs to be forced also. If auto-negotiation is enabled
707 struct igc_mac_info *mac = &hw->mac; in igc_config_fc_after_link_up_generic()
710 u16 speed, duplex; in igc_config_fc_after_link_up_generic() local
719 /* Check for the case where we have copper media and auto-neg is in igc_config_fc_after_link_up_generic()
720 * enabled. In this case, we need to check and see if Auto-Neg in igc_config_fc_after_link_up_generic()
724 if (mac->autoneg) { in igc_config_fc_after_link_up_generic()
729 ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &mii_status_reg); in igc_config_fc_after_link_up_generic()
732 ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &mii_status_reg); in igc_config_fc_after_link_up_generic()
747 ret_val = hw->phy.ops.read_reg(hw, PHY_AUTONEG_ADV, in igc_config_fc_after_link_up_generic()
751 ret_val = hw->phy.ops.read_reg(hw, PHY_LP_ABILITY, in igc_config_fc_after_link_up_generic()
767 *-------|---------|-------|---------|-------------------- in igc_config_fc_after_link_up_generic()
785 *-------|---------|-------|---------|-------------------- in igc_config_fc_after_link_up_generic()
797 if (hw->fc.requested_mode == igc_fc_full) { in igc_config_fc_after_link_up_generic()
798 hw->fc.current_mode = igc_fc_full; in igc_config_fc_after_link_up_generic()
801 hw->fc.current_mode = igc_fc_rx_pause; in igc_config_fc_after_link_up_generic()
809 *-------|---------|-------|---------|-------------------- in igc_config_fc_after_link_up_generic()
816 hw->fc.current_mode = igc_fc_tx_pause; in igc_config_fc_after_link_up_generic()
823 *-------|---------|-------|---------|-------------------- in igc_config_fc_after_link_up_generic()
830 hw->fc.current_mode = igc_fc_rx_pause; in igc_config_fc_after_link_up_generic()
836 hw->fc.current_mode = igc_fc_none; in igc_config_fc_after_link_up_generic()
840 /* Now we need to do one last check... If we auto- in igc_config_fc_after_link_up_generic()
844 ret_val = mac->ops.get_link_up_info(hw, &speed, &duplex); in igc_config_fc_after_link_up_generic()
846 DEBUGOUT("Error getting link speed and duplex\n"); in igc_config_fc_after_link_up_generic()
851 hw->fc.current_mode = igc_fc_none; in igc_config_fc_after_link_up_generic()
867 * igc_get_speed_and_duplex_copper_generic - Retrieve current speed/duplex
869 * @speed: stores the current speed
870 * @duplex: stores the current duplex
872 * Read the status register for the current speed/duplex and store the current
873 * speed and duplex for copper connections.
875 s32 igc_get_speed_and_duplex_copper_generic(struct igc_hw *hw, u16 *speed, in igc_get_speed_and_duplex_copper_generic() argument
884 /* For I225, STATUS will indicate 1G speed in both 1 Gbps in igc_get_speed_and_duplex_copper_generic()
888 if ((hw->mac.type == igc_i225) && in igc_get_speed_and_duplex_copper_generic()
890 *speed = SPEED_2500; in igc_get_speed_and_duplex_copper_generic()
893 *speed = SPEED_1000; in igc_get_speed_and_duplex_copper_generic()
897 *speed = SPEED_100; in igc_get_speed_and_duplex_copper_generic()
900 *speed = SPEED_10; in igc_get_speed_and_duplex_copper_generic()
916 * igc_get_hw_semaphore_generic - Acquire hardware semaphore
924 s32 timeout = hw->nvm.word_size + 1; in igc_get_hw_semaphore_generic()
940 DEBUGOUT("Driver can't access device - SMBI bit is set.\n"); in igc_get_hw_semaphore_generic()
941 return -IGC_ERR_NVM; in igc_get_hw_semaphore_generic()
960 return -IGC_ERR_NVM; in igc_get_hw_semaphore_generic()
967 * igc_put_hw_semaphore_generic - Release hardware semaphore
986 * igc_get_auto_rd_done_generic - Check for auto read completion
1006 return -IGC_ERR_RESET; in igc_get_auto_rd_done_generic()
1013 * igc_disable_pcie_master_generic - Disables PCI-express master access
1016 * Returns IGC_SUCCESS if successful, else returns -10
1017 * (-IGC_ERR_MASTER_REQUESTS_PENDING) if master disable bit has not caused
1020 * Disables PCI-Express master access and verifies there are no pending
1039 timeout--; in igc_disable_pcie_master_generic()
1044 return -IGC_ERR_MASTER_REQUESTS_PENDING; in igc_disable_pcie_master_generic()