patch-2.4.18 linux/drivers/net/sundance.c
Next file: linux/drivers/net/sungem.c
Previous file: linux/drivers/net/starfire.c
Back to the patch index
Back to the overall index
- Lines: 138
- Date:
Wed Feb 6 20:43:12 2002
- Orig file:
linux.orig/drivers/net/sundance.c
- Orig date:
Mon Feb 18 20:18:39 2002
diff -Naur -X /home/marcelo/lib/dontdiff linux.orig/drivers/net/sundance.c linux/drivers/net/sundance.c
@@ -16,11 +16,20 @@
Support and updates available at
http://www.scyld.com/network/sundance.html
+
+
+ Version 1.01a (jgarzik):
+ - Replace some MII-related magic numbers with constants
+
+ Version 1.01b (D-Link):
+ - Add new board to PCI ID list
+
+
*/
#define DRV_NAME "sundance"
-#define DRV_VERSION "1.01"
-#define DRV_RELDATE "4/09/00"
+#define DRV_VERSION "1.01b"
+#define DRV_RELDATE "17-Jan-2002"
/* The user-configurable values.
@@ -217,8 +226,9 @@
{0x1186, 0x1002, 0x1186, 0x1002, 0, 0, 0},
{0x1186, 0x1002, 0x1186, 0x1003, 0, 0, 1},
{0x1186, 0x1002, 0x1186, 0x1012, 0, 0, 2},
- {0x1186, 0x1002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3},
- {0x13F0, 0x0201, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
+ {0x1186, 0x1002, 0x1186, 0x1040, 0, 0, 3},
+ {0x1186, 0x1002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
+ {0x13F0, 0x0201, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 5},
{0,}
};
MODULE_DEVICE_TABLE(pci, sundance_pci_tbl);
@@ -241,6 +251,8 @@
PCI_IOTYPE, 128, CanHaveMII},
{"D-Link DFE-580TX 4 port Server Adapter", {0x10121186, 0xffffffff,},
PCI_IOTYPE, 128, CanHaveMII},
+ {"D-Link DFE-530TXS FAST Ethernet Adapter", {0x10021186, 0xffffffff,},
+ PCI_IOTYPE, 128, CanHaveMII},
{"D-Link DL10050-based FAST Ethernet Adapter",
{0x10021186, 0xffffffff,},
PCI_IOTYPE, 128, CanHaveMII},
@@ -442,7 +454,7 @@
int irq;
int i;
long ioaddr;
- u16 mii_reg0;
+ u16 mii_ctl;
void *ring_space;
dma_addr_t ring_dma;
@@ -581,15 +593,15 @@
}
}
/* Reset PHY */
- mdio_write (dev, np->phys[0], 0, 0x8000);
+ mdio_write (dev, np->phys[0], MII_BMCR, BMCR_RESET);
mdelay (300);
- mdio_write (dev, np->phys[0], 0, 0x1200);
+ mdio_write (dev, np->phys[0], MII_BMCR, BMCR_ANENABLE|BMCR_ANRESTART);
/* Force media type */
if (!np->an_enable) {
- mii_reg0 = 0;
- mii_reg0 |= (np->speed == 100) ? 0x2000 : 0;
- mii_reg0 |= (np->full_duplex) ? 0x0100 : 0;
- mdio_write (dev, np->phys[0], 0, mii_reg0);
+ mii_ctl = 0;
+ mii_ctl |= (np->speed == 100) ? BMCR_SPEED100 : 0;
+ mii_ctl |= (np->full_duplex) ? BMCR_FULLDPLX : 0;
+ mdio_write (dev, np->phys[0], MII_BMCR, mii_ctl);
printk (KERN_INFO "Override speed=%d, %s duplex\n",
np->speed, np->full_duplex ? "Full" : "Half");
@@ -797,12 +809,12 @@
{
struct netdev_private *np = dev->priv;
long ioaddr = dev->base_addr;
- int mii_reg5 = mdio_read(dev, np->phys[0], 5);
- int negotiated = mii_reg5 & np->advertising;
+ int mii_lpa = mdio_read(dev, np->phys[0], MII_LPA);
+ int negotiated = mii_lpa & np->advertising;
int duplex;
/* Force media */
- if (!np->an_enable || mii_reg5 == 0xffff) {
+ if (!np->an_enable || mii_lpa == 0xffff) {
if (np->full_duplex)
writew (readw (ioaddr + MACCtrl0) | EnbFullDuplex,
ioaddr + MACCtrl0);
@@ -1183,7 +1195,7 @@
{
long ioaddr = dev->base_addr;
struct netdev_private *np = dev->priv;
- u16 mii_reg0, mii_reg4, mii_reg5;
+ u16 mii_ctl, mii_advertise, mii_lpa;
int speed;
if (intr_status & IntrDrvRqst) {
@@ -1199,27 +1211,27 @@
}
if (intr_status & LinkChange) {
if (np->an_enable) {
- mii_reg4 = mdio_read (dev, np->phys[0], 4);
- mii_reg5= mdio_read (dev, np->phys[0], 5);
- mii_reg4 &= mii_reg5;
+ mii_advertise = mdio_read (dev, np->phys[0], MII_ADVERTISE);
+ mii_lpa= mdio_read (dev, np->phys[0], MII_LPA);
+ mii_advertise &= mii_lpa;
printk (KERN_INFO "%s: Link changed: ", dev->name);
- if (mii_reg4 & 0x0100)
+ if (mii_advertise & ADVERTISE_100FULL)
printk ("100Mbps, full duplex\n");
- else if (mii_reg4 & 0x0080)
+ else if (mii_advertise & ADVERTISE_100HALF)
printk ("100Mbps, half duplex\n");
- else if (mii_reg4 & 0x0040)
+ else if (mii_advertise & ADVERTISE_10FULL)
printk ("10Mbps, full duplex\n");
- else if (mii_reg4 & 0x0020)
+ else if (mii_advertise & ADVERTISE_10HALF)
printk ("10Mbps, half duplex\n");
else
printk ("\n");
} else {
- mii_reg0 = mdio_read (dev, np->phys[0], 0);
- speed = (mii_reg0 & 0x2000) ? 100 : 10;
+ mii_ctl = mdio_read (dev, np->phys[0], MII_BMCR);
+ speed = (mii_ctl & BMCR_SPEED100) ? 100 : 10;
printk (KERN_INFO "%s: Link changed: %dMbps ,",
dev->name, speed);
- printk ("%s duplex.\n", (mii_reg0 & 0x0100) ?
+ printk ("%s duplex.\n", (mii_ctl & BMCR_FULLDPLX) ?
"full" : "half");
}
check_duplex (dev);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)