aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKunihiko Hayashi <hayashi.kunihiko@socionext.com>2018-11-29 03:06:33 -0500
committerDavid S. Miller <davem@davemloft.net>2018-11-29 13:34:45 -0500
commit8d1283b1d6afe9c67ad8d8053f6202ef6fcb038a (patch)
tree82205652e64d1251bd4e365fb8795867da7561e0
parent7200f2e3c9e267d29e2bfa075794339032e0b98e (diff)
net: ethernet: ave: Preserve wol state in suspend/resume sequence
Since the wol state forces to be initialized after reset, the state should be preserved in suspend/resume sequence. Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/socionext/sni_ave.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c
index 96b80309e36d..1f9ef68d91ee 100644
--- a/drivers/net/ethernet/socionext/sni_ave.c
+++ b/drivers/net/ethernet/socionext/sni_ave.c
@@ -261,6 +261,7 @@ struct ave_private {
261 struct regmap *regmap; 261 struct regmap *regmap;
262 unsigned int pinmode_mask; 262 unsigned int pinmode_mask;
263 unsigned int pinmode_val; 263 unsigned int pinmode_val;
264 u32 wolopts;
264 265
265 /* stats */ 266 /* stats */
266 struct ave_stats stats_rx; 267 struct ave_stats stats_rx;
@@ -1741,6 +1742,7 @@ static int ave_remove(struct platform_device *pdev)
1741#ifdef CONFIG_PM_SLEEP 1742#ifdef CONFIG_PM_SLEEP
1742static int ave_suspend(struct device *dev) 1743static int ave_suspend(struct device *dev)
1743{ 1744{
1745 struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
1744 struct net_device *ndev = dev_get_drvdata(dev); 1746 struct net_device *ndev = dev_get_drvdata(dev);
1745 struct ave_private *priv = netdev_priv(ndev); 1747 struct ave_private *priv = netdev_priv(ndev);
1746 int ret = 0; 1748 int ret = 0;
@@ -1750,17 +1752,25 @@ static int ave_suspend(struct device *dev)
1750 netif_device_detach(ndev); 1752 netif_device_detach(ndev);
1751 } 1753 }
1752 1754
1755 ave_ethtool_get_wol(ndev, &wol);
1756 priv->wolopts = wol.wolopts;
1757
1753 return ret; 1758 return ret;
1754} 1759}
1755 1760
1756static int ave_resume(struct device *dev) 1761static int ave_resume(struct device *dev)
1757{ 1762{
1763 struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
1758 struct net_device *ndev = dev_get_drvdata(dev); 1764 struct net_device *ndev = dev_get_drvdata(dev);
1759 struct ave_private *priv = netdev_priv(ndev); 1765 struct ave_private *priv = netdev_priv(ndev);
1760 int ret = 0; 1766 int ret = 0;
1761 1767
1762 ave_global_reset(ndev); 1768 ave_global_reset(ndev);
1763 1769
1770 ave_ethtool_get_wol(ndev, &wol);
1771 wol.wolopts = priv->wolopts;
1772 ave_ethtool_set_wol(ndev, &wol);
1773
1764 if (ndev->phydev) { 1774 if (ndev->phydev) {
1765 ret = phy_resume(ndev->phydev); 1775 ret = phy_resume(ndev->phydev);
1766 if (ret) 1776 if (ret)