Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 150585
b: refs/heads/master
c: c930a66
h: refs/heads/master
i:
  150583: 062c5ad
v: v3
  • Loading branch information
Joe Perches authored and David S. Miller committed Jun 1, 2009
1 parent 6a4cd8d commit 4c53bb7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 26 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: 56d417b12e57dfe11c9b7ba4bea3882c62a55815
refs/heads/master: c930a66220bac0815cca74eef94ada221377ffba
48 changes: 23 additions & 25 deletions trunk/drivers/net/atl1c/atl1c_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,24 @@ static inline void atl1c_irq_reset(struct atl1c_adapter *adapter)
atl1c_irq_enable(adapter);
}

/*
* atl1c_wait_until_idle - wait up to AT_HW_MAX_IDLE_DELAY reads
* of the idle status register until the device is actually idle
*/
static u32 atl1c_wait_until_idle(struct atl1c_hw *hw)
{
int timeout;
u32 data;

for (timeout = 0; timeout < AT_HW_MAX_IDLE_DELAY; timeout++) {
AT_READ_REG(hw, REG_IDLE_STATUS, &data);
if ((data & IDLE_STATUS_MASK) == 0)
return 0;
msleep(1);
}
return data;
}

/*
* atl1c_phy_config - Timer Call-back
* @data: pointer to netdev cast into an unsigned long
Expand Down Expand Up @@ -1106,7 +1124,6 @@ static void atl1c_configure_dma(struct atl1c_adapter *adapter)
static int atl1c_stop_mac(struct atl1c_hw *hw)
{
u32 data;
int timeout;

AT_READ_REG(hw, REG_RXQ_CTRL, &data);
data &= ~(RXQ1_CTRL_EN | RXQ2_CTRL_EN |
Expand All @@ -1117,25 +1134,13 @@ static int atl1c_stop_mac(struct atl1c_hw *hw)
data &= ~TXQ_CTRL_EN;
AT_WRITE_REG(hw, REG_TWSI_CTRL, data);

for (timeout = 0; timeout < AT_HW_MAX_IDLE_DELAY; timeout++) {
AT_READ_REG(hw, REG_IDLE_STATUS, &data);
if ((data & (IDLE_STATUS_RXQ_NO_IDLE |
IDLE_STATUS_TXQ_NO_IDLE)) == 0)
break;
msleep(1);
}
atl1c_wait_until_idle(hw);

AT_READ_REG(hw, REG_MAC_CTRL, &data);
data &= ~(MAC_CTRL_TX_EN | MAC_CTRL_RX_EN);
AT_WRITE_REG(hw, REG_MAC_CTRL, data);

for (timeout = 0; timeout < AT_HW_MAX_IDLE_DELAY; timeout++) {
AT_READ_REG(hw, REG_IDLE_STATUS, &data);
if ((data & IDLE_STATUS_MASK) == 0)
return 0;
msleep(1);
}
return data;
return (int)atl1c_wait_until_idle(hw);
}

static void atl1c_enable_rx_ctrl(struct atl1c_hw *hw)
Expand Down Expand Up @@ -1178,8 +1183,6 @@ static int atl1c_reset_mac(struct atl1c_hw *hw)
{
struct atl1c_adapter *adapter = (struct atl1c_adapter *)hw->adapter;
struct pci_dev *pdev = adapter->pdev;
u32 idle_status_data = 0;
int timeout = 0;
int ret;

AT_WRITE_REG(hw, REG_IMR, 0);
Expand All @@ -1198,15 +1201,10 @@ static int atl1c_reset_mac(struct atl1c_hw *hw)
AT_WRITE_FLUSH(hw);
msleep(10);
/* Wait at least 10ms for All module to be Idle */
for (timeout = 0; timeout < AT_HW_MAX_IDLE_DELAY; timeout++) {
AT_READ_REG(hw, REG_IDLE_STATUS, &idle_status_data);
if ((idle_status_data & IDLE_STATUS_MASK) == 0)
break;
msleep(1);
}
if (timeout >= AT_HW_MAX_IDLE_DELAY) {

if (atl1c_wait_until_idle(hw)) {
dev_err(&pdev->dev,
"MAC state machine cann't be idle since"
"MAC state machine can't be idle since"
" disabled for 10ms second\n");
return -1;
}
Expand Down

0 comments on commit 4c53bb7

Please sign in to comment.