Skip to content

Commit

Permalink
net: phy: at803x: use genphy_config_init()
Browse files Browse the repository at this point in the history
Use the generic bits from genphy_config_init() instead of implementing
the same functionality again.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Daniel Mack authored and David S. Miller committed Apr 20, 2014
1 parent af6b696 commit 6ff01db
Showing 1 changed file with 3 additions and 33 deletions.
36 changes: 3 additions & 33 deletions drivers/net/phy/at803x.c
Original file line number Diff line number Diff line change
@@ -144,41 +144,11 @@ static int at803x_resume(struct phy_device *phydev)

static int at803x_config_init(struct phy_device *phydev)
{
int val;
int ret;
u32 features;

features = SUPPORTED_TP | SUPPORTED_MII | SUPPORTED_AUI |
SUPPORTED_FIBRE | SUPPORTED_BNC;

val = phy_read(phydev, MII_BMSR);
if (val < 0)
return val;

if (val & BMSR_ANEGCAPABLE)
features |= SUPPORTED_Autoneg;
if (val & BMSR_100FULL)
features |= SUPPORTED_100baseT_Full;
if (val & BMSR_100HALF)
features |= SUPPORTED_100baseT_Half;
if (val & BMSR_10FULL)
features |= SUPPORTED_10baseT_Full;
if (val & BMSR_10HALF)
features |= SUPPORTED_10baseT_Half;

if (val & BMSR_ESTATEN) {
val = phy_read(phydev, MII_ESTATUS);
if (val < 0)
return val;

if (val & ESTATUS_1000_TFULL)
features |= SUPPORTED_1000baseT_Full;
if (val & ESTATUS_1000_THALF)
features |= SUPPORTED_1000baseT_Half;
}

phydev->supported = features;
phydev->advertising = features;
ret = genphy_config_init(phydev);
if (ret < 0)
return ret;

if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) {
ret = phy_write(phydev, AT803X_DEBUG_ADDR,

0 comments on commit 6ff01db

Please sign in to comment.