netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] amd-xgbe: re-initiate auto-negotiation for Broadcom PHYs
@ 2025-02-10 12:09 Raju Rangoju
  2025-02-10 13:49 ` Andrew Lunn
  0 siblings, 1 reply; 2+ messages in thread
From: Raju Rangoju @ 2025-02-10 12:09 UTC (permalink / raw)
  To: netdev
  Cc: kuba, pabeni, edumazet, davem, andrew+netdev, Raju Rangoju,
	Shyam Sundar S K

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.

Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
---
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 21 +++++++++++++++++++++
 drivers/net/ethernet/amd/xgbe/xgbe.h        |  3 +++
 2 files changed, 24 insertions(+)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
index 268399dfcf22..4a9477554937 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
@@ -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)
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h
index d85386cac8d1..543206976da6 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe.h
+++ b/drivers/net/ethernet/amd/xgbe/xgbe.h
@@ -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
-- 
2.34.1


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

* Re: [PATCH net-next] amd-xgbe: re-initiate auto-negotiation for Broadcom PHYs
  2025-02-10 12:09 [PATCH net-next] amd-xgbe: re-initiate auto-negotiation for Broadcom PHYs Raju Rangoju
@ 2025-02-10 13:49 ` Andrew Lunn
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Lunn @ 2025-02-10 13:49 UTC (permalink / raw)
  To: Raju Rangoju
  Cc: netdev, kuba, pabeni, edumazet, davem, andrew+netdev,
	Shyam Sundar S K

On Mon, Feb 10, 2025 at 05:39:33PM +0530, Raju Rangoju wrote:
> 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?

> +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

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

end of thread, other threads:[~2025-02-10 13:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-10 12:09 [PATCH net-next] amd-xgbe: re-initiate auto-negotiation for Broadcom PHYs Raju Rangoju
2025-02-10 13:49 ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).