net/mlx5: fix DevX event registration timing
[dpdk.git] / drivers / net / ixgbe / base / ixgbe_x550.c
index a44d95e..930a61a 100644 (file)
@@ -53,6 +53,7 @@ s32 ixgbe_init_ops_X550(struct ixgbe_hw *hw)
        mac->ops.enable_mdd = ixgbe_enable_mdd_X550;
        mac->ops.mdd_event = ixgbe_mdd_event_X550;
        mac->ops.restore_mdd_vf = ixgbe_restore_mdd_vf_X550;
+       mac->ops.fw_recovery_mode = ixgbe_fw_recovery_mode_X550;
        mac->ops.disable_rx = ixgbe_disable_rx_x550;
        /* Manageability interface */
        mac->ops.set_fw_drv_ver = ixgbe_set_fw_drv_ver_x550;
@@ -320,7 +321,7 @@ STATIC s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)
 
        switch (hw->device_id) {
        case IXGBE_DEV_ID_X550EM_A_SFP:
-               return ixgbe_identify_module_generic(hw);
+               return ixgbe_identify_sfp_module_X550em(hw);
        case IXGBE_DEV_ID_X550EM_X_SFP:
                /* set up for CS4227 usage */
                ixgbe_setup_mux_ctl(hw);
@@ -328,7 +329,7 @@ STATIC s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)
                /* Fallthrough */
 
        case IXGBE_DEV_ID_X550EM_A_SFP_N:
-               return ixgbe_identify_module_generic(hw);
+               return ixgbe_identify_sfp_module_X550em(hw);
                break;
        case IXGBE_DEV_ID_X550EM_X_KX4:
                hw->phy.type = ixgbe_phy_x550em_kx4;
@@ -1533,6 +1534,8 @@ STATIC s32 ixgbe_supported_sfp_modules_X550em(struct ixgbe_hw *hw, bool *linear)
        case ixgbe_sfp_type_1g_sx_core1:
        case ixgbe_sfp_type_1g_lx_core0:
        case ixgbe_sfp_type_1g_lx_core1:
+       case ixgbe_sfp_type_1g_lha_core0:
+       case ixgbe_sfp_type_1g_lha_core1:
                *linear = false;
                break;
        case ixgbe_sfp_type_unknown:
@@ -1873,6 +1876,8 @@ s32 ixgbe_get_link_capabilities_X550em(struct ixgbe_hw *hw,
                /* Check if 1G SFP module. */
                if (hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
                    hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1
+                   || hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+                   hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1
                    || hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
                    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1) {
                        *speed = IXGBE_LINK_SPEED_1GB_FULL;
@@ -2779,9 +2784,9 @@ s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
                                 (IXGBE_CS4227_EDC_MODE_SR << 1));
 
                if (setup_linear)
-                       reg_phy_ext = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 0x1;
+                       reg_phy_ext |= (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 0x1;
                else
-                       reg_phy_ext = (IXGBE_CS4227_EDC_MODE_SR << 1) | 0x1;
+                       reg_phy_ext |= (IXGBE_CS4227_EDC_MODE_SR << 1) | 0x1;
                ret_val = hw->phy.ops.write_reg(hw, reg_slice,
                                         IXGBE_MDIO_ZERO_DEV_TYPE, reg_phy_ext);
 
@@ -4435,6 +4440,8 @@ s32 ixgbe_setup_mac_link_t_X550em(struct ixgbe_hw *hw,
 {
        s32 status;
        ixgbe_link_speed force_speed;
+       u32 i;
+       bool link_up = false;
 
        DEBUGFUNC("ixgbe_setup_mac_link_t_X550em");
 
@@ -4454,6 +4461,19 @@ s32 ixgbe_setup_mac_link_t_X550em(struct ixgbe_hw *hw,
 
                if (status != IXGBE_SUCCESS)
                        return status;
+
+               /* Wait for the controller to acquire link */
+               for (i = 0; i < 10; i++) {
+                       msec_delay(100);
+
+                       status = ixgbe_check_link(hw, &force_speed, &link_up,
+                                                 false);
+                       if (status != IXGBE_SUCCESS)
+                               return status;
+
+                       if (link_up)
+                               break;
+               }
        }
 
        return hw->phy.ops.setup_link_speed(hw, speed, autoneg_wait_to_complete);
@@ -4632,3 +4652,18 @@ s32 ixgbe_set_fw_drv_ver_x550(struct ixgbe_hw *hw, u8 maj, u8 min,
 
        return ret_val;
 }
+
+/**
+ * ixgbe_fw_recovery_mode_X550 - Check FW NVM recovery mode
+ * @hw: pointer t hardware structure
+ *
+ * Returns true if in FW NVM recovery mode.
+ **/
+bool ixgbe_fw_recovery_mode_X550(struct ixgbe_hw *hw)
+{
+       u32 fwsm;
+
+       fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM_BY_MAC(hw));
+
+       return !!(fwsm & IXGBE_FWSM_FW_NVM_RECOVERY_MODE);
+}