Commit 28334aab authored by Jeff Garzik's avatar Jeff Garzik

Update pci-skeleton net driver:

Replace MII-related magic numbers with meaningful constants
listed in linux/mii.h.
parent 32d3d6e8
...@@ -834,7 +834,7 @@ static int __devinit netdrv_init_one (struct pci_dev *pdev, ...@@ -834,7 +834,7 @@ static int __devinit netdrv_init_one (struct pci_dev *pdev,
printk (KERN_INFO printk (KERN_INFO
"%s: Media type forced to Full Duplex.\n", "%s: Media type forced to Full Duplex.\n",
dev->name); dev->name);
mdio_write (dev, tp->phys[0], 4, 0x141); mdio_write (dev, tp->phys[0], MII_ADVERTISE, ADVERTISE_FULL);
tp->duplex_lock = 1; tp->duplex_lock = 1;
} }
...@@ -1235,20 +1235,20 @@ static void netdrv_timer (unsigned long data) ...@@ -1235,20 +1235,20 @@ static void netdrv_timer (unsigned long data)
struct netdrv_private *tp = dev->priv; struct netdrv_private *tp = dev->priv;
void *ioaddr = tp->mmio_addr; void *ioaddr = tp->mmio_addr;
int next_tick = 60 * HZ; int next_tick = 60 * HZ;
int mii_reg5; int mii_lpa;
mii_reg5 = mdio_read (dev, tp->phys[0], 5); mii_lpa = mdio_read (dev, tp->phys[0], MII_LPA);
if (!tp->duplex_lock && mii_reg5 != 0xffff) { if (!tp->duplex_lock && mii_lpa != 0xffff) {
int duplex = (mii_reg5 & 0x0100) int duplex = (mii_lpa & LPA_100FULL)
|| (mii_reg5 & 0x01C0) == 0x0040; || (mii_lpa & 0x01C0) == 0x0040;
if (tp->full_duplex != duplex) { if (tp->full_duplex != duplex) {
tp->full_duplex = duplex; tp->full_duplex = duplex;
printk (KERN_INFO printk (KERN_INFO
"%s: Setting %s-duplex based on MII #%d link" "%s: Setting %s-duplex based on MII #%d link"
" partner ability of %4.4x.\n", dev->name, " partner ability of %4.4x.\n", dev->name,
tp->full_duplex ? "full" : "half", tp->full_duplex ? "full" : "half",
tp->phys[0], mii_reg5); tp->phys[0], mii_lpa);
NETDRV_W8 (Cfg9346, Cfg9346_Unlock); NETDRV_W8 (Cfg9346, Cfg9346_Unlock);
NETDRV_W8 (Config1, tp->full_duplex ? 0x60 : 0x20); NETDRV_W8 (Config1, tp->full_duplex ? 0x60 : 0x20);
NETDRV_W8 (Cfg9346, Cfg9346_Lock); NETDRV_W8 (Cfg9346, Cfg9346_Lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment