]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/net/ethernet/intel/e1000e/ich8lan.c
e1000e: demote a debugging WARN to a debug log message
[mirror_ubuntu-bionic-kernel.git] / drivers / net / ethernet / intel / e1000e / ich8lan.c
index 3fc3acce995028502bb45d0b582197a5809ec40c..e2a80a283fd313e0e76fa87a8470c09b37415f27 100644 (file)
@@ -811,7 +811,7 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
        }
 
        if ((adapter->hw.mac.type == e1000_ich8lan) &&
-           (adapter->hw.phy.type == e1000_phy_igp_3))
+           (adapter->hw.phy.type != e1000_phy_ife))
                adapter->flags |= FLAG_LSC_GIG_SPEED_DROP;
 
        /* Enable workaround for 82579 w/ ME enabled */
@@ -852,8 +852,6 @@ static void e1000_release_nvm_ich8lan(struct e1000_hw *hw)
        mutex_unlock(&nvm_mutex);
 }
 
-static DEFINE_MUTEX(swflag_mutex);
-
 /**
  *  e1000_acquire_swflag_ich8lan - Acquire software control flag
  *  @hw: pointer to the HW structure
@@ -866,7 +864,11 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
        u32 extcnf_ctrl, timeout = PHY_CFG_TIMEOUT;
        s32 ret_val = 0;
 
-       mutex_lock(&swflag_mutex);
+       if (test_and_set_bit(__E1000_ACCESS_SHARED_RESOURCE,
+                            &hw->adapter->state)) {
+               e_dbg("contention for Phy access\n");
+               return -E1000_ERR_PHY;
+       }
 
        while (timeout) {
                extcnf_ctrl = er32(EXTCNF_CTRL);
@@ -878,7 +880,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
        }
 
        if (!timeout) {
-               e_dbg("SW/FW/HW has locked the resource for too long.\n");
+               e_dbg("SW has already locked the resource.\n");
                ret_val = -E1000_ERR_CONFIG;
                goto out;
        }
@@ -898,7 +900,9 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
        }
 
        if (!timeout) {
-               e_dbg("Failed to acquire the semaphore.\n");
+               e_dbg("Failed to acquire the semaphore, FW or HW has it: "
+                     "FWSM=0x%8.8x EXTCNF_CTRL=0x%8.8x)\n",
+                     er32(FWSM), extcnf_ctrl);
                extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
                ew32(EXTCNF_CTRL, extcnf_ctrl);
                ret_val = -E1000_ERR_CONFIG;
@@ -907,7 +911,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
 
 out:
        if (ret_val)
-               mutex_unlock(&swflag_mutex);
+               clear_bit(__E1000_ACCESS_SHARED_RESOURCE, &hw->adapter->state);
 
        return ret_val;
 }
@@ -932,7 +936,7 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
                e_dbg("Semaphore unexpectedly released by sw/fw/hw\n");
        }
 
-       mutex_unlock(&swflag_mutex);
+       clear_bit(__E1000_ACCESS_SHARED_RESOURCE, &hw->adapter->state);
 }
 
 /**
@@ -1319,16 +1323,20 @@ static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state)
 
                if (mac_reg & E1000_PHY_CTRL_D0A_LPLU)
                        oem_reg |= HV_OEM_BITS_LPLU;
+
+               /* Set Restart auto-neg to activate the bits */
+               if (!e1000_check_reset_block(hw))
+                       oem_reg |= HV_OEM_BITS_RESTART_AN;
        } else {
-               if (mac_reg & E1000_PHY_CTRL_NOND0A_GBE_DISABLE)
+               if (mac_reg & (E1000_PHY_CTRL_GBE_DISABLE |
+                              E1000_PHY_CTRL_NOND0A_GBE_DISABLE))
                        oem_reg |= HV_OEM_BITS_GBE_DIS;
 
-               if (mac_reg & E1000_PHY_CTRL_NOND0A_LPLU)
+               if (mac_reg & (E1000_PHY_CTRL_D0A_LPLU |
+                              E1000_PHY_CTRL_NOND0A_LPLU))
                        oem_reg |= HV_OEM_BITS_LPLU;
        }
-       /* Restart auto-neg to activate the bits */
-       if (!e1000_check_reset_block(hw))
-               oem_reg |= HV_OEM_BITS_RESTART_AN;
+
        ret_val = hw->phy.ops.write_reg_locked(hw, HV_OEM_BITS, oem_reg);
 
 out:
@@ -1574,7 +1582,7 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable)
                ret_val = e1e_wphy(hw, PHY_REG(776, 20), data);
                if (ret_val)
                        goto out;
-               ret_val = e1e_wphy(hw, PHY_REG(776, 23), 0xFE00);
+               ret_val = e1e_wphy(hw, PHY_REG(776, 23), 0xF100);
                if (ret_val)
                        goto out;
                e1e_rphy(hw, HV_PM_CTRL, &data);
@@ -3135,7 +3143,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
        msleep(20);
 
        if (!ret_val)
-               mutex_unlock(&swflag_mutex);
+               clear_bit(__E1000_ACCESS_SHARED_RESOURCE, &hw->adapter->state);
 
        if (ctrl & E1000_CTRL_PHY_RST) {
                ret_val = hw->phy.ops.get_cfg_done(hw);
@@ -3638,15 +3646,14 @@ void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw)
  *  LPLU, Gig disable, MDIC PHY reset):
  *    1) Set Kumeran Near-end loopback
  *    2) Clear Kumeran Near-end loopback
- *  Should only be called for ICH8[m] devices with IGP_3 Phy.
+ *  Should only be called for ICH8[m] devices with any 1G Phy.
  **/
 void e1000e_gig_downshift_workaround_ich8lan(struct e1000_hw *hw)
 {
        s32 ret_val;
        u16 reg_data;
 
-       if ((hw->mac.type != e1000_ich8lan) ||
-           (hw->phy.type != e1000_phy_igp_3))
+       if ((hw->mac.type != e1000_ich8lan) || (hw->phy.type == e1000_phy_ife))
                return;
 
        ret_val = e1000e_read_kmrn_reg(hw, E1000_KMRNCTRLSTA_DIAG_OFFSET,
@@ -3682,8 +3689,12 @@ void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw)
        phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU | E1000_PHY_CTRL_GBE_DISABLE;
        ew32(PHY_CTRL, phy_ctrl);
 
+       if (hw->mac.type == e1000_ich8lan)
+               e1000e_gig_downshift_workaround_ich8lan(hw);
+
        if (hw->mac.type >= e1000_pchlan) {
                e1000_oem_bits_config_ich8lan(hw, false);
+               e1000_phy_hw_reset_ich8lan(hw);
                ret_val = hw->phy.ops.acquire(hw);
                if (ret_val)
                        return;
@@ -4011,7 +4022,7 @@ release:
        }
 }
 
-static struct e1000_mac_operations ich8_mac_ops = {
+static const struct e1000_mac_operations ich8_mac_ops = {
        .id_led_init            = e1000e_id_led_init,
        /* check_mng_mode dependent on mac type */
        .check_for_link         = e1000_check_for_copper_link_ich8lan,
@@ -4030,7 +4041,7 @@ static struct e1000_mac_operations ich8_mac_ops = {
        /* id_led_init dependent on mac type */
 };
 
-static struct e1000_phy_operations ich8_phy_ops = {
+static const struct e1000_phy_operations ich8_phy_ops = {
        .acquire                = e1000_acquire_swflag_ich8lan,
        .check_reset_block      = e1000_check_reset_block_ich8lan,
        .commit                 = NULL,
@@ -4044,7 +4055,7 @@ static struct e1000_phy_operations ich8_phy_ops = {
        .write_reg              = e1000e_write_phy_reg_igp,
 };
 
-static struct e1000_nvm_operations ich8_nvm_ops = {
+static const struct e1000_nvm_operations ich8_nvm_ops = {
        .acquire                = e1000_acquire_nvm_ich8lan,
        .read                   = e1000_read_nvm_ich8lan,
        .release                = e1000_release_nvm_ich8lan,
@@ -4054,7 +4065,7 @@ static struct e1000_nvm_operations ich8_nvm_ops = {
        .write                  = e1000_write_nvm_ich8lan,
 };
 
-struct e1000_info e1000_ich8_info = {
+const struct e1000_info e1000_ich8_info = {
        .mac                    = e1000_ich8lan,
        .flags                  = FLAG_HAS_WOL
                                  | FLAG_IS_ICH
@@ -4070,7 +4081,7 @@ struct e1000_info e1000_ich8_info = {
        .nvm_ops                = &ich8_nvm_ops,
 };
 
-struct e1000_info e1000_ich9_info = {
+const struct e1000_info e1000_ich9_info = {
        .mac                    = e1000_ich9lan,
        .flags                  = FLAG_HAS_JUMBO_FRAMES
                                  | FLAG_IS_ICH
@@ -4088,7 +4099,7 @@ struct e1000_info e1000_ich9_info = {
        .nvm_ops                = &ich8_nvm_ops,
 };
 
-struct e1000_info e1000_ich10_info = {
+const struct e1000_info e1000_ich10_info = {
        .mac                    = e1000_ich10lan,
        .flags                  = FLAG_HAS_JUMBO_FRAMES
                                  | FLAG_IS_ICH
@@ -4106,7 +4117,7 @@ struct e1000_info e1000_ich10_info = {
        .nvm_ops                = &ich8_nvm_ops,
 };
 
-struct e1000_info e1000_pch_info = {
+const struct e1000_info e1000_pch_info = {
        .mac                    = e1000_pchlan,
        .flags                  = FLAG_IS_ICH
                                  | FLAG_HAS_WOL
@@ -4125,7 +4136,7 @@ struct e1000_info e1000_pch_info = {
        .nvm_ops                = &ich8_nvm_ops,
 };
 
-struct e1000_info e1000_pch2_info = {
+const struct e1000_info e1000_pch2_info = {
        .mac                    = e1000_pch2lan,
        .flags                  = FLAG_IS_ICH
                                  | FLAG_HAS_WOL