Skip to content

Commit b629820

Browse files
Marek Vasutdavem330
authored andcommitted
net: phy: smsc: Implement PHY config_init for LAN87xx
The LAN8710/LAN8720 chips do have broken the "FlexPWR" smart power-saving capability. Enabling it leads to the PHY not being able to detect Link when cold-started without cable connected. Thus, make sure this is disabled. Signed-off-by: Marek Vasut <[email protected]> Cc: Christian Hohnstaedt <[email protected]> Cc: David S. Miller <[email protected]> Cc: Fabio Estevam <[email protected]> Cc: Giuseppe Cavallaro <[email protected]> Cc: Otavio Salvador <[email protected]> Acked-by: Otavio Salvador <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a3cff12 commit b629820

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

drivers/net/phy/smsc.c

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,32 @@ static int smsc_phy_config_init(struct phy_device *phydev)
5656
return smsc_phy_ack_interrupt (phydev);
5757
}
5858

59+
static int lan87xx_config_init(struct phy_device *phydev)
60+
{
61+
/*
62+
* Make sure the EDPWRDOWN bit is NOT set. Setting this bit on
63+
* LAN8710/LAN8720 PHY causes the PHY to misbehave, likely due
64+
* to a bug on the chip.
65+
*
66+
* When the system is powered on with the network cable being
67+
* disconnected all the way until after ifconfig ethX up is
68+
* issued for the LAN port with this PHY, connecting the cable
69+
* afterwards does not cause LINK change detection, while the
70+
* expected behavior is the Link UP being detected.
71+
*/
72+
int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS);
73+
if (rc < 0)
74+
return rc;
75+
76+
rc &= ~MII_LAN83C185_EDPWRDOWN;
77+
78+
rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS, rc);
79+
if (rc < 0)
80+
return rc;
81+
82+
return smsc_phy_ack_interrupt(phydev);
83+
}
84+
5985
static int lan911x_config_init(struct phy_device *phydev)
6086
{
6187
return smsc_phy_ack_interrupt(phydev);
@@ -162,7 +188,7 @@ static struct phy_driver smsc_phy_driver[] = {
162188
/* basic functions */
163189
.config_aneg = genphy_config_aneg,
164190
.read_status = genphy_read_status,
165-
.config_init = smsc_phy_config_init,
191+
.config_init = lan87xx_config_init,
166192

167193
/* IRQ related */
168194
.ack_interrupt = smsc_phy_ack_interrupt,

0 commit comments

Comments
 (0)