Commit 439f01a0 authored by Jeff Garzik's avatar Jeff Garzik

[net drivers] Rename MII lib API member, s/duplex_lock/force_media/,

and update all drivers that reference this struct member.
parent 058fd7fa
...@@ -1049,7 +1049,7 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev, ...@@ -1049,7 +1049,7 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
printk(KERN_INFO "%s: Media type forced to Full Duplex.\n", dev->name); printk(KERN_INFO "%s: Media type forced to Full Duplex.\n", dev->name);
/* Changing the MII-advertised media because might prevent /* Changing the MII-advertised media because might prevent
re-connection. */ re-connection. */
tp->mii.duplex_lock = 1; tp->mii.force_media = 1;
} }
if (tp->default_port) { if (tp->default_port) {
printk(KERN_INFO " Forcing %dMbps %s-duplex operation.\n", printk(KERN_INFO " Forcing %dMbps %s-duplex operation.\n",
...@@ -1306,7 +1306,7 @@ static int rtl8139_open (struct net_device *dev) ...@@ -1306,7 +1306,7 @@ static int rtl8139_open (struct net_device *dev)
} }
tp->mii.full_duplex = tp->mii.duplex_lock; tp->mii.full_duplex = tp->mii.force_media;
tp->tx_flag = (TX_FIFO_THRESH << 11) & 0x003f0000; tp->tx_flag = (TX_FIFO_THRESH << 11) & 0x003f0000;
tp->twistie = (tp->chipset == CH_8139_K) ? 1 : 0; tp->twistie = (tp->chipset == CH_8139_K) ? 1 : 0;
tp->time_to_die = 0; tp->time_to_die = 0;
...@@ -1537,7 +1537,7 @@ static inline void rtl8139_thread_iter (struct net_device *dev, ...@@ -1537,7 +1537,7 @@ static inline void rtl8139_thread_iter (struct net_device *dev,
mii_lpa = mdio_read (dev, tp->phys[0], MII_LPA); mii_lpa = mdio_read (dev, tp->phys[0], MII_LPA);
if (!tp->mii.duplex_lock && mii_lpa != 0xffff) { if (!tp->mii.force_media && mii_lpa != 0xffff) {
int duplex = (mii_lpa & LPA_100FULL) int duplex = (mii_lpa & LPA_100FULL)
|| (mii_lpa & 0x01C0) == 0x0040; || (mii_lpa & 0x01C0) == 0x0040;
if (tp->mii.full_duplex != duplex) { if (tp->mii.full_duplex != duplex) {
...@@ -1995,7 +1995,7 @@ static void rtl8139_weird_interrupt (struct net_device *dev, ...@@ -1995,7 +1995,7 @@ static void rtl8139_weird_interrupt (struct net_device *dev,
/* Really link-change on new chips. */ /* Really link-change on new chips. */
int lpar = RTL_R16 (NWayLPAR); int lpar = RTL_R16 (NWayLPAR);
int duplex = (lpar & LPA_100FULL) || (lpar & 0x01C0) == 0x0040 int duplex = (lpar & LPA_100FULL) || (lpar & 0x01C0) == 0x0040
|| tp->mii.duplex_lock; || tp->mii.force_media;
if (tp->mii.full_duplex != duplex) { if (tp->mii.full_duplex != duplex) {
tp->mii.full_duplex = duplex; tp->mii.full_duplex = duplex;
#if 0 #if 0
......
...@@ -523,7 +523,7 @@ static int __devinit epic_init_one (struct pci_dev *pdev, ...@@ -523,7 +523,7 @@ static int __devinit epic_init_one (struct pci_dev *pdev,
/* The lower four bits are the media type. */ /* The lower four bits are the media type. */
if (duplex) { if (duplex) {
ep->mii.duplex_lock = ep->mii.full_duplex = 1; ep->mii.force_media = ep->mii.full_duplex = 1;
printk(KERN_INFO DRV_NAME "(%s): Forced full duplex operation requested.\n", printk(KERN_INFO DRV_NAME "(%s): Forced full duplex operation requested.\n",
pdev->slot_name); pdev->slot_name);
} }
...@@ -854,7 +854,7 @@ static void check_media(struct net_device *dev) ...@@ -854,7 +854,7 @@ static void check_media(struct net_device *dev)
int negotiated = mii_lpa & ep->mii.advertising; int negotiated = mii_lpa & ep->mii.advertising;
int duplex = (negotiated & 0x0100) || (negotiated & 0x01C0) == 0x0040; int duplex = (negotiated & 0x0100) || (negotiated & 0x01C0) == 0x0040;
if (ep->mii.duplex_lock) if (ep->mii.force_media)
return; return;
if (mii_lpa == 0xffff) /* Bogus read */ if (mii_lpa == 0xffff) /* Bogus read */
return; return;
...@@ -1464,8 +1464,8 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -1464,8 +1464,8 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
switch (data->reg_num) { switch (data->reg_num) {
case 0: case 0:
/* Check for autonegotiation on or reset. */ /* Check for autonegotiation on or reset. */
ep->mii.duplex_lock = (value & 0x9000) ? 0 : 1; ep->mii.force_media = (value & 0x9000) ? 0 : 1;
if (ep->mii.duplex_lock) if (ep->mii.force_media)
ep->mii.full_duplex = (value & 0x0100) ? 1 : 0; ep->mii.full_duplex = (value & 0x0100) ? 1 : 0;
break; break;
case 4: ep->mii.advertising = value; break; case 4: ep->mii.advertising = value; break;
......
...@@ -654,7 +654,7 @@ static int __devinit fealnx_init_one(struct pci_dev *pdev, ...@@ -654,7 +654,7 @@ static int __devinit fealnx_init_one(struct pci_dev *pdev,
mdio_write(dev, np->phys[0], MII_ADVERTISE, ADVERTISE_FULL); mdio_write(dev, np->phys[0], MII_ADVERTISE, ADVERTISE_FULL);
else else
writel(ADVERTISE_FULL, dev->base_addr + ANARANLPAR); writel(ADVERTISE_FULL, dev->base_addr + ANARANLPAR);
np->mii.duplex_lock = 1; np->mii.force_media = 1;
} }
/* The chip-specific entries in the device structure. */ /* The chip-specific entries in the device structure. */
...@@ -956,7 +956,7 @@ static int netdev_open(struct net_device *dev) ...@@ -956,7 +956,7 @@ static int netdev_open(struct net_device *dev)
// 89/9/1 modify, // 89/9/1 modify,
// np->crvalue = 0x00e40001; /* tx store and forward, tx/rx enable */ // np->crvalue = 0x00e40001; /* tx store and forward, tx/rx enable */
np->crvalue |= 0x00e40001; /* tx store and forward, tx/rx enable */ np->crvalue |= 0x00e40001; /* tx store and forward, tx/rx enable */
np->mii.full_duplex = np->mii.duplex_lock; np->mii.full_duplex = np->mii.force_media;
getlinkstatus(dev); getlinkstatus(dev);
if (np->linkok) if (np->linkok)
getlinktype(dev); getlinktype(dev);
......
...@@ -122,7 +122,7 @@ int mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd) ...@@ -122,7 +122,7 @@ int mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd)
bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART); bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART);
mii->mdio_write(dev, mii->phy_id, MII_BMCR, bmcr); mii->mdio_write(dev, mii->phy_id, MII_BMCR, bmcr);
mii->duplex_lock = 0; mii->force_media = 0;
} else { } else {
u32 bmcr, tmp; u32 bmcr, tmp;
...@@ -139,7 +139,7 @@ int mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd) ...@@ -139,7 +139,7 @@ int mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd)
if (bmcr != tmp) if (bmcr != tmp)
mii->mdio_write(dev, mii->phy_id, MII_BMCR, tmp); mii->mdio_write(dev, mii->phy_id, MII_BMCR, tmp);
mii->duplex_lock = 1; mii->force_media = 1;
} }
return 0; return 0;
} }
...@@ -186,7 +186,7 @@ unsigned int mii_check_media (struct mii_if_info *mii, ...@@ -186,7 +186,7 @@ unsigned int mii_check_media (struct mii_if_info *mii,
int advertise, lpa, media, duplex; int advertise, lpa, media, duplex;
/* if forced media, go no further */ /* if forced media, go no further */
if (mii->duplex_lock) if (mii->force_media)
return 0; /* duplex did not change */ return 0; /* duplex did not change */
/* check current and old link status */ /* check current and old link status */
......
...@@ -473,7 +473,7 @@ static int __devinit w840_probe1 (struct pci_dev *pdev, ...@@ -473,7 +473,7 @@ static int __devinit w840_probe1 (struct pci_dev *pdev,
np->mii_if.full_duplex = 1; np->mii_if.full_duplex = 1;
if (np->mii_if.full_duplex) if (np->mii_if.full_duplex)
np->mii_if.duplex_lock = 1; np->mii_if.force_media = 1;
/* The chip-specific entries in the device structure. */ /* The chip-specific entries in the device structure. */
dev->open = &netdev_open; dev->open = &netdev_open;
...@@ -773,7 +773,7 @@ static int update_link(struct net_device *dev) ...@@ -773,7 +773,7 @@ static int update_link(struct net_device *dev)
duplex = (negotiated & LPA_100FULL) || ((negotiated & 0x02C0) == LPA_10FULL); duplex = (negotiated & LPA_100FULL) || ((negotiated & 0x02C0) == LPA_10FULL);
fasteth = negotiated & 0x380; fasteth = negotiated & 0x380;
} }
duplex |= np->mii_if.duplex_lock; duplex |= np->mii_if.force_media;
/* remove fastether and fullduplex */ /* remove fastether and fullduplex */
result = np->csr6 & ~0x20000200; result = np->csr6 & ~0x20000200;
if (duplex) if (duplex)
......
...@@ -731,7 +731,7 @@ static int __devinit via_rhine_init_one (struct pci_dev *pdev, ...@@ -731,7 +731,7 @@ static int __devinit via_rhine_init_one (struct pci_dev *pdev,
if (np->mii_if.full_duplex) { if (np->mii_if.full_duplex) {
printk(KERN_INFO "%s: Set to forced full duplex, autonegotiation" printk(KERN_INFO "%s: Set to forced full duplex, autonegotiation"
" disabled.\n", dev->name); " disabled.\n", dev->name);
np->mii_if.duplex_lock = 1; np->mii_if.force_media = 1;
} }
/* The chip-specific entries in the device structure. */ /* The chip-specific entries in the device structure. */
...@@ -1001,7 +1001,7 @@ static void init_registers(struct net_device *dev) ...@@ -1001,7 +1001,7 @@ static void init_registers(struct net_device *dev)
ioaddr + IntrEnable); ioaddr + IntrEnable);
np->chip_cmd = CmdStart|CmdTxOn|CmdRxOn|CmdNoTxPoll; np->chip_cmd = CmdStart|CmdTxOn|CmdRxOn|CmdNoTxPoll;
if (np->mii_if.duplex_lock) if (np->mii_if.force_media)
np->chip_cmd |= CmdFDuplex; np->chip_cmd |= CmdFDuplex;
writew(np->chip_cmd, ioaddr + ChipCmd); writew(np->chip_cmd, ioaddr + ChipCmd);
...@@ -1043,7 +1043,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int regnum, int value ...@@ -1043,7 +1043,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int regnum, int value
switch (regnum) { switch (regnum) {
case MII_BMCR: /* Is user forcing speed/duplex? */ case MII_BMCR: /* Is user forcing speed/duplex? */
if (value & 0x9000) /* Autonegotiation. */ if (value & 0x9000) /* Autonegotiation. */
np->mii_if.duplex_lock = 0; np->mii_if.force_media = 0;
else else
np->mii_if.full_duplex = (value & 0x0100) ? 1 : 0; np->mii_if.full_duplex = (value & 0x0100) ? 1 : 0;
break; break;
...@@ -1114,7 +1114,7 @@ static void via_rhine_check_duplex(struct net_device *dev) ...@@ -1114,7 +1114,7 @@ static void via_rhine_check_duplex(struct net_device *dev)
int negotiated = mii_lpa & np->mii_if.advertising; int negotiated = mii_lpa & np->mii_if.advertising;
int duplex; int duplex;
if (np->mii_if.duplex_lock || mii_lpa == 0xffff) if (np->mii_if.force_media || mii_lpa == 0xffff)
return; return;
duplex = (negotiated & 0x0100) || (negotiated & 0x01C0) == 0x0040; duplex = (negotiated & 0x0100) || (negotiated & 0x01C0) == 0x0040;
if (np->mii_if.full_duplex != duplex) { if (np->mii_if.full_duplex != duplex) {
......
...@@ -108,8 +108,8 @@ struct mii_if_info { ...@@ -108,8 +108,8 @@ struct mii_if_info {
int phy_id; int phy_id;
int advertising; int advertising;
unsigned int full_duplex : 1; unsigned int full_duplex : 1; /* is full duplex? */
unsigned int duplex_lock : 1; unsigned int force_media : 1; /* is autoneg. disabled? */
struct net_device *dev; struct net_device *dev;
int (*mdio_read) (struct net_device *dev, int phy_id, int location); int (*mdio_read) (struct net_device *dev, int phy_id, int location);
......
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