Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 103103
b: refs/heads/master
c: f8dd0ec
h: refs/heads/master
i:
  103101: 8ce3513
  103099: 83f9fe8
  103095: e638b83
  103087: 3a41e18
  103071: 33934c4
  103039: 54e7534
v: v3
  • Loading branch information
Ben Dooks authored and Jeff Garzik committed Jun 25, 2008
1 parent 50b9deb commit 60872b7
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 3 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: aa1eb452e8d8a97ee65ace0054e7a733ae12cf6d
refs/heads/master: f8dd0ecbb74d4b220b105d77c0633945ebb5453e
9 changes: 9 additions & 0 deletions trunk/drivers/net/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,15 @@ config DM9000
To compile this driver as a module, choose M here. The module
will be called dm9000.

config DM9000_FORCE_SIMPLE_PHY_POLL
bool "Force simple NSR based PHY polling"
depends on DM9000
---help---
This configuration forces the DM9000 to use the NSR's LinkStatus
bit to determine if the link is up or down instead of the more
costly MII PHY reads. Note, this will not work if the chip is
operating with an external PHY.

config ENC28J60
tristate "ENC28J60 support"
depends on EXPERIMENTAL && SPI && NET_ETHERNET
Expand Down
41 changes: 39 additions & 2 deletions trunk/drivers/net/dm9000.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,15 +552,48 @@ static const struct ethtool_ops dm9000_ethtool_ops = {
.set_eeprom = dm9000_set_eeprom,
};

static void dm9000_show_carrier(board_info_t *db,
unsigned carrier, unsigned nsr)
{
struct net_device *ndev = db->ndev;
unsigned ncr = dm9000_read_locked(db, DM9000_NCR);

if (carrier)
dev_info(db->dev, "%s: link up, %dMbps, %s-duplex, no LPA\n",
ndev->name, (nsr & NSR_SPEED) ? 10 : 100,
(ncr & NCR_FDX) ? "full" : "half");
else
dev_info(db->dev, "%s: link down\n", ndev->name);
}

static void
dm9000_poll_work(struct work_struct *w)
{
struct delayed_work *dw = container_of(w, struct delayed_work, work);
board_info_t *db = container_of(dw, board_info_t, phy_poll);
struct net_device *ndev = db->ndev;

if (db->flags & DM9000_PLATF_SIMPLE_PHY &&
!(db->flags & DM9000_PLATF_EXT_PHY)) {
unsigned nsr = dm9000_read_locked(db, DM9000_NSR);
unsigned old_carrier = netif_carrier_ok(ndev) ? 1 : 0;
unsigned new_carrier;

mii_check_media(&db->mii, netif_msg_link(db), 0);
new_carrier = (nsr & NSR_LINKST) ? 1 : 0;

if (old_carrier != new_carrier) {
if (netif_msg_link(db))
dm9000_show_carrier(db, new_carrier, nsr);

if (!new_carrier)
netif_carrier_off(ndev);
else
netif_carrier_on(ndev);
}
} else
mii_check_media(&db->mii, netif_msg_link(db), 0);

if (netif_running(db->ndev))
if (netif_running(ndev))
dm9000_schedule_poll(db);
}

Expand Down Expand Up @@ -1267,6 +1300,10 @@ dm9000_probe(struct platform_device *pdev)
db->flags = pdata->flags;
}

#ifdef CONFIG_DM9000_FORCE_SIMPLE_PHY_POLL
db->flags |= DM9000_PLATF_SIMPLE_PHY;
#endif

dm9000_reset(db);

/* try multiple times, DM9000 sometimes gets the read wrong */
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/dm9000.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define DM9000_PLATF_32BITONLY (0x0004)
#define DM9000_PLATF_EXT_PHY (0x0008)
#define DM9000_PLATF_NO_EEPROM (0x0010)
#define DM9000_PLATF_SIMPLE_PHY (0x0020) /* Use NSR to find LinkStatus */

/* platfrom data for platfrom device structure's platfrom_data field */

Expand Down

0 comments on commit 60872b7

Please sign in to comment.