ixgbe: Add support for newer thermal alarm
authorMark Rustad <mark.d.rustad@intel.com>
Mon, 19 Oct 2015 16:22:14 +0000 (09:22 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Thu, 3 Dec 2015 10:32:06 +0000 (02:32 -0800)
The newer copper PHY implementation used with newer X550EM_x
devices uses a different thermal alarm type than the earlier
one. Make changes to support both types.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Darin Miller <darin.j.miller@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c

index 995f03107eacd03511dab6aa8e342a6c474375e1..927349da232ac4510d5403dd92ca6c9dc123c242 100644 (file)
@@ -1345,7 +1345,10 @@ struct ixgbe_thermal_sensor_data {
 #define IXGBE_MDIO_GLOBAL_INT_CHIP_VEN_MASK    0xFF01 /* int chip-wide mask */
 #define IXGBE_MDIO_GLOBAL_INT_CHIP_VEN_FLAG    0xFC01 /* int chip-wide mask */
 #define IXGBE_MDIO_GLOBAL_ALARM_1              0xCC00 /* Global alarm 1 */
+#define IXGBE_MDIO_GLOBAL_ALM_1_DEV_FAULT      0x0010 /* device fault */
 #define IXGBE_MDIO_GLOBAL_ALM_1_HI_TMP_FAIL    0x4000 /* high temp failure */
+#define IXGBE_MDIO_GLOBAL_FAULT_MSG            0xC850 /* global fault msg */
+#define IXGBE_MDIO_GLOBAL_FAULT_MSG_HI_TMP     0x8007 /* high temp failure */
 #define IXGBE_MDIO_GLOBAL_INT_MASK             0xD400 /* Global int mask */
 /* autoneg vendor alarm int enable */
 #define IXGBE_MDIO_GLOBAL_AN_VEN_ALM_INT_EN    0x1000
@@ -1353,6 +1356,7 @@ struct ixgbe_thermal_sensor_data {
 #define IXGBE_MDIO_GLOBAL_VEN_ALM_INT_EN       0x1 /* vendor alarm int enable */
 #define IXGBE_MDIO_GLOBAL_STD_ALM2_INT         0x200 /* vendor alarm2 int mask */
 #define IXGBE_MDIO_GLOBAL_INT_HI_TEMP_EN       0x4000 /* int high temp enable */
+#define IXGBE_MDIO_GLOBAL_INT_DEV_FAULT_EN     0x0010 /*int dev fault enable */
 
 #define IXGBE_MDIO_PMA_PMD_SDA_SCL_ADDR        0xC30A /* PHY_XS SDA/SCL Addr Reg */
 #define IXGBE_MDIO_PMA_PMD_SDA_SCL_DATA        0xC30B /* PHY_XS SDA/SCL Data Reg */
index a9c73b75a9020d4ec789967449691256c56945a9..b8ad3f212e726cb29270c4ef518b7bae31e220b5 100644 (file)
@@ -1444,7 +1444,7 @@ static s32 ixgbe_get_lasi_ext_t_x550em(struct ixgbe_hw *hw, bool *lsc)
                                IXGBE_MDIO_GLOBAL_ALARM_1_INT)))
                return status;
 
-       /* High temperature failure alarm triggered */
+       /* Global alarm triggered */
        status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_ALARM_1,
                                      IXGBE_MDIO_VENDOR_SPECIFIC_1_DEV_TYPE,
                                      &reg);
@@ -1458,6 +1458,21 @@ static s32 ixgbe_get_lasi_ext_t_x550em(struct ixgbe_hw *hw, bool *lsc)
                ixgbe_set_copper_phy_power(hw, false);
                return IXGBE_ERR_OVERTEMP;
        }
+       if (reg & IXGBE_MDIO_GLOBAL_ALM_1_DEV_FAULT) {
+               /*  device fault alarm triggered */
+               status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_FAULT_MSG,
+                                         IXGBE_MDIO_VENDOR_SPECIFIC_1_DEV_TYPE,
+                                         &reg);
+               if (status)
+                       return status;
+
+               /* if device fault was due to high temp alarm handle and exit */
+               if (reg == IXGBE_MDIO_GLOBAL_FAULT_MSG_HI_TMP) {
+                       /* power down the PHY in case the PHY FW didn't */
+                       ixgbe_set_copper_phy_power(hw, false);
+                       return IXGBE_ERR_OVERTEMP;
+               }
+       }
 
        /* Vendor alarm 2 triggered */
        status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_CHIP_STD_INT_FLAG,
@@ -1511,14 +1526,15 @@ static s32 ixgbe_enable_lasi_ext_t_x550em(struct ixgbe_hw *hw)
        if (status)
                return status;
 
-       /* Enables high temperature failure alarm */
+       /* Enable high temperature failure and global fault alarms */
        status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_INT_MASK,
                                      IXGBE_MDIO_VENDOR_SPECIFIC_1_DEV_TYPE,
                                      &reg);
        if (status)
                return status;
 
-       reg |= IXGBE_MDIO_GLOBAL_INT_HI_TEMP_EN;
+       reg |= (IXGBE_MDIO_GLOBAL_INT_HI_TEMP_EN |
+               IXGBE_MDIO_GLOBAL_INT_DEV_FAULT_EN);
 
        status = hw->phy.ops.write_reg(hw, IXGBE_MDIO_GLOBAL_INT_MASK,
                                       IXGBE_MDIO_VENDOR_SPECIFIC_1_DEV_TYPE,