1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00

net: phy: micrel: Add specific suspend

Disable all interrupts when suspend, they will be enabled
when resume. Otherwise, the suspend/resume process will be
blocked occasionally.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Wenyou Yang 2016-08-05 14:35:41 +08:00 committed by David S. Miller
parent a96d3b7593
commit 836384d250

View file

@ -677,17 +677,28 @@ static void kszphy_get_stats(struct phy_device *phydev,
data[i] = kszphy_get_stat(phydev, i); data[i] = kszphy_get_stat(phydev, i);
} }
static int kszphy_suspend(struct phy_device *phydev)
{
/* Disable PHY Interrupts */
if (phy_interrupt_is_valid(phydev)) {
phydev->interrupts = PHY_INTERRUPT_DISABLED;
if (phydev->drv->config_intr)
phydev->drv->config_intr(phydev);
}
return genphy_suspend(phydev);
}
static int kszphy_resume(struct phy_device *phydev) static int kszphy_resume(struct phy_device *phydev)
{ {
int value; genphy_resume(phydev);
mutex_lock(&phydev->lock); /* Enable PHY Interrupts */
if (phy_interrupt_is_valid(phydev)) {
value = phy_read(phydev, MII_BMCR); phydev->interrupts = PHY_INTERRUPT_ENABLED;
phy_write(phydev, MII_BMCR, value & ~BMCR_PDOWN); if (phydev->drv->config_intr)
phydev->drv->config_intr(phydev);
kszphy_config_intr(phydev); }
mutex_unlock(&phydev->lock);
return 0; return 0;
} }
@ -900,7 +911,7 @@ static struct phy_driver ksphy_driver[] = {
.get_sset_count = kszphy_get_sset_count, .get_sset_count = kszphy_get_sset_count,
.get_strings = kszphy_get_strings, .get_strings = kszphy_get_strings,
.get_stats = kszphy_get_stats, .get_stats = kszphy_get_stats,
.suspend = genphy_suspend, .suspend = kszphy_suspend,
.resume = kszphy_resume, .resume = kszphy_resume,
}, { }, {
.phy_id = PHY_ID_KSZ8061, .phy_id = PHY_ID_KSZ8061,