Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 156887
b: refs/heads/master
c: 373a88d
h: refs/heads/master
i:
  156885: 6eef8a5
  156883: ad7301b
  156879: 231a184
v: v3
  • Loading branch information
Bruce Allan authored and David S. Miller committed Aug 10, 2009
1 parent 0f88fe3 commit 2d48a79
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6e455b897bb6be3a4c0c6578f679e83d399e5b92
refs/heads/master: 373a88d78be540c1331ea5adcb76610dddcb008b
44 changes: 31 additions & 13 deletions trunk/drivers/net/e1000e/ich8lan.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,37 +594,55 @@ static DEFINE_MUTEX(nvm_mutex);
**/
static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
{
u32 extcnf_ctrl;
u32 timeout = PHY_CFG_TIMEOUT;
u32 extcnf_ctrl, timeout = PHY_CFG_TIMEOUT;
s32 ret_val = 0;

might_sleep();

mutex_lock(&nvm_mutex);

while (timeout) {
extcnf_ctrl = er32(EXTCNF_CTRL);
if (!(extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG))
break;

if (!(extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)) {
extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG;
ew32(EXTCNF_CTRL, extcnf_ctrl);
mdelay(1);
timeout--;
}

if (!timeout) {
hw_dbg(hw, "SW/FW/HW has locked the resource for too long.\n");
ret_val = -E1000_ERR_CONFIG;
goto out;
}

timeout = PHY_CFG_TIMEOUT * 2;

extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG;
ew32(EXTCNF_CTRL, extcnf_ctrl);

while (timeout) {
extcnf_ctrl = er32(EXTCNF_CTRL);
if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)
break;

extcnf_ctrl = er32(EXTCNF_CTRL);
if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)
break;
}
mdelay(1);
timeout--;
}

if (!timeout) {
hw_dbg(hw, "FW or HW has locked the resource for too long.\n");
hw_dbg(hw, "Failed to acquire the semaphore.\n");
extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
ew32(EXTCNF_CTRL, extcnf_ctrl);
mutex_unlock(&nvm_mutex);
return -E1000_ERR_CONFIG;
ret_val = -E1000_ERR_CONFIG;
goto out;
}

return 0;
out:
if (ret_val)
mutex_unlock(&nvm_mutex);

return ret_val;
}

/**
Expand Down

0 comments on commit 2d48a79

Please sign in to comment.