diff options
-rw-r--r-- | drivers/net/dm9000.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index 7c49f336b440..d45bcd2660af 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -117,6 +117,9 @@ typedef struct board_info { | |||
117 | 117 | ||
118 | struct mutex addr_lock; /* phy and eeprom access lock */ | 118 | struct mutex addr_lock; /* phy and eeprom access lock */ |
119 | 119 | ||
120 | struct delayed_work phy_poll; | ||
121 | struct net_device *ndev; | ||
122 | |||
120 | spinlock_t lock; | 123 | spinlock_t lock; |
121 | 124 | ||
122 | struct mii_if_info mii; | 125 | struct mii_if_info mii; |
@@ -297,6 +300,10 @@ static void dm9000_set_io(struct board_info *db, int byte_width) | |||
297 | } | 300 | } |
298 | } | 301 | } |
299 | 302 | ||
303 | static void dm9000_schedule_poll(board_info_t *db) | ||
304 | { | ||
305 | schedule_delayed_work(&db->phy_poll, HZ * 2); | ||
306 | } | ||
300 | 307 | ||
301 | /* Our watchdog timed out. Called by the networking layer */ | 308 | /* Our watchdog timed out. Called by the networking layer */ |
302 | static void dm9000_timeout(struct net_device *dev) | 309 | static void dm9000_timeout(struct net_device *dev) |
@@ -465,6 +472,17 @@ static const struct ethtool_ops dm9000_ethtool_ops = { | |||
465 | .set_eeprom = dm9000_set_eeprom, | 472 | .set_eeprom = dm9000_set_eeprom, |
466 | }; | 473 | }; |
467 | 474 | ||
475 | static void | ||
476 | dm9000_poll_work(struct work_struct *w) | ||
477 | { | ||
478 | struct delayed_work *dw = container_of(w, struct delayed_work, work); | ||
479 | board_info_t *db = container_of(dw, board_info_t, phy_poll); | ||
480 | |||
481 | mii_check_media(&db->mii, netif_msg_link(db), 0); | ||
482 | |||
483 | if (netif_running(db->ndev)) | ||
484 | dm9000_schedule_poll(db); | ||
485 | } | ||
468 | 486 | ||
469 | /* dm9000_release_board | 487 | /* dm9000_release_board |
470 | * | 488 | * |
@@ -532,10 +550,14 @@ dm9000_probe(struct platform_device *pdev) | |||
532 | memset(db, 0, sizeof (*db)); | 550 | memset(db, 0, sizeof (*db)); |
533 | 551 | ||
534 | db->dev = &pdev->dev; | 552 | db->dev = &pdev->dev; |
553 | db->ndev = ndev; | ||
535 | 554 | ||
536 | spin_lock_init(&db->lock); | 555 | spin_lock_init(&db->lock); |
537 | mutex_init(&db->addr_lock); | 556 | mutex_init(&db->addr_lock); |
538 | 557 | ||
558 | INIT_DELAYED_WORK(&db->phy_poll, dm9000_poll_work); | ||
559 | |||
560 | |||
539 | if (pdev->num_resources < 2) { | 561 | if (pdev->num_resources < 2) { |
540 | ret = -ENODEV; | 562 | ret = -ENODEV; |
541 | goto out; | 563 | goto out; |
@@ -761,6 +783,8 @@ dm9000_open(struct net_device *dev) | |||
761 | 783 | ||
762 | mii_check_media(&db->mii, netif_msg_link(db), 1); | 784 | mii_check_media(&db->mii, netif_msg_link(db), 1); |
763 | netif_start_queue(dev); | 785 | netif_start_queue(dev); |
786 | |||
787 | dm9000_schedule_poll(db); | ||
764 | 788 | ||
765 | return 0; | 789 | return 0; |
766 | } | 790 | } |
@@ -879,6 +903,8 @@ dm9000_stop(struct net_device *ndev) | |||
879 | if (netif_msg_ifdown(db)) | 903 | if (netif_msg_ifdown(db)) |
880 | dev_dbg(db->dev, "shutting down %s\n", ndev->name); | 904 | dev_dbg(db->dev, "shutting down %s\n", ndev->name); |
881 | 905 | ||
906 | cancel_delayed_work(&db->phy_poll); | ||
907 | |||
882 | netif_stop_queue(ndev); | 908 | netif_stop_queue(ndev); |
883 | netif_carrier_off(ndev); | 909 | netif_carrier_off(ndev); |
884 | 910 | ||