Skip to content

Commit

Permalink
mv643xx_eth: use symbolic MII register addresses and values
Browse files Browse the repository at this point in the history
Instead of hardcoding MII register addresses and values, use the
symbolic constants defined in linux/mii.h.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
  • Loading branch information
Lennert Buytenhek authored and Lennert Buytenhek committed Jul 24, 2008
1 parent cd4ccf7 commit 7f106c1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions drivers/net/mv643xx_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1831,14 +1831,14 @@ static void phy_reset(struct mv643xx_eth_private *mp)
{
unsigned int data;

smi_reg_read(mp, mp->phy_addr, 0, &data);
data |= 0x8000;
smi_reg_write(mp, mp->phy_addr, 0, data);
smi_reg_read(mp, mp->phy_addr, MII_BMCR, &data);
data |= BMCR_RESET;
smi_reg_write(mp, mp->phy_addr, MII_BMCR, data);

do {
udelay(1);
smi_reg_read(mp, mp->phy_addr, 0, &data);
} while (data & 0x8000);
smi_reg_read(mp, mp->phy_addr, MII_BMCR, &data);
} while (data & BMCR_RESET);
}

static void port_start(struct mv643xx_eth_private *mp)
Expand Down Expand Up @@ -2385,14 +2385,14 @@ static int phy_detect(struct mv643xx_eth_private *mp)
unsigned int data;
unsigned int data2;

smi_reg_read(mp, mp->phy_addr, 0, &data);
smi_reg_write(mp, mp->phy_addr, 0, data ^ 0x1000);
smi_reg_read(mp, mp->phy_addr, MII_BMCR, &data);
smi_reg_write(mp, mp->phy_addr, MII_BMCR, data ^ BMCR_ANENABLE);

smi_reg_read(mp, mp->phy_addr, 0, &data2);
if (((data ^ data2) & 0x1000) == 0)
smi_reg_read(mp, mp->phy_addr, MII_BMCR, &data2);
if (((data ^ data2) & BMCR_ANENABLE) == 0)
return -ENODEV;

smi_reg_write(mp, mp->phy_addr, 0, data);
smi_reg_write(mp, mp->phy_addr, MII_BMCR, data);

return 0;
}
Expand Down

0 comments on commit 7f106c1

Please sign in to comment.