* [PATCH v2] net: phy: micrel: Add specific suspend
@ 2016-08-05 6:35 Wenyou Yang
2016-08-09 23:19 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Wenyou Yang @ 2016-08-05 6:35 UTC (permalink / raw)
To: Florian Fainelli
Cc: netdev, linux-kernel, linux-arm-kernel, Alexandre Belloni,
Nicolas Ferre, Wenyou Yang
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>
---
Changes in v2:
- Use fairly generic phydrv->config_intr() with
PHY_INTERRUPT_DISABLED, then call genphy_suspend().
- Modify kszphy_resume() with PHY_INTERRUPT_ENABLED accordingly.
- Add static attribute for kszphy_suspend().
drivers/net/phy/micrel.c | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 5a8fefc..b598d46 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -647,17 +647,28 @@ static void kszphy_get_stats(struct phy_device *phydev,
data[i] = kszphy_get_stat(phydev, i);
}
-static int kszphy_resume(struct phy_device *phydev)
+static int kszphy_suspend(struct phy_device *phydev)
{
- int value;
+ /* Disable PHY Interrupts */
+ if (phy_interrupt_is_valid(phydev)) {
+ phydev->interrupts = PHY_INTERRUPT_DISABLED;
+ if (phydev->drv->config_intr)
+ phydev->drv->config_intr(phydev);
+ }
- mutex_lock(&phydev->lock);
+ return genphy_suspend(phydev);
+}
- value = phy_read(phydev, MII_BMCR);
- phy_write(phydev, MII_BMCR, value & ~BMCR_PDOWN);
+static int kszphy_resume(struct phy_device *phydev)
+{
+ genphy_resume(phydev);
- kszphy_config_intr(phydev);
- mutex_unlock(&phydev->lock);
+ /* Enable PHY Interrupts */
+ if (phy_interrupt_is_valid(phydev)) {
+ phydev->interrupts = PHY_INTERRUPT_ENABLED;
+ if (phydev->drv->config_intr)
+ phydev->drv->config_intr(phydev);
+ }
return 0;
}
@@ -870,7 +881,7 @@ static struct phy_driver ksphy_driver[] = {
.get_sset_count = kszphy_get_sset_count,
.get_strings = kszphy_get_strings,
.get_stats = kszphy_get_stats,
- .suspend = genphy_suspend,
+ .suspend = kszphy_suspend,
.resume = kszphy_resume,
}, {
.phy_id = PHY_ID_KSZ8061,
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] net: phy: micrel: Add specific suspend
2016-08-05 6:35 [PATCH v2] net: phy: micrel: Add specific suspend Wenyou Yang
@ 2016-08-09 23:19 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-08-09 23:19 UTC (permalink / raw)
To: wenyou.yang
Cc: f.fainelli, netdev, linux-kernel, linux-arm-kernel,
alexandre.belloni, nicolas.ferre
From: Wenyou Yang <wenyou.yang@atmel.com>
Date: Fri, 5 Aug 2016 14:35:41 +0800
> 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>
> ---
>
> Changes in v2:
> - Use fairly generic phydrv->config_intr() with
> PHY_INTERRUPT_DISABLED, then call genphy_suspend().
> - Modify kszphy_resume() with PHY_INTERRUPT_ENABLED accordingly.
> - Add static attribute for kszphy_suspend().
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-08-09 23:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-05 6:35 [PATCH v2] net: phy: micrel: Add specific suspend Wenyou Yang
2016-08-09 23:19 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).