Skip to contentSkip to conversation

PCI: dwc: Do not fail to probe when link is down

PATCH In review Fabio Estevam 2 participants 3 messages Jul 4, 2023 – Jul 10, 2023

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

PATCH 1/1 PCI: dwc: Do not fail to probe when link is down

From: Fabio Estevam <[email protected]>

Since commit da56a1bfbab5 ("PCI: dwc: Wait for link up only if link is started") the following probe error is observed when the PCI link is down:

imx6q-pcie 33800000.pcie: Phy link never came up
imx6q-pcie: probe of 33800000.pcie failed with error -110

The intention of commit 886a9c134755 ("PCI: dwc: Move link handling into common code") was to standardize the behavior of link down as explained in its commit log:

"The behavior for a link down was inconsistent as some drivers would fail probe in that case while others succeed. Let's standardize this to succeed as there are usecases where devices (and the link) appear later even without hotplug. For example, a reconfigured FPGA device."

Restore the original behavior by ignoring the error from dw_pcie_wait_for_link().

Fixes da56a1bfbab5 ("PCI: dwc: Wait for link up only if link is started")
---
 drivers/pci/controller/dwc/pcie-designware-host.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/pci/controller/dwc/pcie-designware-host.c +2 -5
index cf61733bf78d..af6a7cd060b1 100644
@@ -492,11 +492,8 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
 		if (ret)
 			goto err_remove_edma;
 
-		if (pci->ops && pci->ops->start_link) {
-			ret = dw_pcie_wait_for_link(pci);
-			if (ret)
-				goto err_stop_link;
-		}
+		if (pci->ops && pci->ops->start_link)
+			dw_pcie_wait_for_link(pci);
 	}
 
 	bridge->sysdata = pp;
Signature · 1 line
2.34.1
#1 lore raw
Quoted 32 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Since commit da56a1bfbab5 ("PCI: dwc: Wait for link up only if link is started") the following probe error is observed when the PCI link is down:

imx6q-pcie 33800000.pcie: Phy link never came up
imx6q-pcie: probe of 33800000.pcie failed with error -110

The intention of commit 886a9c134755 ("PCI: dwc: Move link handling into common code") was to standardize the behavior of link down as explained in its commit log:

"The behavior for a link down was inconsistent as some drivers would fail probe in that case while others succeed. Let's standardize this to succeed as there are usecases where devices (and the link) appear later even without hotplug. For example, a reconfigured FPGA device."

Restore the original behavior by ignoring the error from dw_pcie_wait_for_link().

Fixes da56a1bfbab5 ("PCI: dwc: Wait for link up only if link is started")
---
 drivers/pci/controller/dwc/pcie-designware-host.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/pci/controller/dwc/pcie-designware-host.c +0 -0
index cf61733bf78d..af6a7cd060b1 100644

drivers/pci/controller/dwc/pcie-designware-host.c int dw_pcie_host_init(struct dw_pcie_rp *pp) · line 496

Quoted 10 lines
drivers/pci/controller/dwc/pcie-designware-host.c +2 -5
@@ -492,11 +492,8 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
                if (ret)
                        goto err_remove_edma;
 
-               if (pci->ops && pci->ops->start_link) {
-                       ret = dw_pcie_wait_for_link(pci);
-                       if (ret)
-                               goto err_stop_link;
-               }
+               if (pci->ops && pci->ops->start_link)
+                       dw_pcie_wait_for_link(PCI);

We can discard this one as Johan sent a patch doing the full revert:
https://lkml.org/lkml/2023/7/6/204

Reviewed-by on v1 1/1
#2 lore raw
In reply to Fabio Estevam
Quoted 17 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Since commit da56a1bfbab5 ("PCI: dwc: Wait for link up only if link is started") the following probe error is observed when the PCI link is down:

imx6q-pcie 33800000.pcie: Phy link never came up
imx6q-pcie: probe of 33800000.pcie failed with error -110

The intention of commit 886a9c134755 ("PCI: dwc: Move link handling into common code") was to standardize the behavior of link down as explained in its commit log:

"The behavior for a link down was inconsistent as some drivers would fail probe in that case while others succeed. Let's standardize this to succeed as there are usecases where devices (and the link) appear later even without hotplug. For example, a reconfigured FPGA device."

Quoted 5 lines

Restore the original behavior by ignoring the error from dw_pcie_wait_for_link().

Fixes da56a1bfbab5 ("PCI: dwc: Wait for link up only if link is started")
Quoted 25 lines
---
 drivers/pci/controller/dwc/pcie-designware-host.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/pci/controller/dwc/pcie-designware-host.c +2 -5
index cf61733bf78d..af6a7cd060b1 100644
@@ -492,11 +492,8 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
 		if (ret)
 			goto err_remove_edma;
 
-		if (pci->ops && pci->ops->start_link) {
-			ret = dw_pcie_wait_for_link(pci);
-			if (ret)
-				goto err_stop_link;
-		}
+		if (pci->ops && pci->ops->start_link)
+			dw_pcie_wait_for_link(pci);
 	}
 
 	bridge->sysdata = pp;
Signature · 1 line
2.34.1

LGTM.