forked from Minki/linux
mv643xx_eth: use symbolic MII register addresses and values
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>
This commit is contained in:
parent
cd4ccf76bf
commit
7f106c1d05
@ -1831,14 +1831,14 @@ static void phy_reset(struct mv643xx_eth_private *mp)
|
|||||||
{
|
{
|
||||||
unsigned int data;
|
unsigned int data;
|
||||||
|
|
||||||
smi_reg_read(mp, mp->phy_addr, 0, &data);
|
smi_reg_read(mp, mp->phy_addr, MII_BMCR, &data);
|
||||||
data |= 0x8000;
|
data |= BMCR_RESET;
|
||||||
smi_reg_write(mp, mp->phy_addr, 0, data);
|
smi_reg_write(mp, mp->phy_addr, MII_BMCR, data);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
udelay(1);
|
udelay(1);
|
||||||
smi_reg_read(mp, mp->phy_addr, 0, &data);
|
smi_reg_read(mp, mp->phy_addr, MII_BMCR, &data);
|
||||||
} while (data & 0x8000);
|
} while (data & BMCR_RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void port_start(struct mv643xx_eth_private *mp)
|
static void port_start(struct mv643xx_eth_private *mp)
|
||||||
@ -2385,14 +2385,14 @@ static int phy_detect(struct mv643xx_eth_private *mp)
|
|||||||
unsigned int data;
|
unsigned int data;
|
||||||
unsigned int data2;
|
unsigned int data2;
|
||||||
|
|
||||||
smi_reg_read(mp, mp->phy_addr, 0, &data);
|
smi_reg_read(mp, mp->phy_addr, MII_BMCR, &data);
|
||||||
smi_reg_write(mp, mp->phy_addr, 0, data ^ 0x1000);
|
smi_reg_write(mp, mp->phy_addr, MII_BMCR, data ^ BMCR_ANENABLE);
|
||||||
|
|
||||||
smi_reg_read(mp, mp->phy_addr, 0, &data2);
|
smi_reg_read(mp, mp->phy_addr, MII_BMCR, &data2);
|
||||||
if (((data ^ data2) & 0x1000) == 0)
|
if (((data ^ data2) & BMCR_ANENABLE) == 0)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
smi_reg_write(mp, mp->phy_addr, 0, data);
|
smi_reg_write(mp, mp->phy_addr, MII_BMCR, data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user