Skip to content

Commit 6ff01db

Browse files
zonquedavem330
authored andcommitted
net: phy: at803x: use genphy_config_init()
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>
1 parent af6b696 commit 6ff01db

File tree

1 file changed

+3
-33
lines changed

1 file changed

+3
-33
lines changed

drivers/net/phy/at803x.c

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -144,41 +144,11 @@ static int at803x_resume(struct phy_device *phydev)
144144

145145
static int at803x_config_init(struct phy_device *phydev)
146146
{
147-
int val;
148147
int ret;
149-
u32 features;
150-
151-
features = SUPPORTED_TP | SUPPORTED_MII | SUPPORTED_AUI |
152-
SUPPORTED_FIBRE | SUPPORTED_BNC;
153-
154-
val = phy_read(phydev, MII_BMSR);
155-
if (val < 0)
156-
return val;
157-
158-
if (val & BMSR_ANEGCAPABLE)
159-
features |= SUPPORTED_Autoneg;
160-
if (val & BMSR_100FULL)
161-
features |= SUPPORTED_100baseT_Full;
162-
if (val & BMSR_100HALF)
163-
features |= SUPPORTED_100baseT_Half;
164-
if (val & BMSR_10FULL)
165-
features |= SUPPORTED_10baseT_Full;
166-
if (val & BMSR_10HALF)
167-
features |= SUPPORTED_10baseT_Half;
168-
169-
if (val & BMSR_ESTATEN) {
170-
val = phy_read(phydev, MII_ESTATUS);
171-
if (val < 0)
172-
return val;
173-
174-
if (val & ESTATUS_1000_TFULL)
175-
features |= SUPPORTED_1000baseT_Full;
176-
if (val & ESTATUS_1000_THALF)
177-
features |= SUPPORTED_1000baseT_Half;
178-
}
179148

180-
phydev->supported = features;
181-
phydev->advertising = features;
149+
ret = genphy_config_init(phydev);
150+
if (ret < 0)
151+
return ret;
182152

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

0 commit comments

Comments
 (0)