All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: bcmgenet: ensure EXT_ENERGY_DET_MASK is clear
@ 2021-06-25 21:57 Doug Berger
  2021-06-25 22:03 ` Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: Doug Berger @ 2021-06-25 21:57 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: Florian Fainelli, bcm-kernel-feedback-list, netdev, linux-kernel,
	Doug Berger

Setting the EXT_ENERGY_DET_MASK bit allows the port energy detection
logic of the internal PHY to prevent the system from sleeping. Some
internal PHYs will report that energy is detected when the network
interface is closed which can prevent the system from going to sleep
if WoL is enabled when the interface is brought down.

Since the driver does not support waking the system on this logic,
this commit clears the bit whenever the internal PHY is powered up
and the other logic for manipulating the bit is removed since it
serves no useful function.

Fixes: 1c1008c793fa ("net: bcmgenet: add main driver file")
Signed-off-by: Doug Berger <opendmb@gmail.com>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c    | 15 ++-------------
 .../net/ethernet/broadcom/genet/bcmgenet_wol.c    |  6 ------
 2 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 41f7f078cd27..0260cbaf0197 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1640,7 +1640,8 @@ static void bcmgenet_power_up(struct bcmgenet_priv *priv,
 
 	switch (mode) {
 	case GENET_POWER_PASSIVE:
-		reg &= ~(EXT_PWR_DOWN_DLL | EXT_PWR_DOWN_BIAS);
+		reg &= ~(EXT_PWR_DOWN_DLL | EXT_PWR_DOWN_BIAS |
+			 EXT_ENERGY_DET_MASK);
 		if (GENET_IS_V5(priv)) {
 			reg &= ~(EXT_PWR_DOWN_PHY_EN |
 				 EXT_PWR_DOWN_PHY_RD |
@@ -3318,12 +3319,6 @@ static int bcmgenet_open(struct net_device *dev)
 
 	bcmgenet_set_hw_addr(priv, dev->dev_addr);
 
-	if (priv->internal_phy) {
-		reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT);
-		reg |= EXT_ENERGY_DET_MASK;
-		bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT);
-	}
-
 	/* Disable RX/TX DMA and flush TX queues */
 	dma_ctrl = bcmgenet_dma_disable(priv);
 
@@ -4176,12 +4171,6 @@ static int bcmgenet_resume(struct device *d)
 		if (rule->state != BCMGENET_RXNFC_STATE_UNUSED)
 			bcmgenet_hfb_create_rxnfc_filter(priv, rule);
 
-	if (priv->internal_phy) {
-		reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT);
-		reg |= EXT_ENERGY_DET_MASK;
-		bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT);
-	}
-
 	/* Disable RX/TX DMA and flush TX queues */
 	dma_ctrl = bcmgenet_dma_disable(priv);
 
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
index facde824bcaa..e31a5a397f11 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
@@ -186,12 +186,6 @@ int bcmgenet_wol_power_down_cfg(struct bcmgenet_priv *priv,
 	reg |= CMD_RX_EN;
 	bcmgenet_umac_writel(priv, reg, UMAC_CMD);
 
-	if (priv->hw_params->flags & GENET_HAS_EXT) {
-		reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT);
-		reg &= ~EXT_ENERGY_DET_MASK;
-		bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT);
-	}
-
 	reg = UMAC_IRQ_MPD_R;
 	if (hfb_enable)
 		reg |=  UMAC_IRQ_HFB_SM | UMAC_IRQ_HFB_MM;
-- 
2.25.1


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

* Re: [PATCH net] net: bcmgenet: ensure EXT_ENERGY_DET_MASK is clear
  2021-06-25 21:57 [PATCH net] net: bcmgenet: ensure EXT_ENERGY_DET_MASK is clear Doug Berger
@ 2021-06-25 22:03 ` Florian Fainelli
  2021-06-29  3:47   ` Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2021-06-25 22:03 UTC (permalink / raw)
  To: Doug Berger, David S. Miller, Jakub Kicinski
  Cc: bcm-kernel-feedback-list, netdev, linux-kernel

On 6/25/21 2:57 PM, Doug Berger wrote:
> Setting the EXT_ENERGY_DET_MASK bit allows the port energy detection
> logic of the internal PHY to prevent the system from sleeping. Some
> internal PHYs will report that energy is detected when the network
> interface is closed which can prevent the system from going to sleep
> if WoL is enabled when the interface is brought down.
> 
> Since the driver does not support waking the system on this logic,
> this commit clears the bit whenever the internal PHY is powered up
> and the other logic for manipulating the bit is removed since it
> serves no useful function.
> 
> Fixes: 1c1008c793fa ("net: bcmgenet: add main driver file")
> Signed-off-by: Doug Berger <opendmb@gmail.com>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* Re: [PATCH net] net: bcmgenet: ensure EXT_ENERGY_DET_MASK is clear
  2021-06-25 22:03 ` Florian Fainelli
@ 2021-06-29  3:47   ` Florian Fainelli
  0 siblings, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2021-06-29  3:47 UTC (permalink / raw)
  To: Doug Berger, David S. Miller, Jakub Kicinski
  Cc: bcm-kernel-feedback-list, netdev, linux-kernel



On 6/25/2021 3:03 PM, Florian Fainelli wrote:
> On 6/25/21 2:57 PM, Doug Berger wrote:
>> Setting the EXT_ENERGY_DET_MASK bit allows the port energy detection
>> logic of the internal PHY to prevent the system from sleeping. Some
>> internal PHYs will report that energy is detected when the network
>> interface is closed which can prevent the system from going to sleep
>> if WoL is enabled when the interface is brought down.
>>
>> Since the driver does not support waking the system on this logic,
>> this commit clears the bit whenever the internal PHY is powered up
>> and the other logic for manipulating the bit is removed since it
>> serves no useful function.
>>
>> Fixes: 1c1008c793fa ("net: bcmgenet: add main driver file")
>> Signed-off-by: Doug Berger <opendmb@gmail.com>
> 
> Acked-by: Florian Fainelli <f.fainelli@gmail.com>
> 

Doug, it looks like this patch introduces an unused "reg" variable 
warning at lines 3296 and 4137 which is why the patch was marked as 
"Changes Requested":

https://patchwork.kernel.org/project/netdevbpf/patch/20210625215732.209588-1-opendmb@gmail.com/
https://patchwork.hopto.org/static/nipa//507371/12345957/build_32bit


-- 
Florian

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

end of thread, other threads:[~2021-06-29  3:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-25 21:57 [PATCH net] net: bcmgenet: ensure EXT_ENERGY_DET_MASK is clear Doug Berger
2021-06-25 22:03 ` Florian Fainelli
2021-06-29  3:47   ` Florian Fainelli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.