ixgbe/base: update EEE/FEC support for X550EM_X_KR
authorWenzhuo Lu <wenzhuo.lu@intel.com>
Wed, 24 Jun 2015 03:26:12 +0000 (11:26 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Fri, 26 Jun 2015 10:58:05 +0000 (12:58 +0200)
EEE(Energy Efficient Ethernet) is not supported on the initial revision
of IXGBE_DEV_ID_X550EM_X_KR. We determine the revision by reading a fuse
register.

Also, the requirements for FEC(Forward Error Correction) have changed
slightly. Now, we don't change the "request" bit at all. When EEE is
enabled, we advertise that we are capable. When EEE is disabled, we do
not advertise that we are capable. This change makes us consistent with
the power-on defaults that are in the NVM.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
drivers/net/ixgbe/base/ixgbe_type.h
drivers/net/ixgbe/base/ixgbe_x550.c

index 1f73e1f..f2b9de3 100644 (file)
@@ -3832,8 +3832,10 @@ struct ixgbe_hw {
 
 #define IXGBE_NOT_IMPLEMENTED                  0x7FFFFFFF
 
-#define IXGBE_FUSES0_GROUP(_i)         (0x11158 + ((_i) * 4))
-#define IXGBE_FUSES0_300MHZ            (1 << 5)
+
+#define IXGBE_FUSES0_GROUP(_i)         (0x11158 + ((_i) * 4))
+#define IXGBE_FUSES0_300MHZ            (1 << 5)
+#define IXGBE_FUSES0_REV1              (1 << 6)
 
 #define IXGBE_KRM_PORT_CAR_GEN_CTRL(P) ((P) ? 0x8010 : 0x4010)
 #define IXGBE_KRM_LINK_CTRL_1(P)       ((P) ? 0x820C : 0x420C)
index e4e8cff..9590fe1 100644 (file)
@@ -664,6 +664,7 @@ s32 ixgbe_setup_eee_X550(struct ixgbe_hw *hw, bool enable_eee)
        u16 autoneg_eee_reg;
        u32 link_reg;
        s32 status;
+       u32 fuse;
 
        DEBUGFUNC("ixgbe_setup_eee_X550");
 
@@ -684,6 +685,11 @@ s32 ixgbe_setup_eee_X550(struct ixgbe_hw *hw, bool enable_eee)
                        hw->phy.ops.write_reg(hw, IXGBE_MDIO_AUTO_NEG_EEE_ADVT,
                                IXGBE_MDIO_AUTO_NEG_DEV_TYPE, autoneg_eee_reg);
                } else if (hw->device_id == IXGBE_DEV_ID_X550EM_X_KR) {
+                       /* Not supported on first revision. */
+                       fuse = IXGBE_READ_REG(hw, IXGBE_FUSES0_GROUP(0));
+                       if (!(fuse & IXGBE_FUSES0_REV1))
+                               return IXGBE_SUCCESS;
+
                        status = ixgbe_read_iosf_sb_reg_x550(hw,
                                IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
                                IXGBE_SB_IOSF_TARGET_KR_PHY, &link_reg);
@@ -693,9 +699,8 @@ s32 ixgbe_setup_eee_X550(struct ixgbe_hw *hw, bool enable_eee)
                        link_reg |= IXGBE_KRM_LINK_CTRL_1_TETH_EEE_CAP_KR |
                                    IXGBE_KRM_LINK_CTRL_1_TETH_EEE_CAP_KX;
 
-                       /* Must disable FEC when EEE is enabled. */
-                       link_reg &= ~(IXGBE_KRM_LINK_CTRL_1_TETH_AN_FEC_REQ |
-                               IXGBE_KRM_LINK_CTRL_1_TETH_AN_CAP_FEC);
+                       /* Don't advertise FEC capability when EEE enabled. */
+                       link_reg &= ~IXGBE_KRM_LINK_CTRL_1_TETH_AN_CAP_FEC;
 
                        status = ixgbe_write_iosf_sb_reg_x550(hw,
                                IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
@@ -727,9 +732,8 @@ s32 ixgbe_setup_eee_X550(struct ixgbe_hw *hw, bool enable_eee)
                        link_reg &= ~(IXGBE_KRM_LINK_CTRL_1_TETH_EEE_CAP_KR |
                                IXGBE_KRM_LINK_CTRL_1_TETH_EEE_CAP_KX);
 
-                       /* Enable FEC when EEE is disabled. */
-                       link_reg |= (IXGBE_KRM_LINK_CTRL_1_TETH_AN_FEC_REQ |
-                               IXGBE_KRM_LINK_CTRL_1_TETH_AN_CAP_FEC);
+                       /* Advertise FEC capability when EEE is disabled. */
+                       link_reg |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_CAP_FEC;
 
                        status = ixgbe_write_iosf_sb_reg_x550(hw,
                                IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),