Skip to contentSkip to conversation

amd-xgbe: re-initiate auto-negotiation for Broadcom PHYs

PATCH In review Raju Rangoju 2 participants 2 messages Feb 10, 2025

Subsystems (3)
lore
Share & tools
lore

Raju Rangoju

author maintainer
#0 lore raw

PATCH 1/1 amd-xgbe: re-initiate auto-negotiation for Broadcom PHYs

Some PHYs on certain platforms may show a successful link after setting the speed to 100Mbps through auto-negotiation (AN) even when 10M/100M/1G concurrent speed is configured. However, they may not be able to transmit or receive data. These PHYs need an "additional auto-negotiation (AN) cycle" after the speed change, to function correctly.

A quirk for these PHYs is that if the outcome of the AN leads to a change in speed, the AN should be re-initiated at the new speed.

---
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 21 +++++++++++++++++++++
 drivers/net/ethernet/amd/xgbe/xgbe.h        |  3 +++
 2 files changed, 24 insertions(+)
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +21 -0
index 268399dfcf22..4a9477554937 100644
@@ -921,6 +921,24 @@ static void xgbe_phy_free_phy_device(struct xgbe_prv_data *pdata)
 	}
 }
 
+static bool xgbe_phy_broadcom_phy_quirks(struct xgbe_prv_data *pdata)
+{
+	struct xgbe_phy_data *phy_data = pdata->phy_data;
+	unsigned int phy_id = phy_data->phydev->phy_id;
+	unsigned int ver;
+
+	ver = XGMAC_GET_BITS(pdata->hw_feat.version, MAC_VR, SNPSVER);
+
+	/* For Broadcom PHY, use the extra AN flag */
+	if (ver == SNPS_MAC_VER_0x21 && (phy_id & 0xffffffff) == 0x600d8595) {
+		dev_dbg(pdata->dev, "Broadcom PHY quirk in place\n");
+		pdata->an_again = 1;
+		return true;
+	}
+
+	return false;
+}
+
 static bool xgbe_phy_finisar_phy_quirks(struct xgbe_prv_data *pdata)
 {
 	struct xgbe_phy_data *phy_data = pdata->phy_data;
@@ -1035,6 +1053,9 @@ static void xgbe_phy_external_phy_quirks(struct xgbe_prv_data *pdata)
 
 	if (xgbe_phy_finisar_phy_quirks(pdata))
 		return;
+
+	if (xgbe_phy_broadcom_phy_quirks(pdata))
+		return;
 }
 
 static int xgbe_phy_find_phy_device(struct xgbe_prv_data *pdata)
drivers/net/ethernet/amd/xgbe/xgbe.h +3 -0
index d85386cac8d1..543206976da6 100644
@@ -249,6 +249,9 @@
 
 #define XGBE_TC_MIN_QUANTUM	10
 
+/* SNPS MAC version */
+#define SNPS_MAC_VER_0x21	0x21
+
 /* Helper macro for descriptor handling
  *  Always use XGBE_GET_DESC_DATA to access the descriptor data
  *  since the index is free-running and needs to be and-ed
Signature · 1 line
2.34.1
#1 lore raw
Quoted 8 lines · Raju Rangoju

Some PHYs on certain platforms may show a successful link after setting the speed to 100Mbps through auto-negotiation (AN) even when 10M/100M/1G concurrent speed is configured. However, they may not be able to transmit or receive data. These PHYs need an "additional auto-negotiation (AN) cycle" after the speed change, to function correctly.

A quirk for these PHYs is that if the outcome of the AN leads to a change in speed, the AN should be re-initiated at the new speed.

Are you sure it is the PHY which is broken, not the MAC? Is there an errata from Broadcom?

drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c static void xgbe_phy_free_phy_device(struct xgbe_prv_data *pdata) · line 933

Quoted 10 lines
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +10 -0
+static bool xgbe_phy_broadcom_phy_quirks(struct xgbe_prv_data *pdata)
+{
+	struct xgbe_phy_data *phy_data = pdata->phy_data;
+	unsigned int phy_id = phy_data->phydev->phy_id;
+	unsigned int ver;
+
+	ver = XGMAC_GET_BITS(pdata->hw_feat.version, MAC_VR, SNPSVER);
+
+	/* For Broadcom PHY, use the extra AN flag */
+	if (ver == SNPS_MAC_VER_0x21 && (phy_id & 0xffffffff) == 0x600d8595) {

Please add this ID to include/linux/brcmphy.h.

Also, is it specifically revision 5 of this PHY which is broken?

Andrew