Skip to contentSkip to conversation

Add option to enable PHY WOL with PMT enabled

PATCH Applied Ling Pei Lee 2 participants 5 messages Jun 29, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover Add option to enable PHY WOL with PMT enabled

This patchset main objective is to provide an option to enable PHY WoL even the PMT is enabled by default in the HW features.

The current stmmac driver WOL implementation will enable MAC WOL if MAC HW PMT feature is on. Else, the driver will check for PHY WOL support.
Intel EHL mgbe are designed to wake up through PHY WOL although the HW PMT is enabled.Hence, introduced use_phy_wol platform data to provide this PHY WOL option. Set use_phy_wol will disable the plat->pmt which currently used to determine the system to wake up by MAC WOL or PHY WOL.

This WOL patchset includes of setting the device power state to D3hot.
This is because the EHL PSE will need to PSE mgbe to be in D3 state in order for the PSE to goes into suspend mode.

Change Log:
V2: Drop Patch #3 net: stmmac: Reconfigure the PHY WOL settings in stmmac_resume().

Ling Pei Lee (2):
net: stmmac: option to enable PHY WOL with PMT enabled
stmmac: intel: Enable PHY WOL option in EHL

Voon Weifeng (1):
stmmac: intel: set PCI_D3hot in suspend

 drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 2 ++
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++-
 include/linux/stmmac.h                            | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/3 net: stmmac: option to enable PHY WOL with PMT enabled

The current stmmac driver WOL implementation will enable MAC WOL if MAC HW PMT feature is on. Else, the driver will check for PHY WOL support. There is another case where MAC HW PMT is enabled but the platform still goes for the PHY WOL option. E.g, Intel platform are designed for PHY WOL but not MAC WOL although HW MAC PMT features are enabled.

Introduce use_phy_wol platform data to select PHY WOL instead of depending on HW PMT features. Set use_phy_wol will disable the plat->pmt which currently used to determine the system to wake up by MAC WOL or PHY WOL.

---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++-
 include/linux/stmmac.h                            | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -1
index 0a266fa0af7e..a3b79ddcf08e 100644
@@ -6533,7 +6533,8 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
 		 * register (if supported).
 		 */
 		priv->plat->enh_desc = priv->dma_cap.enh_desc;
-		priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up;
+		priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up &&
+				!priv->plat->use_phy_wol;
 		priv->hw->pmt = priv->plat->pmt;
 		if (priv->dma_cap.hash_tb_sz) {
 			priv->hw->multicast_filter_bins =
include/linux/stmmac.h +1 -0
index e55a4807e3ea..9496e6c9ee82 100644
@@ -263,5 +263,6 @@ struct plat_stmmacenet_data {
 	int msi_sfty_ue_vec;
 	int msi_rx_base_vec;
 	int msi_tx_base_vec;
+	bool use_phy_wol;
 };
 #endif
Signature · 1 line
2.25.1
#2 lore raw

PATCH v2 2/3 stmmac: intel: Enable PHY WOL option in EHL

In reply to Ling Pei Lee

Enable PHY Wake On LAN in Intel EHL Intel platform. PHY Wake on LAN option is enabled due to Intel EHL Intel platform is designed for PHY Wake On LAN but not MAC Wake On LAN.

---
 drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +1 -0
index 2ecf93c84b9d..73be34a10a4c 100644
@@ -567,6 +567,7 @@ static int ehl_common_data(struct pci_dev *pdev,
 	plat->rx_queues_to_use = 8;
 	plat->tx_queues_to_use = 8;
 	plat->clk_ptp_rate = 200000000;
+	plat->use_phy_wol = 1;
 
 	plat->safety_feat_cfg->tsoee = 1;
 	plat->safety_feat_cfg->mrxpee = 1;
Signature · 1 line
2.25.1
#3 lore raw

PATCH v2 3/3 stmmac: intel: set PCI_D3hot in suspend

In reply to Ling Pei Lee

From: Voon Weifeng <[email protected]>

During suspend, set the Intel mgbe to D3hot state
to save power consumption.

---
 drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +1 -0
index 73be34a10a4c..69a725b661c2 100644
@@ -1088,6 +1088,7 @@ static int __maybe_unused intel_eth_pci_suspend(struct device *dev)
 		return ret;
 
 	pci_wake_from_d3(pdev, true);
+	pci_set_power_state(pdev, PCI_D3hot);
 	return 0;
 }
 
Signature · 1 line
2.25.1
#4 lore raw
In reply to Ling Pei Lee
This series was applied to netdev/net-next.git (refs/heads/master):

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

Quoted 9 lines · On Tue, 29 Jun 2021 11:08:56 +0800 you wrote:

This patchset main objective is to provide an option to enable PHY WoL even the PMT is enabled by default in the HW features.

The current stmmac driver WOL implementation will enable MAC WOL if MAC HW PMT feature is on. Else, the driver will check for PHY WOL support.
Intel EHL mgbe are designed to wake up through PHY WOL although the HW PMT is enabled.Hence, introduced use_phy_wol platform data to provide this PHY WOL option. Set use_phy_wol will disable the plat->pmt which currently used to determine the system to wake up by MAC WOL or PHY WOL.

This WOL patchset includes of setting the device power state to D3hot.
This is because the EHL PSE will need to PSE mgbe to be in D3 state in order for the PSE to goes into suspend mode.

[...]

Here is the summary with links:
- [net-next,V2,1/3] net: stmmac: option to enable PHY WOL with PMT enabled

    https://git.kernel.org/netdev/net-next/c/5a9b876e9d76
  - [net-next,V2,2/3] stmmac: intel: Enable PHY WOL option in EHL
    https://git.kernel.org/netdev/net-next/c/945beb755633
  - [net-next,V2,3/3] stmmac: intel: set PCI_D3hot in suspend
    https://git.kernel.org/netdev/net-next/c/1dd53a61488d

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html