]> www.infradead.org Git - users/hch/misc.git/commitdiff
net: bcmgenet: move bcmgenet_power_up into resume_noirq
authorDoug Berger <opendmb@gmail.com>
Thu, 6 Mar 2025 19:26:40 +0000 (11:26 -0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 8 Mar 2025 03:33:48 +0000 (19:33 -0800)
The bcmgenet_power_up() function is moved from the resume method
to the resume_noirq method for symmetry with the suspend_noirq
method. This allows the wol_active flag to be removed.

The UMAC_IRQ_WAKE_EVENT interrupts that can be unmasked by the
bcmgenet_wol_power_down_cfg() function are now re-masked by the
bcmgenet_wol_power_up_cfg() function at the resume_noirq level
as well.

Signed-off-by: Doug Berger <opendmb@gmail.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://patch.msgid.link/20250306192643.2383632-13-opendmb@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/broadcom/genet/bcmgenet.c
drivers/net/ethernet/broadcom/genet/bcmgenet.h
drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c

index 0706c9635689fcb1880fb0eaaa2d83bbdabec8d3..8aecf56578cbda9e3165833e216301957551f099 100644 (file)
@@ -4038,8 +4038,20 @@ static int bcmgenet_resume_noirq(struct device *d)
                reg = bcmgenet_intrl2_0_readl(priv, INTRL2_CPU_STAT);
                if (reg & UMAC_IRQ_WAKE_EVENT)
                        pm_wakeup_event(&priv->pdev->dev, 0);
+
+               /* From WOL-enabled suspend, switch to regular clock */
+               bcmgenet_power_up(priv, GENET_POWER_WOL_MAGIC);
        }
 
+       /* If this is an internal GPHY, power it back on now, before UniMAC is
+        * brought out of reset as absolutely no UniMAC activity is allowed
+        */
+       if (priv->internal_phy)
+               bcmgenet_power_up(priv, GENET_POWER_PASSIVE);
+
+       /* take MAC out of reset */
+       bcmgenet_umac_reset(priv);
+
        bcmgenet_intrl2_0_writel(priv, UMAC_IRQ_WAKE_EVENT, INTRL2_CPU_CLEAR);
 
        return 0;
@@ -4055,18 +4067,6 @@ static int bcmgenet_resume(struct device *d)
        if (!netif_running(dev))
                return 0;
 
-       /* From WOL-enabled suspend, switch to regular clock */
-       if (device_may_wakeup(d) && priv->wolopts)
-               bcmgenet_power_up(priv, GENET_POWER_WOL_MAGIC);
-
-       /* If this is an internal GPHY, power it back on now, before UniMAC is
-        * brought out of reset as absolutely no UniMAC activity is allowed
-        */
-       if (priv->internal_phy)
-               bcmgenet_power_up(priv, GENET_POWER_PASSIVE);
-
-       bcmgenet_umac_reset(priv);
-
        init_umac(priv);
 
        phy_init_hw(dev->phydev);
index 926523d019dbff038b2dfc5e4dd4342699eef648..633fa9aa072620e4ad458610eb86a449b2c5bf5d 100644 (file)
@@ -641,7 +641,6 @@ struct bcmgenet_priv {
        struct clk *clk_wol;
        u32 wolopts;
        u8 sopass[SOPASS_MAX];
-       bool wol_active;
 
        struct bcmgenet_mib_counters mib;
 
index f37665ce40cbcff811589a65552c440cf39eaa08..5246214aebc92a1604fd1a1c955c063dbc9bb328 100644 (file)
@@ -199,7 +199,6 @@ int bcmgenet_wol_power_down_cfg(struct bcmgenet_priv *priv,
                  retries);
 
        clk_prepare_enable(priv->clk_wol);
-       priv->wol_active = 1;
 
        if (hfb_enable) {
                bcmgenet_hfb_reg_writel(priv, hfb_enable,
@@ -238,13 +237,12 @@ void bcmgenet_wol_power_up_cfg(struct bcmgenet_priv *priv,
                return;
        }
 
-       if (!priv->wol_active)
-               return; /* failed to suspend so skip the rest */
-
-       priv->wol_active = 0;
        clk_disable_unprepare(priv->clk_wol);
        priv->crc_fwd_en = 0;
 
+       bcmgenet_intrl2_0_writel(priv, UMAC_IRQ_WAKE_EVENT,
+                                INTRL2_CPU_MASK_SET);
+
        /* Disable Magic Packet Detection */
        if (priv->wolopts & (WAKE_MAGIC | WAKE_MAGICSECURE)) {
                reg = bcmgenet_umac_readl(priv, UMAC_MPD_CTRL);