aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/dm9000.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/dm9000.c')
-rw-r--r--drivers/net/dm9000.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 7c38f6129b55..5ad2ec537684 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -552,15 +552,48 @@ static const struct ethtool_ops dm9000_ethtool_ops = {
552 .set_eeprom = dm9000_set_eeprom, 552 .set_eeprom = dm9000_set_eeprom,
553}; 553};
554 554
555static void dm9000_show_carrier(board_info_t *db,
556 unsigned carrier, unsigned nsr)
557{
558 struct net_device *ndev = db->ndev;
559 unsigned ncr = dm9000_read_locked(db, DM9000_NCR);
560
561 if (carrier)
562 dev_info(db->dev, "%s: link up, %dMbps, %s-duplex, no LPA\n",
563 ndev->name, (nsr & NSR_SPEED) ? 10 : 100,
564 (ncr & NCR_FDX) ? "full" : "half");
565 else
566 dev_info(db->dev, "%s: link down\n", ndev->name);
567}
568
555static void 569static void
556dm9000_poll_work(struct work_struct *w) 570dm9000_poll_work(struct work_struct *w)
557{ 571{
558 struct delayed_work *dw = container_of(w, struct delayed_work, work); 572 struct delayed_work *dw = container_of(w, struct delayed_work, work);
559 board_info_t *db = container_of(dw, board_info_t, phy_poll); 573 board_info_t *db = container_of(dw, board_info_t, phy_poll);
574 struct net_device *ndev = db->ndev;
575
576 if (db->flags & DM9000_PLATF_SIMPLE_PHY &&
577 !(db->flags & DM9000_PLATF_EXT_PHY)) {
578 unsigned nsr = dm9000_read_locked(db, DM9000_NSR);
579 unsigned old_carrier = netif_carrier_ok(ndev) ? 1 : 0;
580 unsigned new_carrier;
560 581
561 mii_check_media(&db->mii, netif_msg_link(db), 0); 582 new_carrier = (nsr & NSR_LINKST) ? 1 : 0;
583
584 if (old_carrier != new_carrier) {
585 if (netif_msg_link(db))
586 dm9000_show_carrier(db, new_carrier, nsr);
587
588 if (!new_carrier)
589 netif_carrier_off(ndev);
590 else
591 netif_carrier_on(ndev);
592 }
593 } else
594 mii_check_media(&db->mii, netif_msg_link(db), 0);
562 595
563 if (netif_running(db->ndev)) 596 if (netif_running(ndev))
564 dm9000_schedule_poll(db); 597 dm9000_schedule_poll(db);
565} 598}
566 599
@@ -1267,6 +1300,10 @@ dm9000_probe(struct platform_device *pdev)
1267 db->flags = pdata->flags; 1300 db->flags = pdata->flags;
1268 } 1301 }
1269 1302
1303#ifdef CONFIG_DM9000_FORCE_SIMPLE_PHY_POLL
1304 db->flags |= DM9000_PLATF_SIMPLE_PHY;
1305#endif
1306
1270 dm9000_reset(db); 1307 dm9000_reset(db);
1271 1308
1272 /* try multiple times, DM9000 sometimes gets the read wrong */ 1309 /* try multiple times, DM9000 sometimes gets the read wrong */