Lines Matching +full:phy +full:- +full:i2c
2 SPDX-License-Identifier: BSD-3-Clause
4 Copyright (c) 2001-2020, Intel Corporation
54 * ixgbe_out_i2c_byte_ack - Send I2C byte with ack
71 * ixgbe_in_i2c_byte_ack - Receive an I2C byte and send ack
85 * ixgbe_ones_comp_byte_add - Perform one's complement addition
89 * Returns one's complement 8-bit sum.
100 * ixgbe_read_i2c_combined_generic_int - Perform I2C read combined operation
102 * @addr: I2C bus address to read from
103 * @reg: I2C device register to read from
112 u32 swfw_mask = hw->phy.phy_semaphore_mask; in ixgbe_read_i2c_combined_generic_int()
125 if (lock && hw->mac.ops.acquire_swfw_sync(hw, swfw_mask)) in ixgbe_read_i2c_combined_generic_int()
140 /* Re-start condition */ in ixgbe_read_i2c_combined_generic_int()
158 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_read_i2c_combined_generic_int()
165 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_read_i2c_combined_generic_int()
167 DEBUGOUT("I2C byte read combined error - Retrying.\n"); in ixgbe_read_i2c_combined_generic_int()
169 DEBUGOUT("I2C byte read combined error.\n"); in ixgbe_read_i2c_combined_generic_int()
177 * ixgbe_write_i2c_combined_generic_int - Perform I2C write combined operation
179 * @addr: I2C bus address to write to
180 * @reg: I2C device register to write to
189 u32 swfw_mask = hw->phy.phy_semaphore_mask; in ixgbe_write_i2c_combined_generic_int()
201 if (lock && hw->mac.ops.acquire_swfw_sync(hw, swfw_mask)) in ixgbe_write_i2c_combined_generic_int()
224 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_write_i2c_combined_generic_int()
230 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_write_i2c_combined_generic_int()
232 DEBUGOUT("I2C byte write combined error - Retrying.\n"); in ixgbe_write_i2c_combined_generic_int()
234 DEBUGOUT("I2C byte write combined error.\n"); in ixgbe_write_i2c_combined_generic_int()
242 * ixgbe_init_phy_ops_generic - Inits PHY function ptrs
249 struct ixgbe_phy_info *phy = &hw->phy; in ixgbe_init_phy_ops_generic() local
253 /* PHY */ in ixgbe_init_phy_ops_generic()
254 phy->ops.identify = ixgbe_identify_phy_generic; in ixgbe_init_phy_ops_generic()
255 phy->ops.reset = ixgbe_reset_phy_generic; in ixgbe_init_phy_ops_generic()
256 phy->ops.read_reg = ixgbe_read_phy_reg_generic; in ixgbe_init_phy_ops_generic()
257 phy->ops.write_reg = ixgbe_write_phy_reg_generic; in ixgbe_init_phy_ops_generic()
258 phy->ops.read_reg_mdi = ixgbe_read_phy_reg_mdi; in ixgbe_init_phy_ops_generic()
259 phy->ops.write_reg_mdi = ixgbe_write_phy_reg_mdi; in ixgbe_init_phy_ops_generic()
260 phy->ops.setup_link = ixgbe_setup_phy_link_generic; in ixgbe_init_phy_ops_generic()
261 phy->ops.setup_link_speed = ixgbe_setup_phy_link_speed_generic; in ixgbe_init_phy_ops_generic()
262 phy->ops.check_link = NULL; in ixgbe_init_phy_ops_generic()
263 phy->ops.get_firmware_version = ixgbe_get_phy_firmware_version_generic; in ixgbe_init_phy_ops_generic()
264 phy->ops.read_i2c_byte = ixgbe_read_i2c_byte_generic; in ixgbe_init_phy_ops_generic()
265 phy->ops.write_i2c_byte = ixgbe_write_i2c_byte_generic; in ixgbe_init_phy_ops_generic()
266 phy->ops.read_i2c_sff8472 = ixgbe_read_i2c_sff8472_generic; in ixgbe_init_phy_ops_generic()
267 phy->ops.read_i2c_eeprom = ixgbe_read_i2c_eeprom_generic; in ixgbe_init_phy_ops_generic()
268 phy->ops.write_i2c_eeprom = ixgbe_write_i2c_eeprom_generic; in ixgbe_init_phy_ops_generic()
269 phy->ops.i2c_bus_clear = ixgbe_i2c_bus_clear; in ixgbe_init_phy_ops_generic()
270 phy->ops.identify_sfp = ixgbe_identify_module_generic; in ixgbe_init_phy_ops_generic()
271 phy->sfp_type = ixgbe_sfp_type_unknown; in ixgbe_init_phy_ops_generic()
272 phy->ops.read_i2c_byte_unlocked = ixgbe_read_i2c_byte_generic_unlocked; in ixgbe_init_phy_ops_generic()
273 phy->ops.write_i2c_byte_unlocked = in ixgbe_init_phy_ops_generic()
275 phy->ops.check_overtemp = ixgbe_tn_check_overtemp; in ixgbe_init_phy_ops_generic()
280 * ixgbe_probe_phy - Probe a single address for a PHY
282 * @phy_addr: PHY address to probe
284 * Returns true if PHY found
291 DEBUGOUT1("Unable to validate PHY address 0x%04X\n", in ixgbe_probe_phy()
299 hw->phy.type = ixgbe_get_phy_type_from_id(hw->phy.id); in ixgbe_probe_phy()
301 if (hw->phy.type == ixgbe_phy_unknown) { in ixgbe_probe_phy()
302 hw->phy.ops.read_reg(hw, IXGBE_MDIO_PHY_EXT_ABILITY, in ixgbe_probe_phy()
307 hw->phy.type = ixgbe_phy_cu_unknown; in ixgbe_probe_phy()
309 hw->phy.type = ixgbe_phy_generic; in ixgbe_probe_phy()
316 * ixgbe_identify_phy_generic - Get physical layer module
328 if (!hw->phy.phy_semaphore_mask) { in ixgbe_identify_phy_generic()
329 if (hw->bus.lan_id) in ixgbe_identify_phy_generic()
330 hw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY1_SM; in ixgbe_identify_phy_generic()
332 hw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY0_SM; in ixgbe_identify_phy_generic()
335 if (hw->phy.type != ixgbe_phy_unknown) in ixgbe_identify_phy_generic()
338 if (hw->phy.nw_mng_if_sel) { in ixgbe_identify_phy_generic()
339 phy_addr = (hw->phy.nw_mng_if_sel & in ixgbe_identify_phy_generic()
355 /* Certain media types do not have a phy so an address will not in ixgbe_identify_phy_generic()
360 hw->phy.addr = 0; in ixgbe_identify_phy_generic()
366 * ixgbe_check_reset_blocked - check status of MNG FW veto bit
381 if (hw->mac.type == ixgbe_mac_82598EB) in ixgbe_check_reset_blocked()
395 * ixgbe_validate_phy_addr - Determines phy address is valid
397 * @phy_addr: PHY address
407 hw->phy.addr = phy_addr; in ixgbe_validate_phy_addr()
408 hw->phy.ops.read_reg(hw, IXGBE_MDIO_PHY_ID_HIGH, in ixgbe_validate_phy_addr()
414 DEBUGOUT1("PHY ID HIGH is 0x%04X\n", phy_id); in ixgbe_validate_phy_addr()
420 * ixgbe_get_phy_id - Get the phy type
432 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_PHY_ID_HIGH, in ixgbe_get_phy_id()
437 hw->phy.id = (u32)(phy_id_high << 16); in ixgbe_get_phy_id()
438 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_PHY_ID_LOW, in ixgbe_get_phy_id()
441 hw->phy.id |= (u32)(phy_id_low & IXGBE_PHY_REVISION_MASK); in ixgbe_get_phy_id()
442 hw->phy.revision = (u32)(phy_id_low & ~IXGBE_PHY_REVISION_MASK); in ixgbe_get_phy_id()
451 * ixgbe_get_phy_type_from_id - Get the phy type
452 * @phy_id: PHY ID information
491 * ixgbe_reset_phy_generic - Performs a PHY reset
502 if (hw->phy.type == ixgbe_phy_unknown) in ixgbe_reset_phy_generic()
505 if (status != IXGBE_SUCCESS || hw->phy.type == ixgbe_phy_none) in ixgbe_reset_phy_generic()
508 /* Don't reset PHY if it's shut down due to overtemp. */ in ixgbe_reset_phy_generic()
509 if (!hw->phy.reset_if_overtemp && in ixgbe_reset_phy_generic()
510 (IXGBE_ERR_OVERTEMP == hw->phy.ops.check_overtemp(hw))) in ixgbe_reset_phy_generic()
518 * Perform soft PHY reset to the PHY_XS. in ixgbe_reset_phy_generic()
519 * This will cause a soft reset to the PHY in ixgbe_reset_phy_generic()
521 hw->phy.ops.write_reg(hw, IXGBE_MDIO_PHY_XS_CONTROL, in ixgbe_reset_phy_generic()
526 * Poll for reset bit to self-clear indicating reset is complete. in ixgbe_reset_phy_generic()
532 if (hw->phy.type == ixgbe_phy_x550em_ext_t) { in ixgbe_reset_phy_generic()
533 status = hw->phy.ops.read_reg(hw, in ixgbe_reset_phy_generic()
545 status = hw->phy.ops.read_reg(hw, in ixgbe_reset_phy_generic()
562 "PHY reset polling failed to complete.\n"); in ixgbe_reset_phy_generic()
570 * ixgbe_restart_auto_neg - Restart auto negotiation on the PHY
577 /* Check if PHY reset is blocked by MNG FW */ in ixgbe_restart_auto_neg()
581 /* Restart PHY auto-negotiation. */ in ixgbe_restart_auto_neg()
582 hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, in ixgbe_restart_auto_neg()
585 hw->phy.ops.write_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, in ixgbe_restart_auto_neg()
590 * ixgbe_read_phy_reg_mdi - Reads a value from a specified PHY register without
593 * @reg_addr: 32 bit address of PHY register to read
595 * @phy_data: Pointer to read data from PHY register
605 (hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) | in ixgbe_read_phy_reg_mdi()
625 ERROR_REPORT1(IXGBE_ERROR_POLLING, "PHY address command did not complete.\n"); in ixgbe_read_phy_reg_mdi()
626 DEBUGOUT("PHY address command did not complete, returning IXGBE_ERR_PHY\n"); in ixgbe_read_phy_reg_mdi()
636 (hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) | in ixgbe_read_phy_reg_mdi()
655 ERROR_REPORT1(IXGBE_ERROR_POLLING, "PHY read command didn't complete\n"); in ixgbe_read_phy_reg_mdi()
656 DEBUGOUT("PHY read command didn't complete, returning IXGBE_ERR_PHY\n"); in ixgbe_read_phy_reg_mdi()
672 * ixgbe_read_phy_reg_generic - Reads a value from a specified PHY register
673 * using the SWFW lock - this function is needed in most cases
675 * @reg_addr: 32 bit address of PHY register to read
677 * @phy_data: Pointer to read data from PHY register
683 u32 gssr = hw->phy.phy_semaphore_mask; in ixgbe_read_phy_reg_generic()
687 if (hw->mac.ops.acquire_swfw_sync(hw, gssr)) in ixgbe_read_phy_reg_generic()
690 status = hw->phy.ops.read_reg_mdi(hw, reg_addr, device_type, phy_data); in ixgbe_read_phy_reg_generic()
692 hw->mac.ops.release_swfw_sync(hw, gssr); in ixgbe_read_phy_reg_generic()
698 * ixgbe_write_phy_reg_mdi - Writes a value to specified PHY register
701 * @reg_addr: 32 bit PHY register to write
703 * @phy_data: Data to write to the PHY register
716 (hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) | in ixgbe_write_phy_reg_mdi()
735 ERROR_REPORT1(IXGBE_ERROR_POLLING, "PHY address cmd didn't complete\n"); in ixgbe_write_phy_reg_mdi()
745 (hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) | in ixgbe_write_phy_reg_mdi()
764 ERROR_REPORT1(IXGBE_ERROR_POLLING, "PHY write cmd didn't complete\n"); in ixgbe_write_phy_reg_mdi()
772 * ixgbe_write_phy_reg_generic - Writes a value to specified PHY register
773 * using SWFW lock- this function is needed in most cases
775 * @reg_addr: 32 bit PHY register to write
777 * @phy_data: Data to write to the PHY register
783 u32 gssr = hw->phy.phy_semaphore_mask; in ixgbe_write_phy_reg_generic()
787 if (hw->mac.ops.acquire_swfw_sync(hw, gssr) == IXGBE_SUCCESS) { in ixgbe_write_phy_reg_generic()
788 status = hw->phy.ops.write_reg_mdi(hw, reg_addr, device_type, in ixgbe_write_phy_reg_generic()
790 hw->mac.ops.release_swfw_sync(hw, gssr); in ixgbe_write_phy_reg_generic()
799 * ixgbe_setup_phy_link_generic - Set and restart auto-neg
802 * Restart auto-negotiation and PHY and waits for completion.
815 /* Set or unset auto-negotiation 10G advertisement */ in ixgbe_setup_phy_link_generic()
816 hw->phy.ops.read_reg(hw, IXGBE_MII_10GBASE_T_AUTONEG_CTRL_REG, in ixgbe_setup_phy_link_generic()
821 if ((hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10GB_FULL) && in ixgbe_setup_phy_link_generic()
825 hw->phy.ops.write_reg(hw, IXGBE_MII_10GBASE_T_AUTONEG_CTRL_REG, in ixgbe_setup_phy_link_generic()
829 hw->phy.ops.read_reg(hw, IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG, in ixgbe_setup_phy_link_generic()
833 if (hw->mac.type == ixgbe_mac_X550) { in ixgbe_setup_phy_link_generic()
834 /* Set or unset auto-negotiation 5G advertisement */ in ixgbe_setup_phy_link_generic()
836 if ((hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_5GB_FULL) && in ixgbe_setup_phy_link_generic()
840 /* Set or unset auto-negotiation 2.5G advertisement */ in ixgbe_setup_phy_link_generic()
842 if ((hw->phy.autoneg_advertised & in ixgbe_setup_phy_link_generic()
848 /* Set or unset auto-negotiation 1G advertisement */ in ixgbe_setup_phy_link_generic()
850 if ((hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_1GB_FULL) && in ixgbe_setup_phy_link_generic()
854 hw->phy.ops.write_reg(hw, IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG, in ixgbe_setup_phy_link_generic()
858 /* Set or unset auto-negotiation 100M advertisement */ in ixgbe_setup_phy_link_generic()
859 hw->phy.ops.read_reg(hw, IXGBE_MII_AUTONEG_ADVERTISE_REG, in ixgbe_setup_phy_link_generic()
865 if ((hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_100_FULL) && in ixgbe_setup_phy_link_generic()
869 hw->phy.ops.write_reg(hw, IXGBE_MII_AUTONEG_ADVERTISE_REG, in ixgbe_setup_phy_link_generic()
878 * ixgbe_setup_phy_link_speed_generic - Sets the auto advertised capabilities
895 hw->phy.autoneg_advertised = 0; in ixgbe_setup_phy_link_speed_generic()
898 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10GB_FULL; in ixgbe_setup_phy_link_speed_generic()
901 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_5GB_FULL; in ixgbe_setup_phy_link_speed_generic()
904 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_2_5GB_FULL; in ixgbe_setup_phy_link_speed_generic()
907 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL; in ixgbe_setup_phy_link_speed_generic()
910 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_100_FULL; in ixgbe_setup_phy_link_speed_generic()
913 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10_FULL; in ixgbe_setup_phy_link_speed_generic()
922 * ixgbe_get_copper_speeds_supported - Get copper link speeds from phy
925 * Determines the supported link capabilities by reading the PHY auto
933 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_PHY_SPEED_ABILITY, in ixgbe_get_copper_speeds_supported()
940 hw->phy.speeds_supported |= IXGBE_LINK_SPEED_10GB_FULL; in ixgbe_get_copper_speeds_supported()
942 hw->phy.speeds_supported |= IXGBE_LINK_SPEED_1GB_FULL; in ixgbe_get_copper_speeds_supported()
944 hw->phy.speeds_supported |= IXGBE_LINK_SPEED_100_FULL; in ixgbe_get_copper_speeds_supported()
946 switch (hw->mac.type) { in ixgbe_get_copper_speeds_supported()
948 hw->phy.speeds_supported |= IXGBE_LINK_SPEED_2_5GB_FULL; in ixgbe_get_copper_speeds_supported()
949 hw->phy.speeds_supported |= IXGBE_LINK_SPEED_5GB_FULL; in ixgbe_get_copper_speeds_supported()
953 hw->phy.speeds_supported &= ~IXGBE_LINK_SPEED_100_FULL; in ixgbe_get_copper_speeds_supported()
963 * ixgbe_get_copper_link_capabilities_generic - Determines link capabilities
966 * @autoneg: boolean auto-negotiation value
977 if (!hw->phy.speeds_supported) in ixgbe_get_copper_link_capabilities_generic()
980 *speed = hw->phy.speeds_supported; in ixgbe_get_copper_link_capabilities_generic()
985 * ixgbe_check_phy_link_tnx - Determine link and speed status
991 * the PHY.
1010 * Check current speed and link status of the PHY register. in ixgbe_check_phy_link_tnx()
1016 status = hw->phy.ops.read_reg(hw, in ixgbe_check_phy_link_tnx()
1036 * ixgbe_setup_phy_link_tnx - Set and restart auto-neg
1039 * Restart auto-negotiation and PHY and waits for completion.
1053 /* Set or unset auto-negotiation 10G advertisement */ in ixgbe_setup_phy_link_tnx()
1054 hw->phy.ops.read_reg(hw, IXGBE_MII_10GBASE_T_AUTONEG_CTRL_REG, in ixgbe_setup_phy_link_tnx()
1059 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10GB_FULL) in ixgbe_setup_phy_link_tnx()
1062 hw->phy.ops.write_reg(hw, IXGBE_MII_10GBASE_T_AUTONEG_CTRL_REG, in ixgbe_setup_phy_link_tnx()
1068 /* Set or unset auto-negotiation 1G advertisement */ in ixgbe_setup_phy_link_tnx()
1069 hw->phy.ops.read_reg(hw, IXGBE_MII_AUTONEG_XNP_TX_REG, in ixgbe_setup_phy_link_tnx()
1074 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_1GB_FULL) in ixgbe_setup_phy_link_tnx()
1077 hw->phy.ops.write_reg(hw, IXGBE_MII_AUTONEG_XNP_TX_REG, in ixgbe_setup_phy_link_tnx()
1083 /* Set or unset auto-negotiation 100M advertisement */ in ixgbe_setup_phy_link_tnx()
1084 hw->phy.ops.read_reg(hw, IXGBE_MII_AUTONEG_ADVERTISE_REG, in ixgbe_setup_phy_link_tnx()
1089 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_100_FULL) in ixgbe_setup_phy_link_tnx()
1092 hw->phy.ops.write_reg(hw, IXGBE_MII_AUTONEG_ADVERTISE_REG, in ixgbe_setup_phy_link_tnx()
1102 * ixgbe_get_phy_firmware_version_tnx - Gets the PHY Firmware Version
1104 * @firmware_version: pointer to the PHY Firmware Version
1113 status = hw->phy.ops.read_reg(hw, TNX_FW_REV, in ixgbe_get_phy_firmware_version_tnx()
1121 * ixgbe_get_phy_firmware_version_generic - Gets the PHY Firmware Version
1123 * @firmware_version: pointer to the PHY Firmware Version
1132 status = hw->phy.ops.read_reg(hw, AQ_FW_REV, in ixgbe_get_phy_firmware_version_generic()
1140 * ixgbe_reset_phy_nl - Performs a PHY reset
1158 hw->phy.ops.read_reg(hw, IXGBE_MDIO_PHY_XS_CONTROL, in ixgbe_reset_phy_nl()
1161 /* reset the PHY and poll for completion */ in ixgbe_reset_phy_nl()
1162 hw->phy.ops.write_reg(hw, IXGBE_MDIO_PHY_XS_CONTROL, in ixgbe_reset_phy_nl()
1167 hw->phy.ops.read_reg(hw, IXGBE_MDIO_PHY_XS_CONTROL, in ixgbe_reset_phy_nl()
1175 DEBUGOUT("PHY reset did not complete.\n"); in ixgbe_reset_phy_nl()
1186 ret_val = hw->eeprom.ops.read(hw, data_offset, &block_crc); in ixgbe_reset_phy_nl()
1190 * Read control word from PHY init contents offset in ixgbe_reset_phy_nl()
1192 ret_val = hw->eeprom.ops.read(hw, data_offset, &eword); in ixgbe_reset_phy_nl()
1207 ret_val = hw->eeprom.ops.read(hw, data_offset, in ixgbe_reset_phy_nl()
1213 ret_val = hw->eeprom.ops.read(hw, data_offset, in ixgbe_reset_phy_nl()
1217 hw->phy.ops.write_reg(hw, phy_offset, in ixgbe_reset_phy_nl()
1256 * ixgbe_identify_module_generic - Identifies module type
1267 switch (hw->mac.ops.get_media_type(hw)) { in ixgbe_identify_module_generic()
1277 hw->phy.sfp_type = ixgbe_sfp_type_not_present; in ixgbe_identify_module_generic()
1286 * ixgbe_identify_sfp_module_generic - Identifies SFP modules
1289 * Searches for and identifies the SFP module and assigns appropriate PHY type.
1295 enum ixgbe_sfp_type stored_sfp_type = hw->phy.sfp_type; in ixgbe_identify_sfp_module_generic()
1307 if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_fiber) { in ixgbe_identify_sfp_module_generic()
1308 hw->phy.sfp_type = ixgbe_sfp_type_not_present; in ixgbe_identify_sfp_module_generic()
1313 /* LAN ID is needed for I2C access */ in ixgbe_identify_sfp_module_generic()
1314 hw->mac.ops.set_lan_id(hw); in ixgbe_identify_sfp_module_generic()
1316 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_sfp_module_generic()
1324 hw->phy.type = ixgbe_phy_sfp_unsupported; in ixgbe_identify_sfp_module_generic()
1327 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_sfp_module_generic()
1334 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_sfp_module_generic()
1340 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_sfp_module_generic()
1352 * 3 SFP_DA_CORE0 - 82599-specific in ixgbe_identify_sfp_module_generic()
1353 * 4 SFP_DA_CORE1 - 82599-specific in ixgbe_identify_sfp_module_generic()
1354 * 5 SFP_SR/LR_CORE0 - 82599-specific in ixgbe_identify_sfp_module_generic()
1355 * 6 SFP_SR/LR_CORE1 - 82599-specific in ixgbe_identify_sfp_module_generic()
1356 * 7 SFP_act_lmt_DA_CORE0 - 82599-specific in ixgbe_identify_sfp_module_generic()
1357 * 8 SFP_act_lmt_DA_CORE1 - 82599-specific in ixgbe_identify_sfp_module_generic()
1358 * 9 SFP_1g_cu_CORE0 - 82599-specific in ixgbe_identify_sfp_module_generic()
1359 * 10 SFP_1g_cu_CORE1 - 82599-specific in ixgbe_identify_sfp_module_generic()
1360 * 11 SFP_1g_sx_CORE0 - 82599-specific in ixgbe_identify_sfp_module_generic()
1361 * 12 SFP_1g_sx_CORE1 - 82599-specific in ixgbe_identify_sfp_module_generic()
1363 if (hw->mac.type == ixgbe_mac_82598EB) { in ixgbe_identify_sfp_module_generic()
1365 hw->phy.sfp_type = ixgbe_sfp_type_da_cu; in ixgbe_identify_sfp_module_generic()
1367 hw->phy.sfp_type = ixgbe_sfp_type_sr; in ixgbe_identify_sfp_module_generic()
1369 hw->phy.sfp_type = ixgbe_sfp_type_lr; in ixgbe_identify_sfp_module_generic()
1371 hw->phy.sfp_type = ixgbe_sfp_type_unknown; in ixgbe_identify_sfp_module_generic()
1374 if (hw->bus.lan_id == 0) in ixgbe_identify_sfp_module_generic()
1375 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1378 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1381 hw->phy.ops.read_i2c_eeprom( in ixgbe_identify_sfp_module_generic()
1386 if (hw->bus.lan_id == 0) in ixgbe_identify_sfp_module_generic()
1387 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1390 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1393 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1399 if (hw->bus.lan_id == 0) in ixgbe_identify_sfp_module_generic()
1400 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1403 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1406 if (hw->bus.lan_id == 0) in ixgbe_identify_sfp_module_generic()
1407 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1410 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1413 if (hw->bus.lan_id == 0) in ixgbe_identify_sfp_module_generic()
1414 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1417 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1420 if (hw->bus.lan_id == 0) in ixgbe_identify_sfp_module_generic()
1421 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1424 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1427 hw->phy.sfp_type = ixgbe_sfp_type_unknown; in ixgbe_identify_sfp_module_generic()
1431 if (hw->phy.sfp_type != stored_sfp_type) in ixgbe_identify_sfp_module_generic()
1432 hw->phy.sfp_setup_needed = true; in ixgbe_identify_sfp_module_generic()
1434 /* Determine if the SFP+ PHY is dual speed or not. */ in ixgbe_identify_sfp_module_generic()
1435 hw->phy.multispeed_fiber = false; in ixgbe_identify_sfp_module_generic()
1442 hw->phy.multispeed_fiber = true; in ixgbe_identify_sfp_module_generic()
1444 /* Determine PHY vendor */ in ixgbe_identify_sfp_module_generic()
1445 if (hw->phy.type != ixgbe_phy_nl) { in ixgbe_identify_sfp_module_generic()
1446 hw->phy.id = identifier; in ixgbe_identify_sfp_module_generic()
1447 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_sfp_module_generic()
1454 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_sfp_module_generic()
1461 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_sfp_module_generic()
1476 hw->phy.type = in ixgbe_identify_sfp_module_generic()
1481 hw->phy.type = ixgbe_phy_sfp_ftl_active; in ixgbe_identify_sfp_module_generic()
1483 hw->phy.type = ixgbe_phy_sfp_ftl; in ixgbe_identify_sfp_module_generic()
1486 hw->phy.type = ixgbe_phy_sfp_avago; in ixgbe_identify_sfp_module_generic()
1489 hw->phy.type = ixgbe_phy_sfp_intel; in ixgbe_identify_sfp_module_generic()
1493 hw->phy.type = ixgbe_phy_sfp_passive_unknown; in ixgbe_identify_sfp_module_generic()
1495 hw->phy.type = ixgbe_phy_sfp_active_unknown; in ixgbe_identify_sfp_module_generic()
1497 hw->phy.type = ixgbe_phy_sfp_unknown; in ixgbe_identify_sfp_module_generic()
1511 !(hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 || in ixgbe_identify_sfp_module_generic()
1512 hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 || in ixgbe_identify_sfp_module_generic()
1513 hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 || in ixgbe_identify_sfp_module_generic()
1514 hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 || in ixgbe_identify_sfp_module_generic()
1515 hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || in ixgbe_identify_sfp_module_generic()
1516 hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1)) { in ixgbe_identify_sfp_module_generic()
1517 hw->phy.type = ixgbe_phy_sfp_unsupported; in ixgbe_identify_sfp_module_generic()
1522 /* Anything else 82598-based is supported */ in ixgbe_identify_sfp_module_generic()
1523 if (hw->mac.type == ixgbe_mac_82598EB) { in ixgbe_identify_sfp_module_generic()
1530 !(hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 || in ixgbe_identify_sfp_module_generic()
1531 hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 || in ixgbe_identify_sfp_module_generic()
1532 hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 || in ixgbe_identify_sfp_module_generic()
1533 hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 || in ixgbe_identify_sfp_module_generic()
1534 hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || in ixgbe_identify_sfp_module_generic()
1535 hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1)) { in ixgbe_identify_sfp_module_generic()
1536 /* Make sure we're a supported PHY type */ in ixgbe_identify_sfp_module_generic()
1537 if (hw->phy.type == ixgbe_phy_sfp_intel) { in ixgbe_identify_sfp_module_generic()
1540 if (hw->allow_unsupported_sfp == true) { in ixgbe_identify_sfp_module_generic()
1551 hw->phy.type = in ixgbe_identify_sfp_module_generic()
1565 hw->phy.sfp_type = ixgbe_sfp_type_not_present; in ixgbe_identify_sfp_module_generic()
1566 if (hw->phy.type != ixgbe_phy_nl) { in ixgbe_identify_sfp_module_generic()
1567 hw->phy.id = 0; in ixgbe_identify_sfp_module_generic()
1568 hw->phy.type = ixgbe_phy_unknown; in ixgbe_identify_sfp_module_generic()
1574 * ixgbe_get_supported_phy_sfp_layer_generic - Returns physical layer type
1587 hw->phy.ops.identify_sfp(hw); in ixgbe_get_supported_phy_sfp_layer_generic()
1588 if (hw->phy.sfp_type == ixgbe_sfp_type_not_present) in ixgbe_get_supported_phy_sfp_layer_generic()
1591 switch (hw->phy.type) { in ixgbe_get_supported_phy_sfp_layer_generic()
1606 hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_get_supported_phy_sfp_layer_generic()
1608 hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_get_supported_phy_sfp_layer_generic()
1621 hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_get_supported_phy_sfp_layer_generic()
1636 * ixgbe_identify_qsfp_module_generic - Identifies QSFP modules
1639 * Searches for and identifies the QSFP module and assigns appropriate PHY type
1645 enum ixgbe_sfp_type stored_sfp_type = hw->phy.sfp_type; in ixgbe_identify_qsfp_module_generic()
1659 if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_fiber_qsfp) { in ixgbe_identify_qsfp_module_generic()
1660 hw->phy.sfp_type = ixgbe_sfp_type_not_present; in ixgbe_identify_qsfp_module_generic()
1665 /* LAN ID is needed for I2C access */ in ixgbe_identify_qsfp_module_generic()
1666 hw->mac.ops.set_lan_id(hw); in ixgbe_identify_qsfp_module_generic()
1668 status = hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_IDENTIFIER, in ixgbe_identify_qsfp_module_generic()
1675 hw->phy.type = ixgbe_phy_sfp_unsupported; in ixgbe_identify_qsfp_module_generic()
1680 hw->phy.id = identifier; in ixgbe_identify_qsfp_module_generic()
1682 status = hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_QSFP_10GBE_COMP, in ixgbe_identify_qsfp_module_generic()
1688 status = hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_QSFP_1GBE_COMP, in ixgbe_identify_qsfp_module_generic()
1695 hw->phy.type = ixgbe_phy_qsfp_passive_unknown; in ixgbe_identify_qsfp_module_generic()
1696 if (hw->bus.lan_id == 0) in ixgbe_identify_qsfp_module_generic()
1697 hw->phy.sfp_type = ixgbe_sfp_type_da_cu_core0; in ixgbe_identify_qsfp_module_generic()
1699 hw->phy.sfp_type = ixgbe_sfp_type_da_cu_core1; in ixgbe_identify_qsfp_module_generic()
1702 if (hw->bus.lan_id == 0) in ixgbe_identify_qsfp_module_generic()
1703 hw->phy.sfp_type = ixgbe_sfp_type_srlr_core0; in ixgbe_identify_qsfp_module_generic()
1705 hw->phy.sfp_type = ixgbe_sfp_type_srlr_core1; in ixgbe_identify_qsfp_module_generic()
1711 /* check for active DA cables that pre-date in ixgbe_identify_qsfp_module_generic()
1712 * SFF-8436 v3.6 */ in ixgbe_identify_qsfp_module_generic()
1713 hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_qsfp_module_generic()
1717 hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_qsfp_module_generic()
1721 hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_qsfp_module_generic()
1734 hw->phy.type = ixgbe_phy_qsfp_active_unknown; in ixgbe_identify_qsfp_module_generic()
1735 if (hw->bus.lan_id == 0) in ixgbe_identify_qsfp_module_generic()
1736 hw->phy.sfp_type = in ixgbe_identify_qsfp_module_generic()
1739 hw->phy.sfp_type = in ixgbe_identify_qsfp_module_generic()
1743 hw->phy.type = ixgbe_phy_sfp_unsupported; in ixgbe_identify_qsfp_module_generic()
1749 if (hw->phy.sfp_type != stored_sfp_type) in ixgbe_identify_qsfp_module_generic()
1750 hw->phy.sfp_setup_needed = true; in ixgbe_identify_qsfp_module_generic()
1752 /* Determine if the QSFP+ PHY is dual speed or not. */ in ixgbe_identify_qsfp_module_generic()
1753 hw->phy.multispeed_fiber = false; in ixgbe_identify_qsfp_module_generic()
1758 hw->phy.multispeed_fiber = true; in ixgbe_identify_qsfp_module_generic()
1760 /* Determine PHY vendor for optical modules */ in ixgbe_identify_qsfp_module_generic()
1763 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_qsfp_module_generic()
1770 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_qsfp_module_generic()
1777 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_qsfp_module_generic()
1790 hw->phy.type = ixgbe_phy_qsfp_intel; in ixgbe_identify_qsfp_module_generic()
1792 hw->phy.type = ixgbe_phy_qsfp_unknown; in ixgbe_identify_qsfp_module_generic()
1796 /* Make sure we're a supported PHY type */ in ixgbe_identify_qsfp_module_generic()
1797 if (hw->phy.type == ixgbe_phy_qsfp_intel) { in ixgbe_identify_qsfp_module_generic()
1800 if (hw->allow_unsupported_sfp == true) { in ixgbe_identify_qsfp_module_generic()
1810 hw->phy.type = in ixgbe_identify_qsfp_module_generic()
1824 hw->phy.sfp_type = ixgbe_sfp_type_not_present; in ixgbe_identify_qsfp_module_generic()
1825 hw->phy.id = 0; in ixgbe_identify_qsfp_module_generic()
1826 hw->phy.type = ixgbe_phy_unknown; in ixgbe_identify_qsfp_module_generic()
1832 * ixgbe_get_sfp_init_sequence_offsets - Provides offset of PHY init sequence
1838 * so it returns the offsets to the phy init sequence block.
1845 u16 sfp_type = hw->phy.sfp_type; in ixgbe_get_sfp_init_sequence_offsets()
1849 if (hw->phy.sfp_type == ixgbe_sfp_type_unknown) in ixgbe_get_sfp_init_sequence_offsets()
1852 if (hw->phy.sfp_type == ixgbe_sfp_type_not_present) in ixgbe_get_sfp_init_sequence_offsets()
1855 if ((hw->device_id == IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM) && in ixgbe_get_sfp_init_sequence_offsets()
1856 (hw->phy.sfp_type == ixgbe_sfp_type_da_cu)) in ixgbe_get_sfp_init_sequence_offsets()
1874 /* Read offset to PHY init contents */ in ixgbe_get_sfp_init_sequence_offsets()
1875 if (hw->eeprom.ops.read(hw, IXGBE_PHY_INIT_OFFSET_NL, list_offset)) { in ixgbe_get_sfp_init_sequence_offsets()
1892 if (hw->eeprom.ops.read(hw, *list_offset, &sfp_id)) in ixgbe_get_sfp_init_sequence_offsets()
1898 if (hw->eeprom.ops.read(hw, *list_offset, data_offset)) in ixgbe_get_sfp_init_sequence_offsets()
1908 if (hw->eeprom.ops.read(hw, *list_offset, &sfp_id)) in ixgbe_get_sfp_init_sequence_offsets()
1927 * ixgbe_read_i2c_eeprom_generic - Reads 8 bit EEPROM word over I2C interface
1932 * Performs byte read operation to SFP module's EEPROM over I2C interface.
1939 return hw->phy.ops.read_i2c_byte(hw, byte_offset, in ixgbe_read_i2c_eeprom_generic()
1945 * ixgbe_read_i2c_sff8472_generic - Reads 8 bit word over I2C interface
1950 * Performs byte read operation to SFP module's SFF-8472 data over I2C
1955 return hw->phy.ops.read_i2c_byte(hw, byte_offset, in ixgbe_read_i2c_sff8472_generic()
1961 * ixgbe_write_i2c_eeprom_generic - Writes 8 bit EEPROM word over I2C interface
1966 * Performs byte write operation to SFP module's EEPROM over I2C interface.
1973 return hw->phy.ops.write_i2c_byte(hw, byte_offset, in ixgbe_write_i2c_eeprom_generic()
1979 * ixgbe_is_sfp_probe - Returns true if SFP is being detected
1982 * @addr: I2C address to be read
1988 hw->phy.sfp_type == ixgbe_sfp_type_not_present) in ixgbe_is_sfp_probe()
1994 * ixgbe_read_i2c_byte_generic_int - Reads 8 bit word over I2C
2001 * Performs byte read operation to SFP module's EEPROM over I2C interface at
2010 u32 swfw_mask = hw->phy.phy_semaphore_mask; in ixgbe_read_i2c_byte_generic_int()
2016 if (hw->mac.type >= ixgbe_mac_X550) in ixgbe_read_i2c_byte_generic_int()
2022 if (lock && hw->mac.ops.acquire_swfw_sync(hw, swfw_mask)) in ixgbe_read_i2c_byte_generic_int()
2063 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_read_i2c_byte_generic_int()
2069 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_read_i2c_byte_generic_int()
2073 DEBUGOUT("I2C byte read error - Retrying.\n"); in ixgbe_read_i2c_byte_generic_int()
2075 DEBUGOUT("I2C byte read error.\n"); in ixgbe_read_i2c_byte_generic_int()
2083 * ixgbe_read_i2c_byte_generic - Reads 8 bit word over I2C
2089 * Performs byte read operation to SFP module's EEPROM over I2C interface at
2100 * ixgbe_read_i2c_byte_generic_unlocked - Reads 8 bit word over I2C
2106 * Performs byte read operation to SFP module's EEPROM over I2C interface at
2117 * ixgbe_write_i2c_byte_generic_int - Writes 8 bit word over I2C
2124 * Performs byte write operation to SFP module's EEPROM over I2C interface at
2133 u32 swfw_mask = hw->phy.phy_semaphore_mask; in ixgbe_write_i2c_byte_generic_int()
2137 if (lock && hw->mac.ops.acquire_swfw_sync(hw, swfw_mask) != in ixgbe_write_i2c_byte_generic_int()
2170 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_write_i2c_byte_generic_int()
2176 DEBUGOUT("I2C byte write error - Retrying.\n"); in ixgbe_write_i2c_byte_generic_int()
2178 DEBUGOUT("I2C byte write error.\n"); in ixgbe_write_i2c_byte_generic_int()
2183 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_write_i2c_byte_generic_int()
2189 * ixgbe_write_i2c_byte_generic - Writes 8 bit word over I2C
2195 * Performs byte write operation to SFP module's EEPROM over I2C interface at
2206 * ixgbe_write_i2c_byte_generic_unlocked - Writes 8 bit word over I2C
2212 * Performs byte write operation to SFP module's EEPROM over I2C interface at
2223 * ixgbe_i2c_start - Sets I2C start condition
2226 * Sets I2C start condition (High -> Low on SDA while SCL is High)
2227 * Set bit-bang mode on X550 hardware.
2257 * ixgbe_i2c_stop - Sets I2C stop condition
2260 * Sets I2C stop condition (Low -> High on SDA while SCL is High)
2261 * Disables bit-bang mode and negates data output enable on X550
2294 * ixgbe_clock_in_i2c_byte - Clocks in one byte via I2C
2298 * Clocks in one byte data via I2C data/clock
2308 for (i = 7; i >= 0; i--) { in ixgbe_clock_in_i2c_byte()
2315 * ixgbe_clock_out_i2c_byte - Clocks out one byte via I2C
2319 * Clocks out one byte data via I2C data/clock
2330 for (i = 7; i >= 0; i--) { in ixgbe_clock_out_i2c_byte()
2349 * ixgbe_get_i2c_ack - Polls for I2C ACK
2352 * Clocks in/out one bit via I2C data/clock
2376 /* Poll for ACK. Note that ACK in I2C spec is in ixgbe_get_i2c_ack()
2388 DEBUGOUT("I2C ack was not received.\n"); in ixgbe_get_i2c_ack()
2401 * ixgbe_clock_in_i2c_bit - Clocks in one bit via I2C data/clock
2405 * Clocks in one bit via I2C data/clock
2435 * ixgbe_clock_out_i2c_bit - Clocks in/out one bit via I2C data/clock
2439 * Clocks out one bit via I2C data/clock
2464 "I2C data was not set to %X\n", data); in ixgbe_clock_out_i2c_bit()
2471 * ixgbe_raise_i2c_clk - Raises the I2C SCL clock
2475 * Raises the I2C clock line '0'->'1'
2476 * Negates the I2C clock output enable on X550 hardware.
2507 * ixgbe_lower_i2c_clk - Lowers the I2C SCL clock
2511 * Lowers the I2C clock line '1'->'0'
2512 * Asserts the I2C clock output enable on X550 hardware.
2529 * ixgbe_set_i2c_data - Sets the I2C data bit
2532 * @data: I2C data value (0 or 1) to set
2534 * Sets the I2C data bit
2535 * Asserts the I2C data output enable on X550 hardware.
2553 /* Data rise/fall (1000ns/300ns) and set-up time (250ns) */ in ixgbe_set_i2c_data()
2569 "Error - I2C data was not set to %X.\n", in ixgbe_set_i2c_data()
2577 * ixgbe_get_i2c_data - Reads the I2C SDA data bit
2581 * Returns the I2C data bit value
2582 * Negates the I2C data output enable on X550 hardware.
2607 * ixgbe_i2c_bus_clear - Clears the I2C bus
2610 * Clears the I2C bus by sending nine clock pulses.
2639 /* Put the i2c bus back to default state */ in ixgbe_i2c_bus_clear()
2644 * ixgbe_tn_check_overtemp - Checks if an overtemp occurred.
2656 if (hw->device_id != IXGBE_DEV_ID_82599_T3_LOM) in ixgbe_tn_check_overtemp()
2660 hw->phy.ops.read_reg(hw, IXGBE_TN_LASI_STATUS_REG, in ixgbe_tn_check_overtemp()
2673 * ixgbe_set_copper_phy_power - Control power for copper phy
2685 status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_VENDOR_SPECIFIC_1_CONTROL, in ixgbe_set_copper_phy_power()
2699 status = hw->phy.ops.write_reg(hw, IXGBE_MDIO_VENDOR_SPECIFIC_1_CONTROL, in ixgbe_set_copper_phy_power()