diff options
author | Wenyou Yang <wenyou.yang@atmel.com> | 2016-08-05 02:35:41 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-08-09 19:19:15 -0400 |
commit | 836384d2501dee87b1c437f3e268871980c857bf (patch) | |
tree | 974f8faa03331e5101f985c0270c11a116b5b0da | |
parent | a96d3b7593a3eefab62dd930e5c99201c3678ee4 (diff) |
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>
-rw-r--r-- | drivers/net/phy/micrel.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 1882d9828c99..053e87905b94 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c | |||
@@ -677,17 +677,28 @@ static void kszphy_get_stats(struct phy_device *phydev, | |||
677 | data[i] = kszphy_get_stat(phydev, i); | 677 | data[i] = kszphy_get_stat(phydev, i); |
678 | } | 678 | } |
679 | 679 | ||
680 | static int kszphy_resume(struct phy_device *phydev) | 680 | static int kszphy_suspend(struct phy_device *phydev) |
681 | { | 681 | { |
682 | int value; | 682 | /* Disable PHY Interrupts */ |
683 | if (phy_interrupt_is_valid(phydev)) { | ||
684 | phydev->interrupts = PHY_INTERRUPT_DISABLED; | ||
685 | if (phydev->drv->config_intr) | ||
686 | phydev->drv->config_intr(phydev); | ||
687 | } | ||
683 | 688 | ||
684 | mutex_lock(&phydev->lock); | 689 | return genphy_suspend(phydev); |
690 | } | ||
685 | 691 | ||
686 | value = phy_read(phydev, MII_BMCR); | 692 | static int kszphy_resume(struct phy_device *phydev) |
687 | phy_write(phydev, MII_BMCR, value & ~BMCR_PDOWN); | 693 | { |
694 | genphy_resume(phydev); | ||
688 | 695 | ||
689 | kszphy_config_intr(phydev); | 696 | /* Enable PHY Interrupts */ |
690 | mutex_unlock(&phydev->lock); | 697 | if (phy_interrupt_is_valid(phydev)) { |
698 | phydev->interrupts = PHY_INTERRUPT_ENABLED; | ||
699 | if (phydev->drv->config_intr) | ||
700 | phydev->drv->config_intr(phydev); | ||
701 | } | ||
691 | 702 | ||
692 | return 0; | 703 | return 0; |
693 | } | 704 | } |
@@ -900,7 +911,7 @@ static struct phy_driver ksphy_driver[] = { | |||
900 | .get_sset_count = kszphy_get_sset_count, | 911 | .get_sset_count = kszphy_get_sset_count, |
901 | .get_strings = kszphy_get_strings, | 912 | .get_strings = kszphy_get_strings, |
902 | .get_stats = kszphy_get_stats, | 913 | .get_stats = kszphy_get_stats, |
903 | .suspend = genphy_suspend, | 914 | .suspend = kszphy_suspend, |
904 | .resume = kszphy_resume, | 915 | .resume = kszphy_resume, |
905 | }, { | 916 | }, { |
906 | .phy_id = PHY_ID_KSZ8061, | 917 | .phy_id = PHY_ID_KSZ8061, |