Skip to contentSkip to conversation

ixgbe: fixes for configuring link on x550a

PATCH New Emil Tantilov 2 participants 11 messages May 17, 2017 – May 18, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover ixgbe: fixes for configuring link on x550a

The following series introduces small fixes needed to address issues with setting up link on SFP+ based x550a parts.

---

Emil Tantilov (5):
ixgbe: correct CS4223/7 PHY identification
ixgbe: add write flush when configuring CS4223/7
ixgbe: always call setup_mac_link for multispeed fiber
ixgbe: add missing configuration for rate select 1
ixgbe: fix incorrect status check

 drivers/net/ethernet/intel/ixgbe/ixgbe_common.c |   37 ++++++++++++-----------
 drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h    |    5 ++-
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c   |   30 ++++++++++++++-----
 3 files changed, 45 insertions(+), 27 deletions(-)

--

#1 lore raw

PATCH 1/5 ixgbe: correct CS4223/7 PHY identification

Previous method was unreliable. Use a different register to diferentiate between the SKUs.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h  |    5 +++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c |    8 ++++----
 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h +3 -2
index 5aa2c3c..b0cac96 100644
@@ -84,8 +84,9 @@
 #define IXGBE_CS4227_GLOBAL_ID_LSB		0
 #define IXGBE_CS4227_GLOBAL_ID_MSB		1
 #define IXGBE_CS4227_SCRATCH			2
-#define IXGBE_CS4223_PHY_ID			0x7003	/* Quad port */
-#define IXGBE_CS4227_PHY_ID			0x3003	/* Dual port */
+#define IXGBE_CS4227_EFUSE_PDF_SKU		0x19F
+#define IXGBE_CS4223_SKU_ID			0x0010  /* Quad port */
+#define IXGBE_CS4227_SKU_ID			0x0014  /* Dual port */
 #define IXGBE_CS4227_RESET_PENDING		0x1357
 #define IXGBE_CS4227_RESET_COMPLETE		0x5AA5
 #define IXGBE_CS4227_RETRIES			15
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +4 -4
index b8d9097..870f9e1 100644
@@ -1807,16 +1807,16 @@ static s32 ixgbe_setup_sfi_x550a(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
 	if (hw->phy.mdio.prtad == MDIO_PRTAD_NONE)
 		return IXGBE_ERR_PHY_ADDR_INVALID;
 
-	/* Get external PHY device id */
-	ret_val = hw->phy.ops.read_reg(hw, IXGBE_CS4227_GLOBAL_ID_MSB,
-				  IXGBE_MDIO_ZERO_DEV_TYPE, &reg_phy_ext);
+	/* Get external PHY SKU id */
+	ret_val = hw->phy.ops.read_reg(hw, IXGBE_CS4227_EFUSE_PDF_SKU,
+				       IXGBE_MDIO_ZERO_DEV_TYPE, &reg_phy_ext);
 	if (ret_val)
 		return ret_val;
 
 	/* When configuring quad port CS4223, the MAC instance is part
 	 * of the slice offset.
 	 */
-	if (reg_phy_ext == IXGBE_CS4223_PHY_ID)
+	if (reg_phy_ext == IXGBE_CS4223_SKU_ID)
 		slice_offset = (hw->bus.lan_id +
 				(hw->bus.instance_id << 1)) << 12;
 	else
#2 lore raw

PATCH 1/5 ixgbe: correct CS4223/7 PHY identification

Quoted 8 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Emil Tantilov
Sent: Wednesday, May 17, 2017 3:18 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH 1/5] ixgbe: correct CS4223/7 PHY identification

Quoted 8 lines

Previous method was unreliable. Use a different register to diferentiate between the SKUs.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h  |    5 +++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c |    8 ++++----
 2 files changed, 7 insertions(+), 6 deletions(-)
#3 lore raw

PATCH 2/5 ixgbe: add write flush when configuring CS4223/7

In reply to Emil Tantilov

Make sure the writes are processed immediately. Without the flush it is possible for operations on one port to spill over the other as the resource is shared.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c |   20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +18 -2
index 870f9e1..cb5d363 100644
@@ -1824,12 +1824,28 @@ static s32 ixgbe_setup_sfi_x550a(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
 
 	/* Configure CS4227/CS4223 LINE side to proper mode. */
 	reg_slice = IXGBE_CS4227_LINE_SPARE24_LSB + slice_offset;
+
+	ret_val = hw->phy.ops.read_reg(hw, reg_slice,
+				       IXGBE_MDIO_ZERO_DEV_TYPE, &reg_phy_ext);
+	if (ret_val)
+		return ret_val;
+
+	reg_phy_ext &= ~((IXGBE_CS4227_EDC_MODE_CX1 << 1) |
+			 (IXGBE_CS4227_EDC_MODE_SR << 1));
+
 	if (setup_linear)
 		reg_phy_ext = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 1;
 	else
 		reg_phy_ext = (IXGBE_CS4227_EDC_MODE_SR << 1) | 1;
-	return hw->phy.ops.write_reg(hw, reg_slice, IXGBE_MDIO_ZERO_DEV_TYPE,
-				     reg_phy_ext);
+
+	ret_val = hw->phy.ops.write_reg(hw, reg_slice,
+					IXGBE_MDIO_ZERO_DEV_TYPE, reg_phy_ext);
+	if (ret_val)
+		return ret_val;
+
+	/* Flush previous write with a read */
+	return hw->phy.ops.read_reg(hw, reg_slice,
+				    IXGBE_MDIO_ZERO_DEV_TYPE, &reg_phy_ext);
 }
 
 /**
#4 lore raw

PATCH 2/5 ixgbe: add write flush when configuring CS4223/7

Quoted 12 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Emil Tantilov
Sent: Wednesday, May 17, 2017 3:18 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH 2/5] ixgbe: add write flush when configuring CS4223/7

Make sure the writes are processed immediately. Without the flush it is possible for operations on one port to spill over the other as the resource is shared.

Quoted 5 lines
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c |   20
++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
#5 lore raw

PATCH 3/5 ixgbe: always call setup_mac_link for multispeed fiber

In reply to Emil Tantilov

Remove the logic which would previously skip the link configuration in the case where we are already at the requested speed in ixgbe_setup_mac_link_multispeed_fiber().

By exiting early we are skipping the link configuration and as such the driver may not always configure the PHY correctly for SFP+.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.c |   18 ------------------
 1 file changed, 18 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +0 -18
index 3af6127..8a2e8bf8 100644
@@ -4121,15 +4121,6 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
 		speedcnt++;
 		highest_link_speed = IXGBE_LINK_SPEED_10GB_FULL;
 
-		/* If we already have link at this speed, just jump out */
-		status = hw->mac.ops.check_link(hw, &link_speed, &link_up,
-						false);
-		if (status)
-			return status;
-
-		if (link_speed == IXGBE_LINK_SPEED_10GB_FULL && link_up)
-			goto out;
-
 		/* Set the module link speed */
 		switch (hw->phy.media_type) {
 		case ixgbe_media_type_fiber:
@@ -4181,15 +4172,6 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
 		if (highest_link_speed == IXGBE_LINK_SPEED_UNKNOWN)
 			highest_link_speed = IXGBE_LINK_SPEED_1GB_FULL;
 
-		/* If we already have link at this speed, just jump out */
-		status = hw->mac.ops.check_link(hw, &link_speed, &link_up,
-						false);
-		if (status)
-			return status;
-
-		if (link_speed == IXGBE_LINK_SPEED_1GB_FULL && link_up)
-			goto out;
-
 		/* Set the module link speed */
 		switch (hw->phy.media_type) {
 		case ixgbe_media_type_fiber:
#6 lore raw

PATCH 3/5 ixgbe: always call setup_mac_link for multispeed fiber

Quoted 12 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Emil Tantilov
Sent: Wednesday, May 17, 2017 3:18 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH 3/5] ixgbe: always call setup_mac_link for multispeed fiber

Remove the logic which would previously skip the link configuration in the case where we are already at the requested speed in ixgbe_setup_mac_link_multispeed_fiber().

Quoted 7 lines

By exiting early we are skipping the link configuration and as such the driver may not always configure the PHY correctly for SFP+.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.c |   18 ------------------
 1 file changed, 18 deletions(-)
#7 lore raw

PATCH 4/5 ixgbe: add missing configuration for rate select 1

In reply to Emil Tantilov

Add RS1 configuration to ixgbe_set_soft_rate_select_speed()

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +19 -0
index 8a2e8bf8..9b8e594 100644
@@ -4278,4 +4278,23 @@ void ixgbe_set_soft_rate_select_speed(struct ixgbe_hw *hw,
 		hw_dbg(hw, "Failed to write Rx Rate Select RS0\n");
 		return;
 	}
+
+	/* Set RS1 */
+	status = hw->phy.ops.read_i2c_byte(hw, IXGBE_SFF_SFF_8472_ESCB,
+					   IXGBE_I2C_EEPROM_DEV_ADDR2,
+					   &eeprom_data);
+	if (status) {
+		hw_dbg(hw, "Failed to read Rx Rate Select RS1\n");
+		return;
+	}
+
+	eeprom_data = (eeprom_data & ~IXGBE_SFF_SOFT_RS_SELECT_MASK) | rs;
+
+	status = hw->phy.ops.write_i2c_byte(hw, IXGBE_SFF_SFF_8472_ESCB,
+					    IXGBE_I2C_EEPROM_DEV_ADDR2,
+					    eeprom_data);
+	if (status) {
+		hw_dbg(hw, "Failed to write Rx Rate Select RS1\n");
+		return;
+	}
 }
#8 lore raw

PATCH 4/5 ixgbe: add missing configuration for rate select 1

Quoted 8 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Emil Tantilov
Sent: Wednesday, May 17, 2017 3:18 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH 4/5] ixgbe: add missing configuration for rate select 1

Quoted 7 lines

Add RS1 configuration to ixgbe_set_soft_rate_select_speed()

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.c |   19
+++++++++++++++++++
 1 file changed, 19 insertions(+)
#9 lore raw

PATCH 5/5 ixgbe: fix incorrect status check

In reply to Emil Tantilov

Check for ret_val instead of !ret_val to allow the rest of the code to execute and configure the speed properly.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +1 -1
index cb5d363..47c8f24 100644
@@ -1798,7 +1798,7 @@ static s32 ixgbe_setup_sfi_x550a(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
 	if (ret_val == IXGBE_ERR_SFP_NOT_PRESENT)
 		return 0;
 
-	if (!ret_val)
+	if (ret_val)
 		return ret_val;
 
 	/* Configure internal PHY for KR/KX. */
#10 lore raw

PATCH 5/5 ixgbe: fix incorrect status check

Quoted 7 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Emil Tantilov
Sent: Wednesday, May 17, 2017 3:18 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH 5/5] ixgbe: fix incorrect status check

Quoted 7 lines

Check for ret_val instead of !ret_val to allow the rest of the code to execute and configure the speed properly.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)