diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2014-07-21 18:29:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-07-21 19:04:31 -0400 |
commit | 8c90db72f92603d7972488bb2e7efcf23b311655 (patch) | |
tree | 0f3ff2aeec3b3fb403f19bdac0af6fbd72b388d3 | |
parent | 1c3c1e7996c1f99ab96b7d499d9d90072147909e (diff) |
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>
-rw-r--r-- | drivers/net/ethernet/broadcom/genet/bcmgenet.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index 1925ae1dc1e6..62ef49c85980 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c | |||
@@ -2635,6 +2635,12 @@ static int bcmgenet_suspend(struct device *d) | |||
2635 | bcmgenet_tx_reclaim_all(dev); | 2635 | bcmgenet_tx_reclaim_all(dev); |
2636 | bcmgenet_fini_dma(priv); | 2636 | bcmgenet_fini_dma(priv); |
2637 | 2637 | ||
2638 | /* Prepare the device for Wake-on-LAN and switch to the slow clock */ | ||
2639 | if (device_may_wakeup(d) && priv->wolopts) { | ||
2640 | bcmgenet_power_down(priv, GENET_POWER_WOL_MAGIC); | ||
2641 | clk_prepare_enable(priv->clk_wol); | ||
2642 | } | ||
2643 | |||
2638 | /* Turn off the clocks */ | 2644 | /* Turn off the clocks */ |
2639 | clk_disable_unprepare(priv->clk); | 2645 | clk_disable_unprepare(priv->clk); |
2640 | 2646 | ||
@@ -2663,6 +2669,12 @@ static int bcmgenet_resume(struct device *d) | |||
2663 | if (ret) | 2669 | if (ret) |
2664 | goto out_clk_disable; | 2670 | goto out_clk_disable; |
2665 | 2671 | ||
2672 | if (priv->wolopts) | ||
2673 | ret = bcmgenet_wol_resume(priv); | ||
2674 | |||
2675 | if (ret) | ||
2676 | goto out_clk_disable; | ||
2677 | |||
2666 | /* disable ethernet MAC while updating its registers */ | 2678 | /* disable ethernet MAC while updating its registers */ |
2667 | umac_enable_set(priv, CMD_TX_EN | CMD_RX_EN, false); | 2679 | umac_enable_set(priv, CMD_TX_EN | CMD_RX_EN, false); |
2668 | 2680 | ||