net/ixgbe/base: cleanup dead EEE code
[dpdk.git] / drivers / net / ixgbe / base / ixgbe_x550.c
index 28c7ce3..97fbf88 100644 (file)
@@ -62,7 +62,7 @@ s32 ixgbe_init_ops_X550(struct ixgbe_hw *hw)
        mac->ops.dmac_config = ixgbe_dmac_config_X550;
        mac->ops.dmac_config_tcs = ixgbe_dmac_config_tcs_X550;
        mac->ops.dmac_update_tcs = ixgbe_dmac_update_tcs_X550;
-       mac->ops.setup_eee = ixgbe_setup_eee_X550;
+       mac->ops.setup_eee = NULL;
        mac->ops.set_source_address_pruning =
                        ixgbe_set_source_address_pruning_X550;
        mac->ops.set_ethertype_anti_spoofing =
@@ -603,15 +603,6 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
        else
                mac->ops.setup_fc = ixgbe_setup_fc_X550em;
 
-       switch (hw->device_id) {
-       case IXGBE_DEV_ID_X550EM_X_KR:
-       case IXGBE_DEV_ID_X550EM_A_KR:
-       case IXGBE_DEV_ID_X550EM_A_KR_L:
-               break;
-       default:
-               mac->ops.setup_eee = NULL;
-       }
-
        /* PHY */
        phy->ops.init = ixgbe_init_phy_ops_X550em;
        phy->ops.identify = ixgbe_identify_phy_x550em;
@@ -679,6 +670,15 @@ s32 ixgbe_init_ops_X550EM_a(struct ixgbe_hw *hw)
                mac->ops.setup_fc = ixgbe_setup_fc_sgmii_x550em_a;
        }
 
+       switch (hw->device_id) {
+       case IXGBE_DEV_ID_X550EM_A_KR:
+       case IXGBE_DEV_ID_X550EM_A_KR_L:
+               mac->ops.setup_eee = ixgbe_setup_eee_X550;
+               break;
+       default:
+               mac->ops.setup_eee = NULL;
+       }
+
        return ret_val;
 }
 
@@ -883,28 +883,10 @@ s32 ixgbe_init_eeprom_params_X550(struct ixgbe_hw *hw)
  */
 STATIC s32 ixgbe_enable_eee_x550(struct ixgbe_hw *hw)
 {
-       u16 autoneg_eee_reg;
        u32 link_reg;
        s32 status;
 
-       if (hw->mac.type == ixgbe_mac_X550) {
-               /* Advertise EEE capability */
-               hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_EEE_ADVT,
-                                    IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-                                    &autoneg_eee_reg);
-
-               autoneg_eee_reg |= (IXGBE_AUTO_NEG_10GBASE_EEE_ADVT |
-                                   IXGBE_AUTO_NEG_1000BASE_EEE_ADVT |
-                                   IXGBE_AUTO_NEG_100BASE_EEE_ADVT);
-
-               hw->phy.ops.write_reg(hw, IXGBE_MDIO_AUTO_NEG_EEE_ADVT,
-                                     IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-                                     autoneg_eee_reg);
-               return IXGBE_SUCCESS;
-       }
-
        switch (hw->device_id) {
-       case IXGBE_DEV_ID_X550EM_X_KR:
        case IXGBE_DEV_ID_X550EM_A_KR:
        case IXGBE_DEV_ID_X550EM_A_KR_L:
                status = hw->mac.ops.read_iosf_sb_reg(hw,
@@ -938,26 +920,9 @@ STATIC s32 ixgbe_enable_eee_x550(struct ixgbe_hw *hw)
  */
 STATIC s32 ixgbe_disable_eee_x550(struct ixgbe_hw *hw)
 {
-       u16 autoneg_eee_reg;
        u32 link_reg;
        s32 status;
 
-       if (hw->mac.type == ixgbe_mac_X550) {
-               /* Disable advertised EEE capability */
-               hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_EEE_ADVT,
-                                    IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-                                    &autoneg_eee_reg);
-
-               autoneg_eee_reg &= ~(IXGBE_AUTO_NEG_10GBASE_EEE_ADVT |
-                                    IXGBE_AUTO_NEG_1000BASE_EEE_ADVT |
-                                    IXGBE_AUTO_NEG_100BASE_EEE_ADVT);
-
-               hw->phy.ops.write_reg(hw, IXGBE_MDIO_AUTO_NEG_EEE_ADVT,
-                                     IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-                                     autoneg_eee_reg);
-               return IXGBE_SUCCESS;
-       }
-
        switch (hw->device_id) {
        case IXGBE_DEV_ID_X550EM_X_KR:
        case IXGBE_DEV_ID_X550EM_A_KR:
@@ -1009,12 +974,6 @@ s32 ixgbe_setup_eee_X550(struct ixgbe_hw *hw, bool enable_eee)
        if (enable_eee) {
                eeer |= (IXGBE_EEER_TX_LPI_EN | IXGBE_EEER_RX_LPI_EN);
 
-               /* Not supported on first revision of X550EM_x. */
-               if ((hw->mac.type == ixgbe_mac_X550EM_x) &&
-                   !(IXGBE_FUSES0_REV_MASK &
-                     IXGBE_READ_REG(hw, IXGBE_FUSES0_GROUP(0))))
-                       return IXGBE_SUCCESS;
-
                status = ixgbe_enable_eee_x550(hw);
                if (status)
                        return status;
@@ -1778,7 +1737,7 @@ STATIC s32 ixgbe_setup_sgmii_m88(struct ixgbe_hw *hw, ixgbe_link_speed speed,
                return rc;
 
        flx_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_MASK;
-       flx_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_1G;
+       flx_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_AN;
        flx_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_AN_EN;
        flx_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SGMII_EN;
        flx_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_AN37_EN;
@@ -2026,19 +1985,32 @@ STATIC s32 ixgbe_enable_lasi_ext_t_x550em(struct ixgbe_hw *hw)
        status = ixgbe_get_lasi_ext_t_x550em(hw, &lsc);
 
        /* Enable link status change alarm */
-       status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_PMA_TX_VEN_LASI_INT_MASK,
-                                     IXGBE_MDIO_AUTO_NEG_DEV_TYPE, &reg);
 
-       if (status != IXGBE_SUCCESS)
-               return status;
+       /* Enable the LASI interrupts on X552 devices to receive notifications
+        * of the link configurations of the external PHY and correspondingly
+        * support the configuration of the internal iXFI link, since iXFI does
+        * not support auto-negotiation. This is not required for X553 devices
+        * having KR support, which performs auto-negotiations and which is used
+        * as the internal link to the external PHY. Hence adding a check here
+        * to avoid enabling LASI interrupts for X553 devices.
+        */
+       if (hw->mac.type != ixgbe_mac_X550EM_a) {
+               status = hw->phy.ops.read_reg(hw,
+                                       IXGBE_MDIO_PMA_TX_VEN_LASI_INT_MASK,
+                                       IXGBE_MDIO_AUTO_NEG_DEV_TYPE, &reg);
+
+               if (status != IXGBE_SUCCESS)
+                       return status;
 
-       reg |= IXGBE_MDIO_PMA_TX_VEN_LASI_INT_EN;
+               reg |= IXGBE_MDIO_PMA_TX_VEN_LASI_INT_EN;
 
-       status = hw->phy.ops.write_reg(hw, IXGBE_MDIO_PMA_TX_VEN_LASI_INT_MASK,
-                                      IXGBE_MDIO_AUTO_NEG_DEV_TYPE, reg);
+               status = hw->phy.ops.write_reg(hw,
+                                       IXGBE_MDIO_PMA_TX_VEN_LASI_INT_MASK,
+                                       IXGBE_MDIO_AUTO_NEG_DEV_TYPE, reg);
 
-       if (status != IXGBE_SUCCESS)
-               return status;
+               if (status != IXGBE_SUCCESS)
+                       return status;
+       }
 
        /* Enable high temperature failure and global fault alarms */
        status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_INT_MASK,
@@ -3040,6 +3012,10 @@ STATIC s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
        s32 status;
        u32 reg_val;
 
+       /* iXFI is only supported with X552 */
+       if (mac->type != ixgbe_mac_X550EM_x)
+               return IXGBE_ERR_LINK_SETUP;
+
        /* Disable AN and force speed to 10G Serial. */
        status = mac->ops.read_iosf_sb_reg(hw,
                                        IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
@@ -3136,7 +3112,8 @@ s32 ixgbe_setup_internal_phy_t_x550em(struct ixgbe_hw *hw)
        if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_copper)
                return IXGBE_ERR_CONFIG;
 
-       if (!(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE)) {
+       if (hw->mac.type == ixgbe_mac_X550EM_x &&
+           !(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE)) {
                /* If link is down, there is no setup necessary so return  */
                status = ixgbe_ext_phy_t_x550em_get_link(hw, &link_up);
                if (status != IXGBE_SUCCESS)
@@ -3779,6 +3756,8 @@ u32 ixgbe_get_supported_physical_layer_X550em(struct ixgbe_hw *hw)
                if (ext_ability & IXGBE_MDIO_PHY_1000BASET_ABILITY)
                        physical_layer |= IXGBE_PHYSICAL_LAYER_1000BASE_T;
                break;
+       case ixgbe_phy_m88:
+               physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_T;
        default:
                break;
        }
@@ -4638,8 +4617,10 @@ s32 ixgbe_setup_mac_link_t_X550em(struct ixgbe_hw *hw,
        else
                force_speed = IXGBE_LINK_SPEED_1GB_FULL;
 
-       /* If internal link mode is XFI, then setup XFI internal link. */
-       if (!(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE)) {
+       /* If X552 and internal link mode is XFI, then setup XFI internal link.
+        */
+       if (hw->mac.type == ixgbe_mac_X550EM_x &&
+           !(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE)) {
                status = ixgbe_setup_ixfi_x550em(hw, &force_speed);
 
                if (status != IXGBE_SUCCESS)