Lines Matching +full:hw +full:- +full:flow +full:- +full:ctrl

1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 1999 - 2018 Intel Corporation. */
15 static s32 ixgbe_get_invariants_X550_x(struct ixgbe_hw *hw) in ixgbe_get_invariants_X550_x() argument
17 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_get_invariants_X550_x()
18 struct ixgbe_phy_info *phy = &hw->phy; in ixgbe_get_invariants_X550_x()
19 struct ixgbe_link_info *link = &hw->link; in ixgbe_get_invariants_X550_x()
22 ixgbe_get_invariants_X540(hw); in ixgbe_get_invariants_X550_x()
24 if (mac->ops.get_media_type(hw) != ixgbe_media_type_copper) in ixgbe_get_invariants_X550_x()
25 phy->ops.set_phy_power = NULL; in ixgbe_get_invariants_X550_x()
27 link->addr = IXGBE_CS4227; in ixgbe_get_invariants_X550_x()
32 static s32 ixgbe_get_invariants_X550_x_fw(struct ixgbe_hw *hw) in ixgbe_get_invariants_X550_x_fw() argument
34 struct ixgbe_phy_info *phy = &hw->phy; in ixgbe_get_invariants_X550_x_fw()
37 ixgbe_get_invariants_X540(hw); in ixgbe_get_invariants_X550_x_fw()
39 phy->ops.set_phy_power = NULL; in ixgbe_get_invariants_X550_x_fw()
44 static s32 ixgbe_get_invariants_X550_a(struct ixgbe_hw *hw) in ixgbe_get_invariants_X550_a() argument
46 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_get_invariants_X550_a()
47 struct ixgbe_phy_info *phy = &hw->phy; in ixgbe_get_invariants_X550_a()
50 ixgbe_get_invariants_X540(hw); in ixgbe_get_invariants_X550_a()
52 if (mac->ops.get_media_type(hw) != ixgbe_media_type_copper) in ixgbe_get_invariants_X550_a()
53 phy->ops.set_phy_power = NULL; in ixgbe_get_invariants_X550_a()
58 static s32 ixgbe_get_invariants_X550_a_fw(struct ixgbe_hw *hw) in ixgbe_get_invariants_X550_a_fw() argument
60 struct ixgbe_phy_info *phy = &hw->phy; in ixgbe_get_invariants_X550_a_fw()
63 ixgbe_get_invariants_X540(hw); in ixgbe_get_invariants_X550_a_fw()
65 phy->ops.set_phy_power = NULL; in ixgbe_get_invariants_X550_a_fw()
70 /** ixgbe_setup_mux_ctl - Setup ESDP register for I2C mux control
71 * @hw: pointer to hardware structure
73 static void ixgbe_setup_mux_ctl(struct ixgbe_hw *hw) in ixgbe_setup_mux_ctl() argument
75 u32 esdp = IXGBE_READ_REG(hw, IXGBE_ESDP); in ixgbe_setup_mux_ctl()
77 if (hw->bus.lan_id) { in ixgbe_setup_mux_ctl()
82 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp); in ixgbe_setup_mux_ctl()
83 IXGBE_WRITE_FLUSH(hw); in ixgbe_setup_mux_ctl()
87 * ixgbe_read_cs4227 - Read CS4227 register
88 * @hw: pointer to hardware structure
94 static s32 ixgbe_read_cs4227(struct ixgbe_hw *hw, u16 reg, u16 *value) in ixgbe_read_cs4227() argument
96 return hw->link.ops.read_link_unlocked(hw, hw->link.addr, reg, value); in ixgbe_read_cs4227()
100 * ixgbe_write_cs4227 - Write CS4227 register
101 * @hw: pointer to hardware structure
107 static s32 ixgbe_write_cs4227(struct ixgbe_hw *hw, u16 reg, u16 value) in ixgbe_write_cs4227() argument
109 return hw->link.ops.write_link_unlocked(hw, hw->link.addr, reg, value); in ixgbe_write_cs4227()
113 * ixgbe_read_pe - Read register from port expander
114 * @hw: pointer to hardware structure
120 static s32 ixgbe_read_pe(struct ixgbe_hw *hw, u8 reg, u8 *value) in ixgbe_read_pe() argument
124 status = ixgbe_read_i2c_byte_generic_unlocked(hw, reg, IXGBE_PE, value); in ixgbe_read_pe()
126 hw_err(hw, "port expander access failed with %d\n", status); in ixgbe_read_pe()
131 * ixgbe_write_pe - Write register to port expander
132 * @hw: pointer to hardware structure
138 static s32 ixgbe_write_pe(struct ixgbe_hw *hw, u8 reg, u8 value) in ixgbe_write_pe() argument
142 status = ixgbe_write_i2c_byte_generic_unlocked(hw, reg, IXGBE_PE, in ixgbe_write_pe()
145 hw_err(hw, "port expander access failed with %d\n", status); in ixgbe_write_pe()
150 * ixgbe_reset_cs4227 - Reset CS4227 using port expander
151 * @hw: pointer to hardware structure
156 static s32 ixgbe_reset_cs4227(struct ixgbe_hw *hw) in ixgbe_reset_cs4227() argument
164 status = ixgbe_read_pe(hw, IXGBE_PE_OUTPUT, &reg); in ixgbe_reset_cs4227()
168 status = ixgbe_write_pe(hw, IXGBE_PE_OUTPUT, reg); in ixgbe_reset_cs4227()
172 status = ixgbe_read_pe(hw, IXGBE_PE_CONFIG, &reg); in ixgbe_reset_cs4227()
176 status = ixgbe_write_pe(hw, IXGBE_PE_CONFIG, reg); in ixgbe_reset_cs4227()
180 status = ixgbe_read_pe(hw, IXGBE_PE_OUTPUT, &reg); in ixgbe_reset_cs4227()
184 status = ixgbe_write_pe(hw, IXGBE_PE_OUTPUT, reg); in ixgbe_reset_cs4227()
190 status = ixgbe_read_pe(hw, IXGBE_PE_OUTPUT, &reg); in ixgbe_reset_cs4227()
194 status = ixgbe_write_pe(hw, IXGBE_PE_OUTPUT, reg); in ixgbe_reset_cs4227()
201 status = ixgbe_read_cs4227(hw, IXGBE_CS4227_EFUSE_STATUS, in ixgbe_reset_cs4227()
208 hw_err(hw, "CS4227 reset did not complete\n"); in ixgbe_reset_cs4227()
209 return -EIO; in ixgbe_reset_cs4227()
212 status = ixgbe_read_cs4227(hw, IXGBE_CS4227_EEPROM_STATUS, &value); in ixgbe_reset_cs4227()
214 hw_err(hw, "CS4227 EEPROM did not load successfully\n"); in ixgbe_reset_cs4227()
215 return -EIO; in ixgbe_reset_cs4227()
222 * ixgbe_check_cs4227 - Check CS4227 and reset as needed
223 * @hw: pointer to hardware structure
225 static void ixgbe_check_cs4227(struct ixgbe_hw *hw) in ixgbe_check_cs4227() argument
227 u32 swfw_mask = hw->phy.phy_semaphore_mask; in ixgbe_check_cs4227()
233 status = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask); in ixgbe_check_cs4227()
235 hw_err(hw, "semaphore failed with %d\n", status); in ixgbe_check_cs4227()
240 /* Get status of reset flow. */ in ixgbe_check_cs4227()
241 status = ixgbe_read_cs4227(hw, IXGBE_CS4227_SCRATCH, &value); in ixgbe_check_cs4227()
249 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_check_cs4227()
254 status = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask); in ixgbe_check_cs4227()
256 hw_err(hw, "semaphore failed with %d\n", status); in ixgbe_check_cs4227()
262 status = ixgbe_reset_cs4227(hw); in ixgbe_check_cs4227()
264 hw_err(hw, "CS4227 reset failed: %d", status); in ixgbe_check_cs4227()
271 ixgbe_write_cs4227(hw, IXGBE_CS4227_SCRATCH, in ixgbe_check_cs4227()
273 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_check_cs4227()
275 status = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask); in ixgbe_check_cs4227()
277 hw_err(hw, "semaphore failed with %d", status); in ixgbe_check_cs4227()
282 status = ixgbe_write_cs4227(hw, IXGBE_CS4227_SCRATCH, in ixgbe_check_cs4227()
286 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_check_cs4227()
287 msleep(hw->eeprom.semaphore_delay); in ixgbe_check_cs4227()
290 /** ixgbe_identify_phy_x550em - Get PHY type based on device id
291 * @hw: pointer to hardware structure
295 static s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw) in ixgbe_identify_phy_x550em() argument
297 switch (hw->device_id) { in ixgbe_identify_phy_x550em()
299 if (hw->bus.lan_id) in ixgbe_identify_phy_x550em()
300 hw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY1_SM; in ixgbe_identify_phy_x550em()
302 hw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY0_SM; in ixgbe_identify_phy_x550em()
303 return ixgbe_identify_module_generic(hw); in ixgbe_identify_phy_x550em()
306 hw->phy.phy_semaphore_mask = IXGBE_GSSR_SHARED_I2C_SM; in ixgbe_identify_phy_x550em()
307 ixgbe_setup_mux_ctl(hw); in ixgbe_identify_phy_x550em()
308 ixgbe_check_cs4227(hw); in ixgbe_identify_phy_x550em()
311 return ixgbe_identify_module_generic(hw); in ixgbe_identify_phy_x550em()
313 hw->phy.type = ixgbe_phy_x550em_kx4; in ixgbe_identify_phy_x550em()
316 hw->phy.type = ixgbe_phy_x550em_xfi; in ixgbe_identify_phy_x550em()
321 hw->phy.type = ixgbe_phy_x550em_kr; in ixgbe_identify_phy_x550em()
324 if (hw->bus.lan_id) in ixgbe_identify_phy_x550em()
325 hw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY1_SM; in ixgbe_identify_phy_x550em()
327 hw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY0_SM; in ixgbe_identify_phy_x550em()
330 return ixgbe_identify_phy_generic(hw); in ixgbe_identify_phy_x550em()
332 hw->phy.type = ixgbe_phy_ext_1g_t; in ixgbe_identify_phy_x550em()
336 hw->phy.type = ixgbe_phy_fw; in ixgbe_identify_phy_x550em()
337 hw->phy.ops.read_reg = NULL; in ixgbe_identify_phy_x550em()
338 hw->phy.ops.write_reg = NULL; in ixgbe_identify_phy_x550em()
339 if (hw->bus.lan_id) in ixgbe_identify_phy_x550em()
340 hw->phy.phy_semaphore_mask |= IXGBE_GSSR_PHY1_SM; in ixgbe_identify_phy_x550em()
342 hw->phy.phy_semaphore_mask |= IXGBE_GSSR_PHY0_SM; in ixgbe_identify_phy_x550em()
350 static s32 ixgbe_read_phy_reg_x550em(struct ixgbe_hw *hw, u32 reg_addr, in ixgbe_read_phy_reg_x550em() argument
353 return -EOPNOTSUPP; in ixgbe_read_phy_reg_x550em()
356 static s32 ixgbe_write_phy_reg_x550em(struct ixgbe_hw *hw, u32 reg_addr, in ixgbe_write_phy_reg_x550em() argument
359 return -EOPNOTSUPP; in ixgbe_write_phy_reg_x550em()
363 * ixgbe_read_i2c_combined_generic - Perform I2C read combined operation
364 * @hw: pointer to the hardware structure
371 static s32 ixgbe_read_i2c_combined_generic(struct ixgbe_hw *hw, u8 addr, in ixgbe_read_i2c_combined_generic() argument
374 return ixgbe_read_i2c_combined_generic_int(hw, addr, reg, val, true); in ixgbe_read_i2c_combined_generic()
378 * ixgbe_read_i2c_combined_generic_unlocked - Do I2C read combined operation
379 * @hw: pointer to the hardware structure
387 ixgbe_read_i2c_combined_generic_unlocked(struct ixgbe_hw *hw, u8 addr, in ixgbe_read_i2c_combined_generic_unlocked() argument
390 return ixgbe_read_i2c_combined_generic_int(hw, addr, reg, val, false); in ixgbe_read_i2c_combined_generic_unlocked()
394 * ixgbe_write_i2c_combined_generic - Perform I2C write combined operation
395 * @hw: pointer to the hardware structure
402 static s32 ixgbe_write_i2c_combined_generic(struct ixgbe_hw *hw, in ixgbe_write_i2c_combined_generic() argument
405 return ixgbe_write_i2c_combined_generic_int(hw, addr, reg, val, true); in ixgbe_write_i2c_combined_generic()
409 * ixgbe_write_i2c_combined_generic_unlocked - Do I2C write combined operation
410 * @hw: pointer to the hardware structure
418 ixgbe_write_i2c_combined_generic_unlocked(struct ixgbe_hw *hw, in ixgbe_write_i2c_combined_generic_unlocked() argument
421 return ixgbe_write_i2c_combined_generic_int(hw, addr, reg, val, false); in ixgbe_write_i2c_combined_generic_unlocked()
425 * ixgbe_fw_phy_activity - Perform an activity on a PHY
426 * @hw: pointer to hardware structure
428 * @data: Pointer to 4 32-bit words of data
430 s32 ixgbe_fw_phy_activity(struct ixgbe_hw *hw, u16 activity, in ixgbe_fw_phy_activity() argument
446 hic.cmd.port_number = hw->bus.lan_id; in ixgbe_fw_phy_activity()
451 rc = ixgbe_host_interface_command(hw, &hic.cmd, sizeof(hic.cmd), in ixgbe_fw_phy_activity()
463 --retries; in ixgbe_fw_phy_activity()
466 return -EIO; in ixgbe_fw_phy_activity()
482 * ixgbe_get_phy_id_fw - Get the phy ID via firmware command
483 * @hw: pointer to hardware structure
487 static s32 ixgbe_get_phy_id_fw(struct ixgbe_hw *hw) in ixgbe_get_phy_id_fw() argument
495 if (hw->phy.id) in ixgbe_get_phy_id_fw()
498 rc = ixgbe_fw_phy_activity(hw, FW_PHY_ACT_GET_PHY_INFO, &info); in ixgbe_get_phy_id_fw()
502 hw->phy.speeds_supported = 0; in ixgbe_get_phy_id_fw()
506 hw->phy.speeds_supported |= ixgbe_fw_map[i].phy_speed; in ixgbe_get_phy_id_fw()
509 hw->phy.id = info[0] & FW_PHY_INFO_ID_HI_MASK; in ixgbe_get_phy_id_fw()
511 hw->phy.id |= phy_id_lo & IXGBE_PHY_REVISION_MASK; in ixgbe_get_phy_id_fw()
512 hw->phy.revision = phy_id_lo & ~IXGBE_PHY_REVISION_MASK; in ixgbe_get_phy_id_fw()
513 if (!hw->phy.id || hw->phy.id == IXGBE_PHY_REVISION_MASK) in ixgbe_get_phy_id_fw()
514 return -EFAULT; in ixgbe_get_phy_id_fw()
516 hw->phy.autoneg_advertised = hw->phy.speeds_supported; in ixgbe_get_phy_id_fw()
517 hw->phy.eee_speeds_supported = IXGBE_LINK_SPEED_100_FULL | in ixgbe_get_phy_id_fw()
519 hw->phy.eee_speeds_advertised = hw->phy.eee_speeds_supported; in ixgbe_get_phy_id_fw()
524 * ixgbe_identify_phy_fw - Get PHY type based on firmware command
525 * @hw: pointer to hardware structure
529 static s32 ixgbe_identify_phy_fw(struct ixgbe_hw *hw) in ixgbe_identify_phy_fw() argument
531 if (hw->bus.lan_id) in ixgbe_identify_phy_fw()
532 hw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY1_SM; in ixgbe_identify_phy_fw()
534 hw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY0_SM; in ixgbe_identify_phy_fw()
536 hw->phy.type = ixgbe_phy_fw; in ixgbe_identify_phy_fw()
537 hw->phy.ops.read_reg = NULL; in ixgbe_identify_phy_fw()
538 hw->phy.ops.write_reg = NULL; in ixgbe_identify_phy_fw()
539 return ixgbe_get_phy_id_fw(hw); in ixgbe_identify_phy_fw()
543 * ixgbe_shutdown_fw_phy - Shutdown a firmware-controlled PHY
544 * @hw: pointer to hardware structure
548 static s32 ixgbe_shutdown_fw_phy(struct ixgbe_hw *hw) in ixgbe_shutdown_fw_phy() argument
553 return ixgbe_fw_phy_activity(hw, FW_PHY_ACT_FORCE_LINK_DOWN, &setup); in ixgbe_shutdown_fw_phy()
557 * ixgbe_setup_fw_link - Setup firmware-controlled PHYs
558 * @hw: pointer to hardware structure
560 static s32 ixgbe_setup_fw_link(struct ixgbe_hw *hw) in ixgbe_setup_fw_link() argument
566 if (hw->phy.reset_disable || ixgbe_check_reset_blocked(hw)) in ixgbe_setup_fw_link()
569 if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) { in ixgbe_setup_fw_link()
570 hw_err(hw, "rx_pause not valid in strict IEEE mode\n"); in ixgbe_setup_fw_link()
571 return -EINVAL; in ixgbe_setup_fw_link()
574 switch (hw->fc.requested_mode) { in ixgbe_setup_fw_link()
592 if (hw->phy.autoneg_advertised & ixgbe_fw_map[i].phy_speed) in ixgbe_setup_fw_link()
597 if (hw->phy.eee_speeds_advertised) in ixgbe_setup_fw_link()
600 rc = ixgbe_fw_phy_activity(hw, FW_PHY_ACT_SETUP_LINK, &setup); in ixgbe_setup_fw_link()
605 return -EIO; in ixgbe_setup_fw_link()
611 * ixgbe_fc_autoneg_fw - Set up flow control for FW-controlled PHYs
612 * @hw: pointer to hardware structure
614 * Called at init time to set up flow control.
616 static s32 ixgbe_fc_autoneg_fw(struct ixgbe_hw *hw) in ixgbe_fc_autoneg_fw() argument
618 if (hw->fc.requested_mode == ixgbe_fc_default) in ixgbe_fc_autoneg_fw()
619 hw->fc.requested_mode = ixgbe_fc_full; in ixgbe_fc_autoneg_fw()
621 return ixgbe_setup_fw_link(hw); in ixgbe_fc_autoneg_fw()
624 /** ixgbe_init_eeprom_params_X550 - Initialize EEPROM params
625 * @hw: pointer to hardware structure
630 static s32 ixgbe_init_eeprom_params_X550(struct ixgbe_hw *hw) in ixgbe_init_eeprom_params_X550() argument
632 struct ixgbe_eeprom_info *eeprom = &hw->eeprom; in ixgbe_init_eeprom_params_X550()
634 if (eeprom->type == ixgbe_eeprom_uninitialized) { in ixgbe_init_eeprom_params_X550()
638 eeprom->semaphore_delay = 10; in ixgbe_init_eeprom_params_X550()
639 eeprom->type = ixgbe_flash; in ixgbe_init_eeprom_params_X550()
641 eec = IXGBE_READ_REG(hw, IXGBE_EEC(hw)); in ixgbe_init_eeprom_params_X550()
643 eeprom->word_size = BIT(eeprom_size + in ixgbe_init_eeprom_params_X550()
646 hw_dbg(hw, "Eeprom params: type = %d, size = %d\n", in ixgbe_init_eeprom_params_X550()
647 eeprom->type, eeprom->word_size); in ixgbe_init_eeprom_params_X550()
654 * ixgbe_iosf_wait - Wait for IOSF command completion
655 * @hw: pointer to hardware structure
656 * @ctrl: pointer to location to receive final IOSF control value
660 * Note: ctrl can be NULL if the IOSF control register value is not needed
662 static s32 ixgbe_iosf_wait(struct ixgbe_hw *hw, u32 *ctrl) in ixgbe_iosf_wait() argument
671 command = IXGBE_READ_REG(hw, IXGBE_SB_IOSF_INDIRECT_CTRL); in ixgbe_iosf_wait()
676 if (ctrl) in ixgbe_iosf_wait()
677 *ctrl = command; in ixgbe_iosf_wait()
679 hw_dbg(hw, "IOSF wait timed out\n"); in ixgbe_iosf_wait()
680 return -EIO; in ixgbe_iosf_wait()
686 /** ixgbe_read_iosf_sb_reg_x550 - Writes a value to specified register of the
688 * @hw: pointer to hardware structure
693 static s32 ixgbe_read_iosf_sb_reg_x550(struct ixgbe_hw *hw, u32 reg_addr, in ixgbe_read_iosf_sb_reg_x550() argument
700 ret = hw->mac.ops.acquire_swfw_sync(hw, gssr); in ixgbe_read_iosf_sb_reg_x550()
704 ret = ixgbe_iosf_wait(hw, NULL); in ixgbe_read_iosf_sb_reg_x550()
712 IXGBE_WRITE_REG(hw, IXGBE_SB_IOSF_INDIRECT_CTRL, command); in ixgbe_read_iosf_sb_reg_x550()
714 ret = ixgbe_iosf_wait(hw, &command); in ixgbe_read_iosf_sb_reg_x550()
718 hw_dbg(hw, "Failed to read, error %x\n", error); in ixgbe_read_iosf_sb_reg_x550()
719 ret = -EIO; in ixgbe_read_iosf_sb_reg_x550()
724 *data = IXGBE_READ_REG(hw, IXGBE_SB_IOSF_INDIRECT_DATA); in ixgbe_read_iosf_sb_reg_x550()
727 hw->mac.ops.release_swfw_sync(hw, gssr); in ixgbe_read_iosf_sb_reg_x550()
732 * ixgbe_get_phy_token - Get the token for shared PHY access
733 * @hw: Pointer to hardware structure
735 static s32 ixgbe_get_phy_token(struct ixgbe_hw *hw) in ixgbe_get_phy_token() argument
744 token_cmd.port_number = hw->bus.lan_id; in ixgbe_get_phy_token()
747 status = ixgbe_host_interface_command(hw, &token_cmd, sizeof(token_cmd), in ixgbe_get_phy_token()
755 return -EIO; in ixgbe_get_phy_token()
757 return -EAGAIN; in ixgbe_get_phy_token()
761 * ixgbe_put_phy_token - Put the token for shared PHY access
762 * @hw: Pointer to hardware structure
764 static s32 ixgbe_put_phy_token(struct ixgbe_hw *hw) in ixgbe_put_phy_token() argument
773 token_cmd.port_number = hw->bus.lan_id; in ixgbe_put_phy_token()
776 status = ixgbe_host_interface_command(hw, &token_cmd, sizeof(token_cmd), in ixgbe_put_phy_token()
783 return -EIO; in ixgbe_put_phy_token()
787 * ixgbe_write_iosf_sb_reg_x550a - Write to IOSF PHY register
788 * @hw: pointer to hardware structure
793 static s32 ixgbe_write_iosf_sb_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr, in ixgbe_write_iosf_sb_reg_x550a() argument
803 write_cmd.port_number = hw->bus.lan_id; in ixgbe_write_iosf_sb_reg_x550a()
808 return ixgbe_host_interface_command(hw, &write_cmd, sizeof(write_cmd), in ixgbe_write_iosf_sb_reg_x550a()
813 * ixgbe_read_iosf_sb_reg_x550a - Read from IOSF PHY register
814 * @hw: pointer to hardware structure
819 static s32 ixgbe_read_iosf_sb_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr, in ixgbe_read_iosf_sb_reg_x550a() argument
833 hic.cmd.port_number = hw->bus.lan_id; in ixgbe_read_iosf_sb_reg_x550a()
837 status = ixgbe_host_interface_command(hw, &hic.cmd, sizeof(hic.cmd), in ixgbe_read_iosf_sb_reg_x550a()
846 /** ixgbe_read_ee_hostif_buffer_X550- Read EEPROM word(s) using hostif
847 * @hw: pointer to hardware structure
854 static s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw, in ixgbe_read_ee_hostif_buffer_X550() argument
865 status = hw->mac.ops.acquire_swfw_sync(hw, mask); in ixgbe_read_ee_hostif_buffer_X550()
867 hw_dbg(hw, "EEPROM read buffer - semaphore failed\n"); in ixgbe_read_ee_hostif_buffer_X550()
889 status = ixgbe_hic_unlocked(hw, (u32 *)&buffer, sizeof(buffer), in ixgbe_read_ee_hostif_buffer_X550()
892 hw_dbg(hw, "Host interface command failed\n"); in ixgbe_read_ee_hostif_buffer_X550()
899 u32 value = IXGBE_READ_REG(hw, reg); in ixgbe_read_ee_hostif_buffer_X550()
910 words -= words_to_read; in ixgbe_read_ee_hostif_buffer_X550()
914 hw->mac.ops.release_swfw_sync(hw, mask); in ixgbe_read_ee_hostif_buffer_X550()
918 /** ixgbe_checksum_ptr_x550 - Checksum one pointer region
919 * @hw: pointer to hardware structure
926 static s32 ixgbe_checksum_ptr_x550(struct ixgbe_hw *hw, u16 ptr, in ixgbe_checksum_ptr_x550() argument
939 status = ixgbe_read_ee_hostif_buffer_X550(hw, ptr, bufsz, buf); in ixgbe_checksum_ptr_x550()
941 hw_dbg(hw, "Failed to read EEPROM image\n"); in ixgbe_checksum_ptr_x550()
947 return -EINVAL; in ixgbe_checksum_ptr_x550()
960 (ptr + length) >= hw->eeprom.word_size) in ixgbe_checksum_ptr_x550()
965 return -EINVAL; in ixgbe_checksum_ptr_x550()
967 for (i = start; length; i++, length--) { in ixgbe_checksum_ptr_x550()
975 status = ixgbe_read_ee_hostif_buffer_X550(hw, ptr, in ixgbe_checksum_ptr_x550()
978 hw_dbg(hw, "Failed to read EEPROM image\n"); in ixgbe_checksum_ptr_x550()
987 /** ixgbe_calc_checksum_X550 - Calculates and returns the checksum
988 * @hw: pointer to hardware structure
992 * Returns a negative error code on error, or the 16-bit checksum
994 static s32 ixgbe_calc_checksum_X550(struct ixgbe_hw *hw, u16 *buffer, in ixgbe_calc_checksum_X550() argument
1003 hw->eeprom.ops.init_params(hw); in ixgbe_calc_checksum_X550()
1007 status = ixgbe_read_ee_hostif_buffer_X550(hw, 0, in ixgbe_calc_checksum_X550()
1011 hw_dbg(hw, "Failed to read EEPROM image\n"); in ixgbe_calc_checksum_X550()
1017 return -EINVAL; in ixgbe_calc_checksum_X550()
1021 /* For X550 hardware include 0x0-0x41 in the checksum, skip the in ixgbe_calc_checksum_X550()
1028 /* Include all data from pointers 0x3, 0x6-0xE. This excludes the in ixgbe_calc_checksum_X550()
1039 pointer >= hw->eeprom.word_size) in ixgbe_calc_checksum_X550()
1055 status = ixgbe_checksum_ptr_x550(hw, pointer, size, &checksum, in ixgbe_calc_checksum_X550()
1061 checksum = (u16)IXGBE_EEPROM_SUM - checksum; in ixgbe_calc_checksum_X550()
1066 /** ixgbe_calc_eeprom_checksum_X550 - Calculates and returns the checksum
1067 * @hw: pointer to hardware structure
1069 * Returns a negative error code on error, or the 16-bit checksum
1071 static s32 ixgbe_calc_eeprom_checksum_X550(struct ixgbe_hw *hw) in ixgbe_calc_eeprom_checksum_X550() argument
1073 return ixgbe_calc_checksum_X550(hw, NULL, 0); in ixgbe_calc_eeprom_checksum_X550()
1076 /** ixgbe_read_ee_hostif_X550 - Read EEPROM word using a host interface command
1077 * @hw: pointer to hardware structure
1083 static s32 ixgbe_read_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset, u16 *data) in ixgbe_read_ee_hostif_X550() argument
1099 status = hw->mac.ops.acquire_swfw_sync(hw, mask); in ixgbe_read_ee_hostif_X550()
1103 status = ixgbe_hic_unlocked(hw, (u32 *)&buffer, sizeof(buffer), in ixgbe_read_ee_hostif_X550()
1106 *data = (u16)IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, in ixgbe_read_ee_hostif_X550()
1110 hw->mac.ops.release_swfw_sync(hw, mask); in ixgbe_read_ee_hostif_X550()
1114 /** ixgbe_validate_eeprom_checksum_X550 - Validate EEPROM checksum
1115 * @hw: pointer to hardware structure
1121 static s32 ixgbe_validate_eeprom_checksum_X550(struct ixgbe_hw *hw, in ixgbe_validate_eeprom_checksum_X550() argument
1132 status = hw->eeprom.ops.read(hw, 0, &checksum); in ixgbe_validate_eeprom_checksum_X550()
1134 hw_dbg(hw, "EEPROM read failed\n"); in ixgbe_validate_eeprom_checksum_X550()
1138 status = hw->eeprom.ops.calc_checksum(hw); in ixgbe_validate_eeprom_checksum_X550()
1144 status = ixgbe_read_ee_hostif_X550(hw, IXGBE_EEPROM_CHECKSUM, in ixgbe_validate_eeprom_checksum_X550()
1153 status = -EIO; in ixgbe_validate_eeprom_checksum_X550()
1154 hw_dbg(hw, "Invalid EEPROM checksum"); in ixgbe_validate_eeprom_checksum_X550()
1164 /** ixgbe_write_ee_hostif_X550 - Write EEPROM word using hostif
1165 * @hw: pointer to hardware structure
1171 static s32 ixgbe_write_ee_hostif_data_X550(struct ixgbe_hw *hw, u16 offset, in ixgbe_write_ee_hostif_data_X550() argument
1187 status = ixgbe_host_interface_command(hw, &buffer, sizeof(buffer), in ixgbe_write_ee_hostif_data_X550()
1192 /** ixgbe_write_ee_hostif_X550 - Write EEPROM word using hostif
1193 * @hw: pointer to hardware structure
1199 static s32 ixgbe_write_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset, u16 data) in ixgbe_write_ee_hostif_X550() argument
1203 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) == 0) { in ixgbe_write_ee_hostif_X550()
1204 status = ixgbe_write_ee_hostif_data_X550(hw, offset, data); in ixgbe_write_ee_hostif_X550()
1205 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); in ixgbe_write_ee_hostif_X550()
1207 hw_dbg(hw, "write ee hostif failed to get semaphore"); in ixgbe_write_ee_hostif_X550()
1208 status = -EBUSY; in ixgbe_write_ee_hostif_X550()
1214 /** ixgbe_update_flash_X550 - Instruct HW to copy EEPROM to Flash device
1215 * @hw: pointer to hardware structure
1219 static s32 ixgbe_update_flash_X550(struct ixgbe_hw *hw) in ixgbe_update_flash_X550() argument
1229 status = ixgbe_host_interface_command(hw, &buffer, sizeof(buffer), in ixgbe_update_flash_X550()
1235 * ixgbe_get_bus_info_X550em - Set PCI bus info
1236 * @hw: pointer to hardware structure
1241 static s32 ixgbe_get_bus_info_X550em(struct ixgbe_hw *hw) in ixgbe_get_bus_info_X550em() argument
1243 hw->bus.type = ixgbe_bus_type_internal; in ixgbe_get_bus_info_X550em()
1244 hw->bus.width = ixgbe_bus_width_unknown; in ixgbe_get_bus_info_X550em()
1245 hw->bus.speed = ixgbe_bus_speed_unknown; in ixgbe_get_bus_info_X550em()
1247 hw->mac.ops.set_lan_id(hw); in ixgbe_get_bus_info_X550em()
1253 * ixgbe_fw_recovery_mode_X550 - Check FW NVM recovery mode
1254 * @hw: pointer t hardware structure
1258 static bool ixgbe_fw_recovery_mode_X550(struct ixgbe_hw *hw) in ixgbe_fw_recovery_mode_X550() argument
1262 fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM(hw)); in ixgbe_fw_recovery_mode_X550()
1266 /** ixgbe_disable_rx_x550 - Disable RX unit
1270 static void ixgbe_disable_rx_x550(struct ixgbe_hw *hw) in ixgbe_disable_rx_x550() argument
1276 rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL); in ixgbe_disable_rx_x550()
1278 pfdtxgswc = IXGBE_READ_REG(hw, IXGBE_PFDTXGSWC); in ixgbe_disable_rx_x550()
1281 IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, pfdtxgswc); in ixgbe_disable_rx_x550()
1282 hw->mac.set_lben = true; in ixgbe_disable_rx_x550()
1284 hw->mac.set_lben = false; in ixgbe_disable_rx_x550()
1290 fw_cmd.port_number = hw->bus.lan_id; in ixgbe_disable_rx_x550()
1292 status = ixgbe_host_interface_command(hw, &fw_cmd, in ixgbe_disable_rx_x550()
1296 /* If we fail - disable RX using register write */ in ixgbe_disable_rx_x550()
1298 rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL); in ixgbe_disable_rx_x550()
1301 IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, rxctrl); in ixgbe_disable_rx_x550()
1307 /** ixgbe_update_eeprom_checksum_X550 - Updates the EEPROM checksum and flash
1308 * @hw: pointer to hardware structure
1314 static s32 ixgbe_update_eeprom_checksum_X550(struct ixgbe_hw *hw) in ixgbe_update_eeprom_checksum_X550() argument
1323 status = ixgbe_read_ee_hostif_X550(hw, 0, &checksum); in ixgbe_update_eeprom_checksum_X550()
1325 hw_dbg(hw, "EEPROM read failed\n"); in ixgbe_update_eeprom_checksum_X550()
1329 status = ixgbe_calc_eeprom_checksum_X550(hw); in ixgbe_update_eeprom_checksum_X550()
1335 status = ixgbe_write_ee_hostif_X550(hw, IXGBE_EEPROM_CHECKSUM, in ixgbe_update_eeprom_checksum_X550()
1340 status = ixgbe_update_flash_X550(hw); in ixgbe_update_eeprom_checksum_X550()
1345 /** ixgbe_write_ee_hostif_buffer_X550 - Write EEPROM word(s) using hostif
1346 * @hw: pointer to hardware structure
1354 static s32 ixgbe_write_ee_hostif_buffer_X550(struct ixgbe_hw *hw, in ixgbe_write_ee_hostif_buffer_X550() argument
1362 status = hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM); in ixgbe_write_ee_hostif_buffer_X550()
1364 hw_dbg(hw, "EEPROM write buffer - semaphore failed\n"); in ixgbe_write_ee_hostif_buffer_X550()
1369 status = ixgbe_write_ee_hostif_data_X550(hw, offset + i, in ixgbe_write_ee_hostif_buffer_X550()
1372 hw_dbg(hw, "Eeprom buffered write failed\n"); in ixgbe_write_ee_hostif_buffer_X550()
1377 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); in ixgbe_write_ee_hostif_buffer_X550()
1382 /** ixgbe_write_iosf_sb_reg_x550 - Writes a value to specified register of the
1385 * @hw: pointer to hardware structure
1390 static s32 ixgbe_write_iosf_sb_reg_x550(struct ixgbe_hw *hw, u32 reg_addr, in ixgbe_write_iosf_sb_reg_x550() argument
1397 ret = hw->mac.ops.acquire_swfw_sync(hw, gssr); in ixgbe_write_iosf_sb_reg_x550()
1401 ret = ixgbe_iosf_wait(hw, NULL); in ixgbe_write_iosf_sb_reg_x550()
1409 IXGBE_WRITE_REG(hw, IXGBE_SB_IOSF_INDIRECT_CTRL, command); in ixgbe_write_iosf_sb_reg_x550()
1412 IXGBE_WRITE_REG(hw, IXGBE_SB_IOSF_INDIRECT_DATA, data); in ixgbe_write_iosf_sb_reg_x550()
1414 ret = ixgbe_iosf_wait(hw, &command); in ixgbe_write_iosf_sb_reg_x550()
1418 hw_dbg(hw, "Failed to write, error %x\n", error); in ixgbe_write_iosf_sb_reg_x550()
1419 return -EIO; in ixgbe_write_iosf_sb_reg_x550()
1423 hw->mac.ops.release_swfw_sync(hw, gssr); in ixgbe_write_iosf_sb_reg_x550()
1428 * ixgbe_setup_ixfi_x550em_x - MAC specific iXFI configuration
1429 * @hw: pointer to hardware structure
1433 static s32 ixgbe_setup_ixfi_x550em_x(struct ixgbe_hw *hw) in ixgbe_setup_ixfi_x550em_x() argument
1439 status = ixgbe_read_iosf_sb_reg_x550(hw, in ixgbe_setup_ixfi_x550em_x()
1440 IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id), in ixgbe_setup_ixfi_x550em_x()
1446 status = ixgbe_write_iosf_sb_reg_x550(hw, in ixgbe_setup_ixfi_x550em_x()
1447 IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id), in ixgbe_setup_ixfi_x550em_x()
1453 status = ixgbe_read_iosf_sb_reg_x550(hw, in ixgbe_setup_ixfi_x550em_x()
1454 IXGBE_KRM_DSP_TXFFE_STATE_4(hw->bus.lan_id), in ixgbe_setup_ixfi_x550em_x()
1462 status = ixgbe_write_iosf_sb_reg_x550(hw, in ixgbe_setup_ixfi_x550em_x()
1463 IXGBE_KRM_DSP_TXFFE_STATE_4(hw->bus.lan_id), in ixgbe_setup_ixfi_x550em_x()
1468 status = ixgbe_read_iosf_sb_reg_x550(hw, in ixgbe_setup_ixfi_x550em_x()
1469 IXGBE_KRM_DSP_TXFFE_STATE_5(hw->bus.lan_id), in ixgbe_setup_ixfi_x550em_x()
1477 status = ixgbe_write_iosf_sb_reg_x550(hw, in ixgbe_setup_ixfi_x550em_x()
1478 IXGBE_KRM_DSP_TXFFE_STATE_5(hw->bus.lan_id), in ixgbe_setup_ixfi_x550em_x()
1484 status = ixgbe_read_iosf_sb_reg_x550(hw, in ixgbe_setup_ixfi_x550em_x()
1485 IXGBE_KRM_TX_COEFF_CTRL_1(hw->bus.lan_id), in ixgbe_setup_ixfi_x550em_x()
1494 status = ixgbe_write_iosf_sb_reg_x550(hw, in ixgbe_setup_ixfi_x550em_x()
1495 IXGBE_KRM_TX_COEFF_CTRL_1(hw->bus.lan_id), in ixgbe_setup_ixfi_x550em_x()
1501 * ixgbe_restart_an_internal_phy_x550em - restart autonegotiation for the
1503 * @hw: pointer to hardware structure
1505 static s32 ixgbe_restart_an_internal_phy_x550em(struct ixgbe_hw *hw) in ixgbe_restart_an_internal_phy_x550em() argument
1510 /* Restart auto-negotiation. */ in ixgbe_restart_an_internal_phy_x550em()
1511 status = hw->mac.ops.read_iosf_sb_reg(hw, in ixgbe_restart_an_internal_phy_x550em()
1512 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_restart_an_internal_phy_x550em()
1516 hw_dbg(hw, "Auto-negotiation did not complete\n"); in ixgbe_restart_an_internal_phy_x550em()
1521 status = hw->mac.ops.write_iosf_sb_reg(hw, in ixgbe_restart_an_internal_phy_x550em()
1522 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_restart_an_internal_phy_x550em()
1525 if (hw->mac.type == ixgbe_mac_x550em_a) { in ixgbe_restart_an_internal_phy_x550em()
1529 status = hw->mac.ops.read_iosf_sb_reg(hw, in ixgbe_restart_an_internal_phy_x550em()
1530 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_restart_an_internal_phy_x550em()
1534 hw_dbg(hw, "Auto-negotiation did not complete\n"); in ixgbe_restart_an_internal_phy_x550em()
1539 status = hw->mac.ops.write_iosf_sb_reg(hw, in ixgbe_restart_an_internal_phy_x550em()
1540 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_restart_an_internal_phy_x550em()
1547 /** ixgbe_setup_ixfi_x550em - Configure the KR PHY for iXFI mode.
1548 * @hw: pointer to hardware structure
1554 static s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed) in ixgbe_setup_ixfi_x550em() argument
1556 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_setup_ixfi_x550em()
1561 if (mac->type != ixgbe_mac_X550EM_x) in ixgbe_setup_ixfi_x550em()
1562 return -EIO; in ixgbe_setup_ixfi_x550em()
1565 status = ixgbe_read_iosf_sb_reg_x550(hw, in ixgbe_setup_ixfi_x550em()
1566 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_ixfi_x550em()
1584 return -EINVAL; in ixgbe_setup_ixfi_x550em()
1587 status = ixgbe_write_iosf_sb_reg_x550(hw, in ixgbe_setup_ixfi_x550em()
1588 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_ixfi_x550em()
1594 if (hw->mac.type == ixgbe_mac_X550EM_x) { in ixgbe_setup_ixfi_x550em()
1595 status = ixgbe_setup_ixfi_x550em_x(hw); in ixgbe_setup_ixfi_x550em()
1601 status = ixgbe_restart_an_internal_phy_x550em(hw); in ixgbe_setup_ixfi_x550em()
1607 * ixgbe_supported_sfp_modules_X550em - Check if SFP module type is supported
1608 * @hw: pointer to hardware structure
1611 static s32 ixgbe_supported_sfp_modules_X550em(struct ixgbe_hw *hw, bool *linear) in ixgbe_supported_sfp_modules_X550em() argument
1613 switch (hw->phy.sfp_type) { in ixgbe_supported_sfp_modules_X550em()
1615 return -ENOENT; in ixgbe_supported_sfp_modules_X550em()
1634 return -EOPNOTSUPP; in ixgbe_supported_sfp_modules_X550em()
1641 * ixgbe_setup_mac_link_sfp_x550em - Configure the KR PHY for SFP.
1642 * @hw: pointer to hardware structure
1649 ixgbe_setup_mac_link_sfp_x550em(struct ixgbe_hw *hw, in ixgbe_setup_mac_link_sfp_x550em() argument
1658 status = ixgbe_supported_sfp_modules_X550em(hw, &setup_linear); in ixgbe_setup_mac_link_sfp_x550em()
1662 * not accepted in the setup MAC link flow. in ixgbe_setup_mac_link_sfp_x550em()
1664 if (status == -ENOENT) in ixgbe_setup_mac_link_sfp_x550em()
1671 ixgbe_setup_kr_speed_x550em(hw, speed); in ixgbe_setup_mac_link_sfp_x550em()
1674 reg_slice = IXGBE_CS4227_LINE_SPARE24_LSB + (hw->bus.lan_id << 12); in ixgbe_setup_mac_link_sfp_x550em()
1680 status = hw->link.ops.write_link(hw, hw->link.addr, reg_slice, in ixgbe_setup_mac_link_sfp_x550em()
1687 * ixgbe_setup_sfi_x550a - Configure the internal PHY for native SFI mode
1688 * @hw: pointer to hardware structure
1694 static s32 ixgbe_setup_sfi_x550a(struct ixgbe_hw *hw, ixgbe_link_speed *speed) in ixgbe_setup_sfi_x550a() argument
1696 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_setup_sfi_x550a()
1701 status = mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sfi_x550a()
1702 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_sfi_x550a()
1722 return -EINVAL; in ixgbe_setup_sfi_x550a()
1725 (void)mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sfi_x550a()
1726 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_sfi_x550a()
1730 (void)mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sfi_x550a()
1731 IXGBE_KRM_FLX_TMRS_CTRL_ST31(hw->bus.lan_id), in ixgbe_setup_sfi_x550a()
1735 (void)mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sfi_x550a()
1736 IXGBE_KRM_FLX_TMRS_CTRL_ST31(hw->bus.lan_id), in ixgbe_setup_sfi_x550a()
1740 (void)mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sfi_x550a()
1741 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_sfi_x550a()
1745 (void)mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sfi_x550a()
1746 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_sfi_x550a()
1750 (void)mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sfi_x550a()
1751 IXGBE_KRM_PCS_KX_AN(hw->bus.lan_id), in ixgbe_setup_sfi_x550a()
1755 (void)mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sfi_x550a()
1756 IXGBE_KRM_PCS_KX_AN(hw->bus.lan_id), in ixgbe_setup_sfi_x550a()
1760 (void)mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sfi_x550a()
1761 IXGBE_KRM_AN_CNTL_4(hw->bus.lan_id), in ixgbe_setup_sfi_x550a()
1765 (void)mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sfi_x550a()
1766 IXGBE_KRM_AN_CNTL_4(hw->bus.lan_id), in ixgbe_setup_sfi_x550a()
1770 (void)mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sfi_x550a()
1771 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_sfi_x550a()
1775 (void)mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sfi_x550a()
1776 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_sfi_x550a()
1780 status = ixgbe_restart_an_internal_phy_x550em(hw); in ixgbe_setup_sfi_x550a()
1786 * ixgbe_setup_mac_link_sfp_n - Setup internal PHY for native SFP
1787 * @hw: pointer to hardware structure
1794 ixgbe_setup_mac_link_sfp_n(struct ixgbe_hw *hw, ixgbe_link_speed speed, in ixgbe_setup_mac_link_sfp_n() argument
1802 ret_val = ixgbe_supported_sfp_modules_X550em(hw, &setup_linear); in ixgbe_setup_mac_link_sfp_n()
1805 * SFP not present error is not excepted in the setup MAC link flow. in ixgbe_setup_mac_link_sfp_n()
1807 if (ret_val == -ENOENT) in ixgbe_setup_mac_link_sfp_n()
1814 ret_val = hw->mac.ops.read_iosf_sb_reg(hw, in ixgbe_setup_mac_link_sfp_n()
1815 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_mac_link_sfp_n()
1824 ret_val = hw->mac.ops.write_iosf_sb_reg(hw, in ixgbe_setup_mac_link_sfp_n()
1825 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_mac_link_sfp_n()
1831 return ixgbe_setup_sfi_x550a(hw, &speed); in ixgbe_setup_mac_link_sfp_n()
1835 * ixgbe_setup_mac_link_sfp_x550a - Setup internal PHY for SFP
1836 * @hw: pointer to hardware structure
1843 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw, ixgbe_link_speed speed, in ixgbe_setup_mac_link_sfp_x550a() argument
1852 ret_val = ixgbe_supported_sfp_modules_X550em(hw, &setup_linear); in ixgbe_setup_mac_link_sfp_x550a()
1855 * SFP not present error is not excepted in the setup MAC link flow. in ixgbe_setup_mac_link_sfp_x550a()
1857 if (ret_val == -ENOENT) in ixgbe_setup_mac_link_sfp_x550a()
1864 ixgbe_setup_kr_speed_x550em(hw, speed); in ixgbe_setup_mac_link_sfp_x550a()
1866 if (hw->phy.mdio.prtad == MDIO_PRTAD_NONE) in ixgbe_setup_mac_link_sfp_x550a()
1867 return -EFAULT; in ixgbe_setup_mac_link_sfp_x550a()
1870 ret_val = hw->phy.ops.read_reg(hw, IXGBE_CS4227_EFUSE_PDF_SKU, in ixgbe_setup_mac_link_sfp_x550a()
1879 slice_offset = (hw->bus.lan_id + in ixgbe_setup_mac_link_sfp_x550a()
1880 (hw->bus.instance_id << 1)) << 12; in ixgbe_setup_mac_link_sfp_x550a()
1882 slice_offset = hw->bus.lan_id << 12; in ixgbe_setup_mac_link_sfp_x550a()
1887 ret_val = hw->phy.ops.read_reg(hw, reg_slice, in ixgbe_setup_mac_link_sfp_x550a()
1900 ret_val = hw->phy.ops.write_reg(hw, reg_slice, in ixgbe_setup_mac_link_sfp_x550a()
1906 return hw->phy.ops.read_reg(hw, reg_slice, in ixgbe_setup_mac_link_sfp_x550a()
1911 * ixgbe_setup_mac_link_t_X550em - Sets the auto advertised link speed
1912 * @hw: pointer to hardware structure
1921 static s32 ixgbe_setup_mac_link_t_X550em(struct ixgbe_hw *hw, in ixgbe_setup_mac_link_t_X550em() argument
1938 if (hw->mac.type == ixgbe_mac_X550EM_x && in ixgbe_setup_mac_link_t_X550em()
1939 !(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE)) { in ixgbe_setup_mac_link_t_X550em()
1940 status = ixgbe_setup_ixfi_x550em(hw, &force_speed); in ixgbe_setup_mac_link_t_X550em()
1946 return hw->phy.ops.setup_link_speed(hw, speed, autoneg_wait); in ixgbe_setup_mac_link_t_X550em()
1949 /** ixgbe_check_link_t_X550em - Determine link and speed status
1950 * @hw: pointer to hardware structure
1957 static s32 ixgbe_check_link_t_X550em(struct ixgbe_hw *hw, in ixgbe_check_link_t_X550em() argument
1965 if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_copper) in ixgbe_check_link_t_X550em()
1966 return -EIO; in ixgbe_check_link_t_X550em()
1968 status = ixgbe_check_mac_link_generic(hw, speed, link_up, in ixgbe_check_link_t_X550em()
1978 * back-to-back reads. in ixgbe_check_link_t_X550em()
1981 status = hw->phy.ops.read_reg(hw, MDIO_STAT1, MDIO_MMD_AN, in ixgbe_check_link_t_X550em()
1996 * ixgbe_setup_sgmii - Set up link for sgmii
1997 * @hw: pointer to hardware structure
2002 ixgbe_setup_sgmii(struct ixgbe_hw *hw, __always_unused ixgbe_link_speed speed, in ixgbe_setup_sgmii() argument
2005 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_setup_sgmii()
2009 rc = mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sgmii()
2010 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_sgmii()
2020 rc = mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sgmii()
2021 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_sgmii()
2026 rc = mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sgmii()
2027 IXGBE_KRM_SGMII_CTRL(hw->bus.lan_id), in ixgbe_setup_sgmii()
2034 rc = mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sgmii()
2035 IXGBE_KRM_SGMII_CTRL(hw->bus.lan_id), in ixgbe_setup_sgmii()
2040 rc = mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sgmii()
2041 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_sgmii()
2046 rc = mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sgmii()
2047 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_sgmii()
2058 rc = mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sgmii()
2059 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_sgmii()
2064 rc = ixgbe_restart_an_internal_phy_x550em(hw); in ixgbe_setup_sgmii()
2069 * ixgbe_setup_sgmii_fw - Set up link for sgmii with firmware-controlled PHYs
2070 * @hw: pointer to hardware structure
2074 static s32 ixgbe_setup_sgmii_fw(struct ixgbe_hw *hw, ixgbe_link_speed speed, in ixgbe_setup_sgmii_fw() argument
2077 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_setup_sgmii_fw()
2081 rc = mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sgmii_fw()
2082 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_sgmii_fw()
2092 rc = mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sgmii_fw()
2093 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_sgmii_fw()
2098 rc = mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sgmii_fw()
2099 IXGBE_KRM_SGMII_CTRL(hw->bus.lan_id), in ixgbe_setup_sgmii_fw()
2106 rc = mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sgmii_fw()
2107 IXGBE_KRM_SGMII_CTRL(hw->bus.lan_id), in ixgbe_setup_sgmii_fw()
2112 rc = mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sgmii_fw()
2113 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_sgmii_fw()
2118 rc = mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sgmii_fw()
2119 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_sgmii_fw()
2130 rc = mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sgmii_fw()
2131 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_sgmii_fw()
2136 ixgbe_restart_an_internal_phy_x550em(hw); in ixgbe_setup_sgmii_fw()
2138 return hw->phy.ops.setup_link_speed(hw, speed, autoneg_wait); in ixgbe_setup_sgmii_fw()
2142 * ixgbe_fc_autoneg_sgmii_x550em_a - Enable flow control IEEE clause 37
2143 * @hw: pointer to hardware structure
2145 * Enable flow control according to IEEE clause 37.
2147 static void ixgbe_fc_autoneg_sgmii_x550em_a(struct ixgbe_hw *hw) in ixgbe_fc_autoneg_sgmii_x550em_a() argument
2151 s32 status = -EIO; in ixgbe_fc_autoneg_sgmii_x550em_a()
2156 * - FC autoneg is disabled, or if in ixgbe_fc_autoneg_sgmii_x550em_a()
2157 * - link is not up. in ixgbe_fc_autoneg_sgmii_x550em_a()
2159 if (hw->fc.disable_fc_autoneg) in ixgbe_fc_autoneg_sgmii_x550em_a()
2162 hw->mac.ops.check_link(hw, &speed, &link_up, false); in ixgbe_fc_autoneg_sgmii_x550em_a()
2166 /* Check if auto-negotiation has completed */ in ixgbe_fc_autoneg_sgmii_x550em_a()
2167 status = ixgbe_fw_phy_activity(hw, FW_PHY_ACT_GET_LINK_INFO, &info); in ixgbe_fc_autoneg_sgmii_x550em_a()
2169 status = -EIO; in ixgbe_fc_autoneg_sgmii_x550em_a()
2173 /* Negotiate the flow control */ in ixgbe_fc_autoneg_sgmii_x550em_a()
2174 status = ixgbe_negotiate_fc(hw, info[0], info[0], in ixgbe_fc_autoneg_sgmii_x550em_a()
2182 hw->fc.fc_was_autonegged = true; in ixgbe_fc_autoneg_sgmii_x550em_a()
2184 hw->fc.fc_was_autonegged = false; in ixgbe_fc_autoneg_sgmii_x550em_a()
2185 hw->fc.current_mode = hw->fc.requested_mode; in ixgbe_fc_autoneg_sgmii_x550em_a()
2189 /** ixgbe_init_mac_link_ops_X550em_a - Init mac link function pointers
2190 * @hw: pointer to hardware structure
2192 static void ixgbe_init_mac_link_ops_X550em_a(struct ixgbe_hw *hw) in ixgbe_init_mac_link_ops_X550em_a() argument
2194 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_init_mac_link_ops_X550em_a()
2196 switch (mac->ops.get_media_type(hw)) { in ixgbe_init_mac_link_ops_X550em_a()
2198 mac->ops.setup_fc = NULL; in ixgbe_init_mac_link_ops_X550em_a()
2199 mac->ops.fc_autoneg = ixgbe_fc_autoneg_fiber_x550em_a; in ixgbe_init_mac_link_ops_X550em_a()
2202 if (hw->device_id != IXGBE_DEV_ID_X550EM_A_1G_T && in ixgbe_init_mac_link_ops_X550em_a()
2203 hw->device_id != IXGBE_DEV_ID_X550EM_A_1G_T_L) { in ixgbe_init_mac_link_ops_X550em_a()
2204 mac->ops.setup_link = ixgbe_setup_mac_link_t_X550em; in ixgbe_init_mac_link_ops_X550em_a()
2207 mac->ops.fc_autoneg = ixgbe_fc_autoneg_sgmii_x550em_a; in ixgbe_init_mac_link_ops_X550em_a()
2208 mac->ops.setup_fc = ixgbe_fc_autoneg_fw; in ixgbe_init_mac_link_ops_X550em_a()
2209 mac->ops.setup_link = ixgbe_setup_sgmii_fw; in ixgbe_init_mac_link_ops_X550em_a()
2210 mac->ops.check_link = ixgbe_check_mac_link_generic; in ixgbe_init_mac_link_ops_X550em_a()
2213 mac->ops.fc_autoneg = ixgbe_fc_autoneg_backplane_x550em_a; in ixgbe_init_mac_link_ops_X550em_a()
2214 mac->ops.setup_fc = ixgbe_setup_fc_backplane_x550em_a; in ixgbe_init_mac_link_ops_X550em_a()
2221 /** ixgbe_init_mac_link_ops_X550em - init mac link function pointers
2222 * @hw: pointer to hardware structure
2224 static void ixgbe_init_mac_link_ops_X550em(struct ixgbe_hw *hw) in ixgbe_init_mac_link_ops_X550em() argument
2226 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_init_mac_link_ops_X550em()
2228 mac->ops.setup_fc = ixgbe_setup_fc_x550em; in ixgbe_init_mac_link_ops_X550em()
2230 switch (mac->ops.get_media_type(hw)) { in ixgbe_init_mac_link_ops_X550em()
2235 mac->ops.disable_tx_laser = NULL; in ixgbe_init_mac_link_ops_X550em()
2236 mac->ops.enable_tx_laser = NULL; in ixgbe_init_mac_link_ops_X550em()
2237 mac->ops.flap_tx_laser = NULL; in ixgbe_init_mac_link_ops_X550em()
2238 mac->ops.setup_link = ixgbe_setup_mac_link_multispeed_fiber; in ixgbe_init_mac_link_ops_X550em()
2239 switch (hw->device_id) { in ixgbe_init_mac_link_ops_X550em()
2241 mac->ops.setup_mac_link = ixgbe_setup_mac_link_sfp_n; in ixgbe_init_mac_link_ops_X550em()
2244 mac->ops.setup_mac_link = in ixgbe_init_mac_link_ops_X550em()
2248 mac->ops.setup_mac_link = in ixgbe_init_mac_link_ops_X550em()
2252 mac->ops.set_rate_select_speed = in ixgbe_init_mac_link_ops_X550em()
2256 if (hw->device_id == IXGBE_DEV_ID_X550EM_X_1G_T) in ixgbe_init_mac_link_ops_X550em()
2258 mac->ops.setup_link = ixgbe_setup_mac_link_t_X550em; in ixgbe_init_mac_link_ops_X550em()
2259 mac->ops.setup_fc = ixgbe_setup_fc_generic; in ixgbe_init_mac_link_ops_X550em()
2260 mac->ops.check_link = ixgbe_check_link_t_X550em; in ixgbe_init_mac_link_ops_X550em()
2263 if (hw->device_id == IXGBE_DEV_ID_X550EM_A_SGMII || in ixgbe_init_mac_link_ops_X550em()
2264 hw->device_id == IXGBE_DEV_ID_X550EM_A_SGMII_L) in ixgbe_init_mac_link_ops_X550em()
2265 mac->ops.setup_link = ixgbe_setup_sgmii; in ixgbe_init_mac_link_ops_X550em()
2272 if (hw->mac.type == ixgbe_mac_x550em_a) in ixgbe_init_mac_link_ops_X550em()
2273 ixgbe_init_mac_link_ops_X550em_a(hw); in ixgbe_init_mac_link_ops_X550em()
2276 /** ixgbe_setup_sfp_modules_X550em - Setup SFP module
2277 * @hw: pointer to hardware structure
2279 static s32 ixgbe_setup_sfp_modules_X550em(struct ixgbe_hw *hw) in ixgbe_setup_sfp_modules_X550em() argument
2285 status = ixgbe_supported_sfp_modules_X550em(hw, &linear); in ixgbe_setup_sfp_modules_X550em()
2289 ixgbe_init_mac_link_ops_X550em(hw); in ixgbe_setup_sfp_modules_X550em()
2290 hw->phy.ops.reset = NULL; in ixgbe_setup_sfp_modules_X550em()
2295 /** ixgbe_get_link_capabilities_x550em - Determines link capabilities
2296 * @hw: pointer to hardware structure
2300 static s32 ixgbe_get_link_capabilities_X550em(struct ixgbe_hw *hw, in ixgbe_get_link_capabilities_X550em() argument
2304 if (hw->phy.type == ixgbe_phy_fw) { in ixgbe_get_link_capabilities_X550em()
2306 *speed = hw->phy.speeds_supported; in ixgbe_get_link_capabilities_X550em()
2311 if (hw->phy.media_type == ixgbe_media_type_fiber) { in ixgbe_get_link_capabilities_X550em()
2312 /* CS4227 SFP must not enable auto-negotiation */ in ixgbe_get_link_capabilities_X550em()
2315 if (hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || in ixgbe_get_link_capabilities_X550em()
2316 hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1 || in ixgbe_get_link_capabilities_X550em()
2317 hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 || in ixgbe_get_link_capabilities_X550em()
2318 hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1) { in ixgbe_get_link_capabilities_X550em()
2324 if (hw->phy.multispeed_fiber) in ixgbe_get_link_capabilities_X550em()
2330 switch (hw->phy.type) { in ixgbe_get_link_capabilities_X550em()
2345 if (hw->mac.type == ixgbe_mac_x550em_a) { in ixgbe_get_link_capabilities_X550em()
2347 if (hw->phy.nw_mng_if_sel & in ixgbe_get_link_capabilities_X550em()
2351 } else if (hw->device_id == in ixgbe_get_link_capabilities_X550em()
2369 * ixgbe_get_lasi_ext_t_x550em - Determime external Base T PHY interrupt cause
2370 * @hw: pointer to hardware structure
2378 static s32 ixgbe_get_lasi_ext_t_x550em(struct ixgbe_hw *hw, bool *lsc, in ixgbe_get_lasi_ext_t_x550em() argument
2388 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_CHIP_STD_INT_FLAG, in ixgbe_get_lasi_ext_t_x550em()
2395 /* Vendor Auto-Neg alarm triggered or Global alarm 1 triggered */ in ixgbe_get_lasi_ext_t_x550em()
2396 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_INT_CHIP_VEN_FLAG, in ixgbe_get_lasi_ext_t_x550em()
2405 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_ALARM_1, in ixgbe_get_lasi_ext_t_x550em()
2415 ixgbe_set_copper_phy_power(hw, false); in ixgbe_get_lasi_ext_t_x550em()
2417 return -EIO; in ixgbe_get_lasi_ext_t_x550em()
2421 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_FAULT_MSG, in ixgbe_get_lasi_ext_t_x550em()
2430 ixgbe_set_copper_phy_power(hw, false); in ixgbe_get_lasi_ext_t_x550em()
2432 return -EIO; in ixgbe_get_lasi_ext_t_x550em()
2437 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_CHIP_STD_INT_FLAG, in ixgbe_get_lasi_ext_t_x550em()
2444 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_VENDOR_TX_ALARM2, in ixgbe_get_lasi_ext_t_x550em()
2458 * ixgbe_enable_lasi_ext_t_x550em - Enable external Base T PHY interrupts
2459 * @hw: pointer to hardware structure
2466 static s32 ixgbe_enable_lasi_ext_t_x550em(struct ixgbe_hw *hw) in ixgbe_enable_lasi_ext_t_x550em() argument
2473 status = ixgbe_get_lasi_ext_t_x550em(hw, &lsc, &overtemp); in ixgbe_enable_lasi_ext_t_x550em()
2480 * not support auto-negotiation. This is not required for X553 devices in ixgbe_enable_lasi_ext_t_x550em()
2481 * having KR support, which performs auto-negotiations and which is used in ixgbe_enable_lasi_ext_t_x550em()
2485 if (hw->mac.type != ixgbe_mac_x550em_a) { in ixgbe_enable_lasi_ext_t_x550em()
2486 status = hw->phy.ops.read_reg(hw, in ixgbe_enable_lasi_ext_t_x550em()
2494 status = hw->phy.ops.write_reg(hw, in ixgbe_enable_lasi_ext_t_x550em()
2502 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_INT_MASK, in ixgbe_enable_lasi_ext_t_x550em()
2511 status = hw->phy.ops.write_reg(hw, IXGBE_MDIO_GLOBAL_INT_MASK, in ixgbe_enable_lasi_ext_t_x550em()
2517 /* Enable vendor Auto-Neg alarm and Global Interrupt Mask 1 alarm */ in ixgbe_enable_lasi_ext_t_x550em()
2518 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_INT_CHIP_VEN_MASK, in ixgbe_enable_lasi_ext_t_x550em()
2527 status = hw->phy.ops.write_reg(hw, IXGBE_MDIO_GLOBAL_INT_CHIP_VEN_MASK, in ixgbe_enable_lasi_ext_t_x550em()
2533 /* Enable chip-wide vendor alarm */ in ixgbe_enable_lasi_ext_t_x550em()
2534 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_INT_CHIP_STD_MASK, in ixgbe_enable_lasi_ext_t_x550em()
2542 status = hw->phy.ops.write_reg(hw, IXGBE_MDIO_GLOBAL_INT_CHIP_STD_MASK, in ixgbe_enable_lasi_ext_t_x550em()
2550 * ixgbe_handle_lasi_ext_t_x550em - Handle external Base T PHY interrupt
2551 * @hw: pointer to hardware structure
2558 static s32 ixgbe_handle_lasi_ext_t_x550em(struct ixgbe_hw *hw, in ixgbe_handle_lasi_ext_t_x550em() argument
2561 struct ixgbe_phy_info *phy = &hw->phy; in ixgbe_handle_lasi_ext_t_x550em()
2565 status = ixgbe_get_lasi_ext_t_x550em(hw, &lsc, is_overtemp); in ixgbe_handle_lasi_ext_t_x550em()
2569 if (lsc && phy->ops.setup_internal_link) in ixgbe_handle_lasi_ext_t_x550em()
2570 return phy->ops.setup_internal_link(hw); in ixgbe_handle_lasi_ext_t_x550em()
2576 * ixgbe_setup_kr_speed_x550em - Configure the KR PHY for link speed.
2577 * @hw: pointer to hardware structure
2582 static s32 ixgbe_setup_kr_speed_x550em(struct ixgbe_hw *hw, in ixgbe_setup_kr_speed_x550em() argument
2588 status = hw->mac.ops.read_iosf_sb_reg(hw, in ixgbe_setup_kr_speed_x550em()
2589 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_kr_speed_x550em()
2606 status = hw->mac.ops.write_iosf_sb_reg(hw, in ixgbe_setup_kr_speed_x550em()
2607 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_kr_speed_x550em()
2610 if (hw->mac.type == ixgbe_mac_x550em_a) { in ixgbe_setup_kr_speed_x550em()
2612 status = hw->mac.ops.read_iosf_sb_reg(hw, in ixgbe_setup_kr_speed_x550em()
2613 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_kr_speed_x550em()
2625 status = hw->mac.ops.write_iosf_sb_reg(hw, in ixgbe_setup_kr_speed_x550em()
2626 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_kr_speed_x550em()
2630 return ixgbe_restart_an_internal_phy_x550em(hw); in ixgbe_setup_kr_speed_x550em()
2634 * ixgbe_setup_kr_x550em - Configure the KR PHY
2635 * @hw: pointer to hardware structure
2637 static s32 ixgbe_setup_kr_x550em(struct ixgbe_hw *hw) in ixgbe_setup_kr_x550em() argument
2640 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_2_5GB_FULL) in ixgbe_setup_kr_x550em()
2643 if (ixgbe_check_reset_blocked(hw)) in ixgbe_setup_kr_x550em()
2646 return ixgbe_setup_kr_speed_x550em(hw, hw->phy.autoneg_advertised); in ixgbe_setup_kr_x550em()
2649 /** ixgbe_ext_phy_t_x550em_get_link - Get ext phy link status
2650 * @hw: address of hardware structure
2655 static s32 ixgbe_ext_phy_t_x550em_get_link(struct ixgbe_hw *hw, bool *link_up) in ixgbe_ext_phy_t_x550em_get_link() argument
2663 ret = hw->phy.ops.read_reg(hw, MDIO_STAT1, MDIO_MMD_AN, in ixgbe_ext_phy_t_x550em_get_link()
2668 ret = hw->phy.ops.read_reg(hw, MDIO_STAT1, MDIO_MMD_AN, in ixgbe_ext_phy_t_x550em_get_link()
2678 /** ixgbe_setup_internal_phy_t_x550em - Configure KR PHY to X557 link
2679 * @hw: point to hardware structure
2684 * between the PHYs to match the link speed of the BASE-T link.
2686 * A return of a non-zero value indicates an error, and the base driver should
2689 static s32 ixgbe_setup_internal_phy_t_x550em(struct ixgbe_hw *hw) in ixgbe_setup_internal_phy_t_x550em() argument
2696 if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_copper) in ixgbe_setup_internal_phy_t_x550em()
2697 return -EIO; in ixgbe_setup_internal_phy_t_x550em()
2699 if (!(hw->mac.type == ixgbe_mac_X550EM_x && in ixgbe_setup_internal_phy_t_x550em()
2700 !(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE))) { in ixgbe_setup_internal_phy_t_x550em()
2703 return ixgbe_setup_kr_speed_x550em(hw, speed); in ixgbe_setup_internal_phy_t_x550em()
2707 status = ixgbe_ext_phy_t_x550em_get_link(hw, &link_up); in ixgbe_setup_internal_phy_t_x550em()
2714 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_VENDOR_STAT, in ixgbe_setup_internal_phy_t_x550em()
2721 status = ixgbe_ext_phy_t_x550em_get_link(hw, &link_up); in ixgbe_setup_internal_phy_t_x550em()
2740 return -EINVAL; in ixgbe_setup_internal_phy_t_x550em()
2743 return ixgbe_setup_ixfi_x550em(hw, &force_speed); in ixgbe_setup_internal_phy_t_x550em()
2746 /** ixgbe_reset_phy_t_X550em - Performs X557 PHY reset and enables LASI
2747 * @hw: pointer to hardware structure
2749 static s32 ixgbe_reset_phy_t_X550em(struct ixgbe_hw *hw) in ixgbe_reset_phy_t_X550em() argument
2753 status = ixgbe_reset_phy_generic(hw); in ixgbe_reset_phy_t_X550em()
2759 return ixgbe_enable_lasi_ext_t_x550em(hw); in ixgbe_reset_phy_t_X550em()
2763 * ixgbe_led_on_t_x550em - Turns on the software controllable LEDs.
2764 * @hw: pointer to hardware structure
2767 static s32 ixgbe_led_on_t_x550em(struct ixgbe_hw *hw, u32 led_idx) in ixgbe_led_on_t_x550em() argument
2772 return -EINVAL; in ixgbe_led_on_t_x550em()
2775 hw->phy.ops.read_reg(hw, IXGBE_X557_LED_PROVISIONING + led_idx, in ixgbe_led_on_t_x550em()
2778 hw->phy.ops.write_reg(hw, IXGBE_X557_LED_PROVISIONING + led_idx, in ixgbe_led_on_t_x550em()
2785 * ixgbe_led_off_t_x550em - Turns off the software controllable LEDs.
2786 * @hw: pointer to hardware structure
2789 static s32 ixgbe_led_off_t_x550em(struct ixgbe_hw *hw, u32 led_idx) in ixgbe_led_off_t_x550em() argument
2794 return -EINVAL; in ixgbe_led_off_t_x550em()
2797 hw->phy.ops.read_reg(hw, IXGBE_X557_LED_PROVISIONING + led_idx, in ixgbe_led_off_t_x550em()
2800 hw->phy.ops.write_reg(hw, IXGBE_X557_LED_PROVISIONING + led_idx, in ixgbe_led_off_t_x550em()
2807 * ixgbe_set_fw_drv_ver_x550 - Sends driver version to firmware
2808 * @hw: pointer to the HW structure
2818 * else returns -EBUSY when encountering an error acquiring
2819 * semaphore, -EIO when command fails or -ENIVAL when incorrect
2822 static s32 ixgbe_set_fw_drv_ver_x550(struct ixgbe_hw *hw, u8 maj, u8 min, in ixgbe_set_fw_drv_ver_x550() argument
2831 return -EINVAL; in ixgbe_set_fw_drv_ver_x550()
2836 fw_cmd.port_num = (u8)hw->bus.func; in ixgbe_set_fw_drv_ver_x550()
2847 ret_val = ixgbe_host_interface_command(hw, (u32 *)&fw_cmd, in ixgbe_set_fw_drv_ver_x550()
2856 return -EIO; in ixgbe_set_fw_drv_ver_x550()
2863 /** ixgbe_get_lcd_x550em - Determine lowest common denominator
2864 * @hw: pointer to hardware structure
2869 static s32 ixgbe_get_lcd_t_x550em(struct ixgbe_hw *hw, in ixgbe_get_lcd_t_x550em() argument
2874 u16 word = hw->eeprom.ctrl_word_3; in ixgbe_get_lcd_t_x550em()
2878 status = hw->phy.ops.read_reg(hw, IXGBE_AUTO_NEG_LP_STATUS, in ixgbe_get_lcd_t_x550em()
2891 if ((hw->bus.lan_id && (word & NVM_INIT_CTRL_3_D10GMP_PORT1)) || in ixgbe_get_lcd_t_x550em()
2901 * ixgbe_setup_fc_x550em - Set up flow control
2902 * @hw: pointer to hardware structure
2904 static s32 ixgbe_setup_fc_x550em(struct ixgbe_hw *hw) in ixgbe_setup_fc_x550em() argument
2911 if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) { in ixgbe_setup_fc_x550em()
2912 hw_err(hw, "ixgbe_fc_rx_pause not valid in strict IEEE mode\n"); in ixgbe_setup_fc_x550em()
2913 return -EINVAL; in ixgbe_setup_fc_x550em()
2917 * default flow control setting, so we explicitly set it to full. in ixgbe_setup_fc_x550em()
2919 if (hw->fc.requested_mode == ixgbe_fc_default) in ixgbe_setup_fc_x550em()
2920 hw->fc.requested_mode = ixgbe_fc_full; in ixgbe_setup_fc_x550em()
2923 switch (hw->fc.requested_mode) { in ixgbe_setup_fc_x550em()
2933 /* Rx Flow control is enabled and Tx Flow control is in ixgbe_setup_fc_x550em()
2947 hw_err(hw, "Flow control param set incorrectly\n"); in ixgbe_setup_fc_x550em()
2948 return -EIO; in ixgbe_setup_fc_x550em()
2951 switch (hw->device_id) { in ixgbe_setup_fc_x550em()
2955 rc = hw->mac.ops.read_iosf_sb_reg(hw, in ixgbe_setup_fc_x550em()
2956 IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id), in ixgbe_setup_fc_x550em()
2968 rc = hw->mac.ops.write_iosf_sb_reg(hw, in ixgbe_setup_fc_x550em()
2969 IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id), in ixgbe_setup_fc_x550em()
2974 hw->fc.disable_fc_autoneg = true; in ixgbe_setup_fc_x550em()
2977 hw->fc.disable_fc_autoneg = true; in ixgbe_setup_fc_x550em()
2986 * ixgbe_fc_autoneg_backplane_x550em_a - Enable flow control IEEE clause 37
2987 * @hw: pointer to hardware structure
2989 static void ixgbe_fc_autoneg_backplane_x550em_a(struct ixgbe_hw *hw) in ixgbe_fc_autoneg_backplane_x550em_a() argument
2993 s32 status = -EIO; in ixgbe_fc_autoneg_backplane_x550em_a()
2998 * - FC autoneg is disabled, or if in ixgbe_fc_autoneg_backplane_x550em_a()
2999 * - link is not up. in ixgbe_fc_autoneg_backplane_x550em_a()
3001 if (hw->fc.disable_fc_autoneg) { in ixgbe_fc_autoneg_backplane_x550em_a()
3002 hw_err(hw, "Flow control autoneg is disabled"); in ixgbe_fc_autoneg_backplane_x550em_a()
3006 hw->mac.ops.check_link(hw, &speed, &link_up, false); in ixgbe_fc_autoneg_backplane_x550em_a()
3008 hw_err(hw, "The link is down"); in ixgbe_fc_autoneg_backplane_x550em_a()
3012 /* Check at auto-negotiation has completed */ in ixgbe_fc_autoneg_backplane_x550em_a()
3013 status = hw->mac.ops.read_iosf_sb_reg(hw, in ixgbe_fc_autoneg_backplane_x550em_a()
3014 IXGBE_KRM_LINK_S1(hw->bus.lan_id), in ixgbe_fc_autoneg_backplane_x550em_a()
3018 hw_dbg(hw, "Auto-Negotiation did not complete\n"); in ixgbe_fc_autoneg_backplane_x550em_a()
3019 status = -EIO; in ixgbe_fc_autoneg_backplane_x550em_a()
3024 * local flow control settings accordingly in ixgbe_fc_autoneg_backplane_x550em_a()
3026 status = hw->mac.ops.read_iosf_sb_reg(hw, in ixgbe_fc_autoneg_backplane_x550em_a()
3027 IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id), in ixgbe_fc_autoneg_backplane_x550em_a()
3031 hw_dbg(hw, "Auto-Negotiation did not complete\n"); in ixgbe_fc_autoneg_backplane_x550em_a()
3035 status = hw->mac.ops.read_iosf_sb_reg(hw, in ixgbe_fc_autoneg_backplane_x550em_a()
3036 IXGBE_KRM_LP_BASE_PAGE_HIGH(hw->bus.lan_id), in ixgbe_fc_autoneg_backplane_x550em_a()
3040 hw_dbg(hw, "Auto-Negotiation did not complete\n"); in ixgbe_fc_autoneg_backplane_x550em_a()
3044 status = ixgbe_negotiate_fc(hw, an_cntl_1, lp_an_page_low, in ixgbe_fc_autoneg_backplane_x550em_a()
3052 hw->fc.fc_was_autonegged = true; in ixgbe_fc_autoneg_backplane_x550em_a()
3054 hw->fc.fc_was_autonegged = false; in ixgbe_fc_autoneg_backplane_x550em_a()
3055 hw->fc.current_mode = hw->fc.requested_mode; in ixgbe_fc_autoneg_backplane_x550em_a()
3060 * ixgbe_fc_autoneg_fiber_x550em_a - passthrough FC settings
3061 * @hw: pointer to hardware structure
3063 static void ixgbe_fc_autoneg_fiber_x550em_a(struct ixgbe_hw *hw) in ixgbe_fc_autoneg_fiber_x550em_a() argument
3065 hw->fc.fc_was_autonegged = false; in ixgbe_fc_autoneg_fiber_x550em_a()
3066 hw->fc.current_mode = hw->fc.requested_mode; in ixgbe_fc_autoneg_fiber_x550em_a()
3069 /** ixgbe_enter_lplu_x550em - Transition to low power states
3070 * @hw: pointer to hardware structure
3073 * (from D0 to non-D0). Link is required to enter LPLU so avoid resetting
3076 static s32 ixgbe_enter_lplu_t_x550em(struct ixgbe_hw *hw) in ixgbe_enter_lplu_t_x550em() argument
3085 if (ixgbe_check_reset_blocked(hw)) in ixgbe_enter_lplu_t_x550em()
3088 status = ixgbe_ext_phy_t_x550em_get_link(hw, &link_up); in ixgbe_enter_lplu_t_x550em()
3092 status = hw->eeprom.ops.read(hw, NVM_INIT_CTRL_3, in ixgbe_enter_lplu_t_x550em()
3093 &hw->eeprom.ctrl_word_3); in ixgbe_enter_lplu_t_x550em()
3101 if (!link_up || !(hw->eeprom.ctrl_word_3 & NVM_INIT_CTRL_3_LPLU) || in ixgbe_enter_lplu_t_x550em()
3102 !(hw->wol_enabled || ixgbe_mng_present(hw))) in ixgbe_enter_lplu_t_x550em()
3103 return ixgbe_set_copper_phy_power(hw, false); in ixgbe_enter_lplu_t_x550em()
3106 status = ixgbe_get_lcd_t_x550em(hw, &lcd_speed); in ixgbe_enter_lplu_t_x550em()
3112 return ixgbe_set_copper_phy_power(hw, false); in ixgbe_enter_lplu_t_x550em()
3114 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_VENDOR_STAT, in ixgbe_enter_lplu_t_x550em()
3121 status = ixgbe_ext_phy_t_x550em_get_link(hw, &link_up); in ixgbe_enter_lplu_t_x550em()
3123 return ixgbe_set_copper_phy_power(hw, false); in ixgbe_enter_lplu_t_x550em()
3136 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_VENDOR_TX_ALARM, in ixgbe_enter_lplu_t_x550em()
3142 status = hw->phy.ops.read_reg(hw, MDIO_AN_10GBT_CTRL, in ixgbe_enter_lplu_t_x550em()
3148 status = hw->phy.ops.read_reg(hw, in ixgbe_enter_lplu_t_x550em()
3155 save_autoneg = hw->phy.autoneg_advertised; in ixgbe_enter_lplu_t_x550em()
3158 status = hw->mac.ops.setup_link(hw, lcd_speed, false); in ixgbe_enter_lplu_t_x550em()
3161 hw->phy.autoneg_advertised = save_autoneg; in ixgbe_enter_lplu_t_x550em()
3167 * ixgbe_reset_phy_fw - Reset firmware-controlled PHYs
3168 * @hw: pointer to hardware structure
3170 static s32 ixgbe_reset_phy_fw(struct ixgbe_hw *hw) in ixgbe_reset_phy_fw() argument
3175 if (hw->phy.reset_disable || ixgbe_check_reset_blocked(hw)) in ixgbe_reset_phy_fw()
3178 rc = ixgbe_fw_phy_activity(hw, FW_PHY_ACT_PHY_SW_RESET, &store); in ixgbe_reset_phy_fw()
3183 rc = ixgbe_fw_phy_activity(hw, FW_PHY_ACT_INIT_PHY, &store); in ixgbe_reset_phy_fw()
3187 return ixgbe_setup_fw_link(hw); in ixgbe_reset_phy_fw()
3191 * ixgbe_check_overtemp_fw - Check firmware-controlled PHYs for overtemp
3192 * @hw: pointer to hardware structure
3196 static bool ixgbe_check_overtemp_fw(struct ixgbe_hw *hw) in ixgbe_check_overtemp_fw() argument
3201 rc = ixgbe_fw_phy_activity(hw, FW_PHY_ACT_GET_LINK_INFO, &store); in ixgbe_check_overtemp_fw()
3206 ixgbe_shutdown_fw_phy(hw); in ixgbe_check_overtemp_fw()
3213 * ixgbe_read_mng_if_sel_x550em - Read NW_MNG_IF_SEL register
3214 * @hw: pointer to hardware structure
3218 static void ixgbe_read_mng_if_sel_x550em(struct ixgbe_hw *hw) in ixgbe_read_mng_if_sel_x550em() argument
3223 hw->phy.nw_mng_if_sel = IXGBE_READ_REG(hw, IXGBE_NW_MNG_IF_SEL); in ixgbe_read_mng_if_sel_x550em()
3228 if (hw->mac.type == ixgbe_mac_x550em_a && in ixgbe_read_mng_if_sel_x550em()
3229 hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_MDIO_ACT) { in ixgbe_read_mng_if_sel_x550em()
3230 hw->phy.mdio.prtad = FIELD_GET(IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD, in ixgbe_read_mng_if_sel_x550em()
3231 hw->phy.nw_mng_if_sel); in ixgbe_read_mng_if_sel_x550em()
3235 /** ixgbe_init_phy_ops_X550em - PHY/SFP specific init
3236 * @hw: pointer to hardware structure
3242 static s32 ixgbe_init_phy_ops_X550em(struct ixgbe_hw *hw) in ixgbe_init_phy_ops_X550em() argument
3244 struct ixgbe_phy_info *phy = &hw->phy; in ixgbe_init_phy_ops_X550em()
3247 hw->mac.ops.set_lan_id(hw); in ixgbe_init_phy_ops_X550em()
3249 ixgbe_read_mng_if_sel_x550em(hw); in ixgbe_init_phy_ops_X550em()
3251 if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber) { in ixgbe_init_phy_ops_X550em()
3252 phy->phy_semaphore_mask = IXGBE_GSSR_SHARED_I2C_SM; in ixgbe_init_phy_ops_X550em()
3253 ixgbe_setup_mux_ctl(hw); in ixgbe_init_phy_ops_X550em()
3257 ret_val = phy->ops.identify(hw); in ixgbe_init_phy_ops_X550em()
3258 if (ret_val == -EOPNOTSUPP || ret_val == -EFAULT) in ixgbe_init_phy_ops_X550em()
3262 ixgbe_init_mac_link_ops_X550em(hw); in ixgbe_init_phy_ops_X550em()
3263 if (phy->sfp_type != ixgbe_sfp_type_unknown) in ixgbe_init_phy_ops_X550em()
3264 phy->ops.reset = NULL; in ixgbe_init_phy_ops_X550em()
3267 switch (hw->phy.type) { in ixgbe_init_phy_ops_X550em()
3269 phy->ops.setup_link = NULL; in ixgbe_init_phy_ops_X550em()
3270 phy->ops.read_reg = ixgbe_read_phy_reg_x550em; in ixgbe_init_phy_ops_X550em()
3271 phy->ops.write_reg = ixgbe_write_phy_reg_x550em; in ixgbe_init_phy_ops_X550em()
3274 phy->ops.setup_link = ixgbe_setup_kr_x550em; in ixgbe_init_phy_ops_X550em()
3275 phy->ops.read_reg = ixgbe_read_phy_reg_x550em; in ixgbe_init_phy_ops_X550em()
3276 phy->ops.write_reg = ixgbe_write_phy_reg_x550em; in ixgbe_init_phy_ops_X550em()
3279 /* link is managed by HW */ in ixgbe_init_phy_ops_X550em()
3280 phy->ops.setup_link = NULL; in ixgbe_init_phy_ops_X550em()
3281 phy->ops.read_reg = ixgbe_read_phy_reg_x550em; in ixgbe_init_phy_ops_X550em()
3282 phy->ops.write_reg = ixgbe_write_phy_reg_x550em; in ixgbe_init_phy_ops_X550em()
3288 phy->nw_mng_if_sel = IXGBE_READ_REG(hw, IXGBE_NW_MNG_IF_SEL); in ixgbe_init_phy_ops_X550em()
3293 phy->ops.setup_internal_link = in ixgbe_init_phy_ops_X550em()
3297 if (hw->mac.type == ixgbe_mac_X550EM_x && in ixgbe_init_phy_ops_X550em()
3298 !(IXGBE_READ_REG(hw, IXGBE_FUSES0_GROUP(0)) & in ixgbe_init_phy_ops_X550em()
3300 phy->ops.enter_lplu = ixgbe_enter_lplu_t_x550em; in ixgbe_init_phy_ops_X550em()
3302 phy->ops.handle_lasi = ixgbe_handle_lasi_ext_t_x550em; in ixgbe_init_phy_ops_X550em()
3303 phy->ops.reset = ixgbe_reset_phy_t_X550em; in ixgbe_init_phy_ops_X550em()
3306 phy->ops.setup_link = NULL; in ixgbe_init_phy_ops_X550em()
3309 phy->ops.setup_link = ixgbe_setup_fw_link; in ixgbe_init_phy_ops_X550em()
3310 phy->ops.reset = ixgbe_reset_phy_fw; in ixgbe_init_phy_ops_X550em()
3313 phy->ops.setup_link = NULL; in ixgbe_init_phy_ops_X550em()
3314 phy->ops.read_reg = NULL; in ixgbe_init_phy_ops_X550em()
3315 phy->ops.write_reg = NULL; in ixgbe_init_phy_ops_X550em()
3316 phy->ops.reset = NULL; in ixgbe_init_phy_ops_X550em()
3325 /** ixgbe_get_media_type_X550em - Get media type
3326 * @hw: pointer to hardware structure
3331 static enum ixgbe_media_type ixgbe_get_media_type_X550em(struct ixgbe_hw *hw) in ixgbe_get_media_type_X550em() argument
3336 switch (hw->device_id) { in ixgbe_get_media_type_X550em()
3339 hw->phy.type = ixgbe_phy_sgmii; in ixgbe_get_media_type_X550em()
3367 /** ixgbe_init_ext_t_x550em - Start (unstall) the external Base T PHY.
3368 ** @hw: pointer to hardware structure
3370 static s32 ixgbe_init_ext_t_x550em(struct ixgbe_hw *hw) in ixgbe_init_ext_t_x550em() argument
3375 status = hw->phy.ops.read_reg(hw, in ixgbe_init_ext_t_x550em()
3383 * SW instance after a power on so the PHY FW must be un-stalled. in ixgbe_init_ext_t_x550em()
3386 status = hw->phy.ops.read_reg(hw, in ixgbe_init_ext_t_x550em()
3395 status = hw->phy.ops.write_reg(hw, in ixgbe_init_ext_t_x550em()
3407 * ixgbe_set_mdio_speed - Set MDIO clock speed
3408 * @hw: pointer to hardware structure
3410 static void ixgbe_set_mdio_speed(struct ixgbe_hw *hw) in ixgbe_set_mdio_speed() argument
3414 switch (hw->device_id) { in ixgbe_set_mdio_speed()
3421 hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0); in ixgbe_set_mdio_speed()
3423 IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0); in ixgbe_set_mdio_speed()
3428 hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0); in ixgbe_set_mdio_speed()
3430 IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0); in ixgbe_set_mdio_speed()
3437 /** ixgbe_reset_hw_X550em - Perform hardware reset
3438 ** @hw: pointer to hardware structure
3444 static s32 ixgbe_reset_hw_X550em(struct ixgbe_hw *hw) in ixgbe_reset_hw_X550em() argument
3448 u32 ctrl = 0; in ixgbe_reset_hw_X550em() local
3451 u32 swfw_mask = hw->phy.phy_semaphore_mask; in ixgbe_reset_hw_X550em()
3454 status = hw->mac.ops.stop_adapter(hw); in ixgbe_reset_hw_X550em()
3459 ixgbe_clear_tx_pending(hw); in ixgbe_reset_hw_X550em()
3462 ixgbe_set_mdio_speed(hw); in ixgbe_reset_hw_X550em()
3465 status = hw->phy.ops.init(hw); in ixgbe_reset_hw_X550em()
3466 if (status == -EOPNOTSUPP || status == -EFAULT) in ixgbe_reset_hw_X550em()
3470 if (hw->phy.type == ixgbe_phy_x550em_ext_t) { in ixgbe_reset_hw_X550em()
3471 status = ixgbe_init_ext_t_x550em(hw); in ixgbe_reset_hw_X550em()
3477 if (hw->phy.sfp_setup_needed) { in ixgbe_reset_hw_X550em()
3478 status = hw->mac.ops.setup_sfp(hw); in ixgbe_reset_hw_X550em()
3479 hw->phy.sfp_setup_needed = false; in ixgbe_reset_hw_X550em()
3482 if (status == -EOPNOTSUPP) in ixgbe_reset_hw_X550em()
3486 if (!hw->phy.reset_disable && hw->phy.ops.reset) in ixgbe_reset_hw_X550em()
3487 hw->phy.ops.reset(hw); in ixgbe_reset_hw_X550em()
3495 ctrl = IXGBE_CTRL_LNK_RST; in ixgbe_reset_hw_X550em()
3497 if (!hw->force_full_reset) { in ixgbe_reset_hw_X550em()
3498 hw->mac.ops.check_link(hw, &link_speed, &link_up, false); in ixgbe_reset_hw_X550em()
3500 ctrl = IXGBE_CTRL_RST; in ixgbe_reset_hw_X550em()
3503 status = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask); in ixgbe_reset_hw_X550em()
3505 hw_dbg(hw, "semaphore failed with %d", status); in ixgbe_reset_hw_X550em()
3506 return -EBUSY; in ixgbe_reset_hw_X550em()
3509 ctrl |= IXGBE_READ_REG(hw, IXGBE_CTRL); in ixgbe_reset_hw_X550em()
3510 IXGBE_WRITE_REG(hw, IXGBE_CTRL, ctrl); in ixgbe_reset_hw_X550em()
3511 IXGBE_WRITE_FLUSH(hw); in ixgbe_reset_hw_X550em()
3512 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_reset_hw_X550em()
3515 /* Poll for reset bit to self-clear meaning reset is complete */ in ixgbe_reset_hw_X550em()
3517 ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL); in ixgbe_reset_hw_X550em()
3518 if (!(ctrl & IXGBE_CTRL_RST_MASK)) in ixgbe_reset_hw_X550em()
3523 if (ctrl & IXGBE_CTRL_RST_MASK) { in ixgbe_reset_hw_X550em()
3524 status = -EIO; in ixgbe_reset_hw_X550em()
3525 hw_dbg(hw, "Reset polling failed to complete.\n"); in ixgbe_reset_hw_X550em()
3534 if (hw->mac.flags & IXGBE_FLAGS_DOUBLE_RESET_REQUIRED) { in ixgbe_reset_hw_X550em()
3535 hw->mac.flags &= ~IXGBE_FLAGS_DOUBLE_RESET_REQUIRED; in ixgbe_reset_hw_X550em()
3540 hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr); in ixgbe_reset_hw_X550em()
3546 hw->mac.num_rar_entries = 128; in ixgbe_reset_hw_X550em()
3547 hw->mac.ops.init_rx_addrs(hw); in ixgbe_reset_hw_X550em()
3549 ixgbe_set_mdio_speed(hw); in ixgbe_reset_hw_X550em()
3551 if (hw->device_id == IXGBE_DEV_ID_X550EM_X_SFP) in ixgbe_reset_hw_X550em()
3552 ixgbe_setup_mux_ctl(hw); in ixgbe_reset_hw_X550em()
3557 /** ixgbe_set_ethertype_anti_spoofing_X550 - Enable/Disable Ethertype
3558 * anti-spoofing
3559 * @hw: pointer to hardware structure
3560 * @enable: enable or disable switch for Ethertype anti-spoofing
3561 * @vf: Virtual Function pool - VF Pool to set for Ethertype anti-spoofing
3563 static void ixgbe_set_ethertype_anti_spoofing_X550(struct ixgbe_hw *hw, in ixgbe_set_ethertype_anti_spoofing_X550() argument
3570 pfvfspoof = IXGBE_READ_REG(hw, IXGBE_PFVFSPOOF(vf_target_reg)); in ixgbe_set_ethertype_anti_spoofing_X550()
3576 IXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(vf_target_reg), pfvfspoof); in ixgbe_set_ethertype_anti_spoofing_X550()
3579 /** ixgbe_set_source_address_pruning_X550 - Enable/Disbale src address pruning
3580 * @hw: pointer to hardware structure
3584 static void ixgbe_set_source_address_pruning_X550(struct ixgbe_hw *hw, in ixgbe_set_source_address_pruning_X550() argument
3594 pfflp = (u64)IXGBE_READ_REG(hw, IXGBE_PFFLPL); in ixgbe_set_source_address_pruning_X550()
3595 pfflp |= (u64)IXGBE_READ_REG(hw, IXGBE_PFFLPH) << 32; in ixgbe_set_source_address_pruning_X550()
3602 IXGBE_WRITE_REG(hw, IXGBE_PFFLPL, (u32)pfflp); in ixgbe_set_source_address_pruning_X550()
3603 IXGBE_WRITE_REG(hw, IXGBE_PFFLPH, (u32)(pfflp >> 32)); in ixgbe_set_source_address_pruning_X550()
3607 * ixgbe_setup_fc_backplane_x550em_a - Set up flow control
3608 * @hw: pointer to hardware structure
3610 * Called at init time to set up flow control.
3612 static s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw) in ixgbe_setup_fc_backplane_x550em_a() argument
3618 if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) { in ixgbe_setup_fc_backplane_x550em_a()
3619 hw_err(hw, "ixgbe_fc_rx_pause not valid in strict IEEE mode\n"); in ixgbe_setup_fc_backplane_x550em_a()
3620 return -EINVAL; in ixgbe_setup_fc_backplane_x550em_a()
3623 if (hw->fc.requested_mode == ixgbe_fc_default) in ixgbe_setup_fc_backplane_x550em_a()
3624 hw->fc.requested_mode = ixgbe_fc_full; in ixgbe_setup_fc_backplane_x550em_a()
3626 /* Set up the 1G and 10G flow control advertisement registers so the in ixgbe_setup_fc_backplane_x550em_a()
3627 * HW will be able to do FC autoneg once the cable is plugged in. If in ixgbe_setup_fc_backplane_x550em_a()
3630 status = hw->mac.ops.read_iosf_sb_reg(hw, in ixgbe_setup_fc_backplane_x550em_a()
3631 IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id), in ixgbe_setup_fc_backplane_x550em_a()
3635 hw_dbg(hw, "Auto-Negotiation did not complete\n"); in ixgbe_setup_fc_backplane_x550em_a()
3640 * 0: Flow control is completely disabled in ixgbe_setup_fc_backplane_x550em_a()
3641 * 1: Rx flow control is enabled (we can receive pause frames, in ixgbe_setup_fc_backplane_x550em_a()
3643 * 2: Tx flow control is enabled (we can send pause frames but in ixgbe_setup_fc_backplane_x550em_a()
3645 * 3: Both Rx and Tx flow control (symmetric) are enabled. in ixgbe_setup_fc_backplane_x550em_a()
3648 switch (hw->fc.requested_mode) { in ixgbe_setup_fc_backplane_x550em_a()
3650 /* Flow control completely disabled by software override. */ in ixgbe_setup_fc_backplane_x550em_a()
3655 /* Tx Flow control is enabled, and Rx Flow control is in ixgbe_setup_fc_backplane_x550em_a()
3662 /* Rx Flow control is enabled and Tx Flow control is in ixgbe_setup_fc_backplane_x550em_a()
3671 /* Flow control (both Rx and Tx) is enabled by SW override. */ in ixgbe_setup_fc_backplane_x550em_a()
3676 hw_err(hw, "Flow control param set incorrectly\n"); in ixgbe_setup_fc_backplane_x550em_a()
3677 return -EIO; in ixgbe_setup_fc_backplane_x550em_a()
3680 status = hw->mac.ops.write_iosf_sb_reg(hw, in ixgbe_setup_fc_backplane_x550em_a()
3681 IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id), in ixgbe_setup_fc_backplane_x550em_a()
3684 /* Restart auto-negotiation. */ in ixgbe_setup_fc_backplane_x550em_a()
3685 status = ixgbe_restart_an_internal_phy_x550em(hw); in ixgbe_setup_fc_backplane_x550em_a()
3691 * ixgbe_set_mux - Set mux for port 1 access with CS4227
3692 * @hw: pointer to hardware structure
3695 static void ixgbe_set_mux(struct ixgbe_hw *hw, u8 state) in ixgbe_set_mux() argument
3699 if (!hw->bus.lan_id) in ixgbe_set_mux()
3701 esdp = IXGBE_READ_REG(hw, IXGBE_ESDP); in ixgbe_set_mux()
3706 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp); in ixgbe_set_mux()
3707 IXGBE_WRITE_FLUSH(hw); in ixgbe_set_mux()
3711 * ixgbe_acquire_swfw_sync_X550em - Acquire SWFW semaphore
3712 * @hw: pointer to hardware structure
3717 static s32 ixgbe_acquire_swfw_sync_X550em(struct ixgbe_hw *hw, u32 mask) in ixgbe_acquire_swfw_sync_X550em() argument
3721 status = ixgbe_acquire_swfw_sync_X540(hw, mask); in ixgbe_acquire_swfw_sync_X550em()
3726 ixgbe_set_mux(hw, 1); in ixgbe_acquire_swfw_sync_X550em()
3732 * ixgbe_release_swfw_sync_X550em - Release SWFW semaphore
3733 * @hw: pointer to hardware structure
3738 static void ixgbe_release_swfw_sync_X550em(struct ixgbe_hw *hw, u32 mask) in ixgbe_release_swfw_sync_X550em() argument
3741 ixgbe_set_mux(hw, 0); in ixgbe_release_swfw_sync_X550em()
3743 ixgbe_release_swfw_sync_X540(hw, mask); in ixgbe_release_swfw_sync_X550em()
3747 * ixgbe_acquire_swfw_sync_x550em_a - Acquire SWFW semaphore
3748 * @hw: pointer to hardware structure
3753 static s32 ixgbe_acquire_swfw_sync_x550em_a(struct ixgbe_hw *hw, u32 mask) in ixgbe_acquire_swfw_sync_x550em_a() argument
3759 while (--retries) { in ixgbe_acquire_swfw_sync_x550em_a()
3762 status = ixgbe_acquire_swfw_sync_X540(hw, hmask); in ixgbe_acquire_swfw_sync_x550em_a()
3768 status = ixgbe_get_phy_token(hw); in ixgbe_acquire_swfw_sync_x550em_a()
3772 ixgbe_release_swfw_sync_X540(hw, hmask); in ixgbe_acquire_swfw_sync_x550em_a()
3773 if (status != -EAGAIN) in ixgbe_acquire_swfw_sync_x550em_a()
3782 * ixgbe_release_swfw_sync_x550em_a - Release SWFW semaphore
3783 * @hw: pointer to hardware structure
3788 static void ixgbe_release_swfw_sync_x550em_a(struct ixgbe_hw *hw, u32 mask) in ixgbe_release_swfw_sync_x550em_a() argument
3793 ixgbe_put_phy_token(hw); in ixgbe_release_swfw_sync_x550em_a()
3796 ixgbe_release_swfw_sync_X540(hw, hmask); in ixgbe_release_swfw_sync_x550em_a()
3800 * ixgbe_read_phy_reg_x550a - Reads specified PHY register
3801 * @hw: pointer to hardware structure
3810 static s32 ixgbe_read_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr, in ixgbe_read_phy_reg_x550a() argument
3813 u32 mask = hw->phy.phy_semaphore_mask | IXGBE_GSSR_TOKEN_SM; in ixgbe_read_phy_reg_x550a()
3816 if (hw->mac.ops.acquire_swfw_sync(hw, mask)) in ixgbe_read_phy_reg_x550a()
3817 return -EBUSY; in ixgbe_read_phy_reg_x550a()
3819 status = hw->phy.ops.read_reg_mdi(hw, reg_addr, device_type, phy_data); in ixgbe_read_phy_reg_x550a()
3821 hw->mac.ops.release_swfw_sync(hw, mask); in ixgbe_read_phy_reg_x550a()
3827 * ixgbe_write_phy_reg_x550a - Writes specified PHY register
3828 * @hw: pointer to hardware structure
3836 static s32 ixgbe_write_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr, in ixgbe_write_phy_reg_x550a() argument
3839 u32 mask = hw->phy.phy_semaphore_mask | IXGBE_GSSR_TOKEN_SM; in ixgbe_write_phy_reg_x550a()
3842 if (hw->mac.ops.acquire_swfw_sync(hw, mask)) in ixgbe_write_phy_reg_x550a()
3843 return -EBUSY; in ixgbe_write_phy_reg_x550a()
3845 status = ixgbe_write_phy_reg_mdi(hw, reg_addr, device_type, phy_data); in ixgbe_write_phy_reg_x550a()
3846 hw->mac.ops.release_swfw_sync(hw, mask); in ixgbe_write_phy_reg_x550a()