diff options
author | Francois Romieu <romieu@fr.zoreil.com> | 2011-08-21 10:17:22 -0400 |
---|---|---|
committer | Francois Romieu <romieu@fr.zoreil.com> | 2011-08-25 05:08:21 -0400 |
commit | cd2967803617cd0a0bb8611e7d41c33a451207a5 (patch) | |
tree | ff7c2b014c8ba1d8b022f78510e32911af4dc1a7 /drivers/net | |
parent | 78f6a6bd89e9a33e4be1bc61e6990a1172aa396e (diff) |
sunbmac: use standard #defines from mii.h.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/sun/sunbmac.c | 31 | ||||
-rw-r--r-- | drivers/net/ethernet/sun/sunbmac.h | 17 |
2 files changed, 16 insertions, 32 deletions
diff --git a/drivers/net/ethernet/sun/sunbmac.c b/drivers/net/ethernet/sun/sunbmac.c index c94f5ef348d4..0d8cfd9ea053 100644 --- a/drivers/net/ethernet/sun/sunbmac.c +++ b/drivers/net/ethernet/sun/sunbmac.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/crc32.h> | 17 | #include <linux/crc32.h> |
18 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
19 | #include <linux/ethtool.h> | 19 | #include <linux/ethtool.h> |
20 | #include <linux/mii.h> | ||
20 | #include <linux/netdevice.h> | 21 | #include <linux/netdevice.h> |
21 | #include <linux/etherdevice.h> | 22 | #include <linux/etherdevice.h> |
22 | #include <linux/skbuff.h> | 23 | #include <linux/skbuff.h> |
@@ -500,13 +501,13 @@ static int try_next_permutation(struct bigmac *bp, void __iomem *tregs) | |||
500 | 501 | ||
501 | /* Reset the PHY. */ | 502 | /* Reset the PHY. */ |
502 | bp->sw_bmcr = (BMCR_ISOLATE | BMCR_PDOWN | BMCR_LOOPBACK); | 503 | bp->sw_bmcr = (BMCR_ISOLATE | BMCR_PDOWN | BMCR_LOOPBACK); |
503 | bigmac_tcvr_write(bp, tregs, BIGMAC_BMCR, bp->sw_bmcr); | 504 | bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr); |
504 | bp->sw_bmcr = (BMCR_RESET); | 505 | bp->sw_bmcr = (BMCR_RESET); |
505 | bigmac_tcvr_write(bp, tregs, BIGMAC_BMCR, bp->sw_bmcr); | 506 | bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr); |
506 | 507 | ||
507 | timeout = 64; | 508 | timeout = 64; |
508 | while (--timeout) { | 509 | while (--timeout) { |
509 | bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, BIGMAC_BMCR); | 510 | bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR); |
510 | if ((bp->sw_bmcr & BMCR_RESET) == 0) | 511 | if ((bp->sw_bmcr & BMCR_RESET) == 0) |
511 | break; | 512 | break; |
512 | udelay(20); | 513 | udelay(20); |
@@ -514,11 +515,11 @@ static int try_next_permutation(struct bigmac *bp, void __iomem *tregs) | |||
514 | if (timeout == 0) | 515 | if (timeout == 0) |
515 | printk(KERN_ERR "%s: PHY reset failed.\n", bp->dev->name); | 516 | printk(KERN_ERR "%s: PHY reset failed.\n", bp->dev->name); |
516 | 517 | ||
517 | bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, BIGMAC_BMCR); | 518 | bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR); |
518 | 519 | ||
519 | /* Now we try 10baseT. */ | 520 | /* Now we try 10baseT. */ |
520 | bp->sw_bmcr &= ~(BMCR_SPEED100); | 521 | bp->sw_bmcr &= ~(BMCR_SPEED100); |
521 | bigmac_tcvr_write(bp, tregs, BIGMAC_BMCR, bp->sw_bmcr); | 522 | bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr); |
522 | return 0; | 523 | return 0; |
523 | } | 524 | } |
524 | 525 | ||
@@ -534,8 +535,8 @@ static void bigmac_timer(unsigned long data) | |||
534 | 535 | ||
535 | bp->timer_ticks++; | 536 | bp->timer_ticks++; |
536 | if (bp->timer_state == ltrywait) { | 537 | if (bp->timer_state == ltrywait) { |
537 | bp->sw_bmsr = bigmac_tcvr_read(bp, tregs, BIGMAC_BMSR); | 538 | bp->sw_bmsr = bigmac_tcvr_read(bp, tregs, MII_BMSR); |
538 | bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, BIGMAC_BMCR); | 539 | bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR); |
539 | if (bp->sw_bmsr & BMSR_LSTATUS) { | 540 | if (bp->sw_bmsr & BMSR_LSTATUS) { |
540 | printk(KERN_INFO "%s: Link is now up at %s.\n", | 541 | printk(KERN_INFO "%s: Link is now up at %s.\n", |
541 | bp->dev->name, | 542 | bp->dev->name, |
@@ -588,18 +589,18 @@ static void bigmac_begin_auto_negotiation(struct bigmac *bp) | |||
588 | int timeout; | 589 | int timeout; |
589 | 590 | ||
590 | /* Grab new software copies of PHY registers. */ | 591 | /* Grab new software copies of PHY registers. */ |
591 | bp->sw_bmsr = bigmac_tcvr_read(bp, tregs, BIGMAC_BMSR); | 592 | bp->sw_bmsr = bigmac_tcvr_read(bp, tregs, MII_BMSR); |
592 | bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, BIGMAC_BMCR); | 593 | bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR); |
593 | 594 | ||
594 | /* Reset the PHY. */ | 595 | /* Reset the PHY. */ |
595 | bp->sw_bmcr = (BMCR_ISOLATE | BMCR_PDOWN | BMCR_LOOPBACK); | 596 | bp->sw_bmcr = (BMCR_ISOLATE | BMCR_PDOWN | BMCR_LOOPBACK); |
596 | bigmac_tcvr_write(bp, tregs, BIGMAC_BMCR, bp->sw_bmcr); | 597 | bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr); |
597 | bp->sw_bmcr = (BMCR_RESET); | 598 | bp->sw_bmcr = (BMCR_RESET); |
598 | bigmac_tcvr_write(bp, tregs, BIGMAC_BMCR, bp->sw_bmcr); | 599 | bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr); |
599 | 600 | ||
600 | timeout = 64; | 601 | timeout = 64; |
601 | while (--timeout) { | 602 | while (--timeout) { |
602 | bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, BIGMAC_BMCR); | 603 | bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR); |
603 | if ((bp->sw_bmcr & BMCR_RESET) == 0) | 604 | if ((bp->sw_bmcr & BMCR_RESET) == 0) |
604 | break; | 605 | break; |
605 | udelay(20); | 606 | udelay(20); |
@@ -607,11 +608,11 @@ static void bigmac_begin_auto_negotiation(struct bigmac *bp) | |||
607 | if (timeout == 0) | 608 | if (timeout == 0) |
608 | printk(KERN_ERR "%s: PHY reset failed.\n", bp->dev->name); | 609 | printk(KERN_ERR "%s: PHY reset failed.\n", bp->dev->name); |
609 | 610 | ||
610 | bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, BIGMAC_BMCR); | 611 | bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR); |
611 | 612 | ||
612 | /* First we try 100baseT. */ | 613 | /* First we try 100baseT. */ |
613 | bp->sw_bmcr |= BMCR_SPEED100; | 614 | bp->sw_bmcr |= BMCR_SPEED100; |
614 | bigmac_tcvr_write(bp, tregs, BIGMAC_BMCR, bp->sw_bmcr); | 615 | bigmac_tcvr_write(bp, tregs, MII_BMCR, bp->sw_bmcr); |
615 | 616 | ||
616 | bp->timer_state = ltrywait; | 617 | bp->timer_state = ltrywait; |
617 | bp->timer_ticks = 0; | 618 | bp->timer_ticks = 0; |
@@ -1054,7 +1055,7 @@ static u32 bigmac_get_link(struct net_device *dev) | |||
1054 | struct bigmac *bp = netdev_priv(dev); | 1055 | struct bigmac *bp = netdev_priv(dev); |
1055 | 1056 | ||
1056 | spin_lock_irq(&bp->lock); | 1057 | spin_lock_irq(&bp->lock); |
1057 | bp->sw_bmsr = bigmac_tcvr_read(bp, bp->tregs, BIGMAC_BMSR); | 1058 | bp->sw_bmsr = bigmac_tcvr_read(bp, bp->tregs, MII_BMSR); |
1058 | spin_unlock_irq(&bp->lock); | 1059 | spin_unlock_irq(&bp->lock); |
1059 | 1060 | ||
1060 | return (bp->sw_bmsr & BMSR_LSTATUS); | 1061 | return (bp->sw_bmsr & BMSR_LSTATUS); |
diff --git a/drivers/net/ethernet/sun/sunbmac.h b/drivers/net/ethernet/sun/sunbmac.h index 4943e975a731..06dd21707353 100644 --- a/drivers/net/ethernet/sun/sunbmac.h +++ b/drivers/net/ethernet/sun/sunbmac.h | |||
@@ -223,23 +223,6 @@ | |||
223 | #define BIGMAC_PHY_EXTERNAL 0 /* External transceiver */ | 223 | #define BIGMAC_PHY_EXTERNAL 0 /* External transceiver */ |
224 | #define BIGMAC_PHY_INTERNAL 1 /* Internal transceiver */ | 224 | #define BIGMAC_PHY_INTERNAL 1 /* Internal transceiver */ |
225 | 225 | ||
226 | /* PHY registers */ | ||
227 | #define BIGMAC_BMCR 0x00 /* Basic mode control register */ | ||
228 | #define BIGMAC_BMSR 0x01 /* Basic mode status register */ | ||
229 | |||
230 | /* BMCR bits */ | ||
231 | #define BMCR_ISOLATE 0x0400 /* Disconnect DP83840 from MII */ | ||
232 | #define BMCR_PDOWN 0x0800 /* Powerdown the DP83840 */ | ||
233 | #define BMCR_ANENABLE 0x1000 /* Enable auto negotiation */ | ||
234 | #define BMCR_SPEED100 0x2000 /* Select 100Mbps */ | ||
235 | #define BMCR_LOOPBACK 0x4000 /* TXD loopback bits */ | ||
236 | #define BMCR_RESET 0x8000 /* Reset the DP83840 */ | ||
237 | |||
238 | /* BMSR bits */ | ||
239 | #define BMSR_ERCAP 0x0001 /* Ext-reg capability */ | ||
240 | #define BMSR_JCD 0x0002 /* Jabber detected */ | ||
241 | #define BMSR_LSTATUS 0x0004 /* Link status */ | ||
242 | |||
243 | /* Ring descriptors and such, same as Quad Ethernet. */ | 226 | /* Ring descriptors and such, same as Quad Ethernet. */ |
244 | struct be_rxd { | 227 | struct be_rxd { |
245 | u32 rx_flags; | 228 | u32 rx_flags; |