diff options
author | Alex Bounine <alex.bou9@gmail.com> | 2008-02-11 14:36:12 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-02-11 14:47:18 -0500 |
commit | b1aefe58c21de4265223b563ae923b50f4c4be08 (patch) | |
tree | 935158dc844b42184e615e9b6c50692d5bad5942 | |
parent | 85bbe2158340dafb060fc7fe55a8208fe08cae26 (diff) |
Tsi108_eth: fix link recovery after disconnect
Bug fix for tsi108_eth network driver.
This patch fixes a problem with link recovery after connection was lost.
Signed-off-by: Alexandre Bounine <alexandreb@tundra.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/net/tsi108_eth.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c index 5a730ba8b1a2..bc3848962bb1 100644 --- a/drivers/net/tsi108_eth.c +++ b/drivers/net/tsi108_eth.c | |||
@@ -338,22 +338,21 @@ static void tsi108_check_phy(struct net_device *dev) | |||
338 | 338 | ||
339 | TSI_WRITE(TSI108_MAC_CFG2, mac_cfg2_reg); | 339 | TSI_WRITE(TSI108_MAC_CFG2, mac_cfg2_reg); |
340 | TSI_WRITE(TSI108_EC_PORTCTRL, portctrl_reg); | 340 | TSI_WRITE(TSI108_EC_PORTCTRL, portctrl_reg); |
341 | } | ||
341 | 342 | ||
342 | if (data->link_up == 0) { | 343 | if (data->link_up == 0) { |
343 | /* The manual says it can take 3-4 usecs for the speed change | 344 | /* The manual says it can take 3-4 usecs for the speed change |
344 | * to take effect. | 345 | * to take effect. |
345 | */ | 346 | */ |
346 | udelay(5); | 347 | udelay(5); |
347 | 348 | ||
348 | spin_lock(&data->txlock); | 349 | spin_lock(&data->txlock); |
349 | if (is_valid_ether_addr(dev->dev_addr) && data->txfree) | 350 | if (is_valid_ether_addr(dev->dev_addr) && data->txfree) |
350 | netif_wake_queue(dev); | 351 | netif_wake_queue(dev); |
351 | 352 | ||
352 | data->link_up = 1; | 353 | data->link_up = 1; |
353 | spin_unlock(&data->txlock); | 354 | spin_unlock(&data->txlock); |
354 | } | ||
355 | } | 355 | } |
356 | |||
357 | } else { | 356 | } else { |
358 | if (data->link_up == 1) { | 357 | if (data->link_up == 1) { |
359 | netif_stop_queue(dev); | 358 | netif_stop_queue(dev); |
@@ -1267,12 +1266,11 @@ static void tsi108_init_phy(struct net_device *dev) | |||
1267 | * PHY_STAT register before the link up status bit is set. | 1266 | * PHY_STAT register before the link up status bit is set. |
1268 | */ | 1267 | */ |
1269 | 1268 | ||
1270 | data->link_up = 1; | 1269 | data->link_up = 0; |
1271 | 1270 | ||
1272 | while (!((phyval = tsi108_read_mii(data, MII_BMSR)) & | 1271 | while (!((phyval = tsi108_read_mii(data, MII_BMSR)) & |
1273 | BMSR_LSTATUS)) { | 1272 | BMSR_LSTATUS)) { |
1274 | if (i++ > (MII_READ_DELAY / 10)) { | 1273 | if (i++ > (MII_READ_DELAY / 10)) { |
1275 | data->link_up = 0; | ||
1276 | break; | 1274 | break; |
1277 | } | 1275 | } |
1278 | spin_unlock_irqrestore(&phy_lock, flags); | 1276 | spin_unlock_irqrestore(&phy_lock, flags); |