Commit d2fc4294 authored by Michael Welling's avatar Michael Welling
Browse files

Enables the use of slow oscillator mode lower APM sleep power.


Signed-off-by: default avatarMichael Welling <mwelling@emacinc.com>
parent e806b3ad
......@@ -177,16 +177,49 @@ static int ksz8873mll_config_aneg(struct phy_device *phydev)
#ifdef CONFIG_PM
int kszphy_suspend(struct phy_device *phydev)
{
int ret = genphy_suspend(phydev);
int value;
/* TODO: disable the PHY oscillator */
return ret;
mutex_lock(&phydev->lock);
/* enable power down mode */
value = phy_read(phydev, MII_BMCR);
phy_write(phydev, MII_BMCR, (value | BMCR_PDOWN));
/* enable slow oscillator mode */
value = phy_read(phydev, 0x11);
phy_write(phydev, 0x11, (value | 1 << 5));
mutex_unlock(&phydev->lock);
return 0;
}
int kszphy_resume(struct phy_device *phydev)
{
/*TODO: enable the PHY oscillator */
return genphy_resume(phydev);
int value;
mutex_lock(&phydev->lock);
/* disable slow oscillator mode */
value = phy_read(phydev, 0x11);
phy_write(phydev, 0x11, (value & ~(1 << 5)));
/* disable power down mode */
value = phy_read(phydev, MII_BMCR);
phy_write(phydev, MII_BMCR, (value & ~BMCR_PDOWN));
/* reset the PHY */
value = phy_read(phydev, MII_BMCR);
phy_write(phydev, MII_BMCR, (value | BMCR_RESET));
/* turn 50Mhz mode back on */
value = phy_read(phydev, MII_KSZPHY_CTRL);
value |= KSZ8051_RMII_50MHZ_CLK;
phy_write(phydev, MII_KSZPHY_CTRL, value);
mutex_unlock(&phydev->lock);
return 0;
}
#endif
......@@ -292,8 +325,10 @@ static struct phy_driver ksphy_driver[] = {
.read_status = genphy_read_status,
.ack_interrupt = kszphy_ack_interrupt,
.config_intr = kszphy_config_intr,
.suspend = genphy_suspend,
.resume = genphy_resume,
#ifdef CONFIG_PM
.suspend = kszphy_suspend,
.resume = kszphy_resume,
#endif
.driver = { .owner = THIS_MODULE,},
}, {
.phy_id = PHY_ID_KSZ8061,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment