Lines Matching +full:hw +full:- +full:device +full:- +full:address
1 // SPDX-License-Identifier: GPL-2.0
11 * igc_disable_pcie_master - Disables PCI-express master access
12 * @hw: pointer to the HW structure
14 * Returns 0 (0) if successful, else returns -10
15 * (-IGC_ERR_MASTER_REQUESTS_PENDING) if master disable bit has not caused
18 * Disables PCI-Express master access and verifies there are no pending
21 s32 igc_disable_pcie_master(struct igc_hw *hw) in igc_disable_pcie_master() argument
36 timeout--; in igc_disable_pcie_master()
41 ret_val = -IGC_ERR_MASTER_REQUESTS_PENDING; in igc_disable_pcie_master()
50 * igc_init_rx_addrs - Initialize receive addresses
51 * @hw: pointer to the HW structure
52 * @rar_count: receive address registers
54 * Setup the receive address registers by setting the base receive address
55 * register to the devices MAC address and clearing all the other receive
56 * address registers to 0.
58 void igc_init_rx_addrs(struct igc_hw *hw, u16 rar_count) in igc_init_rx_addrs() argument
63 /* Setup the receive address */ in igc_init_rx_addrs()
64 hw_dbg("Programming MAC Address into RAR[0]\n"); in igc_init_rx_addrs()
66 hw->mac.ops.rar_set(hw, hw->mac.addr, 0); in igc_init_rx_addrs()
68 /* Zero out the other (rar_entry_count - 1) receive addresses */ in igc_init_rx_addrs()
69 hw_dbg("Clearing RAR[1-%u]\n", rar_count - 1); in igc_init_rx_addrs()
71 hw->mac.ops.rar_set(hw, mac_addr, i); in igc_init_rx_addrs()
75 * igc_set_fc_watermarks - Set flow control high/low watermarks
76 * @hw: pointer to the HW structure
82 static s32 igc_set_fc_watermarks(struct igc_hw *hw) in igc_set_fc_watermarks() argument
92 if (hw->fc.current_mode & igc_fc_tx_pause) { in igc_set_fc_watermarks()
97 fcrtl = hw->fc.low_water; in igc_set_fc_watermarks()
98 if (hw->fc.send_xon) in igc_set_fc_watermarks()
101 fcrth = hw->fc.high_water; in igc_set_fc_watermarks()
110 * igc_setup_link - Setup flow control and link settings
111 * @hw: pointer to the HW structure
114 * control. Calls the appropriate media-specific link configuration
119 s32 igc_setup_link(struct igc_hw *hw) in igc_setup_link() argument
126 if (igc_check_reset_block(hw)) in igc_setup_link()
132 if (hw->fc.requested_mode == igc_fc_default) in igc_setup_link()
133 hw->fc.requested_mode = igc_fc_full; in igc_setup_link()
139 hw->fc.current_mode = hw->fc.requested_mode; in igc_setup_link()
141 hw_dbg("After fix-ups FlowControl is now = %x\n", hw->fc.current_mode); in igc_setup_link()
144 ret_val = hw->mac.ops.setup_physical_interface(hw); in igc_setup_link()
148 /* Initialize the flow control address, type, and PAUSE timer in igc_setup_link()
153 hw_dbg("Initializing the Flow Control address, type and timer regs\n"); in igc_setup_link()
158 wr32(IGC_FCTTV, hw->fc.pause_time); in igc_setup_link()
160 ret_val = igc_set_fc_watermarks(hw); in igc_setup_link()
167 * igc_force_mac_fc - Force the MAC's flow control settings
168 * @hw: pointer to the HW structure
171 * device control register to reflect the adapter settings. TFCE and RFCE
176 s32 igc_force_mac_fc(struct igc_hw *hw) in igc_force_mac_fc() argument
183 /* Because we didn't get link via the internal auto-negotiation in igc_force_mac_fc()
185 * auto-neg), we have to manually enable/disable transmit an in igc_force_mac_fc()
189 * according to the "hw->fc.current_mode" parameter. in igc_force_mac_fc()
200 hw_dbg("hw->fc.current_mode = %u\n", hw->fc.current_mode); in igc_force_mac_fc()
202 switch (hw->fc.current_mode) { in igc_force_mac_fc()
219 ret_val = -IGC_ERR_CONFIG; in igc_force_mac_fc()
230 * igc_clear_hw_cntrs_base - Clear base hardware counters
231 * @hw: pointer to the HW structure
235 void igc_clear_hw_cntrs_base(struct igc_hw *hw) in igc_clear_hw_cntrs_base() argument
312 * igc_rar_set - Set receive address register
313 * @hw: pointer to the HW structure
314 * @addr: pointer to the receive address
315 * @index: receive address array register
317 * Sets the receive address array register at index to the address passed
320 void igc_rar_set(struct igc_hw *hw, u8 *addr, u32 index) in igc_rar_set() argument
324 /* HW expects these in little endian so we reverse the byte order in igc_rar_set()
333 /* If MAC address zero, no need to set the AV bit */ in igc_rar_set()
337 /* Some bridges will combine consecutive 32-bit writes into in igc_rar_set()
348 * igc_check_for_copper_link - Check for link (Copper)
349 * @hw: pointer to the HW structure
355 s32 igc_check_for_copper_link(struct igc_hw *hw) in igc_check_for_copper_link() argument
357 struct igc_mac_info *mac = &hw->mac; in igc_check_for_copper_link()
361 /* We only want to go out to the PHY registers to see if Auto-Neg in igc_check_for_copper_link()
366 if (!mac->get_link_status) { in igc_check_for_copper_link()
375 ret_val = igc_phy_has_link(hw, 1, 0, &link); in igc_check_for_copper_link()
382 mac->get_link_status = false; in igc_check_for_copper_link()
385 * immediately after link-up in igc_check_for_copper_link()
387 igc_check_downshift(hw); in igc_check_for_copper_link()
392 if (!mac->autoneg) { in igc_check_for_copper_link()
393 ret_val = -IGC_ERR_CONFIG; in igc_check_for_copper_link()
397 /* Auto-Neg is enabled. Auto Speed Detection takes care in igc_check_for_copper_link()
401 igc_config_collision_dist(hw); in igc_check_for_copper_link()
403 /* Configure Flow Control now that Auto-Neg has completed. in igc_check_for_copper_link()
405 * settings because we may have had to re-autoneg with a in igc_check_for_copper_link()
408 ret_val = igc_config_fc_after_link_up(hw); in igc_check_for_copper_link()
416 ret_val = igc_set_ltr_i225(hw, link); in igc_check_for_copper_link()
422 * igc_config_collision_dist - Configure collision distance
423 * @hw: pointer to the HW structure
429 void igc_config_collision_dist(struct igc_hw *hw) in igc_config_collision_dist() argument
443 * igc_config_fc_after_link_up - Configures flow control after link
444 * @hw: pointer to the HW structure
446 * Checks the status of auto-negotiation after link up to ensure that the
448 * flow control needs to be forced also. If auto-negotiation is enabled
452 s32 igc_config_fc_after_link_up(struct igc_hw *hw) in igc_config_fc_after_link_up() argument
455 struct igc_mac_info *mac = &hw->mac; in igc_config_fc_after_link_up()
459 /* Check for the case where we have fiber media and auto-neg failed in igc_config_fc_after_link_up()
463 if (mac->autoneg_failed) in igc_config_fc_after_link_up()
464 ret_val = igc_force_mac_fc(hw); in igc_config_fc_after_link_up()
471 /* Check for the case where we have copper media and auto-neg is in igc_config_fc_after_link_up()
472 * enabled. In this case, we need to check and see if Auto-Neg in igc_config_fc_after_link_up()
476 if (mac->autoneg) { in igc_config_fc_after_link_up()
481 ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, in igc_config_fc_after_link_up()
485 ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, in igc_config_fc_after_link_up()
497 * Register (Address 4) and the Auto_Negotiation Base in igc_config_fc_after_link_up()
498 * Page Ability Register (Address 5) to determine how in igc_config_fc_after_link_up()
501 ret_val = hw->phy.ops.read_reg(hw, PHY_AUTONEG_ADV, in igc_config_fc_after_link_up()
505 ret_val = hw->phy.ops.read_reg(hw, PHY_LP_ABILITY, in igc_config_fc_after_link_up()
510 * (Address 4) and two bits in the Auto Negotiation Base in igc_config_fc_after_link_up()
511 * Page Ability Register (Address 5) determine flow control in igc_config_fc_after_link_up()
518 * LOCAL DEVICE | LINK PARTNER in igc_config_fc_after_link_up()
520 *-------|---------|-------|---------|-------------------- in igc_config_fc_after_link_up()
536 * LOCAL DEVICE | LINK PARTNER in igc_config_fc_after_link_up()
538 *-------|---------|-------|---------|-------------------- in igc_config_fc_after_link_up()
550 if (hw->fc.requested_mode == igc_fc_full) { in igc_config_fc_after_link_up()
551 hw->fc.current_mode = igc_fc_full; in igc_config_fc_after_link_up()
554 hw->fc.current_mode = igc_fc_rx_pause; in igc_config_fc_after_link_up()
561 * LOCAL DEVICE | LINK PARTNER in igc_config_fc_after_link_up()
563 *-------|---------|-------|---------|-------------------- in igc_config_fc_after_link_up()
570 hw->fc.current_mode = igc_fc_tx_pause; in igc_config_fc_after_link_up()
575 * LOCAL DEVICE | LINK PARTNER in igc_config_fc_after_link_up()
577 *-------|---------|-------|---------|-------------------- in igc_config_fc_after_link_up()
584 hw->fc.current_mode = igc_fc_rx_pause; in igc_config_fc_after_link_up()
607 else if ((hw->fc.requested_mode == igc_fc_none) || in igc_config_fc_after_link_up()
608 (hw->fc.requested_mode == igc_fc_tx_pause) || in igc_config_fc_after_link_up()
609 (hw->fc.strict_ieee)) { in igc_config_fc_after_link_up()
610 hw->fc.current_mode = igc_fc_none; in igc_config_fc_after_link_up()
613 hw->fc.current_mode = igc_fc_rx_pause; in igc_config_fc_after_link_up()
617 /* Now we need to do one last check... If we auto- in igc_config_fc_after_link_up()
621 ret_val = hw->mac.ops.get_speed_and_duplex(hw, &speed, &duplex); in igc_config_fc_after_link_up()
628 hw->fc.current_mode = igc_fc_none; in igc_config_fc_after_link_up()
633 ret_val = igc_force_mac_fc(hw); in igc_config_fc_after_link_up()
645 * igc_get_auto_rd_done - Check for auto read completion
646 * @hw: pointer to the HW structure
650 s32 igc_get_auto_rd_done(struct igc_hw *hw) in igc_get_auto_rd_done() argument
663 hw_dbg("Auto read by HW from NVM has not completed.\n"); in igc_get_auto_rd_done()
664 ret_val = -IGC_ERR_RESET; in igc_get_auto_rd_done()
673 * igc_get_speed_and_duplex_copper - Retrieve current speed/duplex
674 * @hw: pointer to the HW structure
681 s32 igc_get_speed_and_duplex_copper(struct igc_hw *hw, u16 *speed, in igc_get_speed_and_duplex_copper() argument
692 if (hw->mac.type == igc_i225 && in igc_get_speed_and_duplex_copper()
720 * igc_put_hw_semaphore - Release hardware semaphore
721 * @hw: pointer to the HW structure
725 void igc_put_hw_semaphore(struct igc_hw *hw) in igc_put_hw_semaphore() argument
737 * igc_enable_mng_pass_thru - Enable processing of ARP's
738 * @hw: pointer to the HW structure
743 bool igc_enable_mng_pass_thru(struct igc_hw *hw) in igc_enable_mng_pass_thru() argument
749 if (!hw->mac.asf_firmware_present) in igc_enable_mng_pass_thru()
757 if (hw->mac.arc_subsystem_valid) { in igc_enable_mng_pass_thru()
780 * igc_hash_mc_addr - Generate a multicast hash value
781 * @hw: pointer to the HW structure
782 * @mc_addr: pointer to a multicast address
784 * Generates a multicast address hash value which is used to determine
785 * the multicast filter table array address and new table value. See
788 static u32 igc_hash_mc_addr(struct igc_hw *hw, u8 *mc_addr) in igc_hash_mc_addr() argument
794 hash_mask = (hw->mac.mta_reg_count * 32) - 1; in igc_hash_mc_addr()
796 /* For a mc_filter_type of 0, bit_shift is the number of left-shifts in igc_hash_mc_addr()
802 /* The portion of the address that is used for the hash table in igc_hash_mc_addr()
806 * left-shifts where the MSB of mc_addr[5] would still fall within in igc_hash_mc_addr()
809 * remaining number of bits. Thus 8 - bit_shift. The rest of the in igc_hash_mc_addr()
812 * 8-bit shifting total. in igc_hash_mc_addr()
814 * For example, given the following Destination MAC Address and an in igc_hash_mc_addr()
815 * MTA register count of 128 (thus a 4096-bit vector and 0xFFF mask), in igc_hash_mc_addr()
827 switch (hw->mac.mc_filter_type) { in igc_hash_mc_addr()
842 hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) | in igc_hash_mc_addr()
849 * igc_update_mc_addr_list - Update Multicast addresses
850 * @hw: pointer to the HW structure
857 void igc_update_mc_addr_list(struct igc_hw *hw, in igc_update_mc_addr_list() argument
864 memset(&hw->mac.mta_shadow, 0, sizeof(hw->mac.mta_shadow)); in igc_update_mc_addr_list()
868 hash_value = igc_hash_mc_addr(hw, mc_addr_list); in igc_update_mc_addr_list()
870 hash_reg = (hash_value >> 5) & (hw->mac.mta_reg_count - 1); in igc_update_mc_addr_list()
873 hw->mac.mta_shadow[hash_reg] |= BIT(hash_bit); in igc_update_mc_addr_list()
878 for (i = hw->mac.mta_reg_count - 1; i >= 0; i--) in igc_update_mc_addr_list()
879 array_wr32(IGC_MTA, i, hw->mac.mta_shadow[i]); in igc_update_mc_addr_list()