提交 106427e6 编写于 作者: N Neil Horman 提交者: Linus Torvalds

[PATCH] 3c59x: cleanup of mdio_read routines to use MII_* macros

Clean up mdio_read routines in 3c59x.c to use the MII_* macros defined in
include/linux/mii.h
Signed-off-by: NNeil Horman <nhorman@tuxdriver.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 62afe595
...@@ -1457,7 +1457,7 @@ static int __devinit vortex_probe1(struct device *gendev, ...@@ -1457,7 +1457,7 @@ static int __devinit vortex_probe1(struct device *gendev,
if (vp->drv_flags & EXTRA_PREAMBLE) if (vp->drv_flags & EXTRA_PREAMBLE)
mii_preamble_required++; mii_preamble_required++;
mdio_sync(ioaddr, 32); mdio_sync(ioaddr, 32);
mdio_read(dev, 24, 1); mdio_read(dev, 24, MII_BMSR);
for (phy = 0; phy < 32 && phy_idx < 1; phy++) { for (phy = 0; phy < 32 && phy_idx < 1; phy++) {
int mii_status, phyx; int mii_status, phyx;
...@@ -1471,7 +1471,7 @@ static int __devinit vortex_probe1(struct device *gendev, ...@@ -1471,7 +1471,7 @@ static int __devinit vortex_probe1(struct device *gendev,
phyx = phy - 1; phyx = phy - 1;
else else
phyx = phy; phyx = phy;
mii_status = mdio_read(dev, phyx, 1); mii_status = mdio_read(dev, phyx, MII_BMSR);
if (mii_status && mii_status != 0xffff) { if (mii_status && mii_status != 0xffff) {
vp->phys[phy_idx++] = phyx; vp->phys[phy_idx++] = phyx;
if (print_info) { if (print_info) {
...@@ -1487,7 +1487,7 @@ static int __devinit vortex_probe1(struct device *gendev, ...@@ -1487,7 +1487,7 @@ static int __devinit vortex_probe1(struct device *gendev,
printk(KERN_WARNING" ***WARNING*** No MII transceivers found!\n"); printk(KERN_WARNING" ***WARNING*** No MII transceivers found!\n");
vp->phys[0] = 24; vp->phys[0] = 24;
} else { } else {
vp->advertising = mdio_read(dev, vp->phys[0], 4); vp->advertising = mdio_read(dev, vp->phys[0], MII_ADVERTISE);
if (vp->full_duplex) { if (vp->full_duplex) {
/* Only advertise the FD media types. */ /* Only advertise the FD media types. */
vp->advertising &= ~0x02A0; vp->advertising &= ~0x02A0;
...@@ -1661,8 +1661,8 @@ vortex_up(struct net_device *dev) ...@@ -1661,8 +1661,8 @@ vortex_up(struct net_device *dev)
int mii_reg1, mii_reg5; int mii_reg1, mii_reg5;
EL3WINDOW(4); EL3WINDOW(4);
/* Read BMSR (reg1) only to clear old status. */ /* Read BMSR (reg1) only to clear old status. */
mii_reg1 = mdio_read(dev, vp->phys[0], 1); mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR);
mii_reg5 = mdio_read(dev, vp->phys[0], 5); mii_reg5 = mdio_read(dev, vp->phys[0], MII_LPA);
if (mii_reg5 == 0xffff || mii_reg5 == 0x0000) { if (mii_reg5 == 0xffff || mii_reg5 == 0x0000) {
netif_carrier_off(dev); /* No MII device or no link partner report */ netif_carrier_off(dev); /* No MII device or no link partner report */
} else { } else {
...@@ -1892,14 +1892,14 @@ vortex_timer(unsigned long data) ...@@ -1892,14 +1892,14 @@ vortex_timer(unsigned long data)
case XCVR_MII: case XCVR_NWAY: case XCVR_MII: case XCVR_NWAY:
{ {
spin_lock_bh(&vp->lock); spin_lock_bh(&vp->lock);
mii_status = mdio_read(dev, vp->phys[0], 1); mii_status = mdio_read(dev, vp->phys[0], MII_BMSR);
mii_status = mdio_read(dev, vp->phys[0], 1); mii_status = mdio_read(dev, vp->phys[0], MII_BMSR);
ok = 1; ok = 1;
if (vortex_debug > 2) if (vortex_debug > 2)
printk(KERN_DEBUG "%s: MII transceiver has status %4.4x.\n", printk(KERN_DEBUG "%s: MII transceiver has status %4.4x.\n",
dev->name, mii_status); dev->name, mii_status);
if (mii_status & BMSR_LSTATUS) { if (mii_status & BMSR_LSTATUS) {
int mii_reg5 = mdio_read(dev, vp->phys[0], 5); int mii_reg5 = mdio_read(dev, vp->phys[0], MII_LPA);
if (! vp->force_fd && mii_reg5 != 0xffff) { if (! vp->force_fd && mii_reg5 != 0xffff) {
int duplex; int duplex;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册