[SRU][N][PATCH 1/3] UBUNTU: SAUCE: Revert "net: bcm: asp2: convert to phylib managed EEE"

Alice C. Munduruca alice.munduruca at canonical.com
Tue Jul 14 14:48:39 UTC 2026


BugLink: https://bugs.launchpad.net/bugs/2159608

This reverts commit e57cfd7faf78bcdd2261089a6c89e0c6ac92fe76.

This commit was included via upstream update, but dependent
commits weren't included. This results in a compile error
when CONFIG_BCMASP is enabled.

Co-authored-by: Kuan-Ying Lee <kuan-yung.lee at canonical.com>
[cremfuelled: `wol_irq{,_enabled}` are removed by a commit
 needed for a CVE fix, so that removal should be kept. The
 `eee` needs to be re-added, since we don't want to import
 phylib-managed EEE patches.]
Signed-off-by: Alice C. Munduruca <alice.munduruca at canonical.com>
---
 drivers/net/ethernet/broadcom/asp2/bcmasp.h   |  4 +++
 .../ethernet/broadcom/asp2/bcmasp_ethtool.c   | 31 +++++++++++++++++++
 .../net/ethernet/broadcom/asp2/bcmasp_intf.c  | 19 ++++++------
 3 files changed, 44 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.h b/drivers/net/ethernet/broadcom/asp2/bcmasp.h
index f065d3051b53..7af160c48b55 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp.h
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.h
@@ -335,6 +335,8 @@ struct bcmasp_intf {
 
 	u32				wolopts;
 	u8				sopass[SOPASS_MAX];
+
+	struct ethtool_eee		eee;
 };
 
 #define NUM_NET_FILTERS				32
@@ -593,4 +595,6 @@ int bcmasp_netfilt_get_all_active(struct bcmasp_intf *intf, u32 *rule_locs,
 void bcmasp_netfilt_suspend(struct bcmasp_intf *intf);
 
 void bcmasp_enable_wol(struct bcmasp_intf *intf, bool en);
+
+void bcmasp_eee_enable_set(struct bcmasp_intf *intf, bool enable);
 #endif
diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c b/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c
index c11a1d874e4c..3981a0fa77bd 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c
@@ -320,6 +320,20 @@ static int bcmasp_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
 	return err;
 }
 
+void bcmasp_eee_enable_set(struct bcmasp_intf *intf, bool enable)
+{
+	u32 reg;
+
+	reg = umac_rl(intf, UMC_EEE_CTRL);
+	if (enable)
+		reg |= EEE_EN;
+	else
+		reg &= ~EEE_EN;
+	umac_wl(intf, reg, UMC_EEE_CTRL);
+
+	intf->eee.eee_enabled = enable;
+}
+
 static int bcmasp_get_eee(struct net_device *dev, struct ethtool_eee *e)
 {
 	if (!dev->phydev)
@@ -330,9 +344,26 @@ static int bcmasp_get_eee(struct net_device *dev, struct ethtool_eee *e)
 
 static int bcmasp_set_eee(struct net_device *dev, struct ethtool_eee *e)
 {
+	struct bcmasp_intf *intf = netdev_priv(dev);
+	struct ethtool_eee *p = &intf->eee;
+	int ret;
+
 	if (!dev->phydev)
 		return -ENODEV;
 
+	if (!p->eee_enabled) {
+		bcmasp_eee_enable_set(intf, false);
+	} else {
+		ret = phy_init_eee(dev->phydev, 0);
+		if (ret) {
+			netif_err(intf, hw, dev,
+				  "EEE initialization failed: %d\n", ret);
+			return ret;
+		}
+
+		bcmasp_eee_enable_set(intf, true);
+	}
+
 	return phy_ethtool_set_eee(dev->phydev, e);
 }
 
diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
index 81aa27660323..27891f5ef22b 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
@@ -615,6 +615,7 @@ static void bcmasp_adj_link(struct net_device *dev)
 	struct phy_device *phydev = dev->phydev;
 	u32 cmd_bits = 0, reg;
 	int changed = 0;
+	bool active;
 
 	if (intf->old_link != phydev->link) {
 		changed = 1;
@@ -673,12 +674,9 @@ static void bcmasp_adj_link(struct net_device *dev)
 		umac_wl(intf, reg, UMC_CMD);
 
 		umac_wl(intf, phydev->eee_cfg.tx_lpi_timer, UMC_EEE_LPI_TIMER);
-		reg = umac_rl(intf, UMC_EEE_CTRL);
-		if (phydev->enable_tx_lpi)
-			reg |= EEE_EN;
-		else
-			reg &= ~EEE_EN;
-		umac_wl(intf, reg, UMC_EEE_CTRL);
+
+		active = phy_init_eee(phydev, 0) >= 0;
+		bcmasp_eee_enable_set(intf, active);
 	}
 
 	reg = rgmii_rl(intf, RGMII_OOB_CNTRL);
@@ -1361,8 +1359,7 @@ static void bcmasp_suspend_to_wol(struct bcmasp_intf *intf)
 				     ASP_WAKEUP_INTR2_MASK_CLEAR);
 	}
 
-	if (ndev->phydev && ndev->phydev->eee_cfg.eee_enabled &&
-	    intf->parent->eee_fixup)
+	if (intf->eee.eee_enabled && intf->parent->eee_fixup)
 		intf->parent->eee_fixup(intf, true);
 
 	netif_dbg(intf, wol, ndev, "entered WOL mode\n");
@@ -1413,8 +1410,7 @@ static void bcmasp_resume_from_wol(struct bcmasp_intf *intf)
 {
 	u32 reg;
 
-	if (intf->ndev->phydev && intf->ndev->phydev->eee_cfg.eee_enabled &&
-	    intf->parent->eee_fixup)
+	if (intf->eee.eee_enabled && intf->parent->eee_fixup)
 		intf->parent->eee_fixup(intf, false);
 
 	reg = umac_rl(intf, UMC_MPD_CTRL);
@@ -1445,6 +1441,9 @@ int bcmasp_interface_resume(struct bcmasp_intf *intf)
 
 	bcmasp_resume_from_wol(intf);
 
+	if (intf->eee.eee_enabled)
+		bcmasp_eee_enable_set(intf, true);
+
 	netif_device_attach(dev);
 
 	return 0;
-- 
2.53.0




More information about the kernel-team mailing list