Lines Matching +full:auto +full:- +full:i2c
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 1999 - 2018 Intel Corporation. */
29 * ixgbe_out_i2c_byte_ack - Send I2C byte with ack
46 * ixgbe_in_i2c_byte_ack - Receive an I2C byte and send ack
64 * ixgbe_ones_comp_byte_add - Perform one's complement addition
68 * Returns one's complement 8-bit sum.
79 * ixgbe_read_i2c_combined_generic_int - Perform I2C read combined operation
81 * @addr: I2C bus address to read from
82 * @reg: I2C device register to read from
91 u32 swfw_mask = hw->phy.phy_semaphore_mask; in ixgbe_read_i2c_combined_generic_int()
104 if (lock && hw->mac.ops.acquire_swfw_sync(hw, swfw_mask)) in ixgbe_read_i2c_combined_generic_int()
119 /* Re-start condition */ in ixgbe_read_i2c_combined_generic_int()
138 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_read_i2c_combined_generic_int()
145 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_read_i2c_combined_generic_int()
148 hw_dbg(hw, "I2C byte read combined error - Retry.\n"); in ixgbe_read_i2c_combined_generic_int()
150 hw_dbg(hw, "I2C byte read combined error.\n"); in ixgbe_read_i2c_combined_generic_int()
157 * ixgbe_write_i2c_combined_generic_int - Perform I2C write combined operation
159 * @addr: I2C bus address to write to
160 * @reg: I2C device register to write to
169 u32 swfw_mask = hw->phy.phy_semaphore_mask; in ixgbe_write_i2c_combined_generic_int()
181 if (lock && hw->mac.ops.acquire_swfw_sync(hw, swfw_mask)) in ixgbe_write_i2c_combined_generic_int()
204 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_write_i2c_combined_generic_int()
210 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_write_i2c_combined_generic_int()
213 hw_dbg(hw, "I2C byte write combined error - Retry.\n"); in ixgbe_write_i2c_combined_generic_int()
215 hw_dbg(hw, "I2C byte write combined error.\n"); in ixgbe_write_i2c_combined_generic_int()
222 * ixgbe_probe_phy - Probe a single address for a PHY
232 hw->phy.mdio.prtad = phy_addr; in ixgbe_probe_phy()
233 if (mdio45_probe(&hw->phy.mdio, phy_addr) != 0) in ixgbe_probe_phy()
239 hw->phy.type = ixgbe_get_phy_type_from_id(hw->phy.id); in ixgbe_probe_phy()
241 if (hw->phy.type == ixgbe_phy_unknown) { in ixgbe_probe_phy()
242 hw->phy.ops.read_reg(hw, in ixgbe_probe_phy()
249 hw->phy.type = ixgbe_phy_cu_unknown; in ixgbe_probe_phy()
251 hw->phy.type = ixgbe_phy_generic; in ixgbe_probe_phy()
258 * ixgbe_identify_phy_generic - Get physical layer module
268 if (!hw->phy.phy_semaphore_mask) { in ixgbe_identify_phy_generic()
269 if (hw->bus.lan_id) in ixgbe_identify_phy_generic()
270 hw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY1_SM; in ixgbe_identify_phy_generic()
272 hw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY0_SM; in ixgbe_identify_phy_generic()
275 if (hw->phy.type != ixgbe_phy_unknown) in ixgbe_identify_phy_generic()
278 if (hw->phy.nw_mng_if_sel) { in ixgbe_identify_phy_generic()
279 phy_addr = (hw->phy.nw_mng_if_sel & in ixgbe_identify_phy_generic()
300 hw->phy.mdio.prtad = MDIO_PRTAD_NONE; in ixgbe_identify_phy_generic()
306 * ixgbe_check_reset_blocked - check status of MNG FW veto bit
319 if (hw->mac.type == ixgbe_mac_82598EB) in ixgbe_check_reset_blocked()
332 * ixgbe_get_phy_id - Get the phy type
342 status = hw->phy.ops.read_reg(hw, MDIO_DEVID1, MDIO_MMD_PMAPMD, in ixgbe_get_phy_id()
346 hw->phy.id = (u32)(phy_id_high << 16); in ixgbe_get_phy_id()
347 status = hw->phy.ops.read_reg(hw, MDIO_DEVID2, MDIO_MMD_PMAPMD, in ixgbe_get_phy_id()
349 hw->phy.id |= (u32)(phy_id_low & IXGBE_PHY_REVISION_MASK); in ixgbe_get_phy_id()
350 hw->phy.revision = (u32)(phy_id_low & ~IXGBE_PHY_REVISION_MASK); in ixgbe_get_phy_id()
356 * ixgbe_get_phy_type_from_id - Get the phy type
392 * ixgbe_reset_phy_generic - Performs a PHY reset
401 if (hw->phy.type == ixgbe_phy_unknown) in ixgbe_reset_phy_generic()
404 if (status != 0 || hw->phy.type == ixgbe_phy_none) in ixgbe_reset_phy_generic()
408 if (!hw->phy.reset_if_overtemp && in ixgbe_reset_phy_generic()
409 (IXGBE_ERR_OVERTEMP == hw->phy.ops.check_overtemp(hw))) in ixgbe_reset_phy_generic()
420 hw->phy.ops.write_reg(hw, MDIO_CTRL1, in ixgbe_reset_phy_generic()
425 * Poll for reset bit to self-clear indicating reset is complete. in ixgbe_reset_phy_generic()
431 if (hw->phy.type == ixgbe_phy_x550em_ext_t) { in ixgbe_reset_phy_generic()
432 status = hw->phy.ops.read_reg(hw, in ixgbe_reset_phy_generic()
443 status = hw->phy.ops.read_reg(hw, MDIO_CTRL1, in ixgbe_reset_phy_generic()
464 * ixgbe_read_phy_mdi - Reads a value from a specified PHY register without
479 (hw->phy.mdio.prtad << IXGBE_MSCA_PHY_ADDR_SHIFT) | in ixgbe_read_phy_reg_mdi()
507 (hw->phy.mdio.prtad << IXGBE_MSCA_PHY_ADDR_SHIFT) | in ixgbe_read_phy_reg_mdi()
540 * ixgbe_read_phy_reg_generic - Reads a value from a specified PHY register
541 * using the SWFW lock - this function is needed in most cases
551 u32 gssr = hw->phy.phy_semaphore_mask; in ixgbe_read_phy_reg_generic()
553 if (hw->mac.ops.acquire_swfw_sync(hw, gssr) == 0) { in ixgbe_read_phy_reg_generic()
556 hw->mac.ops.release_swfw_sync(hw, gssr); in ixgbe_read_phy_reg_generic()
565 * ixgbe_write_phy_reg_mdi - Writes a value to specified PHY register
583 (hw->phy.mdio.prtad << IXGBE_MSCA_PHY_ADDR_SHIFT) | in ixgbe_write_phy_reg_mdi()
612 (hw->phy.mdio.prtad << IXGBE_MSCA_PHY_ADDR_SHIFT) | in ixgbe_write_phy_reg_mdi()
638 * ixgbe_write_phy_reg_generic - Writes a value to specified PHY register
639 * using SWFW lock- this function is needed in most cases
649 u32 gssr = hw->phy.phy_semaphore_mask; in ixgbe_write_phy_reg_generic()
651 if (hw->mac.ops.acquire_swfw_sync(hw, gssr) == 0) { in ixgbe_write_phy_reg_generic()
654 hw->mac.ops.release_swfw_sync(hw, gssr); in ixgbe_write_phy_reg_generic()
665 * ixgbe_msca_cmd - Write the command register and poll for completion/timeout
679 * ixgbe_mii_bus_read_generic - Read a clause 22/45 register with gssr flags
691 if (hw->mac.ops.acquire_swfw_sync(hw, gssr)) in ixgbe_mii_bus_read_generic()
692 return -EBUSY; in ixgbe_mii_bus_read_generic()
724 hw->mac.ops.release_swfw_sync(hw, gssr); in ixgbe_mii_bus_read_generic()
729 * ixgbe_mii_bus_write_generic - Write a clause 22/45 register with gssr flags
742 if (hw->mac.ops.acquire_swfw_sync(hw, gssr)) in ixgbe_mii_bus_write_generic()
743 return -EBUSY; in ixgbe_mii_bus_write_generic()
768 hw->mac.ops.release_swfw_sync(hw, gssr); in ixgbe_mii_bus_write_generic()
773 * ixgbe_mii_bus_read - Read a clause 22/45 register
780 struct ixgbe_adapter *adapter = bus->priv; in ixgbe_mii_bus_read()
781 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_mii_bus_read()
782 u32 gssr = hw->phy.phy_semaphore_mask; in ixgbe_mii_bus_read()
788 * ixgbe_mii_bus_write - Write a clause 22/45 register
797 struct ixgbe_adapter *adapter = bus->priv; in ixgbe_mii_bus_write()
798 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_mii_bus_write()
799 u32 gssr = hw->phy.phy_semaphore_mask; in ixgbe_mii_bus_write()
805 * ixgbe_x550em_a_mii_bus_read - Read a clause 22/45 register on x550em_a
813 struct ixgbe_adapter *adapter = bus->priv; in ixgbe_x550em_a_mii_bus_read()
814 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_x550em_a_mii_bus_read()
815 u32 gssr = hw->phy.phy_semaphore_mask; in ixgbe_x550em_a_mii_bus_read()
822 * ixgbe_x550em_a_mii_bus_write - Write a clause 22/45 register on x550em_a
831 struct ixgbe_adapter *adapter = bus->priv; in ixgbe_x550em_a_mii_bus_write()
832 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_x550em_a_mii_bus_write()
833 u32 gssr = hw->phy.phy_semaphore_mask; in ixgbe_x550em_a_mii_bus_write()
840 * ixgbe_get_first_secondary_devfn - get first device downstream of root port
852 if (rp_pdev && rp_pdev->subordinate) { in ixgbe_get_first_secondary_devfn()
853 bus = rp_pdev->subordinate->number; in ixgbe_get_first_secondary_devfn()
861 * ixgbe_x550em_a_has_mii - is this the first ixgbe x550em_a PCI function?
870 struct ixgbe_adapter *adapter = hw->back; in ixgbe_x550em_a_has_mii()
871 struct pci_dev *pdev = adapter->pdev; in ixgbe_x550em_a_has_mii()
895 * ixgbe_mii_bus_init - mii_bus structure setup
906 struct ixgbe_adapter *adapter = hw->back; in ixgbe_mii_bus_init()
907 struct pci_dev *pdev = adapter->pdev; in ixgbe_mii_bus_init()
908 struct device *dev = &adapter->netdev->dev; in ixgbe_mii_bus_init()
911 switch (hw->device_id) { in ixgbe_mii_bus_init()
935 return -ENOMEM; in ixgbe_mii_bus_init()
937 bus->read = read; in ixgbe_mii_bus_init()
938 bus->write = write; in ixgbe_mii_bus_init()
941 snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mdio-%s", ixgbe_driver_name, in ixgbe_mii_bus_init()
944 bus->name = "ixgbe-mdio"; in ixgbe_mii_bus_init()
945 bus->priv = adapter; in ixgbe_mii_bus_init()
946 bus->parent = dev; in ixgbe_mii_bus_init()
947 bus->phy_mask = GENMASK(31, 0); in ixgbe_mii_bus_init()
953 hw->phy.mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_SUPPORTS_C22; in ixgbe_mii_bus_init()
955 adapter->mii_bus = bus; in ixgbe_mii_bus_init()
960 * ixgbe_setup_phy_link_generic - Set and restart autoneg
974 /* Set or unset auto-negotiation 10G advertisement */ in ixgbe_setup_phy_link_generic()
975 hw->phy.ops.read_reg(hw, MDIO_AN_10GBT_CTRL, MDIO_MMD_AN, &autoneg_reg); in ixgbe_setup_phy_link_generic()
978 if ((hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10GB_FULL) && in ixgbe_setup_phy_link_generic()
982 hw->phy.ops.write_reg(hw, MDIO_AN_10GBT_CTRL, MDIO_MMD_AN, autoneg_reg); in ixgbe_setup_phy_link_generic()
984 hw->phy.ops.read_reg(hw, IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG, in ixgbe_setup_phy_link_generic()
987 if (hw->mac.type == ixgbe_mac_X550) { in ixgbe_setup_phy_link_generic()
988 /* Set or unset auto-negotiation 5G advertisement */ in ixgbe_setup_phy_link_generic()
990 if ((hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_5GB_FULL) && in ixgbe_setup_phy_link_generic()
994 /* Set or unset auto-negotiation 2.5G advertisement */ in ixgbe_setup_phy_link_generic()
996 if ((hw->phy.autoneg_advertised & in ixgbe_setup_phy_link_generic()
1002 /* Set or unset auto-negotiation 1G advertisement */ in ixgbe_setup_phy_link_generic()
1004 if ((hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_1GB_FULL) && in ixgbe_setup_phy_link_generic()
1008 hw->phy.ops.write_reg(hw, IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG, in ixgbe_setup_phy_link_generic()
1011 /* Set or unset auto-negotiation 100M advertisement */ in ixgbe_setup_phy_link_generic()
1012 hw->phy.ops.read_reg(hw, MDIO_AN_ADVERTISE, MDIO_MMD_AN, &autoneg_reg); in ixgbe_setup_phy_link_generic()
1015 if ((hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_100_FULL) && in ixgbe_setup_phy_link_generic()
1019 hw->phy.ops.write_reg(hw, MDIO_AN_ADVERTISE, MDIO_MMD_AN, autoneg_reg); in ixgbe_setup_phy_link_generic()
1026 hw->phy.ops.read_reg(hw, MDIO_CTRL1, in ixgbe_setup_phy_link_generic()
1031 hw->phy.ops.write_reg(hw, MDIO_CTRL1, in ixgbe_setup_phy_link_generic()
1038 * ixgbe_setup_phy_link_speed_generic - Sets the auto advertised capabilities
1050 hw->phy.autoneg_advertised = 0; in ixgbe_setup_phy_link_speed_generic()
1053 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10GB_FULL; in ixgbe_setup_phy_link_speed_generic()
1056 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_5GB_FULL; in ixgbe_setup_phy_link_speed_generic()
1059 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_2_5GB_FULL; in ixgbe_setup_phy_link_speed_generic()
1062 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL; in ixgbe_setup_phy_link_speed_generic()
1065 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_100_FULL; in ixgbe_setup_phy_link_speed_generic()
1068 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10_FULL; in ixgbe_setup_phy_link_speed_generic()
1071 if (hw->phy.ops.setup_link) in ixgbe_setup_phy_link_speed_generic()
1072 hw->phy.ops.setup_link(hw); in ixgbe_setup_phy_link_speed_generic()
1078 * ixgbe_get_copper_speeds_supported - Get copper link speed from phy
1081 * Determines the supported link capabilities by reading the PHY auto
1089 status = hw->phy.ops.read_reg(hw, MDIO_SPEED, MDIO_MMD_PMAPMD, in ixgbe_get_copper_speeds_supported()
1095 hw->phy.speeds_supported |= IXGBE_LINK_SPEED_10GB_FULL; in ixgbe_get_copper_speeds_supported()
1097 hw->phy.speeds_supported |= IXGBE_LINK_SPEED_1GB_FULL; in ixgbe_get_copper_speeds_supported()
1099 hw->phy.speeds_supported |= IXGBE_LINK_SPEED_100_FULL; in ixgbe_get_copper_speeds_supported()
1101 switch (hw->mac.type) { in ixgbe_get_copper_speeds_supported()
1103 hw->phy.speeds_supported |= IXGBE_LINK_SPEED_2_5GB_FULL; in ixgbe_get_copper_speeds_supported()
1104 hw->phy.speeds_supported |= IXGBE_LINK_SPEED_5GB_FULL; in ixgbe_get_copper_speeds_supported()
1108 hw->phy.speeds_supported &= ~IXGBE_LINK_SPEED_100_FULL; in ixgbe_get_copper_speeds_supported()
1118 * ixgbe_get_copper_link_capabilities_generic - Determines link capabilities
1121 * @autoneg: boolean auto-negotiation value
1130 if (!hw->phy.speeds_supported) in ixgbe_get_copper_link_capabilities_generic()
1133 *speed = hw->phy.speeds_supported; in ixgbe_get_copper_link_capabilities_generic()
1138 * ixgbe_check_phy_link_tnx - Determine link and speed status
1167 status = hw->phy.ops.read_reg(hw, in ixgbe_check_phy_link_tnx()
1188 * ixgbe_setup_phy_link_tnx - Set and restart autoneg
1205 /* Set or unset auto-negotiation 10G advertisement */ in ixgbe_setup_phy_link_tnx()
1206 hw->phy.ops.read_reg(hw, MDIO_AN_10GBT_CTRL, in ixgbe_setup_phy_link_tnx()
1211 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10GB_FULL) in ixgbe_setup_phy_link_tnx()
1214 hw->phy.ops.write_reg(hw, MDIO_AN_10GBT_CTRL, in ixgbe_setup_phy_link_tnx()
1220 /* Set or unset auto-negotiation 1G advertisement */ in ixgbe_setup_phy_link_tnx()
1221 hw->phy.ops.read_reg(hw, IXGBE_MII_AUTONEG_XNP_TX_REG, in ixgbe_setup_phy_link_tnx()
1226 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_1GB_FULL) in ixgbe_setup_phy_link_tnx()
1229 hw->phy.ops.write_reg(hw, IXGBE_MII_AUTONEG_XNP_TX_REG, in ixgbe_setup_phy_link_tnx()
1235 /* Set or unset auto-negotiation 100M advertisement */ in ixgbe_setup_phy_link_tnx()
1236 hw->phy.ops.read_reg(hw, MDIO_AN_ADVERTISE, in ixgbe_setup_phy_link_tnx()
1242 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_100_FULL) in ixgbe_setup_phy_link_tnx()
1245 hw->phy.ops.write_reg(hw, MDIO_AN_ADVERTISE, in ixgbe_setup_phy_link_tnx()
1255 hw->phy.ops.read_reg(hw, MDIO_CTRL1, in ixgbe_setup_phy_link_tnx()
1260 hw->phy.ops.write_reg(hw, MDIO_CTRL1, in ixgbe_setup_phy_link_tnx()
1266 * ixgbe_reset_phy_nl - Performs a PHY reset
1282 hw->phy.ops.read_reg(hw, MDIO_CTRL1, MDIO_MMD_PHYXS, &phy_data); in ixgbe_reset_phy_nl()
1285 hw->phy.ops.write_reg(hw, MDIO_CTRL1, MDIO_MMD_PHYXS, in ixgbe_reset_phy_nl()
1289 hw->phy.ops.read_reg(hw, MDIO_CTRL1, MDIO_MMD_PHYXS, in ixgbe_reset_phy_nl()
1307 ret_val = hw->eeprom.ops.read(hw, data_offset, &block_crc); in ixgbe_reset_phy_nl()
1313 ret_val = hw->eeprom.ops.read(hw, data_offset, &eword); in ixgbe_reset_phy_nl()
1328 ret_val = hw->eeprom.ops.read(hw, data_offset++, in ixgbe_reset_phy_nl()
1333 ret_val = hw->eeprom.ops.read(hw, data_offset, in ixgbe_reset_phy_nl()
1337 hw->phy.ops.write_reg(hw, phy_offset, in ixgbe_reset_phy_nl()
1372 * ixgbe_identify_module_generic - Identifies module type
1379 switch (hw->mac.ops.get_media_type(hw)) { in ixgbe_identify_module_generic()
1385 hw->phy.sfp_type = ixgbe_sfp_type_not_present; in ixgbe_identify_module_generic()
1393 * ixgbe_identify_sfp_module_generic - Identifies SFP modules
1400 struct ixgbe_adapter *adapter = hw->back; in ixgbe_identify_sfp_module_generic()
1403 enum ixgbe_sfp_type stored_sfp_type = hw->phy.sfp_type; in ixgbe_identify_sfp_module_generic()
1412 if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_fiber) { in ixgbe_identify_sfp_module_generic()
1413 hw->phy.sfp_type = ixgbe_sfp_type_not_present; in ixgbe_identify_sfp_module_generic()
1418 hw->mac.ops.set_lan_id(hw); in ixgbe_identify_sfp_module_generic()
1420 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_sfp_module_generic()
1428 hw->phy.type = ixgbe_phy_sfp_unsupported; in ixgbe_identify_sfp_module_generic()
1431 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_sfp_module_generic()
1438 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_sfp_module_generic()
1444 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_sfp_module_generic()
1456 * 3 SFP_DA_CORE0 - 82599-specific in ixgbe_identify_sfp_module_generic()
1457 * 4 SFP_DA_CORE1 - 82599-specific in ixgbe_identify_sfp_module_generic()
1458 * 5 SFP_SR/LR_CORE0 - 82599-specific in ixgbe_identify_sfp_module_generic()
1459 * 6 SFP_SR/LR_CORE1 - 82599-specific in ixgbe_identify_sfp_module_generic()
1460 * 7 SFP_act_lmt_DA_CORE0 - 82599-specific in ixgbe_identify_sfp_module_generic()
1461 * 8 SFP_act_lmt_DA_CORE1 - 82599-specific in ixgbe_identify_sfp_module_generic()
1462 * 9 SFP_1g_cu_CORE0 - 82599-specific in ixgbe_identify_sfp_module_generic()
1463 * 10 SFP_1g_cu_CORE1 - 82599-specific in ixgbe_identify_sfp_module_generic()
1464 * 11 SFP_1g_sx_CORE0 - 82599-specific in ixgbe_identify_sfp_module_generic()
1465 * 12 SFP_1g_sx_CORE1 - 82599-specific in ixgbe_identify_sfp_module_generic()
1467 if (hw->mac.type == ixgbe_mac_82598EB) { in ixgbe_identify_sfp_module_generic()
1469 hw->phy.sfp_type = ixgbe_sfp_type_da_cu; in ixgbe_identify_sfp_module_generic()
1471 hw->phy.sfp_type = ixgbe_sfp_type_sr; in ixgbe_identify_sfp_module_generic()
1473 hw->phy.sfp_type = ixgbe_sfp_type_lr; in ixgbe_identify_sfp_module_generic()
1475 hw->phy.sfp_type = ixgbe_sfp_type_unknown; in ixgbe_identify_sfp_module_generic()
1478 if (hw->bus.lan_id == 0) in ixgbe_identify_sfp_module_generic()
1479 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1482 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1485 hw->phy.ops.read_i2c_eeprom( in ixgbe_identify_sfp_module_generic()
1490 if (hw->bus.lan_id == 0) in ixgbe_identify_sfp_module_generic()
1491 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1494 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1497 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1503 if (hw->bus.lan_id == 0) in ixgbe_identify_sfp_module_generic()
1504 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1507 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1510 if (hw->bus.lan_id == 0) in ixgbe_identify_sfp_module_generic()
1511 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1514 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1517 if (hw->bus.lan_id == 0) in ixgbe_identify_sfp_module_generic()
1518 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1521 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1524 if (hw->bus.lan_id == 0) in ixgbe_identify_sfp_module_generic()
1525 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1528 hw->phy.sfp_type = in ixgbe_identify_sfp_module_generic()
1531 hw->phy.sfp_type = ixgbe_sfp_type_unknown; in ixgbe_identify_sfp_module_generic()
1535 if (hw->phy.sfp_type != stored_sfp_type) in ixgbe_identify_sfp_module_generic()
1536 hw->phy.sfp_setup_needed = true; in ixgbe_identify_sfp_module_generic()
1539 hw->phy.multispeed_fiber = false; in ixgbe_identify_sfp_module_generic()
1544 hw->phy.multispeed_fiber = true; in ixgbe_identify_sfp_module_generic()
1547 if (hw->phy.type != ixgbe_phy_nl) { in ixgbe_identify_sfp_module_generic()
1548 hw->phy.id = identifier; in ixgbe_identify_sfp_module_generic()
1549 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_sfp_module_generic()
1556 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_sfp_module_generic()
1563 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_sfp_module_generic()
1578 hw->phy.type = in ixgbe_identify_sfp_module_generic()
1583 hw->phy.type = ixgbe_phy_sfp_ftl_active; in ixgbe_identify_sfp_module_generic()
1585 hw->phy.type = ixgbe_phy_sfp_ftl; in ixgbe_identify_sfp_module_generic()
1588 hw->phy.type = ixgbe_phy_sfp_avago; in ixgbe_identify_sfp_module_generic()
1591 hw->phy.type = ixgbe_phy_sfp_intel; in ixgbe_identify_sfp_module_generic()
1595 hw->phy.type = in ixgbe_identify_sfp_module_generic()
1598 hw->phy.type = in ixgbe_identify_sfp_module_generic()
1601 hw->phy.type = ixgbe_phy_sfp_unknown; in ixgbe_identify_sfp_module_generic()
1613 !(hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 || in ixgbe_identify_sfp_module_generic()
1614 hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 || in ixgbe_identify_sfp_module_generic()
1615 hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 || in ixgbe_identify_sfp_module_generic()
1616 hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 || in ixgbe_identify_sfp_module_generic()
1617 hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || in ixgbe_identify_sfp_module_generic()
1618 hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1)) { in ixgbe_identify_sfp_module_generic()
1619 hw->phy.type = ixgbe_phy_sfp_unsupported; in ixgbe_identify_sfp_module_generic()
1623 /* Anything else 82598-based is supported */ in ixgbe_identify_sfp_module_generic()
1624 if (hw->mac.type == ixgbe_mac_82598EB) in ixgbe_identify_sfp_module_generic()
1627 hw->mac.ops.get_device_caps(hw, &enforce_sfp); in ixgbe_identify_sfp_module_generic()
1629 !(hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 || in ixgbe_identify_sfp_module_generic()
1630 hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 || in ixgbe_identify_sfp_module_generic()
1631 hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 || in ixgbe_identify_sfp_module_generic()
1632 hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 || in ixgbe_identify_sfp_module_generic()
1633 hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || in ixgbe_identify_sfp_module_generic()
1634 hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1)) { in ixgbe_identify_sfp_module_generic()
1636 if (hw->phy.type == ixgbe_phy_sfp_intel) in ixgbe_identify_sfp_module_generic()
1638 if (hw->allow_unsupported_sfp) { in ixgbe_identify_sfp_module_generic()
1643 hw->phy.type = ixgbe_phy_sfp_unsupported; in ixgbe_identify_sfp_module_generic()
1649 hw->phy.sfp_type = ixgbe_sfp_type_not_present; in ixgbe_identify_sfp_module_generic()
1650 if (hw->phy.type != ixgbe_phy_nl) { in ixgbe_identify_sfp_module_generic()
1651 hw->phy.id = 0; in ixgbe_identify_sfp_module_generic()
1652 hw->phy.type = ixgbe_phy_unknown; in ixgbe_identify_sfp_module_generic()
1658 * ixgbe_identify_qsfp_module_generic - Identifies QSFP modules
1665 struct ixgbe_adapter *adapter = hw->back; in ixgbe_identify_qsfp_module_generic()
1668 enum ixgbe_sfp_type stored_sfp_type = hw->phy.sfp_type; in ixgbe_identify_qsfp_module_generic()
1679 if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_fiber_qsfp) { in ixgbe_identify_qsfp_module_generic()
1680 hw->phy.sfp_type = ixgbe_sfp_type_not_present; in ixgbe_identify_qsfp_module_generic()
1685 hw->mac.ops.set_lan_id(hw); in ixgbe_identify_qsfp_module_generic()
1687 status = hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_IDENTIFIER, in ixgbe_identify_qsfp_module_generic()
1694 hw->phy.type = ixgbe_phy_sfp_unsupported; in ixgbe_identify_qsfp_module_generic()
1698 hw->phy.id = identifier; in ixgbe_identify_qsfp_module_generic()
1700 status = hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_QSFP_10GBE_COMP, in ixgbe_identify_qsfp_module_generic()
1706 status = hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_QSFP_1GBE_COMP, in ixgbe_identify_qsfp_module_generic()
1713 hw->phy.type = ixgbe_phy_qsfp_passive_unknown; in ixgbe_identify_qsfp_module_generic()
1714 if (hw->bus.lan_id == 0) in ixgbe_identify_qsfp_module_generic()
1715 hw->phy.sfp_type = ixgbe_sfp_type_da_cu_core0; in ixgbe_identify_qsfp_module_generic()
1717 hw->phy.sfp_type = ixgbe_sfp_type_da_cu_core1; in ixgbe_identify_qsfp_module_generic()
1720 if (hw->bus.lan_id == 0) in ixgbe_identify_qsfp_module_generic()
1721 hw->phy.sfp_type = ixgbe_sfp_type_srlr_core0; in ixgbe_identify_qsfp_module_generic()
1723 hw->phy.sfp_type = ixgbe_sfp_type_srlr_core1; in ixgbe_identify_qsfp_module_generic()
1729 /* check for active DA cables that pre-date in ixgbe_identify_qsfp_module_generic()
1730 * SFF-8436 v3.6 in ixgbe_identify_qsfp_module_generic()
1732 hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_qsfp_module_generic()
1736 hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_qsfp_module_generic()
1740 hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_qsfp_module_generic()
1753 hw->phy.type = ixgbe_phy_qsfp_active_unknown; in ixgbe_identify_qsfp_module_generic()
1754 if (hw->bus.lan_id == 0) in ixgbe_identify_qsfp_module_generic()
1755 hw->phy.sfp_type = in ixgbe_identify_qsfp_module_generic()
1758 hw->phy.sfp_type = in ixgbe_identify_qsfp_module_generic()
1762 hw->phy.type = ixgbe_phy_sfp_unsupported; in ixgbe_identify_qsfp_module_generic()
1767 if (hw->phy.sfp_type != stored_sfp_type) in ixgbe_identify_qsfp_module_generic()
1768 hw->phy.sfp_setup_needed = true; in ixgbe_identify_qsfp_module_generic()
1771 hw->phy.multispeed_fiber = false; in ixgbe_identify_qsfp_module_generic()
1776 hw->phy.multispeed_fiber = true; in ixgbe_identify_qsfp_module_generic()
1781 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_qsfp_module_generic()
1788 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_qsfp_module_generic()
1795 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_identify_qsfp_module_generic()
1808 hw->phy.type = ixgbe_phy_qsfp_intel; in ixgbe_identify_qsfp_module_generic()
1810 hw->phy.type = ixgbe_phy_qsfp_unknown; in ixgbe_identify_qsfp_module_generic()
1812 hw->mac.ops.get_device_caps(hw, &enforce_sfp); in ixgbe_identify_qsfp_module_generic()
1815 if (hw->phy.type == ixgbe_phy_qsfp_intel) in ixgbe_identify_qsfp_module_generic()
1817 if (hw->allow_unsupported_sfp) { in ixgbe_identify_qsfp_module_generic()
1822 hw->phy.type = ixgbe_phy_sfp_unsupported; in ixgbe_identify_qsfp_module_generic()
1830 hw->phy.sfp_type = ixgbe_sfp_type_not_present; in ixgbe_identify_qsfp_module_generic()
1831 hw->phy.id = 0; in ixgbe_identify_qsfp_module_generic()
1832 hw->phy.type = ixgbe_phy_unknown; in ixgbe_identify_qsfp_module_generic()
1838 * ixgbe_get_sfp_init_sequence_offsets - Provides offset of PHY init sequence
1851 u16 sfp_type = hw->phy.sfp_type; in ixgbe_get_sfp_init_sequence_offsets()
1853 if (hw->phy.sfp_type == ixgbe_sfp_type_unknown) in ixgbe_get_sfp_init_sequence_offsets()
1856 if (hw->phy.sfp_type == ixgbe_sfp_type_not_present) in ixgbe_get_sfp_init_sequence_offsets()
1859 if ((hw->device_id == IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM) && in ixgbe_get_sfp_init_sequence_offsets()
1860 (hw->phy.sfp_type == ixgbe_sfp_type_da_cu)) in ixgbe_get_sfp_init_sequence_offsets()
1879 if (hw->eeprom.ops.read(hw, IXGBE_PHY_INIT_OFFSET_NL, list_offset)) { in ixgbe_get_sfp_init_sequence_offsets()
1895 if (hw->eeprom.ops.read(hw, *list_offset, &sfp_id)) in ixgbe_get_sfp_init_sequence_offsets()
1901 if (hw->eeprom.ops.read(hw, *list_offset, data_offset)) in ixgbe_get_sfp_init_sequence_offsets()
1911 if (hw->eeprom.ops.read(hw, *list_offset, &sfp_id)) in ixgbe_get_sfp_init_sequence_offsets()
1929 * ixgbe_read_i2c_eeprom_generic - Reads 8 bit EEPROM word over I2C interface
1934 * 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.
1971 return hw->phy.ops.write_i2c_byte(hw, byte_offset, in ixgbe_write_i2c_eeprom_generic()
1977 * ixgbe_is_sfp_probe - Returns true if SFP is being detected
1980 * @addr: I2C address to be read
1986 hw->phy.sfp_type == ixgbe_sfp_type_not_present) in ixgbe_is_sfp_probe()
1992 * ixgbe_read_i2c_byte_generic_int - Reads 8 bit word over I2C
1999 * Performs byte read operation to SFP module's EEPROM over I2C interface at
2008 u32 swfw_mask = hw->phy.phy_semaphore_mask; in ixgbe_read_i2c_byte_generic_int()
2011 if (hw->mac.type >= ixgbe_mac_X550) in ixgbe_read_i2c_byte_generic_int()
2019 if (lock && hw->mac.ops.acquire_swfw_sync(hw, swfw_mask)) in ixgbe_read_i2c_byte_generic_int()
2062 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_read_i2c_byte_generic_int()
2068 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_read_i2c_byte_generic_int()
2073 hw_dbg(hw, "I2C byte read error - Retrying.\n"); in ixgbe_read_i2c_byte_generic_int()
2075 hw_dbg(hw, "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()
2135 if (lock && hw->mac.ops.acquire_swfw_sync(hw, swfw_mask)) in ixgbe_write_i2c_byte_generic_int()
2167 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_write_i2c_byte_generic_int()
2174 hw_dbg(hw, "I2C byte write error - Retrying.\n"); in ixgbe_write_i2c_byte_generic_int()
2176 hw_dbg(hw, "I2C byte write error.\n"); in ixgbe_write_i2c_byte_generic_int()
2180 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_write_i2c_byte_generic_int()
2186 * ixgbe_write_i2c_byte_generic - Writes 8 bit word over I2C
2192 * Performs byte write operation to SFP module's EEPROM over I2C interface at
2203 * ixgbe_write_i2c_byte_generic_unlocked - Writes 8 bit word over I2C
2209 * Performs byte write operation to SFP module's EEPROM over I2C interface at
2220 * ixgbe_i2c_start - Sets I2C start condition
2223 * Sets I2C start condition (High -> Low on SDA while SCL is High)
2224 * Set bit-bang mode on X550 hardware.
2252 * ixgbe_i2c_stop - Sets I2C stop condition
2255 * Sets I2C stop condition (Low -> High on SDA while SCL is High)
2256 * Disables bit-bang mode and negates data output enable on X550
2287 * ixgbe_clock_in_i2c_byte - Clocks in one byte via I2C
2291 * Clocks in one byte data via I2C data/clock
2299 for (i = 7; i >= 0; i--) { in ixgbe_clock_in_i2c_byte()
2308 * ixgbe_clock_out_i2c_byte - Clocks out one byte via I2C
2312 * Clocks out one byte data via I2C data/clock
2321 for (i = 7; i >= 0; i--) { in ixgbe_clock_out_i2c_byte()
2340 * ixgbe_get_i2c_ack - Polls for I2C ACK
2343 * Clocks in/out one bit via I2C data/clock
2365 /* Poll for ACK. Note that ACK in I2C spec is in ixgbe_get_i2c_ack()
2377 hw_dbg(hw, "I2C ack was not received.\n"); in ixgbe_get_i2c_ack()
2390 * ixgbe_clock_in_i2c_bit - Clocks in one bit via I2C data/clock
2394 * Clocks in one bit via I2C data/clock
2424 * ixgbe_clock_out_i2c_bit - Clocks in/out one bit via I2C data/clock
2428 * Clocks out one bit via I2C data/clock
2449 hw_dbg(hw, "I2C data was not set to %X\n", data); in ixgbe_clock_out_i2c_bit()
2456 * ixgbe_raise_i2c_clk - Raises the I2C SCL clock
2460 * Raises the I2C clock line '0'->'1'
2461 * Negates the I2C clock output enable on X550 hardware.
2489 * ixgbe_lower_i2c_clk - Lowers the I2C SCL clock
2493 * Lowers the I2C clock line '1'->'0'
2494 * Asserts the I2C clock output enable on X550 hardware.
2510 * ixgbe_set_i2c_data - Sets the I2C data bit
2513 * @data: I2C data value (0 or 1) to set
2515 * Sets the I2C data bit
2516 * Asserts the I2C data output enable on X550 hardware.
2531 /* Data rise/fall (1000ns/300ns) and set-up time (250ns) */ in ixgbe_set_i2c_data()
2545 hw_dbg(hw, "Error - I2C data was not set to %X.\n", data); in ixgbe_set_i2c_data()
2553 * ixgbe_get_i2c_data - Reads the I2C SDA data bit
2557 * Returns the I2C data bit value
2558 * Negates the I2C data output enable on X550 hardware.
2577 * ixgbe_i2c_bus_clear - Clears the I2C bus
2580 * Clears the I2C bus by sending nine clock pulses.
2607 /* Put the i2c bus back to default state */ in ixgbe_i2c_bus_clear()
2612 * ixgbe_tn_check_overtemp - Checks if an overtemp occurred.
2621 if (hw->device_id != IXGBE_DEV_ID_82599_T3_LOM) in ixgbe_tn_check_overtemp()
2625 hw->phy.ops.read_reg(hw, IXGBE_TN_LASI_STATUS_REG, in ixgbe_tn_check_overtemp()
2634 /** ixgbe_set_copper_phy_power - Control power for copper phy
2644 if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_copper) in ixgbe_set_copper_phy_power()
2650 status = hw->phy.ops.read_reg(hw, MDIO_CTRL1, MDIO_MMD_VEND1, ®); in ixgbe_set_copper_phy_power()
2662 status = hw->phy.ops.write_reg(hw, MDIO_CTRL1, MDIO_MMD_VEND1, reg); in ixgbe_set_copper_phy_power()