Skip to contentSkip to conversation

amd-xgbe: add support for 2.5GbE and rx-adaptation

PATCH Applied Raju Rangoju 4 participants 9 messages Feb 1, 2023 – Feb 4, 2023

Subsystems (3)
lore
Share & tools
lore

Raju Rangoju

author maintainer
#0 lore raw

v2 cover amd-xgbe: add support for 2.5GbE and rx-adaptation

This patch series adds support for 2.GbE in 10GBaseT mode and rx-adaptation support for Yellow Carp devices.

1) Support for 2.5GbE:
Add the necessary changes to the driver to fully recognize and enable 2.5GbE speed in 10GBaseT mode.

2) Support for rx-adaptation:
In order to support the 10G backplane mode without Auto-negotiation and to support the longer-length DAC cables, it requires PHY to perform RX Adaptation sequence as mentioned in the Synopsys databook. Add the necessary changes to Yellow Carp devices to ensure seamless RX Adaptation for 10G-SFI (LONG DAC), and 10G-KR modes without Auto-Negotiation (CL72 not present)

Changes since v1:
- remove the unneeded inline usage
- re-ordered the code to quash forward declarations; however there are couple of them since there is a circular dependency. Below is link for the same:
https://lore.kernel.org/netdev/[email protected]/

Raju Rangoju (2):
amd-xgbe: add 2.5GbE support to 10G BaseT mode
amd-xgbe: add support for rx-adaptation

 drivers/net/ethernet/amd/xgbe/xgbe-common.h |  38 ++++
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 187 +++++++++++++++++++-
 drivers/net/ethernet/amd/xgbe/xgbe.h        |   5 +
 3 files changed, 224 insertions(+), 6 deletions(-)
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH v2 1/2 amd-xgbe: add 2.5GbE support to 10G BaseT mode

Add support to the driver to fully recognize and enable 2.5GbE speed in 10GBaseT mode.

---
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +13 -2
index f4683d53e58c..eea06e07b4a0 100644
@@ -1882,6 +1882,9 @@ static void xgbe_phy_an_advertising(struct xgbe_prv_data *pdata,
 		if (phy_data->phydev &&
 		    (phy_data->phydev->speed == SPEED_10000))
 			XGBE_SET_ADV(dlks, 10000baseKR_Full);
+		else if (phy_data->phydev &&
+			 (phy_data->phydev->speed == SPEED_2500))
+			XGBE_SET_ADV(dlks, 2500baseX_Full);
 		else
 			XGBE_SET_ADV(dlks, 1000baseKX_Full);
 		break;
@@ -2282,9 +2285,11 @@ static enum xgbe_mode xgbe_phy_switch_baset_mode(struct xgbe_prv_data *pdata)
 	case XGBE_MODE_SGMII_100:
 	case XGBE_MODE_SGMII_1000:
 		return XGBE_MODE_KR;
+	case XGBE_MODE_KX_2500:
+		return XGBE_MODE_SGMII_1000;
 	case XGBE_MODE_KR:
 	default:
-		return XGBE_MODE_SGMII_1000;
+		return XGBE_MODE_KX_2500;
 	}
 }
 
@@ -2644,7 +2649,8 @@ static bool xgbe_phy_valid_speed_baset_mode(struct xgbe_prv_data *pdata,
 	case SPEED_1000:
 		return true;
 	case SPEED_2500:
-		return (phy_data->port_mode == XGBE_PORT_MODE_NBASE_T);
+		return ((phy_data->port_mode == XGBE_PORT_MODE_10GBASE_T) ||
+			(phy_data->port_mode == XGBE_PORT_MODE_NBASE_T));
 	case SPEED_10000:
 		return (phy_data->port_mode == XGBE_PORT_MODE_10GBASE_T);
 	default:
@@ -3024,6 +3030,7 @@ static bool xgbe_phy_port_mode_mismatch(struct xgbe_prv_data *pdata)
 		if ((phy_data->port_speeds & XGBE_PHY_PORT_SPEED_10) ||
 		    (phy_data->port_speeds & XGBE_PHY_PORT_SPEED_100) ||
 		    (phy_data->port_speeds & XGBE_PHY_PORT_SPEED_1000) ||
+		    (phy_data->port_speeds & XGBE_PHY_PORT_SPEED_2500) ||
 		    (phy_data->port_speeds & XGBE_PHY_PORT_SPEED_10000))
 			return false;
 		break;
@@ -3474,6 +3481,10 @@ static int xgbe_phy_init(struct xgbe_prv_data *pdata)
 			XGBE_SET_SUP(lks, 1000baseT_Full);
 			phy_data->start_mode = XGBE_MODE_SGMII_1000;
 		}
+		if (phy_data->port_speeds & XGBE_PHY_PORT_SPEED_2500) {
+			XGBE_SET_SUP(lks, 2500baseT_Full);
+			phy_data->start_mode = XGBE_MODE_KX_2500;
+		}
 		if (phy_data->port_speeds & XGBE_PHY_PORT_SPEED_10000) {
 			XGBE_SET_SUP(lks, 10000baseT_Full);
 			phy_data->start_mode = XGBE_MODE_KR;
Signature · 1 line
2.25.1
author maintainer
#2 lore raw

PATCH v2 2/2 amd-xgbe: add support for rx-adaptation

In reply to Raju Rangoju

The existing implementation for non-Autonegotiation 10G speed modes does not enable RX adaptation in the Driver and FW. The RX Equalization settings (AFE settings alone) are manually configured and the existing link-up sequence in the driver does not perform rx adaptation process as mentioned in the Synopsys databook. There's a customer request for 10G backplane mode without Auto-negotiation and for the DAC cables of more significant length that follow the non-Autonegotiation mode. These modes require PHY to perform RX Adaptation.

The proposed logic adds the necessary changes to Yellow Carp devices to ensure seamless RX Adaptation for 10G-SFI (LONG DAC) and 10G-KR without AN (CL72 not present). The RX adaptation core algorithm is executed by firmware, however, to achieve that a new mailbox sub-command is required to be sent by the driver.

---
 drivers/net/ethernet/amd/xgbe/xgbe-common.h |  38 +++++
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 172 +++++++++++++++++++-
 drivers/net/ethernet/amd/xgbe/xgbe.h        |   5 +
 3 files changed, 211 insertions(+), 4 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-common.h +38 -0
index 3fd9728f817f..3b70f6737633 100644
@@ -1285,6 +1285,22 @@
 #define MDIO_PMA_RX_CTRL1		0x8051
 #endif
 
+#ifndef MDIO_PMA_RX_LSTS
+#define MDIO_PMA_RX_LSTS		0x018020
+#endif
+
+#ifndef MDIO_PMA_RX_EQ_CTRL4
+#define MDIO_PMA_RX_EQ_CTRL4		0x0001805C
+#endif
+
+#ifndef MDIO_PMA_MP_MISC_STS
+#define MDIO_PMA_MP_MISC_STS		0x0078
+#endif
+
+#ifndef MDIO_PMA_PHY_RX_EQ_CEU
+#define MDIO_PMA_PHY_RX_EQ_CEU		0x1800E
+#endif
+
 #ifndef MDIO_PCS_DIG_CTRL
 #define MDIO_PCS_DIG_CTRL		0x8000
 #endif
@@ -1395,6 +1411,28 @@
 #define XGBE_PMA_RX_RST_0_RESET_ON	0x10
 #define XGBE_PMA_RX_RST_0_RESET_OFF	0x00
 
+#define XGBE_PMA_RX_SIG_DET_0_MASK	BIT(4)
+#define XGBE_PMA_RX_SIG_DET_0_ENABLE	BIT(4)
+#define XGBE_PMA_RX_SIG_DET_0_DISABLE	0x0000
+
+#define XGBE_PMA_RX_VALID_0_MASK	BIT(12)
+#define XGBE_PMA_RX_VALID_0_ENABLE	BIT(12)
+#define XGBE_PMA_RX_VALID_0_DISABLE	0x0000
+
+#define XGBE_PMA_RX_AD_REQ_MASK		BIT(12)
+#define XGBE_PMA_RX_AD_REQ_ENABLE	BIT(12)
+#define XGBE_PMA_RX_AD_REQ_DISABLE	0x0000
+
+#define XGBE_PMA_RX_ADPT_ACK_MASK	BIT(12)
+#define XGBE_PMA_RX_ADPT_ACK		BIT(12)
+
+#define XGBE_PMA_CFF_UPDTM1_VLD		BIT(8)
+#define XGBE_PMA_CFF_UPDT0_VLD		BIT(9)
+#define XGBE_PMA_CFF_UPDT1_VLD		BIT(10)
+#define XGBE_PMA_CFF_UPDT_MASK		(XGBE_PMA_CFF_UPDTM1_VLD |\
+					 XGBE_PMA_CFF_UPDT0_VLD | \
+					 XGBE_PMA_CFF_UPDT1_VLD)
+
 #define XGBE_PMA_PLL_CTRL_MASK		BIT(15)
 #define XGBE_PMA_PLL_CTRL_ENABLE	BIT(15)
 #define XGBE_PMA_PLL_CTRL_DISABLE	0x0000
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +168 -4

228 lines not on this page · raw message

drivers/net/ethernet/amd/xgbe/xgbe.h +5 -0
index 16e73df3e9b9..ad136ed493ed 100644
@@ -625,6 +625,7 @@ enum xgbe_mb_cmd {
 
 enum xgbe_mb_subcmd {
 	XGBE_MB_SUBCMD_NONE = 0,
+	XGBE_MB_SUBCMD_RX_ADAP,
 
 	/* 10GbE SFP subcommands */
 	XGBE_MB_SUBCMD_ACTIVE = 0,
@@ -1316,6 +1317,10 @@ struct xgbe_prv_data {
 
 	bool debugfs_an_cdr_workaround;
 	bool debugfs_an_cdr_track_early;
+	bool en_rx_adap;
+	int rx_adapt_retries;
+	bool rx_adapt_done;
+	bool mode_set;
 };
 
 /* Function prototypes*/
Signature · 1 line
2.25.1
#3 lore raw

Re: [PATCH net-next v2 2/2] amd-xgbe: add support for rx-adaptation

Quoted 18 lines · Raju Rangoju

The existing implementation for non-Autonegotiation 10G speed modes does not enable RX adaptation in the Driver and FW. The RX Equalization settings (AFE settings alone) are manually configured and the existing link-up sequence in the driver does not perform rx adaptation process as mentioned in the Synopsys databook. There's a customer request for 10G backplane mode without Auto-negotiation and for the DAC cables of more significant length that follow the non-Autonegotiation mode. These modes require PHY to perform RX Adaptation.

The proposed logic adds the necessary changes to Yellow Carp devices to ensure seamless RX Adaptation for 10G-SFI (LONG DAC) and 10G-KR without AN (CL72 not present). The RX adaptation core algorithm is executed by firmware, however, to achieve that a new mailbox sub-command is required to be sent by the driver.

...

Quoted 13 lines
drivers/net/ethernet/amd/xgbe/xgbe.h +1 -0
index 16e73df3e9b9..ad136ed493ed 100644
@@ -625,6 +625,7 @@ enum xgbe_mb_cmd {
 
 enum xgbe_mb_subcmd {
 	XGBE_MB_SUBCMD_NONE = 0,
+	XGBE_MB_SUBCMD_RX_ADAP,
 
 	/* 10GbE SFP subcommands */
 	XGBE_MB_SUBCMD_ACTIVE = 0,

drivers/net/ethernet/amd/xgbe/xgbe.h struct xgbe_prv_data { · line 1320

Quoted 4 lines
drivers/net/ethernet/amd/xgbe/xgbe.h +1 -0
@@ -1316,6 +1317,10 @@ struct xgbe_prv_data {
 
 	bool debugfs_an_cdr_workaround;
 	bool debugfs_an_cdr_track_early;
+	bool en_rx_adap;

nit: there is a 1 byte hole here (on x86_64)

Quoted 9 lines
drivers/net/ethernet/amd/xgbe/xgbe.h +3 -0
+	int rx_adapt_retries;
+	bool rx_adapt_done;
+	bool mode_set;
 };
 
 /* Function prototypes*/
Signature · 1 line
2.25.1
maintainer
#4 lore raw

Re: [PATCH net-next v2 2/2] amd-xgbe: add support for rx-adaptation

Quoted 36 lines · Simon Horman
Quoted 18 lines · Raju Rangoju

The existing implementation for non-Autonegotiation 10G speed modes does not enable RX adaptation in the Driver and FW. The RX Equalization settings (AFE settings alone) are manually configured and the existing link-up sequence in the driver does not perform rx adaptation process as mentioned in the Synopsys databook. There's a customer request for 10G backplane mode without Auto-negotiation and for the DAC cables of more significant length that follow the non-Autonegotiation mode. These modes require PHY to perform RX Adaptation.

The proposed logic adds the necessary changes to Yellow Carp devices to ensure seamless RX Adaptation for 10G-SFI (LONG DAC) and 10G-KR without AN (CL72 not present). The RX adaptation core algorithm is executed by firmware, however, to achieve that a new mailbox sub-command is required to be sent by the driver.

...

Quoted 14 lines
drivers/net/ethernet/amd/xgbe/xgbe.h +1 -0
index 16e73df3e9b9..ad136ed493ed 100644
@@ -625,6 +625,7 @@ enum xgbe_mb_cmd {
 
 enum xgbe_mb_subcmd {
 	XGBE_MB_SUBCMD_NONE = 0,
+	XGBE_MB_SUBCMD_RX_ADAP,
 
 	/* 10GbE SFP subcommands */
 	XGBE_MB_SUBCMD_ACTIVE = 0,
@@ -1316,6 +1317,10 @@ struct xgbe_prv_data {
 
Quoted 5 lines

drivers/net/ethernet/amd/xgbe/xgbe.h struct xgbe_prv_data { · line 1320

Quoted 3 lines
drivers/net/ethernet/amd/xgbe/xgbe.h +1 -0
 	bool debugfs_an_cdr_workaround;
 	bool debugfs_an_cdr_track_early;
+	bool en_rx_adap;

nit: there is a 1 byte hole here (on x86_64)

I think even in the current form is ok. The total size of the struct is not going to change, due to alignment, and the fields will sit in the same cacheline in both cases.

I guess the layout could be changed later if needed.

Thanks,

Paolo

#8 lore raw
In reply to Raju Rangoju
This series was applied to netdev/net-next.git (master) by Paolo Abeni <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (master) by Paolo Abeni <[email protected]>:

Quoted 8 lines · On Wed, 1 Feb 2023 11:19:30 +0530 you wrote:

This patch series adds support for 2.GbE in 10GBaseT mode and rx-adaptation support for Yellow Carp devices.

1) Support for 2.5GbE:
Add the necessary changes to the driver to fully recognize and enable 2.5GbE speed in 10GBaseT mode.

[...]

Here is the summary with links:
- [net-next,v2,1/2] amd-xgbe: add 2.5GbE support to 10G BaseT mode

    https://git.kernel.org/netdev/net-next/c/3ee217c47b8b
  - [net-next,v2,2/2] amd-xgbe: add support for rx-adaptation
    https://git.kernel.org/netdev/net-next/c/4f3b20bfbb75

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#5 lore raw

Re: [PATCH net-next v2 2/2] amd-xgbe: add support for rx-adaptation

In reply to Paolo Abeni
Quoted 43 lines · Paolo Abeni
Quoted 36 lines · Simon Horman
Quoted 18 lines · Raju Rangoju

The existing implementation for non-Autonegotiation 10G speed modes does not enable RX adaptation in the Driver and FW. The RX Equalization settings (AFE settings alone) are manually configured and the existing link-up sequence in the driver does not perform rx adaptation process as mentioned in the Synopsys databook. There's a customer request for 10G backplane mode without Auto-negotiation and for the DAC cables of more significant length that follow the non-Autonegotiation mode. These modes require PHY to perform RX Adaptation.

The proposed logic adds the necessary changes to Yellow Carp devices to ensure seamless RX Adaptation for 10G-SFI (LONG DAC) and 10G-KR without AN (CL72 not present). The RX adaptation core algorithm is executed by firmware, however, to achieve that a new mailbox sub-command is required to be sent by the driver.

...

Quoted 14 lines
drivers/net/ethernet/amd/xgbe/xgbe.h +1 -0
index 16e73df3e9b9..ad136ed493ed 100644
@@ -625,6 +625,7 @@ enum xgbe_mb_cmd {
 
 enum xgbe_mb_subcmd {
 	XGBE_MB_SUBCMD_NONE = 0,
+	XGBE_MB_SUBCMD_RX_ADAP,
 
 	/* 10GbE SFP subcommands */
 	XGBE_MB_SUBCMD_ACTIVE = 0,
@@ -1316,6 +1317,10 @@ struct xgbe_prv_data {
 
Quoted 5 lines

drivers/net/ethernet/amd/xgbe/xgbe.h struct xgbe_prv_data { · line 1320

Quoted 3 lines
drivers/net/ethernet/amd/xgbe/xgbe.h +1 -0
 	bool debugfs_an_cdr_workaround;
 	bool debugfs_an_cdr_track_early;
+	bool en_rx_adap;

nit: there is a 1 byte hole here (on x86_64)

Quoted 5 lines

I think even in the current form is ok. The total size of the struct is not going to change, due to alignment, and the fields will sit in the same cacheline in both cases.

I guess the layout could be changed later if needed.

Ok, I did think it was worth mentioning.
But I agree that it doesn't need to be changed at this time.

author maintainer
#6 lore raw

Re: [PATCH net-next v2 2/2] amd-xgbe: add support for rx-adaptation

Quoted 44 lines · Simon Horman
Quoted 43 lines · Paolo Abeni
Quoted 41 lines · Simon Horman
Quoted 18 lines · Raju Rangoju

The existing implementation for non-Autonegotiation 10G speed modes does not enable RX adaptation in the Driver and FW. The RX Equalization settings (AFE settings alone) are manually configured and the existing link-up sequence in the driver does not perform rx adaptation process as mentioned in the Synopsys databook. There's a customer request for 10G backplane mode without Auto-negotiation and for the DAC cables of more significant length that follow the non-Autonegotiation mode. These modes require PHY to perform RX Adaptation.

The proposed logic adds the necessary changes to Yellow Carp devices to ensure seamless RX Adaptation for 10G-SFI (LONG DAC) and 10G-KR without AN (CL72 not present). The RX adaptation core algorithm is executed by firmware, however, to achieve that a new mailbox sub-command is required to be sent by the driver.

...

Quoted 13 lines
drivers/net/ethernet/amd/xgbe/xgbe.h +1 -0
index 16e73df3e9b9..ad136ed493ed 100644
@@ -625,6 +625,7 @@ enum xgbe_mb_cmd {
 
  enum xgbe_mb_subcmd {
  	XGBE_MB_SUBCMD_NONE = 0,
+	XGBE_MB_SUBCMD_RX_ADAP,
 
  	/* 10GbE SFP subcommands */
  	XGBE_MB_SUBCMD_ACTIVE = 0,

drivers/net/ethernet/amd/xgbe/xgbe.h struct xgbe_prv_data { · line 1320

Quoted 4 lines
drivers/net/ethernet/amd/xgbe/xgbe.h +1 -0
@@ -1316,6 +1317,10 @@ struct xgbe_prv_data {
 
  	bool debugfs_an_cdr_workaround;
  	bool debugfs_an_cdr_track_early;
+	bool en_rx_adap;

nit: there is a 1 byte hole here (on x86_64)

Quoted 8 lines
Quoted 5 lines

I think even in the current form is ok. The total size of the struct is not going to change, due to alignment, and the fields will sit in the same cacheline in both cases.

I guess the layout could be changed later if needed.

Ok, I did think it was worth mentioning.
But I agree that it doesn't need to be changed at this time.

Thanks Simon for taking time to review the patch. I'll try to handle it at a later point in time.

#7 lore raw

Re: [PATCH net-next v2 2/2] amd-xgbe: add support for rx-adaptation

Quoted 48 lines · Raju Rangoju
Quoted 45 lines · Simon Horman
Quoted 44 lines · Paolo Abeni
Quoted 22 lines · Simon Horman
Quoted 18 lines · Raju Rangoju

The existing implementation for non-Autonegotiation 10G speed modes does not enable RX adaptation in the Driver and FW. The RX Equalization settings (AFE settings alone) are manually configured and the existing link-up sequence in the driver does not perform rx adaptation process as mentioned in the Synopsys databook. There's a customer request for 10G backplane mode without Auto-negotiation and for the DAC cables of more significant length that follow the non-Autonegotiation mode. These modes require PHY to perform RX Adaptation.

The proposed logic adds the necessary changes to Yellow Carp devices to ensure seamless RX Adaptation for 10G-SFI (LONG DAC) and 10G-KR without AN (CL72 not present). The RX adaptation core algorithm is executed by firmware, however, to achieve that a new mailbox sub-command is required to be sent by the driver.

...

Quoted 16 lines
Quoted 11 lines
drivers/net/ethernet/amd/xgbe/xgbe.h +1 -0
index 16e73df3e9b9..ad136ed493ed 100644
@@ -625,6 +625,7 @@ enum xgbe_mb_cmd {
  enum xgbe_mb_subcmd {
  	XGBE_MB_SUBCMD_NONE = 0,
+	XGBE_MB_SUBCMD_RX_ADAP,
  	/* 10GbE SFP subcommands */
  	XGBE_MB_SUBCMD_ACTIVE = 0,

drivers/net/ethernet/amd/xgbe/xgbe.h struct xgbe_prv_data { · line 1319

Quoted 3 lines
drivers/net/ethernet/amd/xgbe/xgbe.h +1 -0
@@ -1316,6 +1317,10 @@ struct xgbe_prv_data {
  	bool debugfs_an_cdr_workaround;
  	bool debugfs_an_cdr_track_early;
+	bool en_rx_adap;

nit: there is a 1 byte hole here (on x86_64)

I think even in the current form is ok. The total size of the struct is not going to change, due to alignment, and the fields will sit in the same cacheline in both cases.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I guess the layout could be changed later if needed.

Ok, I did think it was worth mentioning.
But I agree that it doesn't need to be changed at this time.

Thanks Simon for taking time to review the patch. I'll try to handle it at a later point in time.

Thanks, much appreciated.