summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2008-01-13 14:18:05 +0000
committerJeff Garzik <jeff@garzik.org>2008-01-18 14:44:33 -0500
commit96d768517eef3c10d4a82bd121caa42f584082cb (patch)
tree73db62f409ef98bfedfcc209835d0c4a80320b31 /drivers/net
parent21b645e4c2531631992dc127cf676631a70046c8 (diff)
dl2k: BMSR fixes
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/dl2k.c32
-rw-r--r--drivers/net/dl2k.h22
2 files changed, 16 insertions, 38 deletions
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index afeea88a520a..4468e0f5d16e 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -1435,7 +1435,7 @@ mii_write (struct net_device *dev, int phy_addr, int reg_num, u16 data)
static int
mii_wait_link (struct net_device *dev, int wait)
{
- BMSR_t bmsr;
+ __u16 bmsr;
int phy_addr;
struct netdev_private *np;
@@ -1443,8 +1443,8 @@ mii_wait_link (struct net_device *dev, int wait)
phy_addr = np->phy_addr;
do {
- bmsr.image = mii_read (dev, phy_addr, MII_BMSR);
- if (bmsr.bits.link_status)
+ bmsr = mii_read (dev, phy_addr, MII_BMSR);
+ if (bmsr & MII_BMSR_LINK_STATUS)
return 0;
mdelay (1);
} while (--wait > 0);
@@ -1454,7 +1454,7 @@ static int
mii_get_media (struct net_device *dev)
{
__u16 negotiate;
- BMSR_t bmsr;
+ __u16 bmsr;
MSCR_t mscr;
MSSR_t mssr;
int phy_addr;
@@ -1463,9 +1463,9 @@ mii_get_media (struct net_device *dev)
np = netdev_priv(dev);
phy_addr = np->phy_addr;
- bmsr.image = mii_read (dev, phy_addr, MII_BMSR);
+ bmsr = mii_read (dev, phy_addr, MII_BMSR);
if (np->an_enable) {
- if (!bmsr.bits.an_complete) {
+ if (!(bmsr & MII_BMSR_AN_COMPLETE)) {
/* Auto-Negotiation not completed */
return -1;
}
@@ -1541,7 +1541,7 @@ mii_set_media (struct net_device *dev)
{
PHY_SCR_t pscr;
__u16 bmcr;
- BMSR_t bmsr;
+ __u16 bmsr;
__u16 anar;
int phy_addr;
struct netdev_private *np;
@@ -1551,22 +1551,22 @@ mii_set_media (struct net_device *dev)
/* Does user set speed? */
if (np->an_enable) {
/* Advertise capabilities */
- bmsr.image = mii_read (dev, phy_addr, MII_BMSR);
+ bmsr = mii_read (dev, phy_addr, MII_BMSR);
anar = mii_read (dev, phy_addr, MII_ANAR) &
~MII_ANAR_100BX_FD &
~MII_ANAR_100BX_HD &
~MII_ANAR_100BT4 &
~MII_ANAR_10BT_FD &
~MII_ANAR_10BT_HD;
- if (bmsr.bits.media_100BX_FD)
+ if (bmsr & MII_BMSR_100BX_FD)
anar |= MII_ANAR_100BX_FD;
- if (bmsr.bits.media_100BX_HD)
+ if (bmsr & MII_BMSR_100BX_HD)
anar |= MII_ANAR_100BX_HD;
- if (bmsr.bits.media_100BT4)
+ if (bmsr & MII_BMSR_100BT4)
anar |= MII_ANAR_100BT4;
- if (bmsr.bits.media_10BT_FD)
+ if (bmsr & MII_BMSR_10BT_FD)
anar |= MII_ANAR_10BT_FD;
- if (bmsr.bits.media_10BT_HD)
+ if (bmsr & MII_BMSR_10BT_HD)
anar |= MII_ANAR_10BT_HD;
anar |= MII_ANAR_PAUSE | MII_ANAR_ASYMMETRIC;
mii_write (dev, phy_addr, MII_ANAR, anar);
@@ -1631,16 +1631,16 @@ static int
mii_get_media_pcs (struct net_device *dev)
{
__u16 negotiate;
- BMSR_t bmsr;
+ __u16 bmsr;
int phy_addr;
struct netdev_private *np;
np = netdev_priv(dev);
phy_addr = np->phy_addr;
- bmsr.image = mii_read (dev, phy_addr, PCS_BMSR);
+ bmsr = mii_read (dev, phy_addr, PCS_BMSR);
if (np->an_enable) {
- if (!bmsr.bits.an_complete) {
+ if (!(bmsr & MII_BMSR_AN_COMPLETE)) {
/* Auto-Negotiation not completed */
return -1;
}
diff --git a/drivers/net/dl2k.h b/drivers/net/dl2k.h
index e6623085e834..c8aacf2ff8da 100644
--- a/drivers/net/dl2k.h
+++ b/drivers/net/dl2k.h
@@ -316,28 +316,6 @@ enum _mii_bmcr {
};
/* Basic Mode Status Register */
-typedef union t_MII_BMSR {
- u16 image;
- struct {
- u16 ext_capability:1; // bit 0
- u16 japper_detect:1; // bit 1
- u16 link_status:1; // bit 2
- u16 an_ability:1; // bit 3
- u16 remote_fault:1; // bit 4
- u16 an_complete:1; // bit 5
- u16 preamble_supp:1; // bit 6
- u16 _bit_7:1; // bit 7
- u16 ext_status:1; // bit 8
- u16 media_100BT2_HD:1; // bit 9
- u16 media_100BT2_FD:1; // bit 10
- u16 media_10BT_HD:1; // bit 11
- u16 media_10BT_FD:1; // bit 12
- u16 media_100BX_HD:1; // bit 13
- u16 media_100BX_FD:1; // bit 14
- u16 media_100BT4:1; // bit 15
- } bits;
-} BMSR_t, *PBMSR_t;
-
enum _mii_bmsr {
MII_BMSR_100BT4 = 0x8000,
MII_BMSR_100BX_FD = 0x4000,