Commit 781fff9f authored by Guo-Fu Tseng's avatar Guo-Fu Tseng Committed by Sasha Levin

jme: Do not enable NIC WoL functions on S0

[ Upstream commit 0772a99b ]

Otherwise it might be back on resume right after going to suspend in
some hardware.
Reported-by: default avatarDiego Viola <diego.viola@gmail.com>
Signed-off-by: default avatarGuo-Fu Tseng <cooldavid@cooldavid.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent 61116b29
...@@ -270,11 +270,17 @@ jme_reset_mac_processor(struct jme_adapter *jme) ...@@ -270,11 +270,17 @@ jme_reset_mac_processor(struct jme_adapter *jme)
} }
static inline void static inline void
jme_clear_pm(struct jme_adapter *jme) jme_clear_pm_enable_wol(struct jme_adapter *jme)
{ {
jwrite32(jme, JME_PMCS, PMCS_STMASK | jme->reg_pmcs); jwrite32(jme, JME_PMCS, PMCS_STMASK | jme->reg_pmcs);
} }
static inline void
jme_clear_pm_disable_wol(struct jme_adapter *jme)
{
jwrite32(jme, JME_PMCS, PMCS_STMASK);
}
static int static int
jme_reload_eeprom(struct jme_adapter *jme) jme_reload_eeprom(struct jme_adapter *jme)
{ {
...@@ -1857,7 +1863,7 @@ jme_open(struct net_device *netdev) ...@@ -1857,7 +1863,7 @@ jme_open(struct net_device *netdev)
struct jme_adapter *jme = netdev_priv(netdev); struct jme_adapter *jme = netdev_priv(netdev);
int rc; int rc;
jme_clear_pm(jme); jme_clear_pm_disable_wol(jme);
JME_NAPI_ENABLE(jme); JME_NAPI_ENABLE(jme);
tasklet_init(&jme->linkch_task, jme_link_change_tasklet, tasklet_init(&jme->linkch_task, jme_link_change_tasklet,
...@@ -1933,7 +1939,7 @@ jme_powersave_phy(struct jme_adapter *jme) ...@@ -1933,7 +1939,7 @@ jme_powersave_phy(struct jme_adapter *jme)
jme_set_100m_half(jme); jme_set_100m_half(jme);
if (jme->reg_pmcs & (PMCS_LFEN | PMCS_LREN)) if (jme->reg_pmcs & (PMCS_LFEN | PMCS_LREN))
jme_wait_link(jme); jme_wait_link(jme);
jme_clear_pm(jme); jme_clear_pm_enable_wol(jme);
} else { } else {
jme_phy_off(jme); jme_phy_off(jme);
} }
...@@ -2650,7 +2656,6 @@ jme_set_wol(struct net_device *netdev, ...@@ -2650,7 +2656,6 @@ jme_set_wol(struct net_device *netdev,
if (wol->wolopts & WAKE_MAGIC) if (wol->wolopts & WAKE_MAGIC)
jme->reg_pmcs |= PMCS_MFEN; jme->reg_pmcs |= PMCS_MFEN;
jwrite32(jme, JME_PMCS, jme->reg_pmcs);
device_set_wakeup_enable(&jme->pdev->dev, !!(jme->reg_pmcs)); device_set_wakeup_enable(&jme->pdev->dev, !!(jme->reg_pmcs));
return 0; return 0;
...@@ -3176,7 +3181,7 @@ jme_init_one(struct pci_dev *pdev, ...@@ -3176,7 +3181,7 @@ jme_init_one(struct pci_dev *pdev,
jme->mii_if.mdio_read = jme_mdio_read; jme->mii_if.mdio_read = jme_mdio_read;
jme->mii_if.mdio_write = jme_mdio_write; jme->mii_if.mdio_write = jme_mdio_write;
jme_clear_pm(jme); jme_clear_pm_disable_wol(jme);
device_set_wakeup_enable(&pdev->dev, true); device_set_wakeup_enable(&pdev->dev, true);
jme_set_phyfifo_5level(jme); jme_set_phyfifo_5level(jme);
...@@ -3308,7 +3313,7 @@ jme_resume(struct device *dev) ...@@ -3308,7 +3313,7 @@ jme_resume(struct device *dev)
if (!netif_running(netdev)) if (!netif_running(netdev))
return 0; return 0;
jme_clear_pm(jme); jme_clear_pm_disable_wol(jme);
jme_phy_on(jme); jme_phy_on(jme);
if (test_bit(JME_FLAG_SSET, &jme->flags)) if (test_bit(JME_FLAG_SSET, &jme->flags))
jme_set_settings(netdev, &jme->old_ecmd); jme_set_settings(netdev, &jme->old_ecmd);
......
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