Lines Matching refs:hw

44 static void ixgbe_disable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw);
45 static void ixgbe_enable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw);
46 static void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw);
47 static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
50 static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
53 static void ixgbe_stop_mac_link_on_d3_82599(struct ixgbe_hw *hw);
54 static s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw,
56 static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
59 static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw,
62 static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw);
63 static s32 ixgbe_read_i2c_byte_82599(struct ixgbe_hw *hw, u8 byte_offset,
65 static s32 ixgbe_write_i2c_byte_82599(struct ixgbe_hw *hw, u8 byte_offset,
67 static s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw);
68 static bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw);
70 bool ixgbe_mng_enabled(struct ixgbe_hw *hw) in ixgbe_mng_enabled() argument
74 fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM); in ixgbe_mng_enabled()
78 manc = IXGBE_READ_REG(hw, IXGBE_MANC); in ixgbe_mng_enabled()
82 factps = IXGBE_READ_REG(hw, IXGBE_FACTPS); in ixgbe_mng_enabled()
89 static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw) in ixgbe_init_mac_link_ops_82599() argument
91 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_init_mac_link_ops_82599()
96 if ((mac->ops.get_media_type(hw) == ixgbe_media_type_fiber) && in ixgbe_init_mac_link_ops_82599()
97 !ixgbe_mng_enabled(hw)) { in ixgbe_init_mac_link_ops_82599()
109 if (hw->phy.multispeed_fiber) { in ixgbe_init_mac_link_ops_82599()
113 if ((mac->ops.get_media_type(hw) == in ixgbe_init_mac_link_ops_82599()
115 (hw->phy.smart_speed == ixgbe_smart_speed_auto || in ixgbe_init_mac_link_ops_82599()
116 hw->phy.smart_speed == ixgbe_smart_speed_on) && in ixgbe_init_mac_link_ops_82599()
117 !ixgbe_verify_lesm_fw_enabled_82599(hw)) in ixgbe_init_mac_link_ops_82599()
124 static s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw) in ixgbe_setup_sfp_modules_82599() argument
129 if (hw->phy.sfp_type != ixgbe_sfp_type_unknown) { in ixgbe_setup_sfp_modules_82599()
130 ixgbe_init_mac_link_ops_82599(hw); in ixgbe_setup_sfp_modules_82599()
132 hw->phy.ops.reset = NULL; in ixgbe_setup_sfp_modules_82599()
134 ret_val = ixgbe_get_sfp_init_sequence_offsets(hw, &list_offset, in ixgbe_setup_sfp_modules_82599()
140 ret_val = hw->mac.ops.acquire_swfw_sync(hw, in ixgbe_setup_sfp_modules_82599()
145 if (hw->eeprom.ops.read(hw, ++data_offset, &data_value)) in ixgbe_setup_sfp_modules_82599()
148 IXGBE_WRITE_REG(hw, IXGBE_CORECTL, data_value); in ixgbe_setup_sfp_modules_82599()
149 IXGBE_WRITE_FLUSH(hw); in ixgbe_setup_sfp_modules_82599()
150 if (hw->eeprom.ops.read(hw, ++data_offset, &data_value)) in ixgbe_setup_sfp_modules_82599()
155 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM); in ixgbe_setup_sfp_modules_82599()
160 usleep_range(hw->eeprom.semaphore_delay * 1000, in ixgbe_setup_sfp_modules_82599()
161 hw->eeprom.semaphore_delay * 2000); in ixgbe_setup_sfp_modules_82599()
164 ret_val = hw->mac.ops.prot_autoc_write(hw, in ixgbe_setup_sfp_modules_82599()
165 hw->mac.orig_autoc | IXGBE_AUTOC_LMS_10G_SERIAL, in ixgbe_setup_sfp_modules_82599()
169 hw_dbg(hw, " sfp module setup not complete\n"); in ixgbe_setup_sfp_modules_82599()
178 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM); in ixgbe_setup_sfp_modules_82599()
182 usleep_range(hw->eeprom.semaphore_delay * 1000, in ixgbe_setup_sfp_modules_82599()
183 hw->eeprom.semaphore_delay * 2000); in ixgbe_setup_sfp_modules_82599()
184 hw_err(hw, "eeprom read at offset %d failed\n", data_offset); in ixgbe_setup_sfp_modules_82599()
199 static s32 prot_autoc_read_82599(struct ixgbe_hw *hw, bool *locked, in prot_autoc_read_82599() argument
206 if (ixgbe_verify_lesm_fw_enabled_82599(hw)) { in prot_autoc_read_82599()
207 ret_val = hw->mac.ops.acquire_swfw_sync(hw, in prot_autoc_read_82599()
215 *reg_val = IXGBE_READ_REG(hw, IXGBE_AUTOC); in prot_autoc_read_82599()
229 static s32 prot_autoc_write_82599(struct ixgbe_hw *hw, u32 autoc, bool locked) in prot_autoc_write_82599() argument
234 if (ixgbe_check_reset_blocked(hw)) in prot_autoc_write_82599()
241 if (!locked && ixgbe_verify_lesm_fw_enabled_82599(hw)) { in prot_autoc_write_82599()
242 ret_val = hw->mac.ops.acquire_swfw_sync(hw, in prot_autoc_write_82599()
250 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc); in prot_autoc_write_82599()
251 ret_val = ixgbe_reset_pipeline_82599(hw); in prot_autoc_write_82599()
258 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM); in prot_autoc_write_82599()
263 static s32 ixgbe_get_invariants_82599(struct ixgbe_hw *hw) in ixgbe_get_invariants_82599() argument
265 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_get_invariants_82599()
267 ixgbe_init_mac_link_ops_82599(hw); in ixgbe_get_invariants_82599()
275 mac->max_msix_vectors = ixgbe_get_pcie_msix_count_generic(hw); in ixgbe_get_invariants_82599()
289 static s32 ixgbe_init_phy_ops_82599(struct ixgbe_hw *hw) in ixgbe_init_phy_ops_82599() argument
291 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_init_phy_ops_82599()
292 struct ixgbe_phy_info *phy = &hw->phy; in ixgbe_init_phy_ops_82599()
296 if (hw->device_id == IXGBE_DEV_ID_82599_QSFP_SF_QP) { in ixgbe_init_phy_ops_82599()
298 hw->phy.qsfp_shared_i2c_bus = true; in ixgbe_init_phy_ops_82599()
301 esdp = IXGBE_READ_REG(hw, IXGBE_ESDP); in ixgbe_init_phy_ops_82599()
307 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp); in ixgbe_init_phy_ops_82599()
308 IXGBE_WRITE_FLUSH(hw); in ixgbe_init_phy_ops_82599()
315 ret_val = phy->ops.identify(hw); in ixgbe_init_phy_ops_82599()
318 ixgbe_init_mac_link_ops_82599(hw); in ixgbe_init_phy_ops_82599()
321 if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) { in ixgbe_init_phy_ops_82599()
328 switch (hw->phy.type) { in ixgbe_init_phy_ops_82599()
350 static s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw, in ixgbe_get_link_capabilities_82599() argument
357 if (hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 || in ixgbe_get_link_capabilities_82599()
358 hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 || in ixgbe_get_link_capabilities_82599()
359 hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 || in ixgbe_get_link_capabilities_82599()
360 hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 || in ixgbe_get_link_capabilities_82599()
361 hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || in ixgbe_get_link_capabilities_82599()
362 hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1) { in ixgbe_get_link_capabilities_82599()
373 if (hw->mac.orig_link_settings_stored) in ixgbe_get_link_capabilities_82599()
374 autoc = hw->mac.orig_autoc; in ixgbe_get_link_capabilities_82599()
376 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); in ixgbe_get_link_capabilities_82599()
431 if (hw->phy.multispeed_fiber) { in ixgbe_get_link_capabilities_82599()
436 if (hw->phy.media_type == ixgbe_media_type_fiber_qsfp) in ixgbe_get_link_capabilities_82599()
451 static enum ixgbe_media_type ixgbe_get_media_type_82599(struct ixgbe_hw *hw) in ixgbe_get_media_type_82599() argument
454 switch (hw->phy.type) { in ixgbe_get_media_type_82599()
463 switch (hw->device_id) { in ixgbe_get_media_type_82599()
505 static void ixgbe_stop_mac_link_on_d3_82599(struct ixgbe_hw *hw) in ixgbe_stop_mac_link_on_d3_82599() argument
510 hw->eeprom.ops.read(hw, IXGBE_EEPROM_CTRL_2, &ee_ctrl_2); in ixgbe_stop_mac_link_on_d3_82599()
513 fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM); in ixgbe_stop_mac_link_on_d3_82599()
516 !hw->wol_enabled && in ixgbe_stop_mac_link_on_d3_82599()
518 autoc2_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC2); in ixgbe_stop_mac_link_on_d3_82599()
520 IXGBE_WRITE_REG(hw, IXGBE_AUTOC2, autoc2_reg); in ixgbe_stop_mac_link_on_d3_82599()
532 static s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw, in ixgbe_start_mac_link_82599() argument
541 if (ixgbe_verify_lesm_fw_enabled_82599(hw)) { in ixgbe_start_mac_link_82599()
542 status = hw->mac.ops.acquire_swfw_sync(hw, in ixgbe_start_mac_link_82599()
551 ixgbe_reset_pipeline_82599(hw); in ixgbe_start_mac_link_82599()
554 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM); in ixgbe_start_mac_link_82599()
558 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); in ixgbe_start_mac_link_82599()
567 links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS); in ixgbe_start_mac_link_82599()
574 hw_dbg(hw, "Autoneg did not complete.\n"); in ixgbe_start_mac_link_82599()
593 static void ixgbe_disable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) in ixgbe_disable_tx_laser_multispeed_fiber() argument
595 u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); in ixgbe_disable_tx_laser_multispeed_fiber()
598 if (ixgbe_check_reset_blocked(hw)) in ixgbe_disable_tx_laser_multispeed_fiber()
603 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); in ixgbe_disable_tx_laser_multispeed_fiber()
604 IXGBE_WRITE_FLUSH(hw); in ixgbe_disable_tx_laser_multispeed_fiber()
616 static void ixgbe_enable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) in ixgbe_enable_tx_laser_multispeed_fiber() argument
618 u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); in ixgbe_enable_tx_laser_multispeed_fiber()
622 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); in ixgbe_enable_tx_laser_multispeed_fiber()
623 IXGBE_WRITE_FLUSH(hw); in ixgbe_enable_tx_laser_multispeed_fiber()
639 static void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) in ixgbe_flap_tx_laser_multispeed_fiber() argument
642 if (ixgbe_check_reset_blocked(hw)) in ixgbe_flap_tx_laser_multispeed_fiber()
645 if (hw->mac.autotry_restart) { in ixgbe_flap_tx_laser_multispeed_fiber()
646 ixgbe_disable_tx_laser_multispeed_fiber(hw); in ixgbe_flap_tx_laser_multispeed_fiber()
647 ixgbe_enable_tx_laser_multispeed_fiber(hw); in ixgbe_flap_tx_laser_multispeed_fiber()
648 hw->mac.autotry_restart = false; in ixgbe_flap_tx_laser_multispeed_fiber()
660 static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, in ixgbe_setup_mac_link_multispeed_fiber() argument
668 u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); in ixgbe_setup_mac_link_multispeed_fiber()
674 status = hw->mac.ops.get_link_capabilities(hw, &link_speed, in ixgbe_setup_mac_link_multispeed_fiber()
690 status = hw->mac.ops.check_link(hw, &link_speed, &link_up, in ixgbe_setup_mac_link_multispeed_fiber()
699 switch (hw->phy.media_type) { in ixgbe_setup_mac_link_multispeed_fiber()
702 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); in ixgbe_setup_mac_link_multispeed_fiber()
703 IXGBE_WRITE_FLUSH(hw); in ixgbe_setup_mac_link_multispeed_fiber()
709 hw_dbg(hw, "Unexpected media type.\n"); in ixgbe_setup_mac_link_multispeed_fiber()
716 status = ixgbe_setup_mac_link_82599(hw, in ixgbe_setup_mac_link_multispeed_fiber()
723 if (hw->mac.ops.flap_tx_laser) in ixgbe_setup_mac_link_multispeed_fiber()
724 hw->mac.ops.flap_tx_laser(hw); in ixgbe_setup_mac_link_multispeed_fiber()
736 status = hw->mac.ops.check_link(hw, &link_speed, in ixgbe_setup_mac_link_multispeed_fiber()
752 status = hw->mac.ops.check_link(hw, &link_speed, &link_up, in ixgbe_setup_mac_link_multispeed_fiber()
761 switch (hw->phy.media_type) { in ixgbe_setup_mac_link_multispeed_fiber()
765 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); in ixgbe_setup_mac_link_multispeed_fiber()
766 IXGBE_WRITE_FLUSH(hw); in ixgbe_setup_mac_link_multispeed_fiber()
772 hw_dbg(hw, "Unexpected media type.\n"); in ixgbe_setup_mac_link_multispeed_fiber()
779 status = ixgbe_setup_mac_link_82599(hw, in ixgbe_setup_mac_link_multispeed_fiber()
786 if (hw->mac.ops.flap_tx_laser) in ixgbe_setup_mac_link_multispeed_fiber()
787 hw->mac.ops.flap_tx_laser(hw); in ixgbe_setup_mac_link_multispeed_fiber()
793 status = hw->mac.ops.check_link(hw, &link_speed, &link_up, in ixgbe_setup_mac_link_multispeed_fiber()
808 status = ixgbe_setup_mac_link_multispeed_fiber(hw, in ixgbe_setup_mac_link_multispeed_fiber()
814 hw->phy.autoneg_advertised = 0; in ixgbe_setup_mac_link_multispeed_fiber()
817 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10GB_FULL; in ixgbe_setup_mac_link_multispeed_fiber()
820 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL; in ixgbe_setup_mac_link_multispeed_fiber()
833 static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw, in ixgbe_setup_mac_link_smartspeed() argument
841 u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); in ixgbe_setup_mac_link_smartspeed()
844 hw->phy.autoneg_advertised = 0; in ixgbe_setup_mac_link_smartspeed()
847 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10GB_FULL; in ixgbe_setup_mac_link_smartspeed()
850 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL; in ixgbe_setup_mac_link_smartspeed()
853 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_100_FULL; in ixgbe_setup_mac_link_smartspeed()
863 hw->phy.smart_speed_active = false; in ixgbe_setup_mac_link_smartspeed()
865 status = ixgbe_setup_mac_link_82599(hw, speed, in ixgbe_setup_mac_link_smartspeed()
880 status = hw->mac.ops.check_link(hw, &link_speed, in ixgbe_setup_mac_link_smartspeed()
899 hw->phy.smart_speed_active = true; in ixgbe_setup_mac_link_smartspeed()
900 status = ixgbe_setup_mac_link_82599(hw, speed, in ixgbe_setup_mac_link_smartspeed()
915 status = hw->mac.ops.check_link(hw, &link_speed, in ixgbe_setup_mac_link_smartspeed()
925 hw->phy.smart_speed_active = false; in ixgbe_setup_mac_link_smartspeed()
926 status = ixgbe_setup_mac_link_82599(hw, speed, in ixgbe_setup_mac_link_smartspeed()
931 hw_dbg(hw, "Smartspeed has downgraded the link speed from the maximum advertised\n"); in ixgbe_setup_mac_link_smartspeed()
943 static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, in ixgbe_setup_mac_link_82599() argument
950 u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2); in ixgbe_setup_mac_link_82599()
955 u32 current_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); in ixgbe_setup_mac_link_82599()
962 status = hw->mac.ops.get_link_capabilities(hw, &link_capabilities, in ixgbe_setup_mac_link_82599()
973 if (hw->mac.orig_link_settings_stored) in ixgbe_setup_mac_link_82599()
974 orig_autoc = hw->mac.orig_autoc; in ixgbe_setup_mac_link_82599()
990 (hw->phy.smart_speed_active == false)) in ixgbe_setup_mac_link_82599()
1019 status = hw->mac.ops.prot_autoc_write(hw, autoc, false); in ixgbe_setup_mac_link_82599()
1031 IXGBE_READ_REG(hw, IXGBE_LINKS); in ixgbe_setup_mac_link_82599()
1039 hw_dbg(hw, "Autoneg did not complete.\n"); in ixgbe_setup_mac_link_82599()
1059 static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw, in ixgbe_setup_copper_link_82599() argument
1066 status = hw->phy.ops.setup_link_speed(hw, speed, in ixgbe_setup_copper_link_82599()
1069 ixgbe_start_mac_link_82599(hw, autoneg_wait_to_complete); in ixgbe_setup_copper_link_82599()
1082 static s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw) in ixgbe_reset_hw_82599() argument
1091 status = hw->mac.ops.stop_adapter(hw); in ixgbe_reset_hw_82599()
1096 ixgbe_clear_tx_pending(hw); in ixgbe_reset_hw_82599()
1101 status = hw->phy.ops.init(hw); in ixgbe_reset_hw_82599()
1107 if (hw->phy.sfp_setup_needed) { in ixgbe_reset_hw_82599()
1108 status = hw->mac.ops.setup_sfp(hw); in ixgbe_reset_hw_82599()
1109 hw->phy.sfp_setup_needed = false; in ixgbe_reset_hw_82599()
1116 if (hw->phy.reset_disable == false && hw->phy.ops.reset != NULL) in ixgbe_reset_hw_82599()
1117 hw->phy.ops.reset(hw); in ixgbe_reset_hw_82599()
1120 curr_lms = IXGBE_READ_REG(hw, IXGBE_AUTOC) & IXGBE_AUTOC_LMS_MASK; in ixgbe_reset_hw_82599()
1130 if (!hw->force_full_reset) { in ixgbe_reset_hw_82599()
1131 hw->mac.ops.check_link(hw, &link_speed, &link_up, false); in ixgbe_reset_hw_82599()
1136 ctrl |= IXGBE_READ_REG(hw, IXGBE_CTRL); in ixgbe_reset_hw_82599()
1137 IXGBE_WRITE_REG(hw, IXGBE_CTRL, ctrl); in ixgbe_reset_hw_82599()
1138 IXGBE_WRITE_FLUSH(hw); in ixgbe_reset_hw_82599()
1143 ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL); in ixgbe_reset_hw_82599()
1150 hw_dbg(hw, "Reset polling failed to complete.\n"); in ixgbe_reset_hw_82599()
1160 if (hw->mac.flags & IXGBE_FLAGS_DOUBLE_RESET_REQUIRED) { in ixgbe_reset_hw_82599()
1161 hw->mac.flags &= ~IXGBE_FLAGS_DOUBLE_RESET_REQUIRED; in ixgbe_reset_hw_82599()
1170 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); in ixgbe_reset_hw_82599()
1171 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2); in ixgbe_reset_hw_82599()
1176 IXGBE_WRITE_REG(hw, IXGBE_AUTOC2, autoc2); in ixgbe_reset_hw_82599()
1177 IXGBE_WRITE_FLUSH(hw); in ixgbe_reset_hw_82599()
1180 if (hw->mac.orig_link_settings_stored == false) { in ixgbe_reset_hw_82599()
1181 hw->mac.orig_autoc = autoc; in ixgbe_reset_hw_82599()
1182 hw->mac.orig_autoc2 = autoc2; in ixgbe_reset_hw_82599()
1183 hw->mac.orig_link_settings_stored = true; in ixgbe_reset_hw_82599()
1192 if ((hw->phy.multispeed_fiber && ixgbe_mng_enabled(hw)) || in ixgbe_reset_hw_82599()
1193 hw->wol_enabled) in ixgbe_reset_hw_82599()
1194 hw->mac.orig_autoc = in ixgbe_reset_hw_82599()
1195 (hw->mac.orig_autoc & ~IXGBE_AUTOC_LMS_MASK) | in ixgbe_reset_hw_82599()
1198 if (autoc != hw->mac.orig_autoc) { in ixgbe_reset_hw_82599()
1199 status = hw->mac.ops.prot_autoc_write(hw, in ixgbe_reset_hw_82599()
1200 hw->mac.orig_autoc, in ixgbe_reset_hw_82599()
1207 (hw->mac.orig_autoc2 & IXGBE_AUTOC2_UPPER_MASK)) { in ixgbe_reset_hw_82599()
1209 autoc2 |= (hw->mac.orig_autoc2 & in ixgbe_reset_hw_82599()
1211 IXGBE_WRITE_REG(hw, IXGBE_AUTOC2, autoc2); in ixgbe_reset_hw_82599()
1216 hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr); in ixgbe_reset_hw_82599()
1223 hw->mac.num_rar_entries = 128; in ixgbe_reset_hw_82599()
1224 hw->mac.ops.init_rx_addrs(hw); in ixgbe_reset_hw_82599()
1227 hw->mac.ops.get_san_mac_addr(hw, hw->mac.san_addr); in ixgbe_reset_hw_82599()
1230 if (is_valid_ether_addr(hw->mac.san_addr)) { in ixgbe_reset_hw_82599()
1231 hw->mac.ops.set_rar(hw, hw->mac.num_rar_entries - 1, in ixgbe_reset_hw_82599()
1232 hw->mac.san_addr, 0, IXGBE_RAH_AV); in ixgbe_reset_hw_82599()
1235 hw->mac.san_mac_rar_index = hw->mac.num_rar_entries - 1; in ixgbe_reset_hw_82599()
1238 hw->mac.num_rar_entries--; in ixgbe_reset_hw_82599()
1242 hw->mac.ops.get_wwn_prefix(hw, &hw->mac.wwnn_prefix, in ixgbe_reset_hw_82599()
1243 &hw->mac.wwpn_prefix); in ixgbe_reset_hw_82599()
1252 s32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw) in ixgbe_reinit_fdir_tables_82599() argument
1255 u32 fdirctrl = IXGBE_READ_REG(hw, IXGBE_FDIRCTRL); in ixgbe_reinit_fdir_tables_82599()
1264 if (!(IXGBE_READ_REG(hw, IXGBE_FDIRCMD) & in ixgbe_reinit_fdir_tables_82599()
1270 hw_dbg(hw, "Flow Director previous command isn't complete, aborting table re-initialization.\n"); in ixgbe_reinit_fdir_tables_82599()
1274 IXGBE_WRITE_REG(hw, IXGBE_FDIRFREE, 0); in ixgbe_reinit_fdir_tables_82599()
1275 IXGBE_WRITE_FLUSH(hw); in ixgbe_reinit_fdir_tables_82599()
1283 IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD, in ixgbe_reinit_fdir_tables_82599()
1284 (IXGBE_READ_REG(hw, IXGBE_FDIRCMD) | in ixgbe_reinit_fdir_tables_82599()
1286 IXGBE_WRITE_FLUSH(hw); in ixgbe_reinit_fdir_tables_82599()
1287 IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD, in ixgbe_reinit_fdir_tables_82599()
1288 (IXGBE_READ_REG(hw, IXGBE_FDIRCMD) & in ixgbe_reinit_fdir_tables_82599()
1290 IXGBE_WRITE_FLUSH(hw); in ixgbe_reinit_fdir_tables_82599()
1295 IXGBE_WRITE_REG(hw, IXGBE_FDIRHASH, 0x00); in ixgbe_reinit_fdir_tables_82599()
1296 IXGBE_WRITE_FLUSH(hw); in ixgbe_reinit_fdir_tables_82599()
1298 IXGBE_WRITE_REG(hw, IXGBE_FDIRCTRL, fdirctrl); in ixgbe_reinit_fdir_tables_82599()
1299 IXGBE_WRITE_FLUSH(hw); in ixgbe_reinit_fdir_tables_82599()
1303 if (IXGBE_READ_REG(hw, IXGBE_FDIRCTRL) & in ixgbe_reinit_fdir_tables_82599()
1309 hw_dbg(hw, "Flow Director Signature poll time exceeded!\n"); in ixgbe_reinit_fdir_tables_82599()
1314 IXGBE_READ_REG(hw, IXGBE_FDIRUSTAT); in ixgbe_reinit_fdir_tables_82599()
1315 IXGBE_READ_REG(hw, IXGBE_FDIRFSTAT); in ixgbe_reinit_fdir_tables_82599()
1316 IXGBE_READ_REG(hw, IXGBE_FDIRMATCH); in ixgbe_reinit_fdir_tables_82599()
1317 IXGBE_READ_REG(hw, IXGBE_FDIRMISS); in ixgbe_reinit_fdir_tables_82599()
1318 IXGBE_READ_REG(hw, IXGBE_FDIRLEN); in ixgbe_reinit_fdir_tables_82599()
1328 static void ixgbe_fdir_enable_82599(struct ixgbe_hw *hw, u32 fdirctrl) in ixgbe_fdir_enable_82599() argument
1333 IXGBE_WRITE_REG(hw, IXGBE_FDIRHKEY, IXGBE_ATR_BUCKET_HASH_KEY); in ixgbe_fdir_enable_82599()
1334 IXGBE_WRITE_REG(hw, IXGBE_FDIRSKEY, IXGBE_ATR_SIGNATURE_HASH_KEY); in ixgbe_fdir_enable_82599()
1349 IXGBE_WRITE_REG(hw, IXGBE_FDIRCTRL, fdirctrl); in ixgbe_fdir_enable_82599()
1350 IXGBE_WRITE_FLUSH(hw); in ixgbe_fdir_enable_82599()
1352 if (IXGBE_READ_REG(hw, IXGBE_FDIRCTRL) & in ixgbe_fdir_enable_82599()
1359 hw_dbg(hw, "Flow Director poll time exceeded!\n"); in ixgbe_fdir_enable_82599()
1368 s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, u32 fdirctrl) in ixgbe_init_fdir_signature_82599() argument
1381 ixgbe_fdir_enable_82599(hw, fdirctrl); in ixgbe_init_fdir_signature_82599()
1392 s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 fdirctrl) in ixgbe_init_fdir_perfect_82599() argument
1411 ixgbe_fdir_enable_82599(hw, fdirctrl); in ixgbe_init_fdir_perfect_82599()
1513 s32 ixgbe_fdir_add_signature_filter_82599(struct ixgbe_hw *hw, in ixgbe_fdir_add_signature_filter_82599() argument
1534 hw_dbg(hw, " Error on flow type input\n"); in ixgbe_fdir_add_signature_filter_82599()
1550 IXGBE_WRITE_REG64(hw, IXGBE_FDIRHASH, fdirhashcmd); in ixgbe_fdir_add_signature_filter_82599()
1552 hw_dbg(hw, "Tx Queue=%x hash=%x\n", queue, (u32)fdirhashcmd); in ixgbe_fdir_add_signature_filter_82599()
1662 s32 ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *hw, in ixgbe_fdir_set_input_mask_82599() argument
1681 hw_dbg(hw, " bucket hash should always be 0 in mask\n"); in ixgbe_fdir_set_input_mask_82599()
1690 hw_dbg(hw, " Error on vm pool mask\n"); in ixgbe_fdir_set_input_mask_82599()
1699 hw_dbg(hw, " Error on src/dst port mask\n"); in ixgbe_fdir_set_input_mask_82599()
1705 hw_dbg(hw, " Error on flow type mask\n"); in ixgbe_fdir_set_input_mask_82599()
1724 hw_dbg(hw, " Error on VLAN mask\n"); in ixgbe_fdir_set_input_mask_82599()
1735 hw_dbg(hw, " Error on flexible byte mask\n"); in ixgbe_fdir_set_input_mask_82599()
1740 IXGBE_WRITE_REG(hw, IXGBE_FDIRM, fdirm); in ixgbe_fdir_set_input_mask_82599()
1746 IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, ~fdirtcpm); in ixgbe_fdir_set_input_mask_82599()
1747 IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, ~fdirtcpm); in ixgbe_fdir_set_input_mask_82599()
1750 IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRSIP4M, in ixgbe_fdir_set_input_mask_82599()
1752 IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRDIP4M, in ixgbe_fdir_set_input_mask_82599()
1758 s32 ixgbe_fdir_write_perfect_filter_82599(struct ixgbe_hw *hw, in ixgbe_fdir_write_perfect_filter_82599() argument
1765 IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRSIPv6(0), in ixgbe_fdir_write_perfect_filter_82599()
1767 IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRSIPv6(1), in ixgbe_fdir_write_perfect_filter_82599()
1769 IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRSIPv6(2), in ixgbe_fdir_write_perfect_filter_82599()
1773 IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRIPSA, input->formatted.src_ip[0]); in ixgbe_fdir_write_perfect_filter_82599()
1776 IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRIPDA, input->formatted.dst_ip[0]); in ixgbe_fdir_write_perfect_filter_82599()
1782 IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport); in ixgbe_fdir_write_perfect_filter_82599()
1788 IXGBE_WRITE_REG(hw, IXGBE_FDIRVLAN, fdirvlan); in ixgbe_fdir_write_perfect_filter_82599()
1793 IXGBE_WRITE_REG(hw, IXGBE_FDIRHASH, fdirhash); in ixgbe_fdir_write_perfect_filter_82599()
1799 IXGBE_WRITE_FLUSH(hw); in ixgbe_fdir_write_perfect_filter_82599()
1810 IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD, fdircmd); in ixgbe_fdir_write_perfect_filter_82599()
1815 s32 ixgbe_fdir_erase_perfect_filter_82599(struct ixgbe_hw *hw, in ixgbe_fdir_erase_perfect_filter_82599() argument
1827 IXGBE_WRITE_REG(hw, IXGBE_FDIRHASH, fdirhash); in ixgbe_fdir_erase_perfect_filter_82599()
1830 IXGBE_WRITE_FLUSH(hw); in ixgbe_fdir_erase_perfect_filter_82599()
1833 IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD, IXGBE_FDIRCMD_CMD_QUERY_REM_FILT); in ixgbe_fdir_erase_perfect_filter_82599()
1839 fdircmd = IXGBE_READ_REG(hw, IXGBE_FDIRCMD); in ixgbe_fdir_erase_perfect_filter_82599()
1849 IXGBE_WRITE_REG(hw, IXGBE_FDIRHASH, fdirhash); in ixgbe_fdir_erase_perfect_filter_82599()
1850 IXGBE_WRITE_FLUSH(hw); in ixgbe_fdir_erase_perfect_filter_82599()
1851 IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD, in ixgbe_fdir_erase_perfect_filter_82599()
1866 static s32 ixgbe_read_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 *val) in ixgbe_read_analog_reg8_82599() argument
1870 IXGBE_WRITE_REG(hw, IXGBE_CORECTL, IXGBE_CORECTL_WRITE_CMD | in ixgbe_read_analog_reg8_82599()
1872 IXGBE_WRITE_FLUSH(hw); in ixgbe_read_analog_reg8_82599()
1874 core_ctl = IXGBE_READ_REG(hw, IXGBE_CORECTL); in ixgbe_read_analog_reg8_82599()
1888 static s32 ixgbe_write_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 val) in ixgbe_write_analog_reg8_82599() argument
1893 IXGBE_WRITE_REG(hw, IXGBE_CORECTL, core_ctl); in ixgbe_write_analog_reg8_82599()
1894 IXGBE_WRITE_FLUSH(hw); in ixgbe_write_analog_reg8_82599()
1908 static s32 ixgbe_start_hw_82599(struct ixgbe_hw *hw) in ixgbe_start_hw_82599() argument
1912 ret_val = ixgbe_start_hw_generic(hw); in ixgbe_start_hw_82599()
1916 ret_val = ixgbe_start_hw_gen2(hw); in ixgbe_start_hw_82599()
1921 hw->mac.autotry_restart = true; in ixgbe_start_hw_82599()
1926 return ixgbe_verify_fw_version_82599(hw); in ixgbe_start_hw_82599()
1937 static s32 ixgbe_identify_phy_82599(struct ixgbe_hw *hw) in ixgbe_identify_phy_82599() argument
1942 status = ixgbe_identify_phy_generic(hw); in ixgbe_identify_phy_82599()
1945 if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_copper) in ixgbe_identify_phy_82599()
1947 status = ixgbe_identify_module_generic(hw); in ixgbe_identify_phy_82599()
1951 if (hw->phy.type == ixgbe_phy_unknown) { in ixgbe_identify_phy_82599()
1952 hw->phy.type = ixgbe_phy_none; in ixgbe_identify_phy_82599()
1957 if (hw->phy.type == ixgbe_phy_sfp_unsupported) in ixgbe_identify_phy_82599()
1970 static s32 ixgbe_enable_rx_dma_82599(struct ixgbe_hw *hw, u32 regval) in ixgbe_enable_rx_dma_82599() argument
1978 hw->mac.ops.disable_rx_buff(hw); in ixgbe_enable_rx_dma_82599()
1981 hw->mac.ops.enable_rx(hw); in ixgbe_enable_rx_dma_82599()
1983 hw->mac.ops.disable_rx(hw); in ixgbe_enable_rx_dma_82599()
1985 hw->mac.ops.enable_rx_buff(hw); in ixgbe_enable_rx_dma_82599()
2000 static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw) in ixgbe_verify_fw_version_82599() argument
2008 if (hw->phy.media_type != ixgbe_media_type_fiber) in ixgbe_verify_fw_version_82599()
2013 if (hw->eeprom.ops.read(hw, offset, &fw_offset)) in ixgbe_verify_fw_version_82599()
2021 if (hw->eeprom.ops.read(hw, offset, &fw_ptp_cfg_offset)) in ixgbe_verify_fw_version_82599()
2029 if (hw->eeprom.ops.read(hw, offset, &fw_version)) in ixgbe_verify_fw_version_82599()
2038 hw_err(hw, "eeprom read at offset %d failed\n", offset); in ixgbe_verify_fw_version_82599()
2049 static bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw) in ixgbe_verify_lesm_fw_enabled_82599() argument
2055 status = hw->eeprom.ops.read(hw, IXGBE_FW_PTR, &fw_offset); in ixgbe_verify_lesm_fw_enabled_82599()
2061 status = hw->eeprom.ops.read(hw, (fw_offset + in ixgbe_verify_lesm_fw_enabled_82599()
2070 status = hw->eeprom.ops.read(hw, (fw_lesm_param_offset + in ixgbe_verify_lesm_fw_enabled_82599()
2091 static s32 ixgbe_read_eeprom_buffer_82599(struct ixgbe_hw *hw, u16 offset, in ixgbe_read_eeprom_buffer_82599() argument
2094 struct ixgbe_eeprom_info *eeprom = &hw->eeprom; in ixgbe_read_eeprom_buffer_82599()
2101 return ixgbe_read_eerd_buffer_generic(hw, offset, words, data); in ixgbe_read_eeprom_buffer_82599()
2103 return ixgbe_read_eeprom_buffer_bit_bang_generic(hw, offset, words, in ixgbe_read_eeprom_buffer_82599()
2117 static s32 ixgbe_read_eeprom_82599(struct ixgbe_hw *hw, in ixgbe_read_eeprom_82599() argument
2120 struct ixgbe_eeprom_info *eeprom = &hw->eeprom; in ixgbe_read_eeprom_82599()
2127 return ixgbe_read_eerd_generic(hw, offset, data); in ixgbe_read_eeprom_82599()
2129 return ixgbe_read_eeprom_bit_bang_generic(hw, offset, data); in ixgbe_read_eeprom_82599()
2141 static s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw) in ixgbe_reset_pipeline_82599() argument
2148 autoc2_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC2); in ixgbe_reset_pipeline_82599()
2151 IXGBE_WRITE_REG(hw, IXGBE_AUTOC2, autoc2_reg); in ixgbe_reset_pipeline_82599()
2152 IXGBE_WRITE_FLUSH(hw); in ixgbe_reset_pipeline_82599()
2155 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); in ixgbe_reset_pipeline_82599()
2159 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, in ixgbe_reset_pipeline_82599()
2165 anlp1_reg = IXGBE_READ_REG(hw, IXGBE_ANLP1); in ixgbe_reset_pipeline_82599()
2171 hw_dbg(hw, "auto negotiation not completed\n"); in ixgbe_reset_pipeline_82599()
2180 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); in ixgbe_reset_pipeline_82599()
2181 IXGBE_WRITE_FLUSH(hw); in ixgbe_reset_pipeline_82599()
2195 static s32 ixgbe_read_i2c_byte_82599(struct ixgbe_hw *hw, u8 byte_offset, in ixgbe_read_i2c_byte_82599() argument
2202 if (hw->phy.qsfp_shared_i2c_bus == true) { in ixgbe_read_i2c_byte_82599()
2204 esdp = IXGBE_READ_REG(hw, IXGBE_ESDP); in ixgbe_read_i2c_byte_82599()
2206 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp); in ixgbe_read_i2c_byte_82599()
2207 IXGBE_WRITE_FLUSH(hw); in ixgbe_read_i2c_byte_82599()
2210 esdp = IXGBE_READ_REG(hw, IXGBE_ESDP); in ixgbe_read_i2c_byte_82599()
2219 hw_dbg(hw, "Driver can't access resource, acquiring I2C bus timeout.\n"); in ixgbe_read_i2c_byte_82599()
2225 status = ixgbe_read_i2c_byte_generic(hw, byte_offset, dev_addr, data); in ixgbe_read_i2c_byte_82599()
2228 if (hw->phy.qsfp_shared_i2c_bus == true) { in ixgbe_read_i2c_byte_82599()
2230 esdp = IXGBE_READ_REG(hw, IXGBE_ESDP); in ixgbe_read_i2c_byte_82599()
2232 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp); in ixgbe_read_i2c_byte_82599()
2233 IXGBE_WRITE_FLUSH(hw); in ixgbe_read_i2c_byte_82599()
2248 static s32 ixgbe_write_i2c_byte_82599(struct ixgbe_hw *hw, u8 byte_offset, in ixgbe_write_i2c_byte_82599() argument
2255 if (hw->phy.qsfp_shared_i2c_bus == true) { in ixgbe_write_i2c_byte_82599()
2257 esdp = IXGBE_READ_REG(hw, IXGBE_ESDP); in ixgbe_write_i2c_byte_82599()
2259 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp); in ixgbe_write_i2c_byte_82599()
2260 IXGBE_WRITE_FLUSH(hw); in ixgbe_write_i2c_byte_82599()
2263 esdp = IXGBE_READ_REG(hw, IXGBE_ESDP); in ixgbe_write_i2c_byte_82599()
2272 hw_dbg(hw, "Driver can't access resource, acquiring I2C bus timeout.\n"); in ixgbe_write_i2c_byte_82599()
2278 status = ixgbe_write_i2c_byte_generic(hw, byte_offset, dev_addr, data); in ixgbe_write_i2c_byte_82599()
2281 if (hw->phy.qsfp_shared_i2c_bus == true) { in ixgbe_write_i2c_byte_82599()
2283 esdp = IXGBE_READ_REG(hw, IXGBE_ESDP); in ixgbe_write_i2c_byte_82599()
2285 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp); in ixgbe_write_i2c_byte_82599()
2286 IXGBE_WRITE_FLUSH(hw); in ixgbe_write_i2c_byte_82599()