netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: stmmac: dwmac4: Re-enable MAC Rx before powering down
@ 2017-09-26 10:44 Ed Blake
  2017-09-28 17:19 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Ed Blake @ 2017-09-26 10:44 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue; +Cc: netdev, Ed Blake

Re-enable the MAC receiver by setting CONFIG_RE before powering down,
as instructed in section 6.3.5.1 of [1].  Without this the MAC fails
to receive WoL packets and never wakes up.

[1] DWC Ethernet QoS Databook 4.10a October 2014

Signed-off-by: Ed Blake <ed.blake@sondrel.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index c4407e8..2f7d7ec 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -296,6 +296,7 @@ static void dwmac4_pmt(struct mac_device_info *hw, unsigned long mode)
 {
 	void __iomem *ioaddr = hw->pcsr;
 	unsigned int pmt = 0;
+	u32 config;
 
 	if (mode & WAKE_MAGIC) {
 		pr_debug("GMAC: WOL Magic frame\n");
@@ -306,6 +307,12 @@ static void dwmac4_pmt(struct mac_device_info *hw, unsigned long mode)
 		pmt |= power_down | global_unicast | wake_up_frame_en;
 	}
 
+	if (pmt) {
+		/* The receiver must be enabled for WOL before powering down */
+		config = readl(ioaddr + GMAC_CONFIG);
+		config |= GMAC_CONFIG_RE;
+		writel(config, ioaddr + GMAC_CONFIG);
+	}
 	writel(pmt, ioaddr + GMAC_PMT);
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: stmmac: dwmac4: Re-enable MAC Rx before powering down
  2017-09-26 10:44 [PATCH] net: stmmac: dwmac4: Re-enable MAC Rx before powering down Ed Blake
@ 2017-09-28 17:19 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-09-28 17:19 UTC (permalink / raw)
  To: ed.blake; +Cc: peppe.cavallaro, alexandre.torgue, netdev

From: Ed Blake <ed.blake@sondrel.com>
Date: Tue, 26 Sep 2017 11:44:53 +0100

> Re-enable the MAC receiver by setting CONFIG_RE before powering down,
> as instructed in section 6.3.5.1 of [1].  Without this the MAC fails
> to receive WoL packets and never wakes up.
> 
> [1] DWC Ethernet QoS Databook 4.10a October 2014
> 
> Signed-off-by: Ed Blake <ed.blake@sondrel.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-28 17:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-26 10:44 [PATCH] net: stmmac: dwmac4: Re-enable MAC Rx before powering down Ed Blake
2017-09-28 17:19 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).