Skip to content

Commit cd29678

Browse files
author
Francois Romieu
committed
sunbmac: use standard #defines from mii.h.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
1 parent 78f6a6b commit cd29678

File tree

2 files changed

+16
-32
lines changed

2 files changed

+16
-32
lines changed

drivers/net/ethernet/sun/sunbmac.c

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/crc32.h>
1818
#include <linux/errno.h>
1919
#include <linux/ethtool.h>
20+
#include <linux/mii.h>
2021
#include <linux/netdevice.h>
2122
#include <linux/etherdevice.h>
2223
#include <linux/skbuff.h>
@@ -500,25 +501,25 @@ static int try_next_permutation(struct bigmac *bp, void __iomem *tregs)
500501

501502
/* Reset the PHY. */
502503
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);
504505
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);
506507

507508
timeout = 64;
508509
while (--timeout) {
509-
bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, BIGMAC_BMCR);
510+
bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR);
510511
if ((bp->sw_bmcr & BMCR_RESET) == 0)
511512
break;
512513
udelay(20);
513514
}
514515
if (timeout == 0)
515516
printk(KERN_ERR "%s: PHY reset failed.\n", bp->dev->name);
516517

517-
bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, BIGMAC_BMCR);
518+
bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR);
518519

519520
/* Now we try 10baseT. */
520521
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);
522523
return 0;
523524
}
524525

@@ -534,8 +535,8 @@ static void bigmac_timer(unsigned long data)
534535

535536
bp->timer_ticks++;
536537
if (bp->timer_state == ltrywait) {
537-
bp->sw_bmsr = bigmac_tcvr_read(bp, tregs, BIGMAC_BMSR);
538-
bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, BIGMAC_BMCR);
538+
bp->sw_bmsr = bigmac_tcvr_read(bp, tregs, MII_BMSR);
539+
bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR);
539540
if (bp->sw_bmsr & BMSR_LSTATUS) {
540541
printk(KERN_INFO "%s: Link is now up at %s.\n",
541542
bp->dev->name,
@@ -588,30 +589,30 @@ static void bigmac_begin_auto_negotiation(struct bigmac *bp)
588589
int timeout;
589590

590591
/* Grab new software copies of PHY registers. */
591-
bp->sw_bmsr = bigmac_tcvr_read(bp, tregs, BIGMAC_BMSR);
592-
bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, BIGMAC_BMCR);
592+
bp->sw_bmsr = bigmac_tcvr_read(bp, tregs, MII_BMSR);
593+
bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR);
593594

594595
/* Reset the PHY. */
595596
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);
597598
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);
599600

600601
timeout = 64;
601602
while (--timeout) {
602-
bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, BIGMAC_BMCR);
603+
bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR);
603604
if ((bp->sw_bmcr & BMCR_RESET) == 0)
604605
break;
605606
udelay(20);
606607
}
607608
if (timeout == 0)
608609
printk(KERN_ERR "%s: PHY reset failed.\n", bp->dev->name);
609610

610-
bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, BIGMAC_BMCR);
611+
bp->sw_bmcr = bigmac_tcvr_read(bp, tregs, MII_BMCR);
611612

612613
/* First we try 100baseT. */
613614
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);
615616

616617
bp->timer_state = ltrywait;
617618
bp->timer_ticks = 0;
@@ -1054,7 +1055,7 @@ static u32 bigmac_get_link(struct net_device *dev)
10541055
struct bigmac *bp = netdev_priv(dev);
10551056

10561057
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);
10581059
spin_unlock_irq(&bp->lock);
10591060

10601061
return (bp->sw_bmsr & BMSR_LSTATUS);

drivers/net/ethernet/sun/sunbmac.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -223,23 +223,6 @@
223223
#define BIGMAC_PHY_EXTERNAL 0 /* External transceiver */
224224
#define BIGMAC_PHY_INTERNAL 1 /* Internal transceiver */
225225

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-
243226
/* Ring descriptors and such, same as Quad Ethernet. */
244227
struct be_rxd {
245228
u32 rx_flags;

0 commit comments

Comments
 (0)