forked from Minki/linux
net: stmmac: only call pmt() during suspend/resume if HW enables PMT
This is to prepare WOL support with phy. Compared with WOL implementation which relies on the MAC's PMT features, in phy supported WOL case, device_may_wakeup() may also be true, but we should not call mac's pmt() function if HW doesn't enable PMT. And during resume, we should call phylink_start() if PMT is disabled. Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
2f45f7a13e
commit
e8377e7a29
@ -5085,7 +5085,7 @@ int stmmac_suspend(struct device *dev)
|
|||||||
priv->plat->serdes_powerdown(ndev, priv->plat->bsp_priv);
|
priv->plat->serdes_powerdown(ndev, priv->plat->bsp_priv);
|
||||||
|
|
||||||
/* Enable Power down mode by programming the PMT regs */
|
/* Enable Power down mode by programming the PMT regs */
|
||||||
if (device_may_wakeup(priv->device)) {
|
if (device_may_wakeup(priv->device) && priv->plat->pmt) {
|
||||||
stmmac_pmt(priv, priv->hw, priv->wolopts);
|
stmmac_pmt(priv, priv->hw, priv->wolopts);
|
||||||
priv->irq_wake = 1;
|
priv->irq_wake = 1;
|
||||||
} else {
|
} else {
|
||||||
@ -5157,7 +5157,7 @@ int stmmac_resume(struct device *dev)
|
|||||||
* this bit because it can generate problems while resuming
|
* this bit because it can generate problems while resuming
|
||||||
* from another devices (e.g. serial console).
|
* from another devices (e.g. serial console).
|
||||||
*/
|
*/
|
||||||
if (device_may_wakeup(priv->device)) {
|
if (device_may_wakeup(priv->device) && priv->plat->pmt) {
|
||||||
mutex_lock(&priv->lock);
|
mutex_lock(&priv->lock);
|
||||||
stmmac_pmt(priv, priv->hw, 0);
|
stmmac_pmt(priv, priv->hw, 0);
|
||||||
mutex_unlock(&priv->lock);
|
mutex_unlock(&priv->lock);
|
||||||
@ -5200,7 +5200,7 @@ int stmmac_resume(struct device *dev)
|
|||||||
|
|
||||||
mutex_unlock(&priv->lock);
|
mutex_unlock(&priv->lock);
|
||||||
|
|
||||||
if (!device_may_wakeup(priv->device)) {
|
if (!device_may_wakeup(priv->device) || !priv->plat->pmt) {
|
||||||
rtnl_lock();
|
rtnl_lock();
|
||||||
phylink_start(priv->phylink);
|
phylink_start(priv->phylink);
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
|
Loading…
Reference in New Issue
Block a user