net: bcmgenet: suspend and resume from Wake-on-LAN
Update bcmgenet_suspend() to prepare the hardware for being put into Wake-on-LAN mode if the device can wakeup the system, and Wake-on-LAN is enabled. Whether we resume from Wake-on-LAN or not, make sure that bcmgenet_resume() disables the UniMAC MagicPacket matching mode and puts the hardware in a state where it can receive all incoming packets. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
1c3c1e7996
commit
8c90db72f9
1 changed files with 12 additions and 0 deletions
|
@ -2635,6 +2635,12 @@ static int bcmgenet_suspend(struct device *d)
|
||||||
bcmgenet_tx_reclaim_all(dev);
|
bcmgenet_tx_reclaim_all(dev);
|
||||||
bcmgenet_fini_dma(priv);
|
bcmgenet_fini_dma(priv);
|
||||||
|
|
||||||
|
/* Prepare the device for Wake-on-LAN and switch to the slow clock */
|
||||||
|
if (device_may_wakeup(d) && priv->wolopts) {
|
||||||
|
bcmgenet_power_down(priv, GENET_POWER_WOL_MAGIC);
|
||||||
|
clk_prepare_enable(priv->clk_wol);
|
||||||
|
}
|
||||||
|
|
||||||
/* Turn off the clocks */
|
/* Turn off the clocks */
|
||||||
clk_disable_unprepare(priv->clk);
|
clk_disable_unprepare(priv->clk);
|
||||||
|
|
||||||
|
@ -2663,6 +2669,12 @@ static int bcmgenet_resume(struct device *d)
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out_clk_disable;
|
goto out_clk_disable;
|
||||||
|
|
||||||
|
if (priv->wolopts)
|
||||||
|
ret = bcmgenet_wol_resume(priv);
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
goto out_clk_disable;
|
||||||
|
|
||||||
/* disable ethernet MAC while updating its registers */
|
/* disable ethernet MAC while updating its registers */
|
||||||
umac_enable_set(priv, CMD_TX_EN | CMD_RX_EN, false);
|
umac_enable_set(priv, CMD_TX_EN | CMD_RX_EN, false);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue