Lines Matching +full:mac +full:- +full:phy
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 1999 - 2024 Intel Corporation. */
19 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_get_invariants_X550_x() local
20 struct ixgbe_phy_info *phy = &hw->phy; in ixgbe_get_invariants_X550_x() local
21 struct ixgbe_link_info *link = &hw->link; in ixgbe_get_invariants_X550_x()
26 if (mac->ops.get_media_type(hw) != ixgbe_media_type_copper) in ixgbe_get_invariants_X550_x()
27 phy->ops.set_phy_power = NULL; in ixgbe_get_invariants_X550_x()
29 link->addr = IXGBE_CS4227; in ixgbe_get_invariants_X550_x()
36 struct ixgbe_phy_info *phy = &hw->phy; in ixgbe_get_invariants_X550_x_fw() local
41 phy->ops.set_phy_power = NULL; in ixgbe_get_invariants_X550_x_fw()
48 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_get_invariants_X550_a() local
49 struct ixgbe_phy_info *phy = &hw->phy; in ixgbe_get_invariants_X550_a() local
54 if (mac->ops.get_media_type(hw) != ixgbe_media_type_copper) in ixgbe_get_invariants_X550_a()
55 phy->ops.set_phy_power = NULL; in ixgbe_get_invariants_X550_a()
62 struct ixgbe_phy_info *phy = &hw->phy; in ixgbe_get_invariants_X550_a_fw() local
67 phy->ops.set_phy_power = NULL; in ixgbe_get_invariants_X550_a_fw()
72 /** ixgbe_setup_mux_ctl - Setup ESDP register for I2C mux control
79 if (hw->bus.lan_id) { in ixgbe_setup_mux_ctl()
89 * ixgbe_read_cs4227 - Read CS4227 register
98 return hw->link.ops.read_link_unlocked(hw, hw->link.addr, reg, value); in ixgbe_read_cs4227()
102 * ixgbe_write_cs4227 - Write CS4227 register
111 return hw->link.ops.write_link_unlocked(hw, hw->link.addr, reg, value); in ixgbe_write_cs4227()
115 * ixgbe_read_pe - Read register from port expander
133 * ixgbe_write_pe - Write register to port expander
152 * ixgbe_reset_cs4227 - Reset CS4227 using port expander
211 return -EIO; in ixgbe_reset_cs4227()
217 return -EIO; in ixgbe_reset_cs4227()
224 * ixgbe_check_cs4227 - Check CS4227 and reset as needed
229 u32 swfw_mask = hw->phy.phy_semaphore_mask; in ixgbe_check_cs4227()
235 status = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask); in ixgbe_check_cs4227()
251 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_check_cs4227()
256 status = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask); in ixgbe_check_cs4227()
275 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_check_cs4227()
277 status = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask); in ixgbe_check_cs4227()
288 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_check_cs4227()
289 msleep(hw->eeprom.semaphore_delay); in ixgbe_check_cs4227()
292 /** ixgbe_identify_phy_x550em - Get PHY type based on device id
299 switch (hw->device_id) { in ixgbe_identify_phy_x550em()
301 if (hw->bus.lan_id) in ixgbe_identify_phy_x550em()
302 hw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY1_SM; in ixgbe_identify_phy_x550em()
304 hw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY0_SM; in ixgbe_identify_phy_x550em()
308 hw->phy.phy_semaphore_mask = IXGBE_GSSR_SHARED_I2C_SM; in ixgbe_identify_phy_x550em()
315 hw->phy.type = ixgbe_phy_x550em_kx4; in ixgbe_identify_phy_x550em()
318 hw->phy.type = ixgbe_phy_x550em_xfi; in ixgbe_identify_phy_x550em()
323 hw->phy.type = ixgbe_phy_x550em_kr; in ixgbe_identify_phy_x550em()
326 if (hw->bus.lan_id) in ixgbe_identify_phy_x550em()
327 hw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY1_SM; in ixgbe_identify_phy_x550em()
329 hw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY0_SM; in ixgbe_identify_phy_x550em()
334 hw->phy.type = ixgbe_phy_ext_1g_t; in ixgbe_identify_phy_x550em()
338 hw->phy.type = ixgbe_phy_fw; in ixgbe_identify_phy_x550em()
339 hw->phy.ops.read_reg = NULL; in ixgbe_identify_phy_x550em()
340 hw->phy.ops.write_reg = NULL; in ixgbe_identify_phy_x550em()
341 if (hw->bus.lan_id) in ixgbe_identify_phy_x550em()
342 hw->phy.phy_semaphore_mask |= IXGBE_GSSR_PHY1_SM; in ixgbe_identify_phy_x550em()
344 hw->phy.phy_semaphore_mask |= IXGBE_GSSR_PHY0_SM; in ixgbe_identify_phy_x550em()
355 return -EOPNOTSUPP; in ixgbe_read_phy_reg_x550em()
361 return -EOPNOTSUPP; in ixgbe_write_phy_reg_x550em()
365 * ixgbe_read_i2c_combined_generic - Perform I2C read combined operation
380 * ixgbe_read_i2c_combined_generic_unlocked - Do I2C read combined operation
396 * ixgbe_write_i2c_combined_generic - Perform I2C write combined operation
411 * ixgbe_write_i2c_combined_generic_unlocked - Do I2C write combined operation
427 * ixgbe_fw_phy_activity - Perform an activity on a PHY
430 * @data: Pointer to 4 32-bit words of data
448 hic.cmd.port_number = hw->bus.lan_id; in ixgbe_fw_phy_activity()
465 --retries; in ixgbe_fw_phy_activity()
468 return -EIO; in ixgbe_fw_phy_activity()
484 * ixgbe_get_phy_id_fw - Get the phy ID via firmware command
497 if (hw->phy.id) in ixgbe_get_phy_id_fw()
504 hw->phy.speeds_supported = 0; in ixgbe_get_phy_id_fw()
508 hw->phy.speeds_supported |= ixgbe_fw_map[i].phy_speed; in ixgbe_get_phy_id_fw()
511 hw->phy.id = info[0] & FW_PHY_INFO_ID_HI_MASK; in ixgbe_get_phy_id_fw()
513 hw->phy.id |= phy_id_lo & IXGBE_PHY_REVISION_MASK; in ixgbe_get_phy_id_fw()
514 hw->phy.revision = phy_id_lo & ~IXGBE_PHY_REVISION_MASK; in ixgbe_get_phy_id_fw()
515 if (!hw->phy.id || hw->phy.id == IXGBE_PHY_REVISION_MASK) in ixgbe_get_phy_id_fw()
516 return -EFAULT; in ixgbe_get_phy_id_fw()
518 hw->phy.autoneg_advertised = hw->phy.speeds_supported; in ixgbe_get_phy_id_fw()
519 hw->phy.eee_speeds_supported = IXGBE_LINK_SPEED_100_FULL | in ixgbe_get_phy_id_fw()
521 hw->phy.eee_speeds_advertised = hw->phy.eee_speeds_supported; in ixgbe_get_phy_id_fw()
526 * ixgbe_identify_phy_fw - Get PHY type based on firmware command
533 if (hw->bus.lan_id) in ixgbe_identify_phy_fw()
534 hw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY1_SM; in ixgbe_identify_phy_fw()
536 hw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY0_SM; in ixgbe_identify_phy_fw()
538 hw->phy.type = ixgbe_phy_fw; in ixgbe_identify_phy_fw()
539 hw->phy.ops.read_reg = NULL; in ixgbe_identify_phy_fw()
540 hw->phy.ops.write_reg = NULL; in ixgbe_identify_phy_fw()
545 * ixgbe_shutdown_fw_phy - Shutdown a firmware-controlled PHY
559 * ixgbe_setup_fw_link - Setup firmware-controlled PHYs
568 if (hw->phy.reset_disable || ixgbe_check_reset_blocked(hw)) in ixgbe_setup_fw_link()
571 if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) { in ixgbe_setup_fw_link()
573 return -EINVAL; in ixgbe_setup_fw_link()
576 switch (hw->fc.requested_mode) { in ixgbe_setup_fw_link()
594 if (hw->phy.autoneg_advertised & ixgbe_fw_map[i].phy_speed) in ixgbe_setup_fw_link()
599 if (hw->phy.eee_speeds_advertised) in ixgbe_setup_fw_link()
607 return -EIO; in ixgbe_setup_fw_link()
613 * ixgbe_fc_autoneg_fw - Set up flow control for FW-controlled PHYs
620 if (hw->fc.requested_mode == ixgbe_fc_default) in ixgbe_fc_autoneg_fw()
621 hw->fc.requested_mode = ixgbe_fc_full; in ixgbe_fc_autoneg_fw()
626 /** ixgbe_init_eeprom_params_X550 - Initialize EEPROM params
634 struct ixgbe_eeprom_info *eeprom = &hw->eeprom; in ixgbe_init_eeprom_params_X550()
636 if (eeprom->type == ixgbe_eeprom_uninitialized) { in ixgbe_init_eeprom_params_X550()
640 eeprom->semaphore_delay = 10; in ixgbe_init_eeprom_params_X550()
641 eeprom->type = ixgbe_flash; in ixgbe_init_eeprom_params_X550()
645 eeprom->word_size = BIT(eeprom_size + in ixgbe_init_eeprom_params_X550()
649 eeprom->type, eeprom->word_size); in ixgbe_init_eeprom_params_X550()
656 * ixgbe_iosf_wait - Wait for IOSF command completion
682 return -EIO; in ixgbe_iosf_wait()
688 /** ixgbe_read_iosf_sb_reg_x550 - Writes a value to specified register of the
691 * @reg_addr: 32 bit PHY register to write
702 ret = hw->mac.ops.acquire_swfw_sync(hw, gssr); in ixgbe_read_iosf_sb_reg_x550()
721 ret = -EIO; in ixgbe_read_iosf_sb_reg_x550()
729 hw->mac.ops.release_swfw_sync(hw, gssr); in ixgbe_read_iosf_sb_reg_x550()
734 * ixgbe_get_phy_token - Get the token for shared PHY access
746 token_cmd.port_number = hw->bus.lan_id; in ixgbe_get_phy_token()
757 return -EIO; in ixgbe_get_phy_token()
759 return -EAGAIN; in ixgbe_get_phy_token()
763 * ixgbe_put_phy_token - Put the token for shared PHY access
775 token_cmd.port_number = hw->bus.lan_id; in ixgbe_put_phy_token()
785 return -EIO; in ixgbe_put_phy_token()
789 * ixgbe_write_iosf_sb_reg_x550a - Write to IOSF PHY register
791 * @reg_addr: 32 bit PHY register to write
805 write_cmd.port_number = hw->bus.lan_id; in ixgbe_write_iosf_sb_reg_x550a()
815 * ixgbe_read_iosf_sb_reg_x550a - Read from IOSF PHY register
817 * @reg_addr: 32 bit PHY register to write
835 hic.cmd.port_number = hw->bus.lan_id; in ixgbe_read_iosf_sb_reg_x550a()
848 /** ixgbe_read_ee_hostif_buffer_X550- Read EEPROM word(s) using hostif
867 status = hw->mac.ops.acquire_swfw_sync(hw, mask); in ixgbe_read_ee_hostif_buffer_X550()
869 hw_dbg(hw, "EEPROM read buffer - semaphore failed\n"); in ixgbe_read_ee_hostif_buffer_X550()
912 words -= words_to_read; in ixgbe_read_ee_hostif_buffer_X550()
916 hw->mac.ops.release_swfw_sync(hw, mask); in ixgbe_read_ee_hostif_buffer_X550()
920 /** ixgbe_checksum_ptr_x550 - Checksum one pointer region
949 return -EINVAL; in ixgbe_checksum_ptr_x550()
962 (ptr + length) >= hw->eeprom.word_size) in ixgbe_checksum_ptr_x550()
967 return -EINVAL; in ixgbe_checksum_ptr_x550()
969 for (i = start; length; i++, length--) { in ixgbe_checksum_ptr_x550()
989 /** ixgbe_calc_checksum_X550 - Calculates and returns the checksum
994 * Returns a negative error code on error, or the 16-bit checksum
1005 hw->eeprom.ops.init_params(hw); in ixgbe_calc_checksum_X550()
1019 return -EINVAL; in ixgbe_calc_checksum_X550()
1023 /* For X550 hardware include 0x0-0x41 in the checksum, skip the in ixgbe_calc_checksum_X550()
1030 /* Include all data from pointers 0x3, 0x6-0xE. This excludes the in ixgbe_calc_checksum_X550()
1031 * FW, PHY module, and PCIe Expansion/Option ROM pointers. in ixgbe_calc_checksum_X550()
1041 pointer >= hw->eeprom.word_size) in ixgbe_calc_checksum_X550()
1063 checksum = (u16)IXGBE_EEPROM_SUM - checksum; in ixgbe_calc_checksum_X550()
1068 /** ixgbe_calc_eeprom_checksum_X550 - Calculates and returns the checksum
1071 * Returns a negative error code on error, or the 16-bit checksum
1078 /** ixgbe_read_ee_hostif_X550 - Read EEPROM word using a host interface command
1101 status = hw->mac.ops.acquire_swfw_sync(hw, mask); in ixgbe_read_ee_hostif_X550()
1112 hw->mac.ops.release_swfw_sync(hw, mask); in ixgbe_read_ee_hostif_X550()
1116 /** ixgbe_validate_eeprom_checksum_X550 - Validate EEPROM checksum
1134 status = hw->eeprom.ops.read(hw, 0, &checksum); in ixgbe_validate_eeprom_checksum_X550()
1140 status = hw->eeprom.ops.calc_checksum(hw); in ixgbe_validate_eeprom_checksum_X550()
1155 status = -EIO; in ixgbe_validate_eeprom_checksum_X550()
1166 /** ixgbe_write_ee_hostif_X550 - Write EEPROM word using hostif
1194 /** ixgbe_write_ee_hostif_X550 - Write EEPROM word using hostif
1205 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) == 0) { in ixgbe_write_ee_hostif_X550()
1207 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); in ixgbe_write_ee_hostif_X550()
1210 status = -EBUSY; in ixgbe_write_ee_hostif_X550()
1216 /** ixgbe_update_flash_X550 - Instruct HW to copy EEPROM to Flash device
1237 * ixgbe_get_bus_info_X550em - Set PCI bus info
1245 hw->bus.type = ixgbe_bus_type_internal; in ixgbe_get_bus_info_X550em()
1246 hw->bus.width = ixgbe_bus_width_unknown; in ixgbe_get_bus_info_X550em()
1247 hw->bus.speed = ixgbe_bus_speed_unknown; in ixgbe_get_bus_info_X550em()
1249 hw->mac.ops.set_lan_id(hw); in ixgbe_get_bus_info_X550em()
1255 * ixgbe_fw_recovery_mode_X550 - Check FW NVM recovery mode
1268 /** ixgbe_disable_rx_x550 - Disable RX unit
1284 hw->mac.set_lben = true; in ixgbe_disable_rx_x550()
1286 hw->mac.set_lben = false; in ixgbe_disable_rx_x550()
1292 fw_cmd.port_number = hw->bus.lan_id; in ixgbe_disable_rx_x550()
1298 /* If we fail - disable RX using register write */ in ixgbe_disable_rx_x550()
1309 /** ixgbe_update_eeprom_checksum_X550 - Updates the EEPROM checksum and flash
1347 /** ixgbe_write_ee_hostif_buffer_X550 - Write EEPROM word(s) using hostif
1364 status = hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM); in ixgbe_write_ee_hostif_buffer_X550()
1366 hw_dbg(hw, "EEPROM write buffer - semaphore failed\n"); in ixgbe_write_ee_hostif_buffer_X550()
1379 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); in ixgbe_write_ee_hostif_buffer_X550()
1384 /** ixgbe_write_iosf_sb_reg_x550 - Writes a value to specified register of the
1388 * @reg_addr: 32 bit PHY register to write
1399 ret = hw->mac.ops.acquire_swfw_sync(hw, gssr); in ixgbe_write_iosf_sb_reg_x550()
1421 return -EIO; in ixgbe_write_iosf_sb_reg_x550()
1425 hw->mac.ops.release_swfw_sync(hw, gssr); in ixgbe_write_iosf_sb_reg_x550()
1430 * ixgbe_setup_ixfi_x550em_x - MAC specific iXFI configuration
1442 IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id), in ixgbe_setup_ixfi_x550em_x()
1449 IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id), in ixgbe_setup_ixfi_x550em_x()
1456 IXGBE_KRM_DSP_TXFFE_STATE_4(hw->bus.lan_id), in ixgbe_setup_ixfi_x550em_x()
1465 IXGBE_KRM_DSP_TXFFE_STATE_4(hw->bus.lan_id), in ixgbe_setup_ixfi_x550em_x()
1471 IXGBE_KRM_DSP_TXFFE_STATE_5(hw->bus.lan_id), in ixgbe_setup_ixfi_x550em_x()
1480 IXGBE_KRM_DSP_TXFFE_STATE_5(hw->bus.lan_id), in ixgbe_setup_ixfi_x550em_x()
1487 IXGBE_KRM_TX_COEFF_CTRL_1(hw->bus.lan_id), in ixgbe_setup_ixfi_x550em_x()
1497 IXGBE_KRM_TX_COEFF_CTRL_1(hw->bus.lan_id), in ixgbe_setup_ixfi_x550em_x()
1503 * ixgbe_restart_an_internal_phy_x550em - restart autonegotiation for the
1504 * internal PHY
1512 /* Restart auto-negotiation. */ in ixgbe_restart_an_internal_phy_x550em()
1513 status = hw->mac.ops.read_iosf_sb_reg(hw, in ixgbe_restart_an_internal_phy_x550em()
1514 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_restart_an_internal_phy_x550em()
1518 hw_dbg(hw, "Auto-negotiation did not complete\n"); in ixgbe_restart_an_internal_phy_x550em()
1523 status = hw->mac.ops.write_iosf_sb_reg(hw, in ixgbe_restart_an_internal_phy_x550em()
1524 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_restart_an_internal_phy_x550em()
1527 if (hw->mac.type == ixgbe_mac_x550em_a) { in ixgbe_restart_an_internal_phy_x550em()
1531 status = hw->mac.ops.read_iosf_sb_reg(hw, in ixgbe_restart_an_internal_phy_x550em()
1532 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_restart_an_internal_phy_x550em()
1536 hw_dbg(hw, "Auto-negotiation did not complete\n"); in ixgbe_restart_an_internal_phy_x550em()
1541 status = hw->mac.ops.write_iosf_sb_reg(hw, in ixgbe_restart_an_internal_phy_x550em()
1542 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_restart_an_internal_phy_x550em()
1549 /** ixgbe_setup_ixfi_x550em - Configure the KR PHY for iXFI mode.
1553 * Configures the integrated KR PHY to use iXFI mode. Used to connect an
1554 * internal and external PHY at a specific speed, without autonegotiation.
1558 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_setup_ixfi_x550em() local
1563 if (mac->type != ixgbe_mac_X550EM_x) in ixgbe_setup_ixfi_x550em()
1564 return -EIO; in ixgbe_setup_ixfi_x550em()
1568 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_ixfi_x550em()
1576 /* Select forced link speed for internal PHY. */ in ixgbe_setup_ixfi_x550em()
1585 /* Other link speeds are not supported by internal KR PHY. */ in ixgbe_setup_ixfi_x550em()
1586 return -EINVAL; in ixgbe_setup_ixfi_x550em()
1590 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_ixfi_x550em()
1596 if (hw->mac.type == ixgbe_mac_X550EM_x) { in ixgbe_setup_ixfi_x550em()
1609 * ixgbe_supported_sfp_modules_X550em - Check if SFP module type is supported
1615 switch (hw->phy.sfp_type) { in ixgbe_supported_sfp_modules_X550em()
1617 return -ENOENT; in ixgbe_supported_sfp_modules_X550em()
1636 return -EOPNOTSUPP; in ixgbe_supported_sfp_modules_X550em()
1643 * ixgbe_setup_mac_link_sfp_x550em - Configure the KR PHY for SFP.
1648 * Configures the extern PHY and the integrated KR PHY for SFP support.
1664 * not accepted in the setup MAC link flow. in ixgbe_setup_mac_link_sfp_x550em()
1666 if (status == -ENOENT) in ixgbe_setup_mac_link_sfp_x550em()
1672 /* Configure internal PHY for KR/KX. */ in ixgbe_setup_mac_link_sfp_x550em()
1676 reg_slice = IXGBE_CS4227_LINE_SPARE24_LSB + (hw->bus.lan_id << 12); in ixgbe_setup_mac_link_sfp_x550em()
1682 status = hw->link.ops.write_link(hw, hw->link.addr, reg_slice, in ixgbe_setup_mac_link_sfp_x550em()
1689 * ixgbe_setup_sfi_x550a - Configure the internal PHY for native SFI mode
1693 * Configures the integrated PHY for native SFI mode. Used to connect the
1694 * internal PHY directly to an SFP cage, without autonegotiation.
1698 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_setup_sfi_x550a() local
1703 status = mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sfi_x550a()
1704 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_sfi_x550a()
1714 /* Select forced link speed for internal PHY. */ in ixgbe_setup_sfi_x550a()
1723 /* Other link speeds are not supported by internal PHY. */ in ixgbe_setup_sfi_x550a()
1724 return -EINVAL; in ixgbe_setup_sfi_x550a()
1727 status = mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sfi_x550a()
1728 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_sfi_x550a()
1738 * ixgbe_setup_mac_link_sfp_n - Setup internal PHY for native SFP
1743 * Configure the integrated PHY for native SFP support.
1757 * SFP not present error is not excepted in the setup MAC link flow. in ixgbe_setup_mac_link_sfp_n()
1759 if (ret_val == -ENOENT) in ixgbe_setup_mac_link_sfp_n()
1765 /* Configure internal PHY for native SFI based on module type */ in ixgbe_setup_mac_link_sfp_n()
1766 ret_val = hw->mac.ops.read_iosf_sb_reg(hw, in ixgbe_setup_mac_link_sfp_n()
1767 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_mac_link_sfp_n()
1776 ret_val = hw->mac.ops.write_iosf_sb_reg(hw, in ixgbe_setup_mac_link_sfp_n()
1777 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_mac_link_sfp_n()
1787 * ixgbe_setup_mac_link_sfp_x550a - Setup internal PHY for SFP
1792 * Configure the integrated PHY for SFP support.
1807 * SFP not present error is not excepted in the setup MAC link flow. in ixgbe_setup_mac_link_sfp_x550a()
1809 if (ret_val == -ENOENT) in ixgbe_setup_mac_link_sfp_x550a()
1815 /* Configure internal PHY for KR/KX. */ in ixgbe_setup_mac_link_sfp_x550a()
1818 if (hw->phy.mdio.prtad == MDIO_PRTAD_NONE) in ixgbe_setup_mac_link_sfp_x550a()
1819 return -EFAULT; in ixgbe_setup_mac_link_sfp_x550a()
1821 /* Get external PHY SKU id */ in ixgbe_setup_mac_link_sfp_x550a()
1822 ret_val = hw->phy.ops.read_reg(hw, IXGBE_CS4227_EFUSE_PDF_SKU, in ixgbe_setup_mac_link_sfp_x550a()
1827 /* When configuring quad port CS4223, the MAC instance is part in ixgbe_setup_mac_link_sfp_x550a()
1831 slice_offset = (hw->bus.lan_id + in ixgbe_setup_mac_link_sfp_x550a()
1832 (hw->bus.instance_id << 1)) << 12; in ixgbe_setup_mac_link_sfp_x550a()
1834 slice_offset = hw->bus.lan_id << 12; in ixgbe_setup_mac_link_sfp_x550a()
1839 ret_val = hw->phy.ops.read_reg(hw, reg_slice, in ixgbe_setup_mac_link_sfp_x550a()
1852 ret_val = hw->phy.ops.write_reg(hw, reg_slice, in ixgbe_setup_mac_link_sfp_x550a()
1858 return hw->phy.ops.read_reg(hw, reg_slice, in ixgbe_setup_mac_link_sfp_x550a()
1863 * ixgbe_setup_mac_link_t_X550em - Sets the auto advertised link speed
1868 * Setup internal/external PHY link speed based on link speed, then set
1869 * external PHY auto advertised link speed.
1880 /* Setup internal/external PHY link speed to iXFI (10G), unless in ixgbe_setup_mac_link_t_X550em()
1890 if (hw->mac.type == ixgbe_mac_X550EM_x && in ixgbe_setup_mac_link_t_X550em()
1891 !(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE)) { in ixgbe_setup_mac_link_t_X550em()
1898 return hw->phy.ops.setup_link_speed(hw, speed, autoneg_wait); in ixgbe_setup_mac_link_t_X550em()
1901 /** ixgbe_check_link_t_X550em - Determine link and speed status
1907 * Check that both the MAC and X557 external PHY have link.
1917 if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_copper) in ixgbe_check_link_t_X550em()
1918 return -EIO; in ixgbe_check_link_t_X550em()
1923 /* If check link fails or MAC link is not up, then return */ in ixgbe_check_link_t_X550em()
1927 /* MAC link is up, so check external PHY link. in ixgbe_check_link_t_X550em()
1930 * back-to-back reads. in ixgbe_check_link_t_X550em()
1933 status = hw->phy.ops.read_reg(hw, MDIO_STAT1, MDIO_MMD_AN, in ixgbe_check_link_t_X550em()
1940 /* If external PHY link is not up, then indicate link not up */ in ixgbe_check_link_t_X550em()
1948 * ixgbe_setup_sgmii - Set up link for sgmii
1957 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_setup_sgmii() local
1961 rc = mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sgmii()
1962 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_sgmii()
1972 rc = mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sgmii()
1973 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_sgmii()
1978 rc = mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sgmii()
1979 IXGBE_KRM_SGMII_CTRL(hw->bus.lan_id), in ixgbe_setup_sgmii()
1986 rc = mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sgmii()
1987 IXGBE_KRM_SGMII_CTRL(hw->bus.lan_id), in ixgbe_setup_sgmii()
1992 rc = mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sgmii()
1993 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_sgmii()
1998 rc = mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sgmii()
1999 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_sgmii()
2010 rc = mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sgmii()
2011 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_sgmii()
2021 * ixgbe_setup_sgmii_fw - Set up link for sgmii with firmware-controlled PHYs
2029 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_setup_sgmii_fw() local
2033 rc = mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sgmii_fw()
2034 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_sgmii_fw()
2044 rc = mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sgmii_fw()
2045 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_sgmii_fw()
2050 rc = mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sgmii_fw()
2051 IXGBE_KRM_SGMII_CTRL(hw->bus.lan_id), in ixgbe_setup_sgmii_fw()
2058 rc = mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sgmii_fw()
2059 IXGBE_KRM_SGMII_CTRL(hw->bus.lan_id), in ixgbe_setup_sgmii_fw()
2064 rc = mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sgmii_fw()
2065 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_sgmii_fw()
2070 rc = mac->ops.read_iosf_sb_reg(hw, in ixgbe_setup_sgmii_fw()
2071 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_sgmii_fw()
2082 rc = mac->ops.write_iosf_sb_reg(hw, in ixgbe_setup_sgmii_fw()
2083 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_sgmii_fw()
2090 return hw->phy.ops.setup_link_speed(hw, speed, autoneg_wait); in ixgbe_setup_sgmii_fw()
2094 * ixgbe_fc_autoneg_sgmii_x550em_a - Enable flow control IEEE clause 37
2103 int status = -EIO; in ixgbe_fc_autoneg_sgmii_x550em_a()
2108 * - FC autoneg is disabled, or if in ixgbe_fc_autoneg_sgmii_x550em_a()
2109 * - link is not up. in ixgbe_fc_autoneg_sgmii_x550em_a()
2111 if (hw->fc.disable_fc_autoneg) in ixgbe_fc_autoneg_sgmii_x550em_a()
2114 hw->mac.ops.check_link(hw, &speed, &link_up, false); in ixgbe_fc_autoneg_sgmii_x550em_a()
2118 /* Check if auto-negotiation has completed */ in ixgbe_fc_autoneg_sgmii_x550em_a()
2121 status = -EIO; in ixgbe_fc_autoneg_sgmii_x550em_a()
2134 hw->fc.fc_was_autonegged = true; in ixgbe_fc_autoneg_sgmii_x550em_a()
2136 hw->fc.fc_was_autonegged = false; in ixgbe_fc_autoneg_sgmii_x550em_a()
2137 hw->fc.current_mode = hw->fc.requested_mode; in ixgbe_fc_autoneg_sgmii_x550em_a()
2141 /** ixgbe_init_mac_link_ops_X550em_a - Init mac link function pointers
2146 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_init_mac_link_ops_X550em_a() local
2148 switch (mac->ops.get_media_type(hw)) { in ixgbe_init_mac_link_ops_X550em_a()
2150 mac->ops.setup_fc = NULL; in ixgbe_init_mac_link_ops_X550em_a()
2151 mac->ops.fc_autoneg = ixgbe_fc_autoneg_fiber_x550em_a; in ixgbe_init_mac_link_ops_X550em_a()
2154 if (hw->device_id != IXGBE_DEV_ID_X550EM_A_1G_T && in ixgbe_init_mac_link_ops_X550em_a()
2155 hw->device_id != IXGBE_DEV_ID_X550EM_A_1G_T_L) { in ixgbe_init_mac_link_ops_X550em_a()
2156 mac->ops.setup_link = ixgbe_setup_mac_link_t_X550em; in ixgbe_init_mac_link_ops_X550em_a()
2159 mac->ops.fc_autoneg = ixgbe_fc_autoneg_sgmii_x550em_a; in ixgbe_init_mac_link_ops_X550em_a()
2160 mac->ops.setup_fc = ixgbe_fc_autoneg_fw; in ixgbe_init_mac_link_ops_X550em_a()
2161 mac->ops.setup_link = ixgbe_setup_sgmii_fw; in ixgbe_init_mac_link_ops_X550em_a()
2162 mac->ops.check_link = ixgbe_check_mac_link_generic; in ixgbe_init_mac_link_ops_X550em_a()
2165 mac->ops.fc_autoneg = ixgbe_fc_autoneg_backplane_x550em_a; in ixgbe_init_mac_link_ops_X550em_a()
2166 mac->ops.setup_fc = ixgbe_setup_fc_backplane_x550em_a; in ixgbe_init_mac_link_ops_X550em_a()
2173 /** ixgbe_init_mac_link_ops_X550em - init mac link function pointers
2178 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_init_mac_link_ops_X550em() local
2180 mac->ops.setup_fc = ixgbe_setup_fc_x550em; in ixgbe_init_mac_link_ops_X550em()
2182 switch (mac->ops.get_media_type(hw)) { in ixgbe_init_mac_link_ops_X550em()
2187 mac->ops.disable_tx_laser = NULL; in ixgbe_init_mac_link_ops_X550em()
2188 mac->ops.enable_tx_laser = NULL; in ixgbe_init_mac_link_ops_X550em()
2189 mac->ops.flap_tx_laser = NULL; in ixgbe_init_mac_link_ops_X550em()
2190 mac->ops.setup_link = ixgbe_setup_mac_link_multispeed_fiber; in ixgbe_init_mac_link_ops_X550em()
2191 switch (hw->device_id) { in ixgbe_init_mac_link_ops_X550em()
2193 mac->ops.setup_mac_link = ixgbe_setup_mac_link_sfp_n; in ixgbe_init_mac_link_ops_X550em()
2196 mac->ops.setup_mac_link = in ixgbe_init_mac_link_ops_X550em()
2200 mac->ops.setup_mac_link = in ixgbe_init_mac_link_ops_X550em()
2204 mac->ops.set_rate_select_speed = in ixgbe_init_mac_link_ops_X550em()
2208 if (hw->device_id == IXGBE_DEV_ID_X550EM_X_1G_T) in ixgbe_init_mac_link_ops_X550em()
2210 mac->ops.setup_link = ixgbe_setup_mac_link_t_X550em; in ixgbe_init_mac_link_ops_X550em()
2211 mac->ops.setup_fc = ixgbe_setup_fc_generic; in ixgbe_init_mac_link_ops_X550em()
2212 mac->ops.check_link = ixgbe_check_link_t_X550em; in ixgbe_init_mac_link_ops_X550em()
2215 if (hw->device_id == IXGBE_DEV_ID_X550EM_A_SGMII || in ixgbe_init_mac_link_ops_X550em()
2216 hw->device_id == IXGBE_DEV_ID_X550EM_A_SGMII_L) in ixgbe_init_mac_link_ops_X550em()
2217 mac->ops.setup_link = ixgbe_setup_sgmii; in ixgbe_init_mac_link_ops_X550em()
2224 if (hw->mac.type == ixgbe_mac_x550em_a) in ixgbe_init_mac_link_ops_X550em()
2228 /** ixgbe_setup_sfp_modules_X550em - Setup SFP module
2242 hw->phy.ops.reset = NULL; in ixgbe_setup_sfp_modules_X550em()
2247 /** ixgbe_get_link_capabilities_x550em - Determines link capabilities
2256 if (hw->phy.type == ixgbe_phy_fw) { in ixgbe_get_link_capabilities_X550em()
2258 *speed = hw->phy.speeds_supported; in ixgbe_get_link_capabilities_X550em()
2263 if (hw->phy.media_type == ixgbe_media_type_fiber) { in ixgbe_get_link_capabilities_X550em()
2264 /* CS4227 SFP must not enable auto-negotiation */ in ixgbe_get_link_capabilities_X550em()
2267 if (hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || in ixgbe_get_link_capabilities_X550em()
2268 hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1 || in ixgbe_get_link_capabilities_X550em()
2269 hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 || in ixgbe_get_link_capabilities_X550em()
2270 hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1) { in ixgbe_get_link_capabilities_X550em()
2276 if (hw->phy.multispeed_fiber) in ixgbe_get_link_capabilities_X550em()
2282 switch (hw->phy.type) { in ixgbe_get_link_capabilities_X550em()
2297 if (hw->mac.type == ixgbe_mac_x550em_a) { in ixgbe_get_link_capabilities_X550em()
2299 if (hw->phy.nw_mng_if_sel & in ixgbe_get_link_capabilities_X550em()
2303 } else if (hw->device_id == in ixgbe_get_link_capabilities_X550em()
2321 * ixgbe_get_lasi_ext_t_x550em - Determime external Base T PHY interrupt cause
2324 * PHY interrupt is lsc
2327 * Determime if external Base T PHY interrupt cause is high temperature
2340 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_CHIP_STD_INT_FLAG, in ixgbe_get_lasi_ext_t_x550em()
2347 /* Vendor Auto-Neg alarm triggered or Global alarm 1 triggered */ in ixgbe_get_lasi_ext_t_x550em()
2348 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_INT_CHIP_VEN_FLAG, in ixgbe_get_lasi_ext_t_x550em()
2357 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_ALARM_1, in ixgbe_get_lasi_ext_t_x550em()
2366 /* power down the PHY in case the PHY FW didn't already */ in ixgbe_get_lasi_ext_t_x550em()
2369 return -EIO; in ixgbe_get_lasi_ext_t_x550em()
2373 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_FAULT_MSG, in ixgbe_get_lasi_ext_t_x550em()
2381 /* power down the PHY in case the PHY FW didn't */ in ixgbe_get_lasi_ext_t_x550em()
2384 return -EIO; in ixgbe_get_lasi_ext_t_x550em()
2389 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_CHIP_STD_INT_FLAG, in ixgbe_get_lasi_ext_t_x550em()
2396 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_VENDOR_TX_ALARM2, in ixgbe_get_lasi_ext_t_x550em()
2410 * ixgbe_enable_lasi_ext_t_x550em - Enable external Base T PHY interrupts
2414 * Base T PHY
2416 * Returns PHY access status
2430 * of the link configurations of the external PHY and correspondingly in ixgbe_enable_lasi_ext_t_x550em()
2432 * not support auto-negotiation. This is not required for X553 devices in ixgbe_enable_lasi_ext_t_x550em()
2433 * having KR support, which performs auto-negotiations and which is used in ixgbe_enable_lasi_ext_t_x550em()
2434 * as the internal link to the external PHY. Hence adding a check here in ixgbe_enable_lasi_ext_t_x550em()
2437 if (hw->mac.type != ixgbe_mac_x550em_a) { in ixgbe_enable_lasi_ext_t_x550em()
2438 status = hw->phy.ops.read_reg(hw, in ixgbe_enable_lasi_ext_t_x550em()
2446 status = hw->phy.ops.write_reg(hw, in ixgbe_enable_lasi_ext_t_x550em()
2454 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_INT_MASK, in ixgbe_enable_lasi_ext_t_x550em()
2463 status = hw->phy.ops.write_reg(hw, IXGBE_MDIO_GLOBAL_INT_MASK, in ixgbe_enable_lasi_ext_t_x550em()
2469 /* Enable vendor Auto-Neg alarm and Global Interrupt Mask 1 alarm */ in ixgbe_enable_lasi_ext_t_x550em()
2470 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_INT_CHIP_VEN_MASK, in ixgbe_enable_lasi_ext_t_x550em()
2479 status = hw->phy.ops.write_reg(hw, IXGBE_MDIO_GLOBAL_INT_CHIP_VEN_MASK, in ixgbe_enable_lasi_ext_t_x550em()
2485 /* Enable chip-wide vendor alarm */ in ixgbe_enable_lasi_ext_t_x550em()
2486 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_INT_CHIP_STD_MASK, in ixgbe_enable_lasi_ext_t_x550em()
2494 status = hw->phy.ops.write_reg(hw, IXGBE_MDIO_GLOBAL_INT_CHIP_STD_MASK, in ixgbe_enable_lasi_ext_t_x550em()
2502 * ixgbe_handle_lasi_ext_t_x550em - Handle external Base T PHY interrupt
2506 * Handle external Base T PHY interrupt. If high temperature
2508 * then setup internal/external PHY link
2513 struct ixgbe_phy_info *phy = &hw->phy; in ixgbe_handle_lasi_ext_t_x550em() local
2521 if (lsc && phy->ops.setup_internal_link) in ixgbe_handle_lasi_ext_t_x550em()
2522 return phy->ops.setup_internal_link(hw); in ixgbe_handle_lasi_ext_t_x550em()
2528 * ixgbe_setup_kr_speed_x550em - Configure the KR PHY for link speed.
2532 * Configures the integrated KR PHY.
2540 status = hw->mac.ops.read_iosf_sb_reg(hw, in ixgbe_setup_kr_speed_x550em()
2541 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_kr_speed_x550em()
2558 status = hw->mac.ops.write_iosf_sb_reg(hw, in ixgbe_setup_kr_speed_x550em()
2559 IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), in ixgbe_setup_kr_speed_x550em()
2562 if (hw->mac.type == ixgbe_mac_x550em_a) { in ixgbe_setup_kr_speed_x550em()
2564 status = hw->mac.ops.read_iosf_sb_reg(hw, in ixgbe_setup_kr_speed_x550em()
2565 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_kr_speed_x550em()
2577 status = hw->mac.ops.write_iosf_sb_reg(hw, in ixgbe_setup_kr_speed_x550em()
2578 IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), in ixgbe_setup_kr_speed_x550em()
2586 * ixgbe_setup_kr_x550em - Configure the KR PHY
2592 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_2_5GB_FULL) in ixgbe_setup_kr_x550em()
2598 return ixgbe_setup_kr_speed_x550em(hw, hw->phy.autoneg_advertised); in ixgbe_setup_kr_x550em()
2601 /** ixgbe_ext_phy_t_x550em_get_link - Get ext phy link status
2615 ret = hw->phy.ops.read_reg(hw, MDIO_STAT1, MDIO_MMD_AN, in ixgbe_ext_phy_t_x550em_get_link()
2620 ret = hw->phy.ops.read_reg(hw, MDIO_STAT1, MDIO_MMD_AN, in ixgbe_ext_phy_t_x550em_get_link()
2630 /** ixgbe_setup_internal_phy_t_x550em - Configure KR PHY to X557 link
2633 * Configures the link between the integrated KR PHY and the external X557 PHY
2635 * interrupt from the X557 PHY. This function configures the link speed
2636 * between the PHYs to match the link speed of the BASE-T link.
2638 * A return of a non-zero value indicates an error, and the base driver should
2648 if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_copper) in ixgbe_setup_internal_phy_t_x550em()
2649 return -EIO; in ixgbe_setup_internal_phy_t_x550em()
2651 if (!(hw->mac.type == ixgbe_mac_X550EM_x && in ixgbe_setup_internal_phy_t_x550em()
2652 !(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE))) { in ixgbe_setup_internal_phy_t_x550em()
2666 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_VENDOR_STAT, in ixgbe_setup_internal_phy_t_x550em()
2691 /* Internal PHY does not support anything else */ in ixgbe_setup_internal_phy_t_x550em()
2692 return -EINVAL; in ixgbe_setup_internal_phy_t_x550em()
2698 /** ixgbe_reset_phy_t_X550em - Performs X557 PHY reset and enables LASI
2715 * ixgbe_led_on_t_x550em - Turns on the software controllable LEDs.
2724 return -EINVAL; in ixgbe_led_on_t_x550em()
2727 hw->phy.ops.read_reg(hw, IXGBE_X557_LED_PROVISIONING + led_idx, in ixgbe_led_on_t_x550em()
2730 hw->phy.ops.write_reg(hw, IXGBE_X557_LED_PROVISIONING + led_idx, in ixgbe_led_on_t_x550em()
2737 * ixgbe_led_off_t_x550em - Turns off the software controllable LEDs.
2746 return -EINVAL; in ixgbe_led_off_t_x550em()
2749 hw->phy.ops.read_reg(hw, IXGBE_X557_LED_PROVISIONING + led_idx, in ixgbe_led_off_t_x550em()
2752 hw->phy.ops.write_reg(hw, IXGBE_X557_LED_PROVISIONING + led_idx, in ixgbe_led_off_t_x550em()
2759 * ixgbe_set_fw_drv_ver_x550 - Sends driver version to firmware
2770 * else returns -EBUSY when encountering an error acquiring
2771 * semaphore, -EIO when command fails or -ENIVAL when incorrect
2783 return -EINVAL; in ixgbe_set_fw_drv_ver_x550()
2788 fw_cmd.port_num = (u8)hw->bus.func; in ixgbe_set_fw_drv_ver_x550()
2808 return -EIO; in ixgbe_set_fw_drv_ver_x550()
2815 /** ixgbe_get_lcd_x550em - Determine lowest common denominator
2824 u16 word = hw->eeprom.ctrl_word_3; in ixgbe_get_lcd_t_x550em()
2830 status = hw->phy.ops.read_reg(hw, IXGBE_AUTO_NEG_LP_STATUS, in ixgbe_get_lcd_t_x550em()
2843 if ((hw->bus.lan_id && (word & NVM_INIT_CTRL_3_D10GMP_PORT1)) || in ixgbe_get_lcd_t_x550em()
2853 * ixgbe_setup_fc_x550em - Set up flow control
2863 if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) { in ixgbe_setup_fc_x550em()
2865 return -EINVAL; in ixgbe_setup_fc_x550em()
2871 if (hw->fc.requested_mode == ixgbe_fc_default) in ixgbe_setup_fc_x550em()
2872 hw->fc.requested_mode = ixgbe_fc_full; in ixgbe_setup_fc_x550em()
2875 switch (hw->fc.requested_mode) { in ixgbe_setup_fc_x550em()
2900 return -EIO; in ixgbe_setup_fc_x550em()
2903 switch (hw->device_id) { in ixgbe_setup_fc_x550em()
2907 rc = hw->mac.ops.read_iosf_sb_reg(hw, in ixgbe_setup_fc_x550em()
2908 IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id), in ixgbe_setup_fc_x550em()
2920 rc = hw->mac.ops.write_iosf_sb_reg(hw, in ixgbe_setup_fc_x550em()
2921 IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id), in ixgbe_setup_fc_x550em()
2926 hw->fc.disable_fc_autoneg = true; in ixgbe_setup_fc_x550em()
2929 hw->fc.disable_fc_autoneg = true; in ixgbe_setup_fc_x550em()
2938 * ixgbe_fc_autoneg_backplane_x550em_a - Enable flow control IEEE clause 37
2945 int status = -EIO; in ixgbe_fc_autoneg_backplane_x550em_a()
2950 * - FC autoneg is disabled, or if in ixgbe_fc_autoneg_backplane_x550em_a()
2951 * - link is not up. in ixgbe_fc_autoneg_backplane_x550em_a()
2953 if (hw->fc.disable_fc_autoneg) { in ixgbe_fc_autoneg_backplane_x550em_a()
2958 hw->mac.ops.check_link(hw, &speed, &link_up, false); in ixgbe_fc_autoneg_backplane_x550em_a()
2964 /* Check at auto-negotiation has completed */ in ixgbe_fc_autoneg_backplane_x550em_a()
2965 status = hw->mac.ops.read_iosf_sb_reg(hw, in ixgbe_fc_autoneg_backplane_x550em_a()
2966 IXGBE_KRM_LINK_S1(hw->bus.lan_id), in ixgbe_fc_autoneg_backplane_x550em_a()
2970 hw_dbg(hw, "Auto-Negotiation did not complete\n"); in ixgbe_fc_autoneg_backplane_x550em_a()
2971 status = -EIO; in ixgbe_fc_autoneg_backplane_x550em_a()
2978 status = hw->mac.ops.read_iosf_sb_reg(hw, in ixgbe_fc_autoneg_backplane_x550em_a()
2979 IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id), in ixgbe_fc_autoneg_backplane_x550em_a()
2983 hw_dbg(hw, "Auto-Negotiation did not complete\n"); in ixgbe_fc_autoneg_backplane_x550em_a()
2987 status = hw->mac.ops.read_iosf_sb_reg(hw, in ixgbe_fc_autoneg_backplane_x550em_a()
2988 IXGBE_KRM_LP_BASE_PAGE_HIGH(hw->bus.lan_id), in ixgbe_fc_autoneg_backplane_x550em_a()
2992 hw_dbg(hw, "Auto-Negotiation did not complete\n"); in ixgbe_fc_autoneg_backplane_x550em_a()
3004 hw->fc.fc_was_autonegged = true; in ixgbe_fc_autoneg_backplane_x550em_a()
3006 hw->fc.fc_was_autonegged = false; in ixgbe_fc_autoneg_backplane_x550em_a()
3007 hw->fc.current_mode = hw->fc.requested_mode; in ixgbe_fc_autoneg_backplane_x550em_a()
3012 * ixgbe_fc_autoneg_fiber_x550em_a - passthrough FC settings
3017 hw->fc.fc_was_autonegged = false; in ixgbe_fc_autoneg_fiber_x550em_a()
3018 hw->fc.current_mode = hw->fc.requested_mode; in ixgbe_fc_autoneg_fiber_x550em_a()
3021 /** ixgbe_enter_lplu_x550em - Transition to low power states
3025 * (from D0 to non-D0). Link is required to enter LPLU so avoid resetting
3026 * the X557 PHY immediately prior to entering LPLU.
3044 status = hw->eeprom.ops.read(hw, NVM_INIT_CTRL_3, in ixgbe_enter_lplu_t_x550em()
3045 &hw->eeprom.ctrl_word_3); in ixgbe_enter_lplu_t_x550em()
3053 if (!link_up || !(hw->eeprom.ctrl_word_3 & NVM_INIT_CTRL_3_LPLU) || in ixgbe_enter_lplu_t_x550em()
3054 !(hw->wol_enabled || ixgbe_mng_present(hw))) in ixgbe_enter_lplu_t_x550em()
3066 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_VENDOR_STAT, in ixgbe_enter_lplu_t_x550em()
3088 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_VENDOR_TX_ALARM, in ixgbe_enter_lplu_t_x550em()
3094 status = hw->phy.ops.read_reg(hw, MDIO_AN_10GBT_CTRL, in ixgbe_enter_lplu_t_x550em()
3100 status = hw->phy.ops.read_reg(hw, in ixgbe_enter_lplu_t_x550em()
3107 save_autoneg = hw->phy.autoneg_advertised; in ixgbe_enter_lplu_t_x550em()
3110 status = hw->mac.ops.setup_link(hw, lcd_speed, false); in ixgbe_enter_lplu_t_x550em()
3113 hw->phy.autoneg_advertised = save_autoneg; in ixgbe_enter_lplu_t_x550em()
3119 * ixgbe_reset_phy_fw - Reset firmware-controlled PHYs
3127 if (hw->phy.reset_disable || ixgbe_check_reset_blocked(hw)) in ixgbe_reset_phy_fw()
3143 * ixgbe_check_overtemp_fw - Check firmware-controlled PHYs for overtemp
3165 * ixgbe_read_mng_if_sel_x550em - Read NW_MNG_IF_SEL register
3173 * to determine internal PHY mode. in ixgbe_read_mng_if_sel_x550em()
3175 hw->phy.nw_mng_if_sel = IXGBE_READ_REG(hw, IXGBE_NW_MNG_IF_SEL); in ixgbe_read_mng_if_sel_x550em()
3177 /* If X552 (X550EM_a) and MDIO is connected to external PHY, then set in ixgbe_read_mng_if_sel_x550em()
3178 * PHY address. This register field was has only been used for X552. in ixgbe_read_mng_if_sel_x550em()
3180 if (hw->mac.type == ixgbe_mac_x550em_a && in ixgbe_read_mng_if_sel_x550em()
3181 hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_MDIO_ACT) { in ixgbe_read_mng_if_sel_x550em()
3182 hw->phy.mdio.prtad = FIELD_GET(IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD, in ixgbe_read_mng_if_sel_x550em()
3183 hw->phy.nw_mng_if_sel); in ixgbe_read_mng_if_sel_x550em()
3187 /** ixgbe_init_phy_ops_X550em - PHY/SFP specific init
3191 * set during init_shared_code because the PHY/SFP type was
3196 struct ixgbe_phy_info *phy = &hw->phy; in ixgbe_init_phy_ops_X550em() local
3199 hw->mac.ops.set_lan_id(hw); in ixgbe_init_phy_ops_X550em()
3203 if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber) { in ixgbe_init_phy_ops_X550em()
3204 phy->phy_semaphore_mask = IXGBE_GSSR_SHARED_I2C_SM; in ixgbe_init_phy_ops_X550em()
3208 /* Identify the PHY or SFP module */ in ixgbe_init_phy_ops_X550em()
3209 ret_val = phy->ops.identify(hw); in ixgbe_init_phy_ops_X550em()
3210 if (ret_val == -EOPNOTSUPP || ret_val == -EFAULT) in ixgbe_init_phy_ops_X550em()
3215 if (phy->sfp_type != ixgbe_sfp_type_unknown) in ixgbe_init_phy_ops_X550em()
3216 phy->ops.reset = NULL; in ixgbe_init_phy_ops_X550em()
3218 /* Set functions pointers based on phy type */ in ixgbe_init_phy_ops_X550em()
3219 switch (hw->phy.type) { in ixgbe_init_phy_ops_X550em()
3221 phy->ops.setup_link = NULL; in ixgbe_init_phy_ops_X550em()
3222 phy->ops.read_reg = ixgbe_read_phy_reg_x550em; in ixgbe_init_phy_ops_X550em()
3223 phy->ops.write_reg = ixgbe_write_phy_reg_x550em; in ixgbe_init_phy_ops_X550em()
3226 phy->ops.setup_link = ixgbe_setup_kr_x550em; in ixgbe_init_phy_ops_X550em()
3227 phy->ops.read_reg = ixgbe_read_phy_reg_x550em; in ixgbe_init_phy_ops_X550em()
3228 phy->ops.write_reg = ixgbe_write_phy_reg_x550em; in ixgbe_init_phy_ops_X550em()
3232 phy->ops.setup_link = NULL; in ixgbe_init_phy_ops_X550em()
3233 phy->ops.read_reg = ixgbe_read_phy_reg_x550em; in ixgbe_init_phy_ops_X550em()
3234 phy->ops.write_reg = ixgbe_write_phy_reg_x550em; in ixgbe_init_phy_ops_X550em()
3238 * to determine internal PHY mode in ixgbe_init_phy_ops_X550em()
3240 phy->nw_mng_if_sel = IXGBE_READ_REG(hw, IXGBE_NW_MNG_IF_SEL); in ixgbe_init_phy_ops_X550em()
3245 phy->ops.setup_internal_link = in ixgbe_init_phy_ops_X550em()
3249 if (hw->mac.type == ixgbe_mac_X550EM_x && in ixgbe_init_phy_ops_X550em()
3252 phy->ops.enter_lplu = ixgbe_enter_lplu_t_x550em; in ixgbe_init_phy_ops_X550em()
3254 phy->ops.handle_lasi = ixgbe_handle_lasi_ext_t_x550em; in ixgbe_init_phy_ops_X550em()
3255 phy->ops.reset = ixgbe_reset_phy_t_X550em; in ixgbe_init_phy_ops_X550em()
3258 phy->ops.setup_link = NULL; in ixgbe_init_phy_ops_X550em()
3261 phy->ops.setup_link = ixgbe_setup_fw_link; in ixgbe_init_phy_ops_X550em()
3262 phy->ops.reset = ixgbe_reset_phy_fw; in ixgbe_init_phy_ops_X550em()
3265 phy->ops.setup_link = NULL; in ixgbe_init_phy_ops_X550em()
3266 phy->ops.read_reg = NULL; in ixgbe_init_phy_ops_X550em()
3267 phy->ops.write_reg = NULL; in ixgbe_init_phy_ops_X550em()
3268 phy->ops.reset = NULL; in ixgbe_init_phy_ops_X550em()
3277 /** ixgbe_get_media_type_X550em - Get media type
3287 /* Detect if there is a copper PHY attached. */ in ixgbe_get_media_type_X550em()
3288 switch (hw->device_id) { in ixgbe_get_media_type_X550em()
3291 hw->phy.type = ixgbe_phy_sgmii; in ixgbe_get_media_type_X550em()
3319 /** ixgbe_init_ext_t_x550em - Start (unstall) the external Base T PHY.
3327 status = hw->phy.ops.read_reg(hw, in ixgbe_init_ext_t_x550em()
3334 /* If PHY FW reset completed bit is set then this is the first in ixgbe_init_ext_t_x550em()
3335 * SW instance after a power on so the PHY FW must be un-stalled. in ixgbe_init_ext_t_x550em()
3338 status = hw->phy.ops.read_reg(hw, in ixgbe_init_ext_t_x550em()
3347 status = hw->phy.ops.write_reg(hw, in ixgbe_init_ext_t_x550em()
3359 * ixgbe_set_mdio_speed - Set MDIO clock speed
3366 switch (hw->device_id) { in ixgbe_set_mdio_speed()
3372 /* Config MDIO clock speed before the first MDIO PHY access */ in ixgbe_set_mdio_speed()
3389 /** ixgbe_reset_hw_X550em - Perform hardware reset
3393 ** and clears all interrupts, perform a PHY reset, and perform a link (MAC)
3398 u32 swfw_mask = hw->phy.phy_semaphore_mask; in ixgbe_reset_hw_X550em()
3406 status = hw->mac.ops.stop_adapter(hw); in ixgbe_reset_hw_X550em()
3413 /* set MDIO speed before talking to the PHY in case it's the 1st time */ in ixgbe_reset_hw_X550em()
3416 /* PHY ops must be identified and initialized prior to reset */ in ixgbe_reset_hw_X550em()
3417 status = hw->phy.ops.init(hw); in ixgbe_reset_hw_X550em()
3418 if (status == -EOPNOTSUPP || status == -EFAULT) in ixgbe_reset_hw_X550em()
3421 /* start the external PHY */ in ixgbe_reset_hw_X550em()
3422 if (hw->phy.type == ixgbe_phy_x550em_ext_t) { in ixgbe_reset_hw_X550em()
3429 if (hw->phy.sfp_setup_needed) { in ixgbe_reset_hw_X550em()
3430 status = hw->mac.ops.setup_sfp(hw); in ixgbe_reset_hw_X550em()
3431 hw->phy.sfp_setup_needed = false; in ixgbe_reset_hw_X550em()
3434 if (status == -EOPNOTSUPP) in ixgbe_reset_hw_X550em()
3437 /* Reset PHY */ in ixgbe_reset_hw_X550em()
3438 if (!hw->phy.reset_disable && hw->phy.ops.reset) in ixgbe_reset_hw_X550em()
3439 hw->phy.ops.reset(hw); in ixgbe_reset_hw_X550em()
3442 /* Issue global reset to the MAC. Needs to be SW reset if link is up. in ixgbe_reset_hw_X550em()
3443 * If link reset is used when link is up, it might reset the PHY when in ixgbe_reset_hw_X550em()
3449 if (!hw->force_full_reset) { in ixgbe_reset_hw_X550em()
3450 hw->mac.ops.check_link(hw, &link_speed, &link_up, false); in ixgbe_reset_hw_X550em()
3455 status = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask); in ixgbe_reset_hw_X550em()
3458 return -EBUSY; in ixgbe_reset_hw_X550em()
3464 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_reset_hw_X550em()
3467 /* Poll for reset bit to self-clear meaning reset is complete */ in ixgbe_reset_hw_X550em()
3476 status = -EIO; in ixgbe_reset_hw_X550em()
3484 * since we modify this value when programming the SAN MAC address. in ixgbe_reset_hw_X550em()
3486 if (hw->mac.flags & IXGBE_FLAGS_DOUBLE_RESET_REQUIRED) { in ixgbe_reset_hw_X550em()
3487 hw->mac.flags &= ~IXGBE_FLAGS_DOUBLE_RESET_REQUIRED; in ixgbe_reset_hw_X550em()
3491 /* Store the permanent mac address */ in ixgbe_reset_hw_X550em()
3492 hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr); in ixgbe_reset_hw_X550em()
3494 /* Store MAC address from RAR0, clear receive address registers, and in ixgbe_reset_hw_X550em()
3496 * since we modify this value when programming the SAN MAC address. in ixgbe_reset_hw_X550em()
3498 hw->mac.num_rar_entries = 128; in ixgbe_reset_hw_X550em()
3499 hw->mac.ops.init_rx_addrs(hw); in ixgbe_reset_hw_X550em()
3503 if (hw->device_id == IXGBE_DEV_ID_X550EM_X_SFP) in ixgbe_reset_hw_X550em()
3509 /** ixgbe_set_ethertype_anti_spoofing_x550 - Enable/Disable Ethertype
3510 * anti-spoofing
3512 * @enable: enable or disable switch for Ethertype anti-spoofing
3513 * @vf: Virtual Function pool - VF Pool to set for Ethertype anti-spoofing
3531 /** ixgbe_set_source_address_pruning_x550 - Enable/Disable src address pruning
3559 * ixgbe_setup_fc_backplane_x550em_a - Set up flow control
3570 if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) { in ixgbe_setup_fc_backplane_x550em_a()
3572 return -EINVAL; in ixgbe_setup_fc_backplane_x550em_a()
3575 if (hw->fc.requested_mode == ixgbe_fc_default) in ixgbe_setup_fc_backplane_x550em_a()
3576 hw->fc.requested_mode = ixgbe_fc_full; in ixgbe_setup_fc_backplane_x550em_a()
3582 status = hw->mac.ops.read_iosf_sb_reg(hw, in ixgbe_setup_fc_backplane_x550em_a()
3583 IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id), in ixgbe_setup_fc_backplane_x550em_a()
3587 hw_dbg(hw, "Auto-Negotiation did not complete\n"); in ixgbe_setup_fc_backplane_x550em_a()
3600 switch (hw->fc.requested_mode) { in ixgbe_setup_fc_backplane_x550em_a()
3629 return -EIO; in ixgbe_setup_fc_backplane_x550em_a()
3632 status = hw->mac.ops.write_iosf_sb_reg(hw, in ixgbe_setup_fc_backplane_x550em_a()
3633 IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id), in ixgbe_setup_fc_backplane_x550em_a()
3636 /* Restart auto-negotiation. */ in ixgbe_setup_fc_backplane_x550em_a()
3643 * ixgbe_set_mux - Set mux for port 1 access with CS4227
3651 if (!hw->bus.lan_id) in ixgbe_set_mux()
3663 * ixgbe_acquire_swfw_sync_X550em - Acquire SWFW semaphore
3684 * ixgbe_release_swfw_sync_X550em - Release SWFW semaphore
3699 * ixgbe_acquire_swfw_sync_x550em_a - Acquire SWFW semaphore
3703 * Acquires the SWFW semaphore and get the shared PHY token as needed
3711 while (--retries) { in ixgbe_acquire_swfw_sync_x550em_a()
3725 if (status != -EAGAIN) in ixgbe_acquire_swfw_sync_x550em_a()
3734 * ixgbe_release_swfw_sync_x550em_a - Release SWFW semaphore
3738 * Release the SWFW semaphore and puts the shared PHY token as needed
3752 * ixgbe_read_phy_reg_x550a - Reads specified PHY register
3754 * @reg_addr: 32 bit address of PHY register to read
3756 * @phy_data: Pointer to read data from PHY register
3758 * Reads a value from a specified PHY register using the SWFW lock and PHY
3759 * Token. The PHY Token is needed since the MDIO is shared between to MAC
3765 u32 mask = hw->phy.phy_semaphore_mask | IXGBE_GSSR_TOKEN_SM; in ixgbe_read_phy_reg_x550a()
3768 if (hw->mac.ops.acquire_swfw_sync(hw, mask)) in ixgbe_read_phy_reg_x550a()
3769 return -EBUSY; in ixgbe_read_phy_reg_x550a()
3771 status = hw->phy.ops.read_reg_mdi(hw, reg_addr, device_type, phy_data); in ixgbe_read_phy_reg_x550a()
3773 hw->mac.ops.release_swfw_sync(hw, mask); in ixgbe_read_phy_reg_x550a()
3779 * ixgbe_write_phy_reg_x550a - Writes specified PHY register
3781 * @reg_addr: 32 bit PHY register to write
3783 * @phy_data: Data to write to the PHY register
3785 * Writes a value to specified PHY register using the SWFW lock and PHY Token.
3786 * The PHY Token is needed since the MDIO is shared between to MAC instances.
3791 u32 mask = hw->phy.phy_semaphore_mask | IXGBE_GSSR_TOKEN_SM; in ixgbe_write_phy_reg_x550a()
3794 if (hw->mac.ops.acquire_swfw_sync(hw, mask)) in ixgbe_write_phy_reg_x550a()
3795 return -EBUSY; in ixgbe_write_phy_reg_x550a()
3798 hw->mac.ops.release_swfw_sync(hw, mask); in ixgbe_write_phy_reg_x550a()
4056 .mac = ixgbe_mac_X550,
4066 .mac = ixgbe_mac_X550EM_x,
4077 .mac = ixgbe_mac_X550EM_x,
4087 .mac = ixgbe_mac_x550em_a,
4097 .mac = ixgbe_mac_x550em_a,