Skip to contentSkip to conversation

PCI/pwrctrl: tc9563: Enable 8 GT/s equalization fine-tuning

PATCH Applied Abhishek Kumar 4 participants 4 messages Nov 19 – Nov 20

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

PATCH 1/1 PCI/pwrctrl: tc9563: Enable 8 GT/s equalization fine-tuning

On some boots, links on the PCIe switch report a continuous flood of correctable AER errors (RxErr, BadTLP and Replay Timer Timeout) at 8 GT/s. This happens because the 8 GT/s equalization fine-tuning setting is never programmed: max_num_of_fine_tuning_iterations_at_8gt in K_EQUTUNING_033_028 resets to 0, so equalization only selects a preset and never fine-tunes the transmitter coefficients for the channel, leaving the link with marginal signal quality.

Fix this by programming one fine-tuning iteration on the upstream port and downstream ports 1 and 2 at power-on, so that 8 GT/s equalization adapts the transmitter coefficients to the channel. With this setting the links no longer report any AER errors.

---
 drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +23 -0
index 4091a2f30aa7..d27b009430f1 100644
@@ -29,6 +29,9 @@
 #define TC9563_PORT_L0S_DELAY		0x82496c
 #define TC9563_PORT_L1_DELAY		0x824970
 
+#define TC9563_K_EQUTUNING_033_028	0x824a10
+#define TC9563_EQ_FINE_TUNING_ITER	1
+
 #define TC9563_EMBEDDED_ETH_DELAY	0x8200d8
 #define TC9563_ETH_L1_DELAY_MASK	GENMASK(27, 18)
 #define TC9563_ETH_L1_DELAY_VALUE(x)	FIELD_PREP(TC9563_ETH_L1_DELAY_MASK, x)
@@ -346,6 +349,20 @@ static int tc9563_pwrctrl_set_nfts(struct tc9563_pwrctrl *tc9563,
 				      ARRAY_SIZE(nfts_seq));
 }
 
+static int tc9563_pwrctrl_set_eq_fine_tuning(struct tc9563_pwrctrl *tc9563)
+{
+	int ret;
+
+	ret = regmap_write(tc9563->regmap, TC9563_PORT_SELECT,
+			   BIT(TC9563_USP) | BIT(TC9563_DSP1) |
+			   BIT(TC9563_DSP2));
+	if (ret)
+		return ret;
+
+	return regmap_write(tc9563->regmap, TC9563_K_EQUTUNING_033_028,
+			    TC9563_EQ_FINE_TUNING_ITER);
+}
+
 static int tc9563_pwrctrl_assert_deassert_reset(struct tc9563_pwrctrl *tc9563,
 						bool deassert)
 {
@@ -557,6 +574,12 @@ static int tc9563_pwrctrl_power_on(struct pci_pwrctrl *pwrctrl)
 	if (ret)
 		goto power_off;
 
+	ret = tc9563_pwrctrl_set_eq_fine_tuning(tc9563);
+	if (ret) {
+		dev_err(dev, "Failed to enable 8 GT/s EQ fine-tuning\n");
+		goto power_off;
+	}
+
 	for (i = 0; i < TC9563_MAX; i++) {
 		cfg = &tc9563->cfg[i];
 		ret = tc9563_pwrctrl_disable_port(tc9563, i);

---
base-commit: e8017d29067fd1310a65c3494ce1a1b492adbac6
change-id: 20261119-tc9563_fine_tune-1fee86f2e4a3

Best regards,

Signature · 1 line
Abhishek Kumar <[email protected]>
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] PCI/pwrctrl: tc9563: missing Fixes trailer for 8 GT/s EQ fine-tuning fix --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] PCI/pwrctrl: tc9563: missing Fixes trailer for 8 GT/s EQ fine-tuning fix
--

commit ae3834e64204d960937f7bf637e84695589097d7
Author: Abhishek Kumar <[email protected]>

Quoted 10 lines

PCI/pwrctrl: tc9563: Enable 8 GT/s equalization fine-tuning

On some boots, links on the PCIe switch report a continuous flood of correctable AER errors (RxErr, BadTLP and Replay Timer Timeout) at 8 GT/s. This happens because the 8 GT/s equalization fine-tuning setting is never programmed: max_num_of_fine_tuning_iterations_at_8gt in K_EQUTUNING_033_028 resets to 0, so equalization only selects a preset and never fine-tunes the transmitter coefficients for the channel, leaving the link with marginal signal quality.

Quoted 6 lines

Fix this by programming one fine-tuning iteration on the upstream port and downstream ports 1 and 2 at power-on, so that 8 GT/s equalization adapts the transmitter coefficients to the channel. With this setting the links no longer report any AER errors.

[Severity: Low]
This fixes a missing initialization step from when the TC9563 power control driver was introduced. Should this include:

Fixes 4c9c7be47310 ("PCI: pwrctrl: Add power control driver for TC9563")
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Abhishek Kumar
Quoted 8 lines · Abhishek Kumar

On some boots, links on the PCIe switch report a continuous flood of correctable AER errors (RxErr, BadTLP and Replay Timer Timeout) at 8 GT/s. This happens because the 8 GT/s equalization fine-tuning setting is never programmed: max_num_of_fine_tuning_iterations_at_8gt in K_EQUTUNING_033_028 resets to 0, so equalization only selects a preset and never fine-tunes the transmitter coefficients for the channel, leaving the link with marginal signal quality.

Quoted 7 lines

Fix this by programming one fine-tuning iteration on the upstream port and downstream ports 1 and 2 at power-on, so that 8 GT/s equalization adapts the transmitter coefficients to the channel. With this setting the links no longer report any AER errors.

---

#3 lore raw
In reply to Abhishek Kumar
Quoted 8 lines · Abhishek Kumar

On some boots, links on the PCIe switch report a continuous flood of correctable AER errors (RxErr, BadTLP and Replay Timer Timeout) at 8 GT/s. This happens because the 8 GT/s equalization fine-tuning setting is never programmed: max_num_of_fine_tuning_iterations_at_8gt in K_EQUTUNING_033_028 resets to 0, so equalization only selects a preset and never fine-tunes the transmitter coefficients for the channel, leaving the link with marginal signal quality.

Quoted 6 lines

Fix this by programming one fine-tuning iteration on the upstream port and downstream ports 1 and 2 at power-on, so that 8 GT/s equalization adapts the transmitter coefficients to the channel. With this setting the links no longer report any AER errors.

Applied to pci/pwrctrl for v7.5, thank you!

I added "Toshiba TC9563" to the commit log because this applies to only this device, not PCIe switches in general.

Quoted 61 lines
---
 drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +23 -1
index 4091a2f30aa7..d27b009430f1 100644
@@ -29,6 +29,9 @@
 #define TC9563_PORT_L0S_DELAY		0x82496c
 #define TC9563_PORT_L1_DELAY		0x824970
 
+#define TC9563_K_EQUTUNING_033_028	0x824a10
+#define TC9563_EQ_FINE_TUNING_ITER	1
+
 #define TC9563_EMBEDDED_ETH_DELAY	0x8200d8
 #define TC9563_ETH_L1_DELAY_MASK	GENMASK(27, 18)
 #define TC9563_ETH_L1_DELAY_VALUE(x)	FIELD_PREP(TC9563_ETH_L1_DELAY_MASK, x)
@@ -346,6 +349,20 @@ static int tc9563_pwrctrl_set_nfts(struct tc9563_pwrctrl *tc9563,
 				      ARRAY_SIZE(nfts_seq));
 }
 
+static int tc9563_pwrctrl_set_eq_fine_tuning(struct tc9563_pwrctrl *tc9563)
+{
+	int ret;
+
+	ret = regmap_write(tc9563->regmap, TC9563_PORT_SELECT,
+			   BIT(TC9563_USP) | BIT(TC9563_DSP1) |
+			   BIT(TC9563_DSP2));
+	if (ret)
+		return ret;
+
+	return regmap_write(tc9563->regmap, TC9563_K_EQUTUNING_033_028,
+			    TC9563_EQ_FINE_TUNING_ITER);
+}
+
 static int tc9563_pwrctrl_assert_deassert_reset(struct tc9563_pwrctrl *tc9563,
 						bool deassert)
 {
@@ -557,6 +574,12 @@ static int tc9563_pwrctrl_power_on(struct pci_pwrctrl *pwrctrl)
 	if (ret)
 		goto power_off;
 
+	ret = tc9563_pwrctrl_set_eq_fine_tuning(tc9563);
+	if (ret) {
+		dev_err(dev, "Failed to enable 8 GT/s EQ fine-tuning\n");
+		goto power_off;
+	}
+
 	for (i = 0; i < TC9563_MAX; i++) {
 		cfg = &tc9563->cfg[i];
 		ret = tc9563_pwrctrl_disable_port(tc9563, i);
 
---

base-commit: e8017d29067fd1310a65c3494ce1a1b492adbac6
change-id: 20261119-tc9563_fine_tune-1fee86f2e4a3

Best regards,

Signature · 1 line
Abhishek Kumar <[email protected]>