1 /*******************************************************************************
3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2010 Intel Corporation.
6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License,
8 version 2, as published by the Free Software Foundation.
10 This program is distributed in the hope it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 You should have received a copy of the GNU General Public License along with
16 this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
19 The full GNU General Public License is included in this distribution in
20 the file called "COPYING".
23 e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
24 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
26 *******************************************************************************/
28 #include <linux/pci.h>
29 #include <linux/delay.h>
30 #include <linux/sched.h>
32 #include "ixgbe_common.h"
33 #include "ixgbe_phy.h"
35 static void ixgbe_i2c_start(struct ixgbe_hw *hw);
36 static void ixgbe_i2c_stop(struct ixgbe_hw *hw);
37 static s32 ixgbe_clock_in_i2c_byte(struct ixgbe_hw *hw, u8 *data);
38 static s32 ixgbe_clock_out_i2c_byte(struct ixgbe_hw *hw, u8 data);
39 static s32 ixgbe_get_i2c_ack(struct ixgbe_hw *hw);
40 static s32 ixgbe_clock_in_i2c_bit(struct ixgbe_hw *hw, bool *data);
41 static s32 ixgbe_clock_out_i2c_bit(struct ixgbe_hw *hw, bool data);
42 static s32 ixgbe_raise_i2c_clk(struct ixgbe_hw *hw, u32 *i2cctl);
43 static void ixgbe_lower_i2c_clk(struct ixgbe_hw *hw, u32 *i2cctl);
44 static s32 ixgbe_set_i2c_data(struct ixgbe_hw *hw, u32 *i2cctl, bool data);
45 static bool ixgbe_get_i2c_data(u32 *i2cctl);
46 static void ixgbe_i2c_bus_clear(struct ixgbe_hw *hw);
47 static enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id);
48 static s32 ixgbe_get_phy_id(struct ixgbe_hw *hw);
51 * ixgbe_identify_phy_generic - Get physical layer module
52 * @hw: pointer to hardware structure
54 * Determines the physical layer module found on the current adapter.
56 s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw)
58 s32 status = IXGBE_ERR_PHY_ADDR_INVALID;
61 if (hw->phy.type == ixgbe_phy_unknown) {
62 for (phy_addr = 0; phy_addr < IXGBE_MAX_PHY_ADDR; phy_addr++) {
63 hw->phy.mdio.prtad = phy_addr;
64 if (mdio45_probe(&hw->phy.mdio, phy_addr) == 0) {
67 ixgbe_get_phy_type_from_id(hw->phy.id);
72 /* clear value if nothing found */
73 hw->phy.mdio.prtad = 0;
82 * ixgbe_get_phy_id - Get the phy type
83 * @hw: pointer to hardware structure
86 static s32 ixgbe_get_phy_id(struct ixgbe_hw *hw)
92 status = hw->phy.ops.read_reg(hw, MDIO_DEVID1, MDIO_MMD_PMAPMD,
96 hw->phy.id = (u32)(phy_id_high << 16);
97 status = hw->phy.ops.read_reg(hw, MDIO_DEVID2, MDIO_MMD_PMAPMD,
99 hw->phy.id |= (u32)(phy_id_low & IXGBE_PHY_REVISION_MASK);
100 hw->phy.revision = (u32)(phy_id_low & ~IXGBE_PHY_REVISION_MASK);
106 * ixgbe_get_phy_type_from_id - Get the phy type
107 * @hw: pointer to hardware structure
110 static enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id)
112 enum ixgbe_phy_type phy_type;
116 phy_type = ixgbe_phy_tn;
119 phy_type = ixgbe_phy_aq;
122 phy_type = ixgbe_phy_qt;
125 phy_type = ixgbe_phy_nl;
128 phy_type = ixgbe_phy_unknown;
136 * ixgbe_reset_phy_generic - Performs a PHY reset
137 * @hw: pointer to hardware structure
139 s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw)
145 if (hw->phy.type == ixgbe_phy_unknown)
146 status = ixgbe_identify_phy_generic(hw);
148 if (status != 0 || hw->phy.type == ixgbe_phy_none)
151 /* Don't reset PHY if it's shut down due to overtemp. */
152 if (!hw->phy.reset_if_overtemp &&
153 (IXGBE_ERR_OVERTEMP == hw->phy.ops.check_overtemp(hw)))
157 * Perform soft PHY reset to the PHY_XS.
158 * This will cause a soft reset to the PHY
160 hw->phy.ops.write_reg(hw, MDIO_CTRL1,
165 * Poll for reset bit to self-clear indicating reset is complete.
166 * Some PHYs could take up to 3 seconds to complete and need about
167 * 1.7 usec delay after the reset is complete.
169 for (i = 0; i < 30; i++) {
171 hw->phy.ops.read_reg(hw, MDIO_CTRL1,
172 MDIO_MMD_PHYXS, &ctrl);
173 if (!(ctrl & MDIO_CTRL1_RESET)) {
179 if (ctrl & MDIO_CTRL1_RESET) {
180 status = IXGBE_ERR_RESET_FAILED;
181 hw_dbg(hw, "PHY reset polling failed to complete.\n");
189 * ixgbe_read_phy_reg_generic - Reads a value from a specified PHY register
190 * @hw: pointer to hardware structure
191 * @reg_addr: 32 bit address of PHY register to read
192 * @phy_data: Pointer to read data from PHY register
194 s32 ixgbe_read_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,
195 u32 device_type, u16 *phy_data)
203 if (IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_LAN_ID_1)
204 gssr = IXGBE_GSSR_PHY1_SM;
206 gssr = IXGBE_GSSR_PHY0_SM;
208 if (ixgbe_acquire_swfw_sync(hw, gssr) != 0)
209 status = IXGBE_ERR_SWFW_SYNC;
212 /* Setup and write the address cycle command */
213 command = ((reg_addr << IXGBE_MSCA_NP_ADDR_SHIFT) |
214 (device_type << IXGBE_MSCA_DEV_TYPE_SHIFT) |
215 (hw->phy.mdio.prtad << IXGBE_MSCA_PHY_ADDR_SHIFT) |
216 (IXGBE_MSCA_ADDR_CYCLE | IXGBE_MSCA_MDI_COMMAND));
218 IXGBE_WRITE_REG(hw, IXGBE_MSCA, command);
221 * Check every 10 usec to see if the address cycle completed.
222 * The MDI Command bit will clear when the operation is
225 for (i = 0; i < IXGBE_MDIO_COMMAND_TIMEOUT; i++) {
228 command = IXGBE_READ_REG(hw, IXGBE_MSCA);
230 if ((command & IXGBE_MSCA_MDI_COMMAND) == 0)
234 if ((command & IXGBE_MSCA_MDI_COMMAND) != 0) {
235 hw_dbg(hw, "PHY address command did not complete.\n");
236 status = IXGBE_ERR_PHY;
241 * Address cycle complete, setup and write the read
244 command = ((reg_addr << IXGBE_MSCA_NP_ADDR_SHIFT) |
245 (device_type << IXGBE_MSCA_DEV_TYPE_SHIFT) |
246 (hw->phy.mdio.prtad <<
247 IXGBE_MSCA_PHY_ADDR_SHIFT) |
248 (IXGBE_MSCA_READ | IXGBE_MSCA_MDI_COMMAND));
250 IXGBE_WRITE_REG(hw, IXGBE_MSCA, command);
253 * Check every 10 usec to see if the address cycle
254 * completed. The MDI Command bit will clear when the
255 * operation is complete
257 for (i = 0; i < IXGBE_MDIO_COMMAND_TIMEOUT; i++) {
260 command = IXGBE_READ_REG(hw, IXGBE_MSCA);
262 if ((command & IXGBE_MSCA_MDI_COMMAND) == 0)
266 if ((command & IXGBE_MSCA_MDI_COMMAND) != 0) {
267 hw_dbg(hw, "PHY read command didn't complete\n");
268 status = IXGBE_ERR_PHY;
271 * Read operation is complete. Get the data
274 data = IXGBE_READ_REG(hw, IXGBE_MSRWD);
275 data >>= IXGBE_MSRWD_READ_DATA_SHIFT;
276 *phy_data = (u16)(data);
280 ixgbe_release_swfw_sync(hw, gssr);
287 * ixgbe_write_phy_reg_generic - Writes a value to specified PHY register
288 * @hw: pointer to hardware structure
289 * @reg_addr: 32 bit PHY register to write
290 * @device_type: 5 bit device type
291 * @phy_data: Data to write to the PHY register
293 s32 ixgbe_write_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,
294 u32 device_type, u16 phy_data)
301 if (IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_LAN_ID_1)
302 gssr = IXGBE_GSSR_PHY1_SM;
304 gssr = IXGBE_GSSR_PHY0_SM;
306 if (ixgbe_acquire_swfw_sync(hw, gssr) != 0)
307 status = IXGBE_ERR_SWFW_SYNC;
310 /* Put the data in the MDI single read and write data register*/
311 IXGBE_WRITE_REG(hw, IXGBE_MSRWD, (u32)phy_data);
313 /* Setup and write the address cycle command */
314 command = ((reg_addr << IXGBE_MSCA_NP_ADDR_SHIFT) |
315 (device_type << IXGBE_MSCA_DEV_TYPE_SHIFT) |
316 (hw->phy.mdio.prtad << IXGBE_MSCA_PHY_ADDR_SHIFT) |
317 (IXGBE_MSCA_ADDR_CYCLE | IXGBE_MSCA_MDI_COMMAND));
319 IXGBE_WRITE_REG(hw, IXGBE_MSCA, command);
322 * Check every 10 usec to see if the address cycle completed.
323 * The MDI Command bit will clear when the operation is
326 for (i = 0; i < IXGBE_MDIO_COMMAND_TIMEOUT; i++) {
329 command = IXGBE_READ_REG(hw, IXGBE_MSCA);
331 if ((command & IXGBE_MSCA_MDI_COMMAND) == 0)
335 if ((command & IXGBE_MSCA_MDI_COMMAND) != 0) {
336 hw_dbg(hw, "PHY address cmd didn't complete\n");
337 status = IXGBE_ERR_PHY;
342 * Address cycle complete, setup and write the write
345 command = ((reg_addr << IXGBE_MSCA_NP_ADDR_SHIFT) |
346 (device_type << IXGBE_MSCA_DEV_TYPE_SHIFT) |
347 (hw->phy.mdio.prtad <<
348 IXGBE_MSCA_PHY_ADDR_SHIFT) |
349 (IXGBE_MSCA_WRITE | IXGBE_MSCA_MDI_COMMAND));
351 IXGBE_WRITE_REG(hw, IXGBE_MSCA, command);
354 * Check every 10 usec to see if the address cycle
355 * completed. The MDI Command bit will clear when the
356 * operation is complete
358 for (i = 0; i < IXGBE_MDIO_COMMAND_TIMEOUT; i++) {
361 command = IXGBE_READ_REG(hw, IXGBE_MSCA);
363 if ((command & IXGBE_MSCA_MDI_COMMAND) == 0)
367 if ((command & IXGBE_MSCA_MDI_COMMAND) != 0) {
368 hw_dbg(hw, "PHY address cmd didn't complete\n");
369 status = IXGBE_ERR_PHY;
373 ixgbe_release_swfw_sync(hw, gssr);
380 * ixgbe_setup_phy_link_generic - Set and restart autoneg
381 * @hw: pointer to hardware structure
383 * Restart autonegotiation and PHY and waits for completion.
385 s32 ixgbe_setup_phy_link_generic(struct ixgbe_hw *hw)
387 s32 status = IXGBE_NOT_IMPLEMENTED;
389 u32 max_time_out = 10;
393 * Set advertisement settings in PHY based on autoneg_advertised
394 * settings. If autoneg_advertised = 0, then advertise default values
395 * tnx devices cannot be "forced" to a autoneg 10G and fail. But can
398 hw->phy.ops.read_reg(hw, MDIO_AN_ADVERTISE, MDIO_MMD_AN, &autoneg_reg);
400 if (hw->phy.autoneg_advertised == IXGBE_LINK_SPEED_1GB_FULL)
401 autoneg_reg &= ~MDIO_AN_10GBT_CTRL_ADV10G;
403 autoneg_reg |= MDIO_AN_10GBT_CTRL_ADV10G;
405 hw->phy.ops.write_reg(hw, MDIO_AN_ADVERTISE, MDIO_MMD_AN, autoneg_reg);
407 /* Restart PHY autonegotiation and wait for completion */
408 hw->phy.ops.read_reg(hw, MDIO_CTRL1, MDIO_MMD_AN, &autoneg_reg);
410 autoneg_reg |= MDIO_AN_CTRL1_RESTART;
412 hw->phy.ops.write_reg(hw, MDIO_CTRL1, MDIO_MMD_AN, autoneg_reg);
414 /* Wait for autonegotiation to finish */
415 for (time_out = 0; time_out < max_time_out; time_out++) {
417 /* Restart PHY autonegotiation and wait for completion */
418 status = hw->phy.ops.read_reg(hw, MDIO_STAT1, MDIO_MMD_AN,
421 autoneg_reg &= MDIO_AN_STAT1_COMPLETE;
422 if (autoneg_reg == MDIO_AN_STAT1_COMPLETE) {
428 if (time_out == max_time_out)
429 status = IXGBE_ERR_LINK_SETUP;
435 * ixgbe_setup_phy_link_speed_generic - Sets the auto advertised capabilities
436 * @hw: pointer to hardware structure
437 * @speed: new link speed
438 * @autoneg: true if autonegotiation enabled
440 s32 ixgbe_setup_phy_link_speed_generic(struct ixgbe_hw *hw,
441 ixgbe_link_speed speed,
443 bool autoneg_wait_to_complete)
447 * Clear autoneg_advertised and set new values based on input link
450 hw->phy.autoneg_advertised = 0;
452 if (speed & IXGBE_LINK_SPEED_10GB_FULL)
453 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10GB_FULL;
455 if (speed & IXGBE_LINK_SPEED_1GB_FULL)
456 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL;
458 /* Setup link based on the new speed settings */
459 hw->phy.ops.setup_link(hw);
465 * ixgbe_get_copper_link_capabilities_generic - Determines link capabilities
466 * @hw: pointer to hardware structure
467 * @speed: pointer to link speed
468 * @autoneg: boolean auto-negotiation value
470 * Determines the link capabilities by reading the AUTOC register.
472 s32 ixgbe_get_copper_link_capabilities_generic(struct ixgbe_hw *hw,
473 ixgbe_link_speed *speed,
476 s32 status = IXGBE_ERR_LINK_SETUP;
482 status = hw->phy.ops.read_reg(hw, MDIO_SPEED, MDIO_MMD_PMAPMD,
486 if (speed_ability & MDIO_SPEED_10G)
487 *speed |= IXGBE_LINK_SPEED_10GB_FULL;
488 if (speed_ability & MDIO_PMA_SPEED_1000)
489 *speed |= IXGBE_LINK_SPEED_1GB_FULL;
490 if (speed_ability & MDIO_PMA_SPEED_100)
491 *speed |= IXGBE_LINK_SPEED_100_FULL;
498 * ixgbe_reset_phy_nl - Performs a PHY reset
499 * @hw: pointer to hardware structure
501 s32 ixgbe_reset_phy_nl(struct ixgbe_hw *hw)
503 u16 phy_offset, control, eword, edata, block_crc;
504 bool end_data = false;
505 u16 list_offset, data_offset;
510 hw->phy.ops.read_reg(hw, MDIO_CTRL1, MDIO_MMD_PHYXS, &phy_data);
512 /* reset the PHY and poll for completion */
513 hw->phy.ops.write_reg(hw, MDIO_CTRL1, MDIO_MMD_PHYXS,
514 (phy_data | MDIO_CTRL1_RESET));
516 for (i = 0; i < 100; i++) {
517 hw->phy.ops.read_reg(hw, MDIO_CTRL1, MDIO_MMD_PHYXS,
519 if ((phy_data & MDIO_CTRL1_RESET) == 0)
524 if ((phy_data & MDIO_CTRL1_RESET) != 0) {
525 hw_dbg(hw, "PHY reset did not complete.\n");
526 ret_val = IXGBE_ERR_PHY;
530 /* Get init offsets */
531 ret_val = ixgbe_get_sfp_init_sequence_offsets(hw, &list_offset,
536 ret_val = hw->eeprom.ops.read(hw, data_offset, &block_crc);
540 * Read control word from PHY init contents offset
542 ret_val = hw->eeprom.ops.read(hw, data_offset, &eword);
543 control = (eword & IXGBE_CONTROL_MASK_NL) >>
544 IXGBE_CONTROL_SHIFT_NL;
545 edata = eword & IXGBE_DATA_MASK_NL;
549 hw_dbg(hw, "DELAY: %d MS\n", edata);
553 hw_dbg(hw, "DATA:\n");
555 hw->eeprom.ops.read(hw, data_offset++,
557 for (i = 0; i < edata; i++) {
558 hw->eeprom.ops.read(hw, data_offset, &eword);
559 hw->phy.ops.write_reg(hw, phy_offset,
560 MDIO_MMD_PMAPMD, eword);
561 hw_dbg(hw, "Wrote %4.4x to %4.4x\n", eword,
567 case IXGBE_CONTROL_NL:
569 hw_dbg(hw, "CONTROL:\n");
570 if (edata == IXGBE_CONTROL_EOL_NL) {
573 } else if (edata == IXGBE_CONTROL_SOL_NL) {
576 hw_dbg(hw, "Bad control value\n");
577 ret_val = IXGBE_ERR_PHY;
582 hw_dbg(hw, "Bad control type\n");
583 ret_val = IXGBE_ERR_PHY;
593 * ixgbe_identify_sfp_module_generic - Identifies SFP modules
594 * @hw: pointer to hardware structure
596 * Searches for and identifies the SFP module and assigns appropriate PHY type.
598 s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
600 s32 status = IXGBE_ERR_PHY_ADDR_INVALID;
602 enum ixgbe_sfp_type stored_sfp_type = hw->phy.sfp_type;
604 u8 comp_codes_1g = 0;
605 u8 comp_codes_10g = 0;
606 u8 oui_bytes[3] = {0, 0, 0};
611 if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_fiber) {
612 hw->phy.sfp_type = ixgbe_sfp_type_not_present;
613 status = IXGBE_ERR_SFP_NOT_PRESENT;
617 status = hw->phy.ops.read_i2c_eeprom(hw,
618 IXGBE_SFF_IDENTIFIER,
621 if (status == IXGBE_ERR_SWFW_SYNC ||
622 status == IXGBE_ERR_I2C ||
623 status == IXGBE_ERR_SFP_NOT_PRESENT)
624 goto err_read_i2c_eeprom;
626 /* LAN ID is needed for sfp_type determination */
627 hw->mac.ops.set_lan_id(hw);
629 if (identifier != IXGBE_SFF_IDENTIFIER_SFP) {
630 hw->phy.type = ixgbe_phy_sfp_unsupported;
631 status = IXGBE_ERR_SFP_NOT_SUPPORTED;
633 status = hw->phy.ops.read_i2c_eeprom(hw,
634 IXGBE_SFF_1GBE_COMP_CODES,
637 if (status == IXGBE_ERR_SWFW_SYNC ||
638 status == IXGBE_ERR_I2C ||
639 status == IXGBE_ERR_SFP_NOT_PRESENT)
640 goto err_read_i2c_eeprom;
642 status = hw->phy.ops.read_i2c_eeprom(hw,
643 IXGBE_SFF_10GBE_COMP_CODES,
646 if (status == IXGBE_ERR_SWFW_SYNC ||
647 status == IXGBE_ERR_I2C ||
648 status == IXGBE_ERR_SFP_NOT_PRESENT)
649 goto err_read_i2c_eeprom;
650 status = hw->phy.ops.read_i2c_eeprom(hw,
651 IXGBE_SFF_CABLE_TECHNOLOGY,
654 if (status == IXGBE_ERR_SWFW_SYNC ||
655 status == IXGBE_ERR_I2C ||
656 status == IXGBE_ERR_SFP_NOT_PRESENT)
657 goto err_read_i2c_eeprom;
664 * 3 SFP_DA_CORE0 - 82599-specific
665 * 4 SFP_DA_CORE1 - 82599-specific
666 * 5 SFP_SR/LR_CORE0 - 82599-specific
667 * 6 SFP_SR/LR_CORE1 - 82599-specific
668 * 7 SFP_act_lmt_DA_CORE0 - 82599-specific
669 * 8 SFP_act_lmt_DA_CORE1 - 82599-specific
670 * 9 SFP_1g_cu_CORE0 - 82599-specific
671 * 10 SFP_1g_cu_CORE1 - 82599-specific
673 if (hw->mac.type == ixgbe_mac_82598EB) {
674 if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE)
675 hw->phy.sfp_type = ixgbe_sfp_type_da_cu;
676 else if (comp_codes_10g & IXGBE_SFF_10GBASESR_CAPABLE)
677 hw->phy.sfp_type = ixgbe_sfp_type_sr;
678 else if (comp_codes_10g & IXGBE_SFF_10GBASELR_CAPABLE)
679 hw->phy.sfp_type = ixgbe_sfp_type_lr;
681 hw->phy.sfp_type = ixgbe_sfp_type_unknown;
682 } else if (hw->mac.type == ixgbe_mac_82599EB) {
683 if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE) {
684 if (hw->bus.lan_id == 0)
686 ixgbe_sfp_type_da_cu_core0;
689 ixgbe_sfp_type_da_cu_core1;
690 } else if (cable_tech & IXGBE_SFF_DA_ACTIVE_CABLE) {
691 hw->phy.ops.read_i2c_eeprom(
692 hw, IXGBE_SFF_CABLE_SPEC_COMP,
695 IXGBE_SFF_DA_SPEC_ACTIVE_LIMITING) {
696 if (hw->bus.lan_id == 0)
698 ixgbe_sfp_type_da_act_lmt_core0;
701 ixgbe_sfp_type_da_act_lmt_core1;
704 ixgbe_sfp_type_unknown;
706 } else if (comp_codes_10g &
707 (IXGBE_SFF_10GBASESR_CAPABLE |
708 IXGBE_SFF_10GBASELR_CAPABLE)) {
709 if (hw->bus.lan_id == 0)
711 ixgbe_sfp_type_srlr_core0;
714 ixgbe_sfp_type_srlr_core1;
715 } else if (comp_codes_1g & IXGBE_SFF_1GBASET_CAPABLE) {
716 if (hw->bus.lan_id == 0)
718 ixgbe_sfp_type_1g_cu_core0;
721 ixgbe_sfp_type_1g_cu_core1;
723 hw->phy.sfp_type = ixgbe_sfp_type_unknown;
727 if (hw->phy.sfp_type != stored_sfp_type)
728 hw->phy.sfp_setup_needed = true;
730 /* Determine if the SFP+ PHY is dual speed or not. */
731 hw->phy.multispeed_fiber = false;
732 if (((comp_codes_1g & IXGBE_SFF_1GBASESX_CAPABLE) &&
733 (comp_codes_10g & IXGBE_SFF_10GBASESR_CAPABLE)) ||
734 ((comp_codes_1g & IXGBE_SFF_1GBASELX_CAPABLE) &&
735 (comp_codes_10g & IXGBE_SFF_10GBASELR_CAPABLE)))
736 hw->phy.multispeed_fiber = true;
738 /* Determine PHY vendor */
739 if (hw->phy.type != ixgbe_phy_nl) {
740 hw->phy.id = identifier;
741 status = hw->phy.ops.read_i2c_eeprom(hw,
742 IXGBE_SFF_VENDOR_OUI_BYTE0,
745 if (status == IXGBE_ERR_SWFW_SYNC ||
746 status == IXGBE_ERR_I2C ||
747 status == IXGBE_ERR_SFP_NOT_PRESENT)
748 goto err_read_i2c_eeprom;
750 status = hw->phy.ops.read_i2c_eeprom(hw,
751 IXGBE_SFF_VENDOR_OUI_BYTE1,
754 if (status == IXGBE_ERR_SWFW_SYNC ||
755 status == IXGBE_ERR_I2C ||
756 status == IXGBE_ERR_SFP_NOT_PRESENT)
757 goto err_read_i2c_eeprom;
759 status = hw->phy.ops.read_i2c_eeprom(hw,
760 IXGBE_SFF_VENDOR_OUI_BYTE2,
763 if (status == IXGBE_ERR_SWFW_SYNC ||
764 status == IXGBE_ERR_I2C ||
765 status == IXGBE_ERR_SFP_NOT_PRESENT)
766 goto err_read_i2c_eeprom;
769 ((oui_bytes[0] << IXGBE_SFF_VENDOR_OUI_BYTE0_SHIFT) |
770 (oui_bytes[1] << IXGBE_SFF_VENDOR_OUI_BYTE1_SHIFT) |
771 (oui_bytes[2] << IXGBE_SFF_VENDOR_OUI_BYTE2_SHIFT));
773 switch (vendor_oui) {
774 case IXGBE_SFF_VENDOR_OUI_TYCO:
775 if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE)
777 ixgbe_phy_sfp_passive_tyco;
779 case IXGBE_SFF_VENDOR_OUI_FTL:
780 if (cable_tech & IXGBE_SFF_DA_ACTIVE_CABLE)
781 hw->phy.type = ixgbe_phy_sfp_ftl_active;
783 hw->phy.type = ixgbe_phy_sfp_ftl;
785 case IXGBE_SFF_VENDOR_OUI_AVAGO:
786 hw->phy.type = ixgbe_phy_sfp_avago;
788 case IXGBE_SFF_VENDOR_OUI_INTEL:
789 hw->phy.type = ixgbe_phy_sfp_intel;
792 if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE)
794 ixgbe_phy_sfp_passive_unknown;
795 else if (cable_tech & IXGBE_SFF_DA_ACTIVE_CABLE)
797 ixgbe_phy_sfp_active_unknown;
799 hw->phy.type = ixgbe_phy_sfp_unknown;
804 /* Allow any DA cable vendor */
805 if (cable_tech & (IXGBE_SFF_DA_PASSIVE_CABLE |
806 IXGBE_SFF_DA_ACTIVE_CABLE)) {
811 /* Verify supported 1G SFP modules */
812 if (comp_codes_10g == 0 &&
813 !(hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
814 hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0)) {
815 hw->phy.type = ixgbe_phy_sfp_unsupported;
816 status = IXGBE_ERR_SFP_NOT_SUPPORTED;
820 /* Anything else 82598-based is supported */
821 if (hw->mac.type == ixgbe_mac_82598EB) {
826 /* This is guaranteed to be 82599, no need to check for NULL */
827 hw->mac.ops.get_device_caps(hw, &enforce_sfp);
828 if (!(enforce_sfp & IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP) &&
829 !((hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0) ||
830 (hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1))) {
831 /* Make sure we're a supported PHY type */
832 if (hw->phy.type == ixgbe_phy_sfp_intel) {
835 hw_dbg(hw, "SFP+ module not supported\n");
836 hw->phy.type = ixgbe_phy_sfp_unsupported;
837 status = IXGBE_ERR_SFP_NOT_SUPPORTED;
848 hw->phy.sfp_type = ixgbe_sfp_type_not_present;
849 if (hw->phy.type != ixgbe_phy_nl) {
851 hw->phy.type = ixgbe_phy_unknown;
853 return IXGBE_ERR_SFP_NOT_PRESENT;
857 * ixgbe_get_sfp_init_sequence_offsets - Provides offset of PHY init sequence
858 * @hw: pointer to hardware structure
859 * @list_offset: offset to the SFP ID list
860 * @data_offset: offset to the SFP data block
862 * Checks the MAC's EEPROM to see if it supports a given SFP+ module type, if
863 * so it returns the offsets to the phy init sequence block.
865 s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw,
870 u16 sfp_type = hw->phy.sfp_type;
872 if (hw->phy.sfp_type == ixgbe_sfp_type_unknown)
873 return IXGBE_ERR_SFP_NOT_SUPPORTED;
875 if (hw->phy.sfp_type == ixgbe_sfp_type_not_present)
876 return IXGBE_ERR_SFP_NOT_PRESENT;
878 if ((hw->device_id == IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM) &&
879 (hw->phy.sfp_type == ixgbe_sfp_type_da_cu))
880 return IXGBE_ERR_SFP_NOT_SUPPORTED;
883 * Limiting active cables and 1G Phys must be initialized as
886 if (sfp_type == ixgbe_sfp_type_da_act_lmt_core0 ||
887 sfp_type == ixgbe_sfp_type_1g_cu_core0)
888 sfp_type = ixgbe_sfp_type_srlr_core0;
889 else if (sfp_type == ixgbe_sfp_type_da_act_lmt_core1 ||
890 sfp_type == ixgbe_sfp_type_1g_cu_core1)
891 sfp_type = ixgbe_sfp_type_srlr_core1;
893 /* Read offset to PHY init contents */
894 hw->eeprom.ops.read(hw, IXGBE_PHY_INIT_OFFSET_NL, list_offset);
896 if ((!*list_offset) || (*list_offset == 0xFFFF))
897 return IXGBE_ERR_SFP_NO_INIT_SEQ_PRESENT;
899 /* Shift offset to first ID word */
903 * Find the matching SFP ID in the EEPROM
904 * and program the init sequence
906 hw->eeprom.ops.read(hw, *list_offset, &sfp_id);
908 while (sfp_id != IXGBE_PHY_INIT_END_NL) {
909 if (sfp_id == sfp_type) {
911 hw->eeprom.ops.read(hw, *list_offset, data_offset);
912 if ((!*data_offset) || (*data_offset == 0xFFFF)) {
913 hw_dbg(hw, "SFP+ module not supported\n");
914 return IXGBE_ERR_SFP_NOT_SUPPORTED;
920 if (hw->eeprom.ops.read(hw, *list_offset, &sfp_id))
921 return IXGBE_ERR_PHY;
925 if (sfp_id == IXGBE_PHY_INIT_END_NL) {
926 hw_dbg(hw, "No matching SFP+ module found\n");
927 return IXGBE_ERR_SFP_NOT_SUPPORTED;
934 * ixgbe_read_i2c_eeprom_generic - Reads 8 bit EEPROM word over I2C interface
935 * @hw: pointer to hardware structure
936 * @byte_offset: EEPROM byte offset to read
937 * @eeprom_data: value read
939 * Performs byte read operation to SFP module's EEPROM over I2C interface.
941 s32 ixgbe_read_i2c_eeprom_generic(struct ixgbe_hw *hw, u8 byte_offset,
944 return hw->phy.ops.read_i2c_byte(hw, byte_offset,
945 IXGBE_I2C_EEPROM_DEV_ADDR,
950 * ixgbe_write_i2c_eeprom_generic - Writes 8 bit EEPROM word over I2C interface
951 * @hw: pointer to hardware structure
952 * @byte_offset: EEPROM byte offset to write
953 * @eeprom_data: value to write
955 * Performs byte write operation to SFP module's EEPROM over I2C interface.
957 s32 ixgbe_write_i2c_eeprom_generic(struct ixgbe_hw *hw, u8 byte_offset,
960 return hw->phy.ops.write_i2c_byte(hw, byte_offset,
961 IXGBE_I2C_EEPROM_DEV_ADDR,
966 * ixgbe_read_i2c_byte_generic - Reads 8 bit word over I2C
967 * @hw: pointer to hardware structure
968 * @byte_offset: byte offset to read
971 * Performs byte read operation to SFP module's EEPROM over I2C interface at
972 * a specified deivce address.
974 s32 ixgbe_read_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset,
975 u8 dev_addr, u8 *data)
983 if (IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_LAN_ID_1)
984 swfw_mask = IXGBE_GSSR_PHY1_SM;
986 swfw_mask = IXGBE_GSSR_PHY0_SM;
989 if (ixgbe_acquire_swfw_sync(hw, swfw_mask) != 0) {
990 status = IXGBE_ERR_SWFW_SYNC;
996 /* Device Address and write indication */
997 status = ixgbe_clock_out_i2c_byte(hw, dev_addr);
1001 status = ixgbe_get_i2c_ack(hw);
1005 status = ixgbe_clock_out_i2c_byte(hw, byte_offset);
1009 status = ixgbe_get_i2c_ack(hw);
1013 ixgbe_i2c_start(hw);
1015 /* Device Address and read indication */
1016 status = ixgbe_clock_out_i2c_byte(hw, (dev_addr | 0x1));
1020 status = ixgbe_get_i2c_ack(hw);
1024 status = ixgbe_clock_in_i2c_byte(hw, data);
1028 status = ixgbe_clock_out_i2c_bit(hw, nack);
1036 ixgbe_release_swfw_sync(hw, swfw_mask);
1038 ixgbe_i2c_bus_clear(hw);
1040 if (retry < max_retry)
1041 hw_dbg(hw, "I2C byte read error - Retrying.\n");
1043 hw_dbg(hw, "I2C byte read error.\n");
1045 } while (retry < max_retry);
1047 ixgbe_release_swfw_sync(hw, swfw_mask);
1054 * ixgbe_write_i2c_byte_generic - Writes 8 bit word over I2C
1055 * @hw: pointer to hardware structure
1056 * @byte_offset: byte offset to write
1057 * @data: value to write
1059 * Performs byte write operation to SFP module's EEPROM over I2C interface at
1060 * a specified device address.
1062 s32 ixgbe_write_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset,
1063 u8 dev_addr, u8 data)
1070 if (IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_LAN_ID_1)
1071 swfw_mask = IXGBE_GSSR_PHY1_SM;
1073 swfw_mask = IXGBE_GSSR_PHY0_SM;
1075 if (ixgbe_acquire_swfw_sync(hw, swfw_mask) != 0) {
1076 status = IXGBE_ERR_SWFW_SYNC;
1077 goto write_byte_out;
1081 ixgbe_i2c_start(hw);
1083 status = ixgbe_clock_out_i2c_byte(hw, dev_addr);
1087 status = ixgbe_get_i2c_ack(hw);
1091 status = ixgbe_clock_out_i2c_byte(hw, byte_offset);
1095 status = ixgbe_get_i2c_ack(hw);
1099 status = ixgbe_clock_out_i2c_byte(hw, data);
1103 status = ixgbe_get_i2c_ack(hw);
1111 ixgbe_i2c_bus_clear(hw);
1113 if (retry < max_retry)
1114 hw_dbg(hw, "I2C byte write error - Retrying.\n");
1116 hw_dbg(hw, "I2C byte write error.\n");
1117 } while (retry < max_retry);
1119 ixgbe_release_swfw_sync(hw, swfw_mask);
1126 * ixgbe_i2c_start - Sets I2C start condition
1127 * @hw: pointer to hardware structure
1129 * Sets I2C start condition (High -> Low on SDA while SCL is High)
1131 static void ixgbe_i2c_start(struct ixgbe_hw *hw)
1133 u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL);
1135 /* Start condition must begin with data and clock high */
1136 ixgbe_set_i2c_data(hw, &i2cctl, 1);
1137 ixgbe_raise_i2c_clk(hw, &i2cctl);
1139 /* Setup time for start condition (4.7us) */
1140 udelay(IXGBE_I2C_T_SU_STA);
1142 ixgbe_set_i2c_data(hw, &i2cctl, 0);
1144 /* Hold time for start condition (4us) */
1145 udelay(IXGBE_I2C_T_HD_STA);
1147 ixgbe_lower_i2c_clk(hw, &i2cctl);
1149 /* Minimum low period of clock is 4.7 us */
1150 udelay(IXGBE_I2C_T_LOW);
1155 * ixgbe_i2c_stop - Sets I2C stop condition
1156 * @hw: pointer to hardware structure
1158 * Sets I2C stop condition (Low -> High on SDA while SCL is High)
1160 static void ixgbe_i2c_stop(struct ixgbe_hw *hw)
1162 u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL);
1164 /* Stop condition must begin with data low and clock high */
1165 ixgbe_set_i2c_data(hw, &i2cctl, 0);
1166 ixgbe_raise_i2c_clk(hw, &i2cctl);
1168 /* Setup time for stop condition (4us) */
1169 udelay(IXGBE_I2C_T_SU_STO);
1171 ixgbe_set_i2c_data(hw, &i2cctl, 1);
1173 /* bus free time between stop and start (4.7us)*/
1174 udelay(IXGBE_I2C_T_BUF);
1178 * ixgbe_clock_in_i2c_byte - Clocks in one byte via I2C
1179 * @hw: pointer to hardware structure
1180 * @data: data byte to clock in
1182 * Clocks in one byte data via I2C data/clock
1184 static s32 ixgbe_clock_in_i2c_byte(struct ixgbe_hw *hw, u8 *data)
1190 for (i = 7; i >= 0; i--) {
1191 status = ixgbe_clock_in_i2c_bit(hw, &bit);
1202 * ixgbe_clock_out_i2c_byte - Clocks out one byte via I2C
1203 * @hw: pointer to hardware structure
1204 * @data: data byte clocked out
1206 * Clocks out one byte data via I2C data/clock
1208 static s32 ixgbe_clock_out_i2c_byte(struct ixgbe_hw *hw, u8 data)
1215 for (i = 7; i >= 0; i--) {
1216 bit = (data >> i) & 0x1;
1217 status = ixgbe_clock_out_i2c_bit(hw, bit);
1223 /* Release SDA line (set high) */
1224 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL);
1225 i2cctl |= IXGBE_I2C_DATA_OUT;
1226 IXGBE_WRITE_REG(hw, IXGBE_I2CCTL, i2cctl);
1232 * ixgbe_get_i2c_ack - Polls for I2C ACK
1233 * @hw: pointer to hardware structure
1235 * Clocks in/out one bit via I2C data/clock
1237 static s32 ixgbe_get_i2c_ack(struct ixgbe_hw *hw)
1241 u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL);
1245 status = ixgbe_raise_i2c_clk(hw, &i2cctl);
1250 /* Minimum high period of clock is 4us */
1251 udelay(IXGBE_I2C_T_HIGH);
1253 /* Poll for ACK. Note that ACK in I2C spec is
1254 * transition from 1 to 0 */
1255 for (i = 0; i < timeout; i++) {
1256 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL);
1257 ack = ixgbe_get_i2c_data(&i2cctl);
1265 hw_dbg(hw, "I2C ack was not received.\n");
1266 status = IXGBE_ERR_I2C;
1269 ixgbe_lower_i2c_clk(hw, &i2cctl);
1271 /* Minimum low period of clock is 4.7 us */
1272 udelay(IXGBE_I2C_T_LOW);
1279 * ixgbe_clock_in_i2c_bit - Clocks in one bit via I2C data/clock
1280 * @hw: pointer to hardware structure
1281 * @data: read data value
1283 * Clocks in one bit via I2C data/clock
1285 static s32 ixgbe_clock_in_i2c_bit(struct ixgbe_hw *hw, bool *data)
1288 u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL);
1290 status = ixgbe_raise_i2c_clk(hw, &i2cctl);
1292 /* Minimum high period of clock is 4us */
1293 udelay(IXGBE_I2C_T_HIGH);
1295 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL);
1296 *data = ixgbe_get_i2c_data(&i2cctl);
1298 ixgbe_lower_i2c_clk(hw, &i2cctl);
1300 /* Minimum low period of clock is 4.7 us */
1301 udelay(IXGBE_I2C_T_LOW);
1307 * ixgbe_clock_out_i2c_bit - Clocks in/out one bit via I2C data/clock
1308 * @hw: pointer to hardware structure
1309 * @data: data value to write
1311 * Clocks out one bit via I2C data/clock
1313 static s32 ixgbe_clock_out_i2c_bit(struct ixgbe_hw *hw, bool data)
1316 u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL);
1318 status = ixgbe_set_i2c_data(hw, &i2cctl, data);
1320 status = ixgbe_raise_i2c_clk(hw, &i2cctl);
1322 /* Minimum high period of clock is 4us */
1323 udelay(IXGBE_I2C_T_HIGH);
1325 ixgbe_lower_i2c_clk(hw, &i2cctl);
1327 /* Minimum low period of clock is 4.7 us.
1328 * This also takes care of the data hold time.
1330 udelay(IXGBE_I2C_T_LOW);
1332 status = IXGBE_ERR_I2C;
1333 hw_dbg(hw, "I2C data was not set to %X\n", data);
1339 * ixgbe_raise_i2c_clk - Raises the I2C SCL clock
1340 * @hw: pointer to hardware structure
1341 * @i2cctl: Current value of I2CCTL register
1343 * Raises the I2C clock line '0'->'1'
1345 static s32 ixgbe_raise_i2c_clk(struct ixgbe_hw *hw, u32 *i2cctl)
1349 *i2cctl |= IXGBE_I2C_CLK_OUT;
1351 IXGBE_WRITE_REG(hw, IXGBE_I2CCTL, *i2cctl);
1353 /* SCL rise time (1000ns) */
1354 udelay(IXGBE_I2C_T_RISE);
1360 * ixgbe_lower_i2c_clk - Lowers the I2C SCL clock
1361 * @hw: pointer to hardware structure
1362 * @i2cctl: Current value of I2CCTL register
1364 * Lowers the I2C clock line '1'->'0'
1366 static void ixgbe_lower_i2c_clk(struct ixgbe_hw *hw, u32 *i2cctl)
1369 *i2cctl &= ~IXGBE_I2C_CLK_OUT;
1371 IXGBE_WRITE_REG(hw, IXGBE_I2CCTL, *i2cctl);
1373 /* SCL fall time (300ns) */
1374 udelay(IXGBE_I2C_T_FALL);
1378 * ixgbe_set_i2c_data - Sets the I2C data bit
1379 * @hw: pointer to hardware structure
1380 * @i2cctl: Current value of I2CCTL register
1381 * @data: I2C data value (0 or 1) to set
1383 * Sets the I2C data bit
1385 static s32 ixgbe_set_i2c_data(struct ixgbe_hw *hw, u32 *i2cctl, bool data)
1390 *i2cctl |= IXGBE_I2C_DATA_OUT;
1392 *i2cctl &= ~IXGBE_I2C_DATA_OUT;
1394 IXGBE_WRITE_REG(hw, IXGBE_I2CCTL, *i2cctl);
1396 /* Data rise/fall (1000ns/300ns) and set-up time (250ns) */
1397 udelay(IXGBE_I2C_T_RISE + IXGBE_I2C_T_FALL + IXGBE_I2C_T_SU_DATA);
1399 /* Verify data was set correctly */
1400 *i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL);
1401 if (data != ixgbe_get_i2c_data(i2cctl)) {
1402 status = IXGBE_ERR_I2C;
1403 hw_dbg(hw, "Error - I2C data was not set to %X.\n", data);
1410 * ixgbe_get_i2c_data - Reads the I2C SDA data bit
1411 * @hw: pointer to hardware structure
1412 * @i2cctl: Current value of I2CCTL register
1414 * Returns the I2C data bit value
1416 static bool ixgbe_get_i2c_data(u32 *i2cctl)
1420 if (*i2cctl & IXGBE_I2C_DATA_IN)
1429 * ixgbe_i2c_bus_clear - Clears the I2C bus
1430 * @hw: pointer to hardware structure
1432 * Clears the I2C bus by sending nine clock pulses.
1433 * Used when data line is stuck low.
1435 static void ixgbe_i2c_bus_clear(struct ixgbe_hw *hw)
1437 u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL);
1440 ixgbe_i2c_start(hw);
1442 ixgbe_set_i2c_data(hw, &i2cctl, 1);
1444 for (i = 0; i < 9; i++) {
1445 ixgbe_raise_i2c_clk(hw, &i2cctl);
1447 /* Min high period of clock is 4us */
1448 udelay(IXGBE_I2C_T_HIGH);
1450 ixgbe_lower_i2c_clk(hw, &i2cctl);
1452 /* Min low period of clock is 4.7us*/
1453 udelay(IXGBE_I2C_T_LOW);
1456 ixgbe_i2c_start(hw);
1458 /* Put the i2c bus back to default state */
1463 * ixgbe_check_phy_link_tnx - Determine link and speed status
1464 * @hw: pointer to hardware structure
1466 * Reads the VS1 register to determine if link is up and the current speed for
1469 s32 ixgbe_check_phy_link_tnx(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
1474 u32 max_time_out = 10;
1479 /* Initialize speed and link to default case */
1481 *speed = IXGBE_LINK_SPEED_10GB_FULL;
1484 * Check current speed and link status of the PHY register.
1485 * This is a vendor specific register and may have to
1486 * be changed for other copper PHYs.
1488 for (time_out = 0; time_out < max_time_out; time_out++) {
1490 status = hw->phy.ops.read_reg(hw,
1491 IXGBE_MDIO_VENDOR_SPECIFIC_1_STATUS,
1494 phy_link = phy_data &
1495 IXGBE_MDIO_VENDOR_SPECIFIC_1_LINK_STATUS;
1496 phy_speed = phy_data &
1497 IXGBE_MDIO_VENDOR_SPECIFIC_1_SPEED_STATUS;
1498 if (phy_link == IXGBE_MDIO_VENDOR_SPECIFIC_1_LINK_STATUS) {
1501 IXGBE_MDIO_VENDOR_SPECIFIC_1_SPEED_STATUS)
1502 *speed = IXGBE_LINK_SPEED_1GB_FULL;
1511 * ixgbe_get_phy_firmware_version_tnx - Gets the PHY Firmware Version
1512 * @hw: pointer to hardware structure
1513 * @firmware_version: pointer to the PHY Firmware Version
1515 s32 ixgbe_get_phy_firmware_version_tnx(struct ixgbe_hw *hw,
1516 u16 *firmware_version)
1520 status = hw->phy.ops.read_reg(hw, TNX_FW_REV, MDIO_MMD_VEND1,
1527 * ixgbe_get_phy_firmware_version_generic - Gets the PHY Firmware Version
1528 * @hw: pointer to hardware structure
1529 * @firmware_version: pointer to the PHY Firmware Version
1531 s32 ixgbe_get_phy_firmware_version_generic(struct ixgbe_hw *hw,
1532 u16 *firmware_version)
1536 status = hw->phy.ops.read_reg(hw, AQ_FW_REV, MDIO_MMD_VEND1,
1543 * ixgbe_tn_check_overtemp - Checks if an overtemp occured.
1544 * @hw: pointer to hardware structure
1546 * Checks if the LASI temp alarm status was triggered due to overtemp
1548 s32 ixgbe_tn_check_overtemp(struct ixgbe_hw *hw)
1553 if (hw->device_id != IXGBE_DEV_ID_82599_T3_LOM)
1556 /* Check that the LASI temp alarm status was triggered */
1557 hw->phy.ops.read_reg(hw, IXGBE_TN_LASI_STATUS_REG,
1558 MDIO_MMD_PMAPMD, &phy_data);
1560 if (!(phy_data & IXGBE_TN_LASI_STATUS_TEMP_ALARM))
1563 status = IXGBE_ERR_OVERTEMP;