The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] PCI: qcom: avoid duplicate PERST# GPIO acquisition in legacy path
@ 2026-05-26 11:32 Kathiravan Thirumoorthy
  2026-05-26 14:46 ` Manivannan Sadhasivam
  2026-05-26 14:54 ` Bjorn Andersson
  0 siblings, 2 replies; 3+ messages in thread
From: Kathiravan Thirumoorthy @ 2026-05-26 11:32 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas,
	Konrad Dybcio, Qiang Yu
  Cc: linux-pci, linux-arm-msm, linux-kernel, Kathiravan Thirumoorthy

Commit deed8aec62dc ("PCI: qcom: Handle mixed PERST#/PHY DT
configuration") handles the case where the PHY is moved to the Root
Port node while PERST# remains in the RC node by acquiring the PERST#
GPIO during Root Port parsing.

However, on platforms such as IPQ5424, both PERST# and PHY are
described under the RC node and are intended to be handled via the
legacy binding path. Since PERST# is already acquired during Root Port
parsing, attempting to acquire it again in the legacy path fails,
resulting in probe failures as shown below:

[    1.571859] qcom-pcie 18000000.pcie: probe with driver qcom-pcie failed with error -16
[    1.571909] qcom-pcie 10000000.pcie: probe with driver qcom-pcie failed with error -16
[    1.571973] qcom-pcie 20000000.pcie: probe with driver qcom-pcie failed with error -16

Fix this by removing the redundant GPIO acquisition from
qcom_pcie_parse_legacy_binding() and reusing the PERST# descriptor
obtained in qcom_pcie_parse_ports().

While at it, move the warning message to qcom_pcie_parse_perst() to
avoid polluting dmesg when the legacy binding is used.

Fixes: deed8aec62dc ("PCI: qcom: Handle mixed PERST#/PHY DT configuration")
Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
---
 drivers/pci/controller/dwc/pcie-qcom.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 11fc60489892..77cbd204ac5c 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1824,6 +1824,7 @@ static int qcom_pcie_parse_perst(struct qcom_pcie *pcie,
 	int ret;
 
 	if (pcie->reset) {
+		dev_warn(dev, "Reusing PERST# from Root Complex node. DT needs to be fixed!\n");
 		reset = pcie->reset;
 		goto skip_perst_parsing;
 	}
@@ -1912,8 +1913,6 @@ static int qcom_pcie_parse_ports(struct qcom_pcie *pcie)
 						      GPIOD_OUT_HIGH);
 		if (IS_ERR(pcie->reset))
 			return PTR_ERR(pcie->reset);
-
-		dev_warn(dev, "Reusing PERST# from Root Complex node. DT needs to be fixed!\n");
 	}
 
 	for_each_available_child_of_node_scoped(dev->of_node, of_port) {
@@ -1942,7 +1941,6 @@ static int qcom_pcie_parse_legacy_binding(struct qcom_pcie *pcie)
 	struct device *dev = pcie->pci->dev;
 	struct qcom_pcie_perst *perst;
 	struct qcom_pcie_port *port;
-	struct gpio_desc *reset;
 	struct phy *phy;
 	int ret;
 
@@ -1950,10 +1948,6 @@ static int qcom_pcie_parse_legacy_binding(struct qcom_pcie *pcie)
 	if (IS_ERR(phy))
 		return PTR_ERR(phy);
 
-	reset = devm_gpiod_get_optional(dev, "perst", GPIOD_OUT_HIGH);
-	if (IS_ERR(reset))
-		return PTR_ERR(reset);
-
 	ret = phy_init(phy);
 	if (ret)
 		return ret;
@@ -1970,7 +1964,7 @@ static int qcom_pcie_parse_legacy_binding(struct qcom_pcie *pcie)
 	INIT_LIST_HEAD(&port->list);
 	list_add_tail(&port->list, &pcie->ports);
 
-	perst->desc = reset;
+	perst->desc = pcie->reset;
 	INIT_LIST_HEAD(&port->perst);
 	INIT_LIST_HEAD(&perst->list);
 	list_add_tail(&perst->list, &port->perst);

---
base-commit: d387b06f7c15b4639244ad66b4b0900c6a02b430
change-id: 20260525-fix_perst_gpio_handling-5a4fee9228fd

Best regards,
--  
Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-26 14:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-26 11:32 [PATCH] PCI: qcom: avoid duplicate PERST# GPIO acquisition in legacy path Kathiravan Thirumoorthy
2026-05-26 14:46 ` Manivannan Sadhasivam
2026-05-26 14:54 ` Bjorn Andersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox