int err = genphy_read_status(phydev);
if (!phydev->link && priv->energy_enable) {
+ int energy_detected;
+
/* Disable EDPD to wake up PHY */
int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS);
if (rc < 0)
*/
read_poll_timeout(phy_read, rc,
rc & MII_LAN83C185_ENERGYON || rc < 0,
- 10000, 1500000, true, phydev,
+ 150000, 1500000, true, phydev,
MII_LAN83C185_CTRL_STATUS);
if (rc < 0)
return rc;
if (rc < 0)
return rc;
+ energy_detected = !!(rc & MII_LAN83C185_ENERGYON);
+
rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS,
rc | MII_LAN83C185_EDPWRDOWN);
if (rc < 0)
return rc;
+
+ /* Save CPU and power by deferring the next poll */
+ if (!energy_detected)
+ msleep(2000);
}
return err;