Skip to contentSkip to conversation

amd-xgbe: Miscellaneous fixes

PATCH Superseded Raju Rangoju 2 participants 8 messages Oct 19, 2022

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Raju Rangoju

author maintainer
#0 lore raw

v2 cover amd-xgbe: Miscellaneous fixes

(1) Fix the rrc for Yellow carp devices. CDR workaround path is disabled for YC devices, receiver reset cycle is not needed in such cases.

(2) Add enumerations for mailbox command and sub-commands. Instead of using hard-coded values, use enums.

(3) Enable PLL_CTL for fixed PHY modes only. Driver does not implement SW RRCM for Autoneg Off configuration, hence PLL is needed for fixed PHY modes only.

(4) Fix the SFP compliance codes check for DAC cables. Some of the passive cables have non-zero data at offset 6 in SFP EEPROM data. So, fix the sfp compliance codes check.

(5) Add a quirk for Molex passive cables to extend the rate

    ceiling to 0x78.

Raju Rangoju (5):
amd-xgbe: Yellow carp devices do not need rrc
amd-xgbe: use enums for mailbox cmd and sub_cmds
amd-xgbe: enable PLL_CTL for fixed PHY modes only
amd-xgbe: fix the SFP compliance codes check for DAC cables
amd-xgbe: add the bit rate quirk for Molex cables

 drivers/net/ethernet/amd/xgbe/xgbe-pci.c    |  5 ++
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 58 +++++++++++++--------
 drivers/net/ethernet/amd/xgbe/xgbe.h        | 26 +++++++++
 3 files changed, 68 insertions(+), 21 deletions(-)
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH v2 1/5 amd-xgbe: Yellow carp devices do not need rrc

Link stability issues are noticed on Yellow carp platforms when Receiver Reset Cycle is issued. Since the CDR workaround is disabled on these platforms, the Receiver Reset Cycle is not needed.

So, avoid issuing rrc on Yellow carp platforms.

Fixes dbb6c58b5a61 ("net: amd-xgbe: Add Support for Yellow Carp Ethernet device")

---
Changes since v1:
- Use the correct fixes tag
- Update the commit message

 drivers/net/ethernet/amd/xgbe/xgbe-pci.c    | 5 +++++
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 2 +-
 drivers/net/ethernet/amd/xgbe/xgbe.h        | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/xgbe/xgbe-pci.c +5 -0
index 2af3da4b2d05..f409d7bd1f1e 100644
@@ -285,6 +285,9 @@ static int xgbe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 		/* Yellow Carp devices do not need cdr workaround */
 		pdata->vdata->an_cdr_workaround = 0;
+
+		/* Yellow Carp devices do not need rrc */
+		pdata->vdata->enable_rrc = 0;
 	} else {
 		pdata->xpcs_window_def_reg = PCS_V2_WINDOW_DEF;
 		pdata->xpcs_window_sel_reg = PCS_V2_WINDOW_SELECT;
@@ -483,6 +486,7 @@ static struct xgbe_version_data xgbe_v2a = {
 	.tx_desc_prefetch		= 5,
 	.rx_desc_prefetch		= 5,
 	.an_cdr_workaround		= 1,
+	.enable_rrc			= 1,
 };
 
 static struct xgbe_version_data xgbe_v2b = {
@@ -498,6 +502,7 @@ static struct xgbe_version_data xgbe_v2b = {
 	.tx_desc_prefetch		= 5,
 	.rx_desc_prefetch		= 5,
 	.an_cdr_workaround		= 1,
+	.enable_rrc			= 1,
 };
 
 static const struct pci_device_id xgbe_pci_table[] = {
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +1 -1
index 2156600641b6..19b943eba560 100644
@@ -2640,7 +2640,7 @@ static int xgbe_phy_link_status(struct xgbe_prv_data *pdata, int *an_restart)
 	}
 
 	/* No link, attempt a receiver reset cycle */
-	if (phy_data->rrc_count++ > XGBE_RRC_FREQUENCY) {
+	if (pdata->vdata->enable_rrc && phy_data->rrc_count++ > XGBE_RRC_FREQUENCY) {
 		phy_data->rrc_count = 0;
 		xgbe_phy_rrc(pdata);
 	}
drivers/net/ethernet/amd/xgbe/xgbe.h +1 -0
index b875c430222e..49d23abce73d 100644
@@ -1013,6 +1013,7 @@ struct xgbe_version_data {
 	unsigned int tx_desc_prefetch;
 	unsigned int rx_desc_prefetch;
 	unsigned int an_cdr_workaround;
+	unsigned int enable_rrc;
 };
 
 struct xgbe_prv_data {
Signature · 1 line
2.25.1
author maintainer
#2 lore raw

PATCH v2 2/5 amd-xgbe: use enums for mailbox cmd and sub_cmds

In reply to Raju Rangoju

Instead of using hardcoded values, use enumerations for mailbox command and sub commands.

---
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 29 ++++++++++++---------
 drivers/net/ethernet/amd/xgbe/xgbe.h        | 25 ++++++++++++++++++
 2 files changed, 41 insertions(+), 13 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +16 -13
index 19b943eba560..8cf5d81fca36 100644
@@ -1989,7 +1989,7 @@ static void xgbe_phy_pll_ctrl(struct xgbe_prv_data *pdata, bool enable)
 }
 
 static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
-					unsigned int cmd, unsigned int sub_cmd)
+					enum xgbe_mb_cmd cmd, enum xgbe_mb_subcmd sub_cmd)
 {
 	unsigned int s0 = 0;
 	unsigned int wait;
@@ -2036,7 +2036,7 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
 static void xgbe_phy_rrc(struct xgbe_prv_data *pdata)
 {
 	/* Receiver Reset Cycle */
-	xgbe_phy_perform_ratechange(pdata, 5, 0);
+	xgbe_phy_perform_ratechange(pdata, XGBE_MB_CMD_RRC, XGBE_MB_SUBCMD_NONE);
 
 	netif_dbg(pdata, link, pdata->netdev, "receiver reset complete\n");
 }
@@ -2046,7 +2046,7 @@ static void xgbe_phy_power_off(struct xgbe_prv_data *pdata)
 	struct xgbe_phy_data *phy_data = pdata->phy_data;
 
 	/* Power off */
-	xgbe_phy_perform_ratechange(pdata, 0, 0);
+	xgbe_phy_perform_ratechange(pdata, XGBE_MB_CMD_POWER_OFF, XGBE_MB_SUBCMD_NONE);
 
 	phy_data->cur_mode = XGBE_MODE_UNKNOWN;
 
@@ -2061,14 +2061,17 @@ static void xgbe_phy_sfi_mode(struct xgbe_prv_data *pdata)
 
 	/* 10G/SFI */
 	if (phy_data->sfp_cable != XGBE_SFP_CABLE_PASSIVE) {
-		xgbe_phy_perform_ratechange(pdata, 3, 0);
+		xgbe_phy_perform_ratechange(pdata, XGBE_MB_CMD_SET_10G_SFI, XGBE_MB_SUBCMD_ACTIVE);
 	} else {
 		if (phy_data->sfp_cable_len <= 1)
-			xgbe_phy_perform_ratechange(pdata, 3, 1);
+			xgbe_phy_perform_ratechange(pdata, XGBE_MB_CMD_SET_10G_SFI,
+						    XGBE_MB_SUBCMD_PASSIVE_1M);
 		else if (phy_data->sfp_cable_len <= 3)
-			xgbe_phy_perform_ratechange(pdata, 3, 2);
+			xgbe_phy_perform_ratechange(pdata, XGBE_MB_CMD_SET_10G_SFI,
+						    XGBE_MB_SUBCMD_PASSIVE_3M);
 		else
-			xgbe_phy_perform_ratechange(pdata, 3, 3);
+			xgbe_phy_perform_ratechange(pdata, XGBE_MB_CMD_SET_10G_SFI,
+						    XGBE_MB_SUBCMD_PASSIVE_OTHER);
 	}
 
 	phy_data->cur_mode = XGBE_MODE_SFI;
@@ -2083,7 +2086,7 @@ static void xgbe_phy_x_mode(struct xgbe_prv_data *pdata)
 	xgbe_phy_set_redrv_mode(pdata);
 
 	/* 1G/X */
-	xgbe_phy_perform_ratechange(pdata, 1, 3);
+	xgbe_phy_perform_ratechange(pdata, XGBE_MB_CMD_SET_1G, XGBE_MB_SUBCMD_1G_KX);
 
 	phy_data->cur_mode = XGBE_MODE_X;
 
@@ -2097,7 +2100,7 @@ static void xgbe_phy_sgmii_1000_mode(struct xgbe_prv_data *pdata)
 	xgbe_phy_set_redrv_mode(pdata);
 
 	/* 1G/SGMII */
-	xgbe_phy_perform_ratechange(pdata, 1, 2);
+	xgbe_phy_perform_ratechange(pdata, XGBE_MB_CMD_SET_1G, XGBE_MB_SUBCMD_1G_SGMII);
 
 	phy_data->cur_mode = XGBE_MODE_SGMII_1000;
 
@@ -2111,7 +2114,7 @@ static void xgbe_phy_sgmii_100_mode(struct xgbe_prv_data *pdata)
 	xgbe_phy_set_redrv_mode(pdata);
 
 	/* 100M/SGMII */
-	xgbe_phy_perform_ratechange(pdata, 1, 1);
+	xgbe_phy_perform_ratechange(pdata, XGBE_MB_CMD_SET_1G, XGBE_MB_SUBCMD_100MBITS);
 
 	phy_data->cur_mode = XGBE_MODE_SGMII_100;
 
@@ -2125,7 +2128,7 @@ static void xgbe_phy_kr_mode(struct xgbe_prv_data *pdata)
 	xgbe_phy_set_redrv_mode(pdata);
 
 	/* 10G/KR */
-	xgbe_phy_perform_ratechange(pdata, 4, 0);
+	xgbe_phy_perform_ratechange(pdata, XGBE_MB_CMD_SET_10G_KR, XGBE_MB_SUBCMD_NONE);
 
 	phy_data->cur_mode = XGBE_MODE_KR;
 
@@ -2139,7 +2142,7 @@ static void xgbe_phy_kx_2500_mode(struct xgbe_prv_data *pdata)
 	xgbe_phy_set_redrv_mode(pdata);
 
 	/* 2.5G/KX */
-	xgbe_phy_perform_ratechange(pdata, 2, 0);
+	xgbe_phy_perform_ratechange(pdata, XGBE_MB_CMD_SET_2_5G, XGBE_MB_SUBCMD_NONE);
 
 	phy_data->cur_mode = XGBE_MODE_KX_2500;
 
@@ -2153,7 +2156,7 @@ static void xgbe_phy_kx_1000_mode(struct xgbe_prv_data *pdata)
 	xgbe_phy_set_redrv_mode(pdata);
 
 	/* 1G/KX */
-	xgbe_phy_perform_ratechange(pdata, 1, 3);
+	xgbe_phy_perform_ratechange(pdata, XGBE_MB_CMD_SET_1G, XGBE_MB_SUBCMD_1G_KX);
 
 	phy_data->cur_mode = XGBE_MODE_KX_1000;
 
drivers/net/ethernet/amd/xgbe/xgbe.h +25 -0
index 49d23abce73d..71f24cb47935 100644
@@ -611,6 +611,31 @@ enum xgbe_mdio_mode {
 	XGBE_MDIO_MODE_CL45,
 };
 
+enum xgbe_mb_cmd {
+	XGBE_MB_CMD_POWER_OFF = 0,
+	XGBE_MB_CMD_SET_1G,
+	XGBE_MB_CMD_SET_2_5G,
+	XGBE_MB_CMD_SET_10G_SFI,
+	XGBE_MB_CMD_SET_10G_KR,
+	XGBE_MB_CMD_RRC
+};
+
+enum xgbe_mb_subcmd {
+	XGBE_MB_SUBCMD_NONE = 0,
+
+	/* 10GbE SFP subcommands */
+	XGBE_MB_SUBCMD_ACTIVE = 0,
+	XGBE_MB_SUBCMD_PASSIVE_1M,
+	XGBE_MB_SUBCMD_PASSIVE_3M,
+	XGBE_MB_SUBCMD_PASSIVE_OTHER,
+
+	/* 1GbE Mode subcommands */
+	XGBE_MB_SUBCMD_10MBITS = 0,
+	XGBE_MB_SUBCMD_100MBITS,
+	XGBE_MB_SUBCMD_1G_SGMII,
+	XGBE_MB_SUBCMD_1G_KX
+};
+
 struct xgbe_phy {
 	struct ethtool_link_ksettings lks;
 
Signature · 1 line
2.25.1
author maintainer
#3 lore raw

PATCH v2 3/5 amd-xgbe: enable PLL_CTL for fixed PHY modes only

In reply to Raju Rangoju

PLL control setting(RRC) is needed only in fixed PHY configuration to fix the peer-peer issues. Without the PLL control setting, the link up takes longer time in a fixed phy configuration.

Driver implements SW RRC for Autoneg On configuration, hence PLL control setting (RRC) is not needed for AN On configuration, and can be skipped.

Also, PLL re-initialization is not needed for PHY Power Off and RRCM commands. Otherwise, they lead to mailbox errors. Added the changes accordingly.

Fixes daf182d360e5 ("net: amd-xgbe: Toggle PLL settings during rate change")

---
Changes since v1:
- used enums for all mailxbox command and subcommands, pre-patch to this contains the enum updates
- updated the comment section to include RRC command
- updated the commit message to use RRC instead of RRCM

 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +8 -2
index 8cf5d81fca36..b9c65322248a 100644
@@ -1979,6 +1979,10 @@ static void xgbe_phy_rx_reset(struct xgbe_prv_data *pdata)
 
 static void xgbe_phy_pll_ctrl(struct xgbe_prv_data *pdata, bool enable)
 {
+	/* PLL_CTRL feature needs to be enabled for fixed PHY modes (Non-Autoneg) only */
+	if (pdata->phy.autoneg != AUTONEG_DISABLE)
+		return;
+
 	XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_VEND2_PMA_MISC_CTRL0,
 			 XGBE_PMA_PLL_CTRL_MASK,
 			 enable ? XGBE_PMA_PLL_CTRL_ENABLE
@@ -2029,8 +2033,10 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
 	xgbe_phy_rx_reset(pdata);
 
 reenable_pll:
-	/* Enable PLL re-initialization */
-	xgbe_phy_pll_ctrl(pdata, true);
+	/* Enable PLL re-initialization, not needed for PHY Power Off and RRC cmds */
+	if (cmd != XGBE_MAILBOX_CMD_POWER_OFF &&
+	    cmd != XGBE_MAILBOX_CMD_RRCM)
+		xgbe_phy_pll_ctrl(pdata, true);
 }
 
 static void xgbe_phy_rrc(struct xgbe_prv_data *pdata)
Signature · 1 line
2.25.1
#4 lore raw

Re: [PATCH v2 net 3/5] amd-xgbe: enable PLL_CTL for fixed PHY modes only

Quoted 8 lines · Raju Rangoju

PLL control setting(RRC) is needed only in fixed PHY configuration to fix the peer-peer issues. Without the PLL control setting, the link up takes longer time in a fixed phy configuration.

Driver implements SW RRC for Autoneg On configuration, hence PLL control setting (RRC) is not needed for AN On configuration, and can be skipped.

Also, PLL re-initialization is not needed for PHY Power Off and RRCM

s/RRCM/RRC/

Quoted 31 lines

commands. Otherwise, they lead to mailbox errors. Added the changes accordingly.

Fixes daf182d360e5 ("net: amd-xgbe: Toggle PLL settings during rate change")

---
Changes since v1:
- used enums for all mailxbox command and subcommands, pre-patch to this contains the enum updates
- updated the comment section to include RRC command
- updated the commit message to use RRC instead of RRCM

  drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +4 -0
index 8cf5d81fca36..b9c65322248a 100644
@@ -1979,6 +1979,10 @@ static void xgbe_phy_rx_reset(struct xgbe_prv_data *pdata)
 
  static void xgbe_phy_pll_ctrl(struct xgbe_prv_data *pdata, bool enable)
  {
+	/* PLL_CTRL feature needs to be enabled for fixed PHY modes (Non-Autoneg) only */
+	if (pdata->phy.autoneg != AUTONEG_DISABLE)
+		return;
+
  	XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_VEND2_PMA_MISC_CTRL0,
  			 XGBE_PMA_PLL_CTRL_MASK,
  			 enable ? XGBE_PMA_PLL_CTRL_ENABLE

drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata, · line 2038

Quoted 8 lines
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +3 -2
@@ -2029,8 +2033,10 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
  	xgbe_phy_rx_reset(pdata);
 
  reenable_pll:
-	/* Enable PLL re-initialization */
-	xgbe_phy_pll_ctrl(pdata, true);
+	/* Enable PLL re-initialization, not needed for PHY Power Off and RRC cmds */
+	if (cmd != XGBE_MAILBOX_CMD_POWER_OFF &&
+	    cmd != XGBE_MAILBOX_CMD_RRCM)

XGBE_MAILBOX_CMD_RRCM isn't defined, so this patch won't build.

Thanks,
Tom

Quoted 4 lines
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +1 -0
+		xgbe_phy_pll_ctrl(pdata, true);
  }
 
  static void xgbe_phy_rrc(struct xgbe_prv_data *pdata)
#5 lore raw

Re: [PATCH v2 net 3/5] amd-xgbe: enable PLL_CTL for fixed PHY modes only

Quoted 44 lines · Tom Lendacky
Quoted 8 lines · Raju Rangoju

PLL control setting(RRC) is needed only in fixed PHY configuration to fix the peer-peer issues. Without the PLL control setting, the link up takes longer time in a fixed phy configuration.

Driver implements SW RRC for Autoneg On configuration, hence PLL control setting (RRC) is not needed for AN On configuration, and can be skipped.

Also, PLL re-initialization is not needed for PHY Power Off and RRCM

s/RRCM/RRC/

Quoted 32 lines

commands. Otherwise, they lead to mailbox errors. Added the changes accordingly.

Fixes daf182d360e5 ("net: amd-xgbe: Toggle PLL settings during rate change")

---
Changes since v1:
- used enums for all mailxbox command and subcommands, pre-patch to this contains the enum updates
- updated the comment section to include RRC command
- updated the commit message to use RRC instead of RRCM

  drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 10 ++++++++--

  1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +1 -0
index 8cf5d81fca36..b9c65322248a 100644
@@ -1979,6 +1979,10 @@ static void xgbe_phy_rx_reset(struct 
 xgbe_prv_data *pdata)
   static void xgbe_phy_pll_ctrl(struct xgbe_prv_data *pdata, bool enable)
   {
+    /* PLL_CTRL feature needs to be enabled for fixed PHY modes 

(Non-Autoneg) only */
+    if (pdata->phy.autoneg != AUTONEG_DISABLE)
+        return;
+
      XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_VEND2_PMA_MISC_CTRL0, XGBE_PMA_PLL_CTRL_MASK,
               enable ? XGBE_PMA_PLL_CTRL_ENABLE

drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +0 -0
@@ -2029,8 +2033,10 @@ static void xgbe_phy_perform_ratechange(struct 
Quoted 8 lines
Quoted 8 lines
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +0 -0
 xgbe_prv_data *pdata,
       xgbe_phy_rx_reset(pdata);

  reenable_pll:
-    /* Enable PLL re-initialization */
-    xgbe_phy_pll_ctrl(pdata, true);
+    /* Enable PLL re-initialization, not needed for PHY Power Off and RRC cmds */
+    if (cmd != XGBE_MAILBOX_CMD_POWER_OFF &&

Also, XGBE_MAILBOX_CMD_POWER_OFF isn't defined.

Thanks,
Tom

Quoted 10 lines
Quoted 1 line

+        cmd != XGBE_MAILBOX_CMD_RRCM)

XGBE_MAILBOX_CMD_RRCM isn't defined, so this patch won't build.

Thanks,
Tom

Quoted 3 lines

+        xgbe_phy_pll_ctrl(pdata, true);
  }
  static void xgbe_phy_rrc(struct xgbe_prv_data *pdata)

author maintainer
#6 lore raw

PATCH v2 4/5 amd-xgbe: fix the SFP compliance codes check for DAC cables

In reply to Raju Rangoju

The current XGBE code assumes that offset 6 of EEPROM SFP DAC (passive) cables is NULL. However, some cables (the 5 meter and 7 meter Molex passive cables) have non-zero data at offset 6. Fix the logic by moving the passive cable check above the active so as not to be improperly identified as an active cable. This will fix the issue for any passive cable that advertises 1000Base-CX in offset 6.

Fixes abf0a1c2b26a ("amd-xgbe: Add support for SFP+ modules")

---
Changes since v1:
- Split the changes into two patches. The next patch contains the Vendor specific quirk.
- Add a vendor check for Molex cables before assigning bit rate ceiling

 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +4 -4
index b9c65322248a..bd67a2a71048 100644
@@ -1151,7 +1151,10 @@ static void xgbe_phy_sfp_parse_eeprom(struct xgbe_prv_data *pdata)
 	}
 
 	/* Determine the type of SFP */
-	if (sfp_base[XGBE_SFP_BASE_10GBE_CC] & XGBE_SFP_BASE_10GBE_CC_SR)
+	if (phy_data->sfp_cable == XGBE_SFP_CABLE_PASSIVE &&
+	    xgbe_phy_sfp_bit_rate(sfp_eeprom, XGBE_SFP_SPEED_10000))
+		phy_data->sfp_base = XGBE_SFP_BASE_10000_CR;
+	else if (sfp_base[XGBE_SFP_BASE_10GBE_CC] & XGBE_SFP_BASE_10GBE_CC_SR)
 		phy_data->sfp_base = XGBE_SFP_BASE_10000_SR;
 	else if (sfp_base[XGBE_SFP_BASE_10GBE_CC] & XGBE_SFP_BASE_10GBE_CC_LR)
 		phy_data->sfp_base = XGBE_SFP_BASE_10000_LR;
@@ -1167,9 +1170,6 @@ static void xgbe_phy_sfp_parse_eeprom(struct xgbe_prv_data *pdata)
 		phy_data->sfp_base = XGBE_SFP_BASE_1000_CX;
 	else if (sfp_base[XGBE_SFP_BASE_1GBE_CC] & XGBE_SFP_BASE_1GBE_CC_T)
 		phy_data->sfp_base = XGBE_SFP_BASE_1000_T;
-	else if ((phy_data->sfp_cable == XGBE_SFP_CABLE_PASSIVE) &&
-		 xgbe_phy_sfp_bit_rate(sfp_eeprom, XGBE_SFP_SPEED_10000))
-		phy_data->sfp_base = XGBE_SFP_BASE_10000_CR;
 
 	switch (phy_data->sfp_base) {
 	case XGBE_SFP_BASE_1000_T:
Signature · 1 line
2.25.1
author maintainer
#7 lore raw

PATCH v2 5/5 amd-xgbe: add the bit rate quirk for Molex cables

In reply to Raju Rangoju

The offset 12 (bit-rate) of EEPROM SFP DAC (passive) cables is expected to be in the range 0x64 to 0x68. However, the 5 meter and 7 meter Molex passive cables have the rate ceiling 0x78 at offset 12.

Add a quirk for Molex passive cables to extend the rate ceiling to 0x78.

Fixes abf0a1c2b26a ("amd-xgbe: Add support for SFP+ modules")
---
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +8 -1
index bd67a2a71048..70cad8b36fc7 100644
@@ -239,6 +239,7 @@ enum xgbe_sfp_speed {
 #define XGBE_SFP_BASE_BR_1GBE_MAX		0x0d
 #define XGBE_SFP_BASE_BR_10GBE_MIN		0x64
 #define XGBE_SFP_BASE_BR_10GBE_MAX		0x68
+#define XGBE_MOLEX_SFP_BASE_BR_10GBE_MAX	0x78
 
 #define XGBE_SFP_BASE_CU_CABLE_LEN		18
 
@@ -284,6 +285,8 @@ struct xgbe_sfp_eeprom {
 #define XGBE_BEL_FUSE_VENDOR	"BEL-FUSE        "
 #define XGBE_BEL_FUSE_PARTNO	"1GBT-SFP06      "
 
+#define XGBE_MOLEX_VENDOR	"Molex Inc.      "
+
 struct xgbe_sfp_ascii {
 	union {
 		char vendor[XGBE_SFP_BASE_VENDOR_NAME_LEN + 1];
@@ -834,7 +837,11 @@ static bool xgbe_phy_sfp_bit_rate(struct xgbe_sfp_eeprom *sfp_eeprom,
 		break;
 	case XGBE_SFP_SPEED_10000:
 		min = XGBE_SFP_BASE_BR_10GBE_MIN;
-		max = XGBE_SFP_BASE_BR_10GBE_MAX;
+		if (memcmp(&sfp_eeprom->base[XGBE_SFP_BASE_VENDOR_NAME],
+			   XGBE_MOLEX_VENDOR, XGBE_SFP_BASE_VENDOR_NAME_LEN) == 0)
+			max = XGBE_MOLEX_SFP_BASE_BR_10GBE_MAX;
+		else
+			max = XGBE_SFP_BASE_BR_10GBE_MAX;
 		break;
 	default:
 		return false;
Signature · 1 line
2.25.1