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) ...@@ -177,16 +177,49 @@ static int ksz8873mll_config_aneg(struct phy_device *phydev)
#ifdef CONFIG_PM #ifdef CONFIG_PM
int kszphy_suspend(struct phy_device *phydev) int kszphy_suspend(struct phy_device *phydev)
{ {
int ret = genphy_suspend(phydev); int value;
/* TODO: disable the PHY oscillator */ mutex_lock(&phydev->lock);
return ret;
/* 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) int kszphy_resume(struct phy_device *phydev)
{ {
/*TODO: enable the PHY oscillator */ int value;
return genphy_resume(phydev);
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 #endif
...@@ -292,8 +325,10 @@ static struct phy_driver ksphy_driver[] = { ...@@ -292,8 +325,10 @@ static struct phy_driver ksphy_driver[] = {
.read_status = genphy_read_status, .read_status = genphy_read_status,
.ack_interrupt = kszphy_ack_interrupt, .ack_interrupt = kszphy_ack_interrupt,
.config_intr = kszphy_config_intr, .config_intr = kszphy_config_intr,
.suspend = genphy_suspend, #ifdef CONFIG_PM
.resume = genphy_resume, .suspend = kszphy_suspend,
.resume = kszphy_resume,
#endif
.driver = { .owner = THIS_MODULE,}, .driver = { .owner = THIS_MODULE,},
}, { }, {
.phy_id = PHY_ID_KSZ8061, .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