Skip to content

Commit

Permalink
e1000e: bump up timeout to wait when ME un-configures ULP mode
Browse files Browse the repository at this point in the history
Per guidance from Intel ethernet architecture team, it may take
up to 1 second for unconfiguring ULP mode.

However in practice this seems to be taking up to 2 seconds on
some Lenovo machines.  Detect scenarios that take more than 1 second
but less than 2.5 seconds and emit a warning on resume for those
scenarios.

Suggested-by: Aaron Ma <[email protected]>
Suggested-by: Sasha Netfin <[email protected]>
Suggested-by: Hans de Goede <[email protected]>
CC: Mark Pearson <[email protected]>
Fixes: f15bb6d ("e1000e: Add support for S0ix")
BugLink: https://bugs.launchpad.net/bugs/1865570
Link: https://patchwork.ozlabs.org/project/intel-wired-lan/patch/[email protected]/
Link: https://lkml.org/lkml/2020/12/13/15
Link: https://lkml.org/lkml/2020/12/14/708
Signed-off-by: Mario Limonciello <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Tested-by: Yijun Shen <[email protected]>
Signed-off-by: Tony Nguyen <[email protected]>
  • Loading branch information
Mario Limonciello authored and anguy11 committed Dec 23, 2020
1 parent 808e0d8 commit 3cf31b1
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions drivers/net/ethernet/intel/e1000e/ich8lan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,9 @@ static s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force)
return 0;

if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID) {
struct e1000_adapter *adapter = hw->adapter;
bool firmware_bug = false;

if (force) {
/* Request ME un-configure ULP mode in the PHY */
mac_reg = er32(H2ME);
Expand All @@ -1248,16 +1251,24 @@ static s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force)
ew32(H2ME, mac_reg);
}

/* Poll up to 300msec for ME to clear ULP_CFG_DONE. */
/* Poll up to 2.5 seconds for ME to clear ULP_CFG_DONE.
* If this takes more than 1 second, show a warning indicating a
* firmware bug
*/
while (er32(FWSM) & E1000_FWSM_ULP_CFG_DONE) {
if (i++ == 30) {
if (i++ == 250) {
ret_val = -E1000_ERR_PHY;
goto out;
}
if (i > 100 && !firmware_bug)
firmware_bug = true;

usleep_range(10000, 11000);
}
e_dbg("ULP_CONFIG_DONE cleared after %dmsec\n", i * 10);
if (firmware_bug)
e_warn("ULP_CONFIG_DONE took %dmsec. This is a firmware bug\n", i * 10);
else
e_dbg("ULP_CONFIG_DONE cleared after %dmsec\n", i * 10);

if (force) {
mac_reg = er32(H2ME);
Expand Down

0 comments on commit 3cf31b1

Please sign in to comment.