-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update kernel with two patches to address PCIe link issues: - 312-PCI-imx6-Start-link-at-max-speed-first.patch Address link issues with QCA988X endpoints through PI7C9X2G608GP switch used on GW73xx-A/B/F+ board revisions - 313-PCI-imx6-de-duplicate-Link-up-message.patch de-dupliate PCIe link up messages Signed-off-by: Tim Harvey <[email protected]>
- Loading branch information
Showing
2 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
96 changes: 96 additions & 0 deletions
96
target/linux/imx/patches-5.15/312-PCI-imx6-Start-link-at-max-speed-first.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
From 1c0c14baea296354791ebf6371f2f7331549bfde Mon Sep 17 00:00:00 2001 | ||
From: Tim Harvey <[email protected]> | ||
Date: Fri, 18 Aug 2023 19:34:54 -0700 | ||
Subject: [PATCH 1/2] PCI: imx6: Start link at max speed first | ||
|
||
commit fa33a6d87eac ("PCI: imx6: Start link in Gen1 before negotiating | ||
for Gen2 mode") started link negotiation at Gen1 before attempting | ||
faster speeds in order to work around an issue with a particular switch | ||
on an IMX6Q SoC. | ||
|
||
Restore this behavior to the PCI standard of linking at the max speed | ||
first before a downgrade. This resolves a high rate of link failures | ||
with certain endpoints (QCA988x) when using a PCIe switch. | ||
|
||
Signed-off-by: Tim Harvey <[email protected]> | ||
--- | ||
drivers/pci/controller/dwc/pci-imx6.c | 60 ++++----------------------- | ||
1 file changed, 7 insertions(+), 53 deletions(-) | ||
|
||
diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c | ||
index 349a6daea5e8..6cea06688a81 100644 | ||
--- a/drivers/pci/controller/dwc/pci-imx6.c | ||
+++ b/drivers/pci/controller/dwc/pci-imx6.c | ||
@@ -797,62 +797,16 @@ static int imx6_pcie_start_link(struct dw_pcie *pci) | ||
u32 tmp; | ||
int ret; | ||
|
||
- /* | ||
- * Force Gen1 operation when starting the link. In case the link is | ||
- * started in Gen2 mode, there is a possibility the devices on the | ||
- * bus will not be detected at all. This happens with PCIe switches. | ||
- */ | ||
- tmp = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP); | ||
- tmp &= ~PCI_EXP_LNKCAP_SLS; | ||
- tmp |= PCI_EXP_LNKCAP_SLS_2_5GB; | ||
- dw_pcie_writel_dbi(pci, offset + PCI_EXP_LNKCAP, tmp); | ||
- | ||
/* Start LTSSM. */ | ||
imx6_pcie_ltssm_enable(dev); | ||
- | ||
- dw_pcie_wait_for_link(pci); | ||
- | ||
- if (pci->link_gen == 2) { | ||
- /* Allow Gen2 mode after the link is up. */ | ||
- tmp = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP); | ||
- tmp &= ~PCI_EXP_LNKCAP_SLS; | ||
- tmp |= PCI_EXP_LNKCAP_SLS_5_0GB; | ||
- dw_pcie_writel_dbi(pci, offset + PCI_EXP_LNKCAP, tmp); | ||
- | ||
- /* | ||
- * Start Directed Speed Change so the best possible | ||
- * speed both link partners support can be negotiated. | ||
- */ | ||
- tmp = dw_pcie_readl_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL); | ||
- tmp |= PORT_LOGIC_SPEED_CHANGE; | ||
- dw_pcie_writel_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL, tmp); | ||
- | ||
- if (imx6_pcie->drvdata->flags & | ||
- IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE) { | ||
- /* | ||
- * On i.MX7, DIRECT_SPEED_CHANGE behaves differently | ||
- * from i.MX6 family when no link speed transition | ||
- * occurs and we go Gen1 -> yep, Gen1. The difference | ||
- * is that, in such case, it will not be cleared by HW | ||
- * which will cause the following code to report false | ||
- * failure. | ||
- */ | ||
- | ||
- ret = imx6_pcie_wait_for_speed_change(imx6_pcie); | ||
- if (ret) { | ||
- dev_err(dev, "Failed to bring link up!\n"); | ||
- goto err_reset_phy; | ||
- } | ||
- } | ||
- | ||
- /* Make sure link training is finished as well! */ | ||
- dw_pcie_wait_for_link(pci); | ||
- } else { | ||
- dev_info(dev, "Link: Gen2 disabled\n"); | ||
- } | ||
- | ||
+ ret = dw_pcie_wait_for_link(pci); | ||
+ if (ret) | ||
+ goto err_reset_phy; | ||
tmp = dw_pcie_readw_dbi(pci, offset + PCI_EXP_LNKSTA); | ||
- dev_info(dev, "Link up, Gen%i\n", tmp & PCI_EXP_LNKSTA_CLS); | ||
+ dev_info(pci->dev, "PCIe Gen.%u x%u link up\n", | ||
+ FIELD_GET(PCI_EXP_LNKSTA_CLS, tmp), | ||
+ FIELD_GET(PCI_EXP_LNKSTA_NLW, tmp)); | ||
+ | ||
return 0; | ||
|
||
err_reset_phy: | ||
-- | ||
2.25.1 | ||
|
45 changes: 45 additions & 0 deletions
45
target/linux/imx/patches-5.15/313-PCI-imx6-de-duplicate-Link-up-message.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
From 13663a09dface74817d17f1a96135d9b85a0f23d Mon Sep 17 00:00:00 2001 | ||
From: Tim Harvey <[email protected]> | ||
Date: Thu, 21 Dec 2023 11:08:05 -0800 | ||
Subject: [PATCH 2/2] PCI: imx6: de-duplicate Link up message | ||
|
||
remove the link up message from dw_pcie_wait_for_link as it is already | ||
shown with more detail in imx6_pcie_start_link | ||
|
||
Signed-off-by: Tim Harvey <[email protected]> | ||
--- | ||
drivers/pci/controller/dwc/pcie-designware.c | 14 ++++++++------ | ||
1 file changed, 8 insertions(+), 6 deletions(-) | ||
|
||
diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c | ||
index 00972a7bc976..237c2f5df00a 100644 | ||
--- a/drivers/pci/controller/dwc/pcie-designware.c | ||
+++ b/drivers/pci/controller/dwc/pcie-designware.c | ||
@@ -528,16 +528,18 @@ int dw_pcie_wait_for_link(struct dw_pcie *pci) | ||
|
||
/* Check if the link is up or not */ | ||
for (retries = 0; retries < LINK_WAIT_MAX_RETRIES; retries++) { | ||
- if (dw_pcie_link_up(pci)) { | ||
- dev_info(pci->dev, "Link up\n"); | ||
- return 0; | ||
- } | ||
+ if (dw_pcie_link_up(pci)) | ||
+ break; | ||
+ | ||
usleep_range(LINK_WAIT_USLEEP_MIN, LINK_WAIT_USLEEP_MAX); | ||
} | ||
|
||
- dev_info(pci->dev, "Phy link never came up\n"); | ||
+ if (retries >= LINK_WAIT_MAX_RETRIES) { | ||
+ dev_info(pci->dev, "Phy link never came up\n"); | ||
+ return -ETIMEDOUT; | ||
+ } | ||
|
||
- return -ETIMEDOUT; | ||
+ return 0; | ||
} | ||
EXPORT_SYMBOL_GPL(dw_pcie_wait_for_link); | ||
|
||
-- | ||
2.25.1 | ||
|