ixgbe/base: new X557 phy
[dpdk.git] / lib / librte_pmd_ixgbe / ixgbe / ixgbe_x550.c
index 67e119c..93fc925 100644 (file)
@@ -94,10 +94,8 @@ STATIC s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)
        switch (hw->device_id) {
        case IXGBE_DEV_ID_X550EM_X_SFP:
                /* set up for CS4227 usage */
-               hw->phy.lan_id = IXGBE_READ_REG(hw, IXGBE_STATUS) &
-                                IXGBE_STATUS_LAN_ID_1;
                hw->phy.phy_semaphore_mask = IXGBE_GSSR_SHARED_I2C_SM;
-               if (hw->phy.lan_id) {
+               if (hw->bus.lan_id) {
 
                        esdp &= ~(IXGBE_ESDP_SDP1_NATIVE | IXGBE_ESDP_SDP1);
                        esdp |= IXGBE_ESDP_SDP1_DIR;
@@ -187,8 +185,6 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
                                    ixgbe_get_supported_physical_layer_X550em;
 
        /* PHY */
-       phy->ops.read_reg = ixgbe_read_phy_reg_x550em;
-       phy->ops.write_reg = ixgbe_write_phy_reg_x550em;
        phy->ops.init = ixgbe_init_phy_ops_X550em;
        phy->ops.identify = ixgbe_identify_phy_x550em;
        if (mac->ops.get_media_type(hw) != ixgbe_media_type_copper)
@@ -408,7 +404,7 @@ s32 ixgbe_setup_eee_X550(struct ixgbe_hw *hw, bool enable_eee)
                } else if (hw->device_id == IXGBE_DEV_ID_X550EM_X_KR ||
                           hw->device_id == IXGBE_DEV_ID_X550EM_X) {
                        status = ixgbe_read_iosf_sb_reg_x550(hw,
-                               IXGBE_KRM_LINK_CTRL_1(hw->phy.lan_id),
+                               IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
                                IXGBE_SB_IOSF_TARGET_KR_PHY, &link_reg);
                        if (status != IXGBE_SUCCESS)
                                return status;
@@ -417,7 +413,7 @@ s32 ixgbe_setup_eee_X550(struct ixgbe_hw *hw, bool enable_eee)
                                    IXGBE_KRM_LINK_CTRL_1_TETH_EEE_CAP_KX;
 
                        status = ixgbe_write_iosf_sb_reg_x550(hw,
-                               IXGBE_KRM_LINK_CTRL_1(hw->phy.lan_id),
+                               IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
                                IXGBE_SB_IOSF_TARGET_KR_PHY, link_reg);
                        if (status != IXGBE_SUCCESS)
                                return status;
@@ -439,7 +435,7 @@ s32 ixgbe_setup_eee_X550(struct ixgbe_hw *hw, bool enable_eee)
                } else if (hw->device_id == IXGBE_DEV_ID_X550EM_X_KR ||
                           hw->device_id == IXGBE_DEV_ID_X550EM_X) {
                        status = ixgbe_read_iosf_sb_reg_x550(hw,
-                               IXGBE_KRM_LINK_CTRL_1(hw->phy.lan_id),
+                               IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
                                IXGBE_SB_IOSF_TARGET_KR_PHY, &link_reg);
                        if (status != IXGBE_SUCCESS)
                                return status;
@@ -448,7 +444,7 @@ s32 ixgbe_setup_eee_X550(struct ixgbe_hw *hw, bool enable_eee)
                                IXGBE_KRM_LINK_CTRL_1_TETH_EEE_CAP_KX);
 
                        status = ixgbe_write_iosf_sb_reg_x550(hw,
-                               IXGBE_KRM_LINK_CTRL_1(hw->phy.lan_id),
+                               IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
                                IXGBE_SB_IOSF_TARGET_KR_PHY, link_reg);
                        if (status != IXGBE_SUCCESS)
                                return status;
@@ -824,7 +820,7 @@ s32 ixgbe_setup_sfp_modules_X550em(struct ixgbe_hw *hw)
        /* The CS4227 slice address is the base address + the port-pair reg
         * offset. I.e. Slice 0 = 0x12B0 and slice 1 = 0x22B0.
         */
-       reg_slice = IXGBE_CS4227_SPARE24_LSB + (hw->phy.lan_id << 12);
+       reg_slice = IXGBE_CS4227_SPARE24_LSB + (hw->bus.lan_id << 12);
 
        if (setup_linear)
                edc_mode = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 0x1;
@@ -922,10 +918,9 @@ s32 ixgbe_init_phy_ops_X550em(struct ixgbe_hw *hw)
 
        if (hw->device_id == IXGBE_DEV_ID_X550EM_X_SFP) {
                esdp = IXGBE_READ_REG(hw, IXGBE_ESDP);
-               phy->lan_id = IXGBE_READ_REG(hw, IXGBE_STATUS) &
-                             IXGBE_STATUS_LAN_ID_1;
                phy->phy_semaphore_mask = IXGBE_GSSR_SHARED_I2C_SM;
-               if (phy->lan_id) {
+
+               if (hw->bus.lan_id) {
                        esdp &= ~(IXGBE_ESDP_SDP1_NATIVE | IXGBE_ESDP_SDP1);
                        esdp |= IXGBE_ESDP_SDP1_DIR;
                }
@@ -947,6 +942,11 @@ s32 ixgbe_init_phy_ops_X550em(struct ixgbe_hw *hw)
        switch (hw->phy.type) {
        case ixgbe_phy_x550em_kr:
                phy->ops.setup_link = ixgbe_setup_kr_x550em;
+               phy->ops.read_reg = ixgbe_read_phy_reg_x550em;
+               phy->ops.write_reg = ixgbe_write_phy_reg_x550em;
+               break;
+       case ixgbe_phy_x550em_ext_t:
+               phy->ops.setup_internal_link = ixgbe_setup_internal_phy_x550em;
                break;
        default:
                break;
@@ -988,6 +988,13 @@ s32 ixgbe_reset_hw_X550em(struct ixgbe_hw *hw)
        if (status == IXGBE_ERR_SFP_NOT_SUPPORTED)
                return status;
 
+       /* start the external PHY */
+       if (hw->phy.type == ixgbe_phy_x550em_ext_t) {
+               status = ixgbe_init_ext_t_x550em(hw);
+               if (status)
+                       return status;
+       }
+
        /* Setup SFP module if there is one present. */
        if (hw->phy.sfp_setup_needed) {
                status = hw->mac.ops.setup_sfp(hw);
@@ -1052,6 +1059,97 @@ mac_reset_top:
        hw->mac.num_rar_entries = 128;
        hw->mac.ops.init_rx_addrs(hw);
 
+
+       return status;
+}
+
+/**
+ * ixgbe_init_ext_t_x550em - Start (unstall) the external Base T PHY.
+ * @hw: pointer to hardware structure
+ */
+s32 ixgbe_init_ext_t_x550em(struct ixgbe_hw *hw)
+{
+       u32 status;
+       u16 reg;
+       u32 retries = 1;
+
+       /* TODO: The number of attempts and delay between attempts is undefined */
+       do {
+               /* decrement retries counter and exit if we hit 0 */
+               if (retries < 1) {
+                       ERROR_REPORT1(IXGBE_ERROR_INVALID_STATE,
+                                     "External PHY not yet finished resetting.");
+                       return IXGBE_ERR_PHY;
+               }
+               retries--;
+
+               usec_delay(0);
+
+               status = hw->phy.ops.read_reg(hw,
+                                             IXGBE_MDIO_TX_VENDOR_ALARMS_3,
+                                             IXGBE_MDIO_PMA_PMD_DEV_TYPE,
+                                             &reg);
+
+               if (status != IXGBE_SUCCESS)
+                       return status;
+
+               /* Verify PHY FW reset has completed */
+       } while ((reg & IXGBE_MDIO_TX_VENDOR_ALARMS_3_RST_MASK) != 1);
+
+       /* Set port to low power mode */
+       status = hw->phy.ops.read_reg(hw,
+                                     IXGBE_MDIO_VENDOR_SPECIFIC_1_CONTROL,
+                                     IXGBE_MDIO_VENDOR_SPECIFIC_1_DEV_TYPE,
+                                     &reg);
+
+       if (status != IXGBE_SUCCESS)
+               return status;
+
+       reg |= IXGBE_MDIO_PHY_SET_LOW_POWER_MODE;
+
+       status = hw->phy.ops.write_reg(hw,
+                                      IXGBE_MDIO_VENDOR_SPECIFIC_1_CONTROL,
+                                      IXGBE_MDIO_VENDOR_SPECIFIC_1_DEV_TYPE,
+                                      reg);
+
+       if (status != IXGBE_SUCCESS)
+               return status;
+
+       /* Enable the transmitter */
+       status = hw->phy.ops.read_reg(hw,
+                                     IXGBE_MDIO_PMD_STD_TX_DISABLE_CNTR,
+                                     IXGBE_MDIO_PMA_PMD_DEV_TYPE,
+                                     &reg);
+
+       if (status != IXGBE_SUCCESS)
+               return status;
+
+       reg &= ~IXGBE_MDIO_PMD_GLOBAL_TX_DISABLE;
+
+       status = hw->phy.ops.write_reg(hw,
+                                      IXGBE_MDIO_PMD_STD_TX_DISABLE_CNTR,
+                                      IXGBE_MDIO_PMA_PMD_DEV_TYPE,
+                                      reg);
+
+       if (status != IXGBE_SUCCESS)
+               return status;
+
+       /* Un-stall the PHY FW */
+       status = hw->phy.ops.read_reg(hw,
+                                     IXGBE_MDIO_GLOBAL_RES_PR_10,
+                                     IXGBE_MDIO_VENDOR_SPECIFIC_1_DEV_TYPE,
+                                     &reg);
+
+       if (status != IXGBE_SUCCESS)
+               return status;
+
+       reg &= ~IXGBE_MDIO_POWER_UP_STALL;
+
+       status = hw->phy.ops.write_reg(hw,
+                                      IXGBE_MDIO_GLOBAL_RES_PR_10,
+                                      IXGBE_MDIO_VENDOR_SPECIFIC_1_DEV_TYPE,
+                                      reg);
+
        return status;
 }
 
@@ -1067,7 +1165,7 @@ s32 ixgbe_setup_kr_x550em(struct ixgbe_hw *hw)
        u32 reg_val;
 
        status = ixgbe_read_iosf_sb_reg_x550(hw,
-               IXGBE_KRM_LINK_CTRL_1(hw->phy.lan_id),
+               IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
                IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
        if (status)
                return status;
@@ -1089,7 +1187,7 @@ s32 ixgbe_setup_kr_x550em(struct ixgbe_hw *hw)
        /* Restart auto-negotiation. */
        reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
        status = ixgbe_write_iosf_sb_reg_x550(hw,
-               IXGBE_KRM_LINK_CTRL_1(hw->phy.lan_id),
+               IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
                IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 
        return status;
@@ -1098,45 +1196,61 @@ s32 ixgbe_setup_kr_x550em(struct ixgbe_hw *hw)
 /**
  *  ixgbe_setup_ixfi_x550em - Configure the KR PHY for iXFI.
  *  @hw: pointer to hardware structure
+ *  @speed: the link speed to force
  *
- *  Configures the integrated KR PHY to use iXFI mode.
+ *  Configures the integrated KR PHY to use iXFI mode. Used to connect an
+ *  internal and external PHY at a specific speed, without autonegotiation.
  **/
-s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw)
+STATIC s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
 {
        s32 status;
        u32 reg_val;
 
        /* Disable AN and force speed to 10G Serial. */
        status = ixgbe_read_iosf_sb_reg_x550(hw,
-                                       IXGBE_KRM_LINK_CTRL_1(hw->phy.lan_id),
+                                       IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
                                        IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
        if (status != IXGBE_SUCCESS)
                return status;
+
        reg_val &= ~IXGBE_KRM_LINK_CTRL_1_TETH_AN_ENABLE;
        reg_val &= ~IXGBE_KRM_LINK_CTRL_1_TETH_FORCE_SPEED_MASK;
-       reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_FORCE_SPEED_10G;
+
+       /* Select forced link speed for internal PHY. */
+       switch (*speed) {
+       case IXGBE_LINK_SPEED_10GB_FULL:
+               reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_FORCE_SPEED_10G;
+               break;
+       case IXGBE_LINK_SPEED_1GB_FULL:
+               reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_FORCE_SPEED_1G;
+               break;
+       default:
+               /* Other link speeds are not supported by internal KR PHY. */
+               return IXGBE_ERR_LINK_SETUP;
+       }
+
        status = ixgbe_write_iosf_sb_reg_x550(hw,
-                                       IXGBE_KRM_LINK_CTRL_1(hw->phy.lan_id),
+                                       IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
                                        IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
        if (status != IXGBE_SUCCESS)
                return status;
 
        /* Disable training protocol FSM. */
        status = ixgbe_read_iosf_sb_reg_x550(hw,
-                               IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->phy.lan_id),
+                               IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id),
                                IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
        if (status != IXGBE_SUCCESS)
                return status;
        reg_val |= IXGBE_KRM_RX_TRN_LINKUP_CTRL_CONV_WO_PROTOCOL;
        status = ixgbe_write_iosf_sb_reg_x550(hw,
-                               IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->phy.lan_id),
+                               IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id),
                                IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
        if (status != IXGBE_SUCCESS)
                return status;
 
        /* Disable Flex from training TXFFE. */
        status = ixgbe_read_iosf_sb_reg_x550(hw,
-                               IXGBE_KRM_DSP_TXFFE_STATE_4(hw->phy.lan_id),
+                               IXGBE_KRM_DSP_TXFFE_STATE_4(hw->bus.lan_id),
                                IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
        if (status != IXGBE_SUCCESS)
                return status;
@@ -1144,12 +1258,12 @@ s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw)
        reg_val &= ~IXGBE_KRM_DSP_TXFFE_STATE_CP1_CN1_EN;
        reg_val &= ~IXGBE_KRM_DSP_TXFFE_STATE_CO_ADAPT_EN;
        status = ixgbe_write_iosf_sb_reg_x550(hw,
-                               IXGBE_KRM_DSP_TXFFE_STATE_4(hw->phy.lan_id),
+                               IXGBE_KRM_DSP_TXFFE_STATE_4(hw->bus.lan_id),
                                IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
        if (status != IXGBE_SUCCESS)
                return status;
        status = ixgbe_read_iosf_sb_reg_x550(hw,
-                               IXGBE_KRM_DSP_TXFFE_STATE_5(hw->phy.lan_id),
+                               IXGBE_KRM_DSP_TXFFE_STATE_5(hw->bus.lan_id),
                                IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
        if (status != IXGBE_SUCCESS)
                return status;
@@ -1157,14 +1271,14 @@ s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw)
        reg_val &= ~IXGBE_KRM_DSP_TXFFE_STATE_CP1_CN1_EN;
        reg_val &= ~IXGBE_KRM_DSP_TXFFE_STATE_CO_ADAPT_EN;
        status = ixgbe_write_iosf_sb_reg_x550(hw,
-                               IXGBE_KRM_DSP_TXFFE_STATE_5(hw->phy.lan_id),
+                               IXGBE_KRM_DSP_TXFFE_STATE_5(hw->bus.lan_id),
                                IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
        if (status != IXGBE_SUCCESS)
                return status;
 
        /* Enable override for coefficients. */
        status = ixgbe_read_iosf_sb_reg_x550(hw,
-                               IXGBE_KRM_TX_COEFF_CTRL_1(hw->phy.lan_id),
+                               IXGBE_KRM_TX_COEFF_CTRL_1(hw->bus.lan_id),
                                IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
        if (status != IXGBE_SUCCESS)
                return status;
@@ -1173,25 +1287,93 @@ s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw)
        reg_val |= IXGBE_KRM_TX_COEFF_CTRL_1_CPLUS1_OVRRD_EN;
        reg_val |= IXGBE_KRM_TX_COEFF_CTRL_1_CMINUS1_OVRRD_EN;
        status = ixgbe_write_iosf_sb_reg_x550(hw,
-                               IXGBE_KRM_TX_COEFF_CTRL_1(hw->phy.lan_id),
+                               IXGBE_KRM_TX_COEFF_CTRL_1(hw->bus.lan_id),
                                IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
        if (status != IXGBE_SUCCESS)
                return status;
 
        /* Toggle port SW reset by AN reset. */
        status = ixgbe_read_iosf_sb_reg_x550(hw,
-                                       IXGBE_KRM_LINK_CTRL_1(hw->phy.lan_id),
+                                       IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
                                        IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
        if (status != IXGBE_SUCCESS)
                return status;
        reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
        status = ixgbe_write_iosf_sb_reg_x550(hw,
-                                       IXGBE_KRM_LINK_CTRL_1(hw->phy.lan_id),
+                                       IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
                                        IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 
        return status;
 }
 
+/**
+ * ixgbe_setup_internal_phy_x550em - Configure integrated KR PHY
+ * @hw: point to hardware structure
+ *
+ * Configures the integrated KR PHY to talk to the external PHY. The base
+ * driver will call this function when it gets notification via interrupt from
+ * the external PHY. This function forces the internal PHY into iXFI mode at
+ * the correct speed.
+ *
+ * A return of a non-zero value indicates an error, and the base driver should
+ * not report link up.
+ */
+s32 ixgbe_setup_internal_phy_x550em(struct ixgbe_hw *hw)
+{
+       u32 status;
+       u16 lasi, autoneg_status, speed;
+       ixgbe_link_speed force_speed;
+
+       /* Verify that the external link status has changed */
+       status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_XENPAK_LASI_STATUS,
+                                     IXGBE_MDIO_PMA_PMD_DEV_TYPE,
+                                     &lasi);
+       if (status != IXGBE_SUCCESS)
+               return status;
+
+       /* If there was no change in link status, we can just exit */
+       if (!(lasi & IXGBE_XENPAK_LASI_LINK_STATUS_ALARM))
+               return IXGBE_SUCCESS;
+
+       /* we read this twice back to back to indicate current status */
+       status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_STATUS,
+                                     IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
+                                     &autoneg_status);
+       if (status != IXGBE_SUCCESS)
+               return status;
+
+       status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_STATUS,
+                                     IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
+                                     &autoneg_status);
+       if (status != IXGBE_SUCCESS)
+               return status;
+
+       /* If link is not up return an error indicating treat link as down */
+       if (!(autoneg_status & IXGBE_MDIO_AUTO_NEG_LINK_STATUS))
+               return IXGBE_ERR_INVALID_LINK_SETTINGS;
+
+       status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_VENDOR_STAT,
+                                     IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
+                                     &speed);
+
+       /* clear everything but the speed and duplex bits */
+       speed &= IXGBE_MDIO_AUTO_NEG_VENDOR_STATUS_MASK;
+
+       switch (speed) {
+       case IXGBE_MDIO_AUTO_NEG_VENDOR_STATUS_10GB_FULL:
+               force_speed = IXGBE_LINK_SPEED_10GB_FULL;
+               break;
+       case IXGBE_MDIO_AUTO_NEG_VENDOR_STATUS_1GB_FULL:
+               force_speed = IXGBE_LINK_SPEED_1GB_FULL;
+               break;
+       default:
+               /* Internal PHY does not support anything else */
+               return IXGBE_ERR_INVALID_LINK_SETTINGS;
+       }
+
+       return ixgbe_setup_ixfi_x550em(hw, &force_speed);
+}
+
 /**
  *  ixgbe_setup_phy_loopback_x550em - Configure the KR PHY for loopback.
  *  @hw: pointer to hardware structure
@@ -1205,7 +1387,7 @@ s32 ixgbe_setup_phy_loopback_x550em(struct ixgbe_hw *hw)
 
        /* Disable AN and force speed to 10G Serial. */
        status = ixgbe_read_iosf_sb_reg_x550(hw,
-               IXGBE_KRM_LINK_CTRL_1(hw->phy.lan_id),
+               IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
                IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
        if (status != IXGBE_SUCCESS)
                return status;
@@ -1213,47 +1395,47 @@ s32 ixgbe_setup_phy_loopback_x550em(struct ixgbe_hw *hw)
        reg_val &= ~IXGBE_KRM_LINK_CTRL_1_TETH_FORCE_SPEED_MASK;
        reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_FORCE_SPEED_10G;
        status = ixgbe_write_iosf_sb_reg_x550(hw,
-               IXGBE_KRM_LINK_CTRL_1(hw->phy.lan_id),
+               IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
                IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
        if (status != IXGBE_SUCCESS)
                return status;
 
        /* Set near-end loopback clocks. */
        status = ixgbe_read_iosf_sb_reg_x550(hw,
-               IXGBE_KRM_PORT_CAR_GEN_CTRL(hw->phy.lan_id),
+               IXGBE_KRM_PORT_CAR_GEN_CTRL(hw->bus.lan_id),
                IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
        if (status != IXGBE_SUCCESS)
                return status;
        reg_val |= IXGBE_KRM_PORT_CAR_GEN_CTRL_NELB_32B;
        reg_val |= IXGBE_KRM_PORT_CAR_GEN_CTRL_NELB_KRPCS;
        status = ixgbe_write_iosf_sb_reg_x550(hw,
-               IXGBE_KRM_PORT_CAR_GEN_CTRL(hw->phy.lan_id),
+               IXGBE_KRM_PORT_CAR_GEN_CTRL(hw->bus.lan_id),
                IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
        if (status != IXGBE_SUCCESS)
                return status;
 
        /* Set loopback enable. */
        status = ixgbe_read_iosf_sb_reg_x550(hw,
-               IXGBE_KRM_PMD_DFX_BURNIN(hw->phy.lan_id),
+               IXGBE_KRM_PMD_DFX_BURNIN(hw->bus.lan_id),
                IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
        if (status != IXGBE_SUCCESS)
                return status;
        reg_val |= IXGBE_KRM_PMD_DFX_BURNIN_TX_RX_KR_LB_MASK;
        status = ixgbe_write_iosf_sb_reg_x550(hw,
-               IXGBE_KRM_PMD_DFX_BURNIN(hw->phy.lan_id),
+               IXGBE_KRM_PMD_DFX_BURNIN(hw->bus.lan_id),
                IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
        if (status != IXGBE_SUCCESS)
                return status;
 
        /* Training bypass. */
        status = ixgbe_read_iosf_sb_reg_x550(hw,
-               IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->phy.lan_id),
+               IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id),
                IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
        if (status != IXGBE_SUCCESS)
                return status;
        reg_val |= IXGBE_KRM_RX_TRN_LINKUP_CTRL_PROTOCOL_BYPASS;
        status = ixgbe_write_iosf_sb_reg_x550(hw,
-               IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->phy.lan_id),
+               IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id),
                IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 
        return status;
@@ -1750,6 +1932,7 @@ s32 ixgbe_update_flash_X550(struct ixgbe_hw *hw)
 u32 ixgbe_get_supported_physical_layer_X550em(struct ixgbe_hw *hw)
 {
        u32 physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN;
+       u16 ext_ability = 0;
 
        DEBUGFUNC("ixgbe_get_supported_physical_layer_X550em");
 
@@ -1764,6 +1947,15 @@ u32 ixgbe_get_supported_physical_layer_X550em(struct ixgbe_hw *hw)
                physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_KX4 |
                                 IXGBE_PHYSICAL_LAYER_1000BASE_KX;
                break;
+       case ixgbe_phy_x550em_ext_t:
+               hw->phy.ops.read_reg(hw, IXGBE_MDIO_PHY_EXT_ABILITY,
+                                    IXGBE_MDIO_PMA_PMD_DEV_TYPE,
+                                    &ext_ability);
+               if (ext_ability & IXGBE_MDIO_PHY_10GBASET_ABILITY)
+                       physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_T;
+               if (ext_ability & IXGBE_MDIO_PHY_1000BASET_ABILITY)
+                       physical_layer |= IXGBE_PHYSICAL_LAYER_1000BASE_T;
+               break;
        default:
                break;
        }
@@ -1819,7 +2011,7 @@ void ixgbe_disable_rx_x550(struct ixgbe_hw *hw)
                fw_cmd.hdr.cmd = FW_DISABLE_RXEN_CMD;
                fw_cmd.hdr.buf_len = FW_DISABLE_RXEN_LEN;
                fw_cmd.hdr.checksum = FW_DEFAULT_CHECKSUM;
-               fw_cmd.port_number = hw->phy.lan_id;
+               fw_cmd.port_number = (u8)hw->bus.lan_id;
 
                status = ixgbe_host_interface_command(hw, (u32 *)&fw_cmd,
                                        sizeof(struct ixgbe_hic_disable_rxen),