Re: [PATCH] PCI: qcom: Handle mixed PERST#/PHY DT configuration
From: Dmitry Baryshkov
Date: Sun May 31 2026 - 07:08:43 EST
On Fri, May 08, 2026 at 02:54:19AM -0700, Qiang Yu wrote:
> The driver currently supports two PERST# and PHY DT configuration. In one
> case, PHY, PERST#, are described in the RC node. In the other case, they
> are described in the RP node.
>
> A mixed setup is not supported. One common example is PHY on the RP node
> while PERST# remains on the RC node. In that case the driver goes through
> the RP parse path, does not find PERST# on RP, and does not report an
> error because PERST# is optional. Probe can then succeed silently while
> PERST# is left uncontrolled, and PCIe endpoints fails to work later. This
> silent probe success makes debugging difficult.
>
> Handle this mixed case in the RP parse path by checking whether PERST# is
> present on RC and, if so, using the RC PERST# GPIO for RP ports while
> keeping RP parsing for PHY. Emit a warning to indicate mixed DT content so
> it can be fixed.
>
> This keeps mixed systems functional and makes the configuration issue
> visible instead of failing later at endpoint bring-up.
>
> Suggested-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxxxxxxxx>
> Signed-off-by: Qiang Yu <qiang.yu@xxxxxxxxxxxxxxxx>
> ---
> drivers/pci/controller/dwc/pcie-qcom.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> @@ -1778,6 +1785,14 @@ static int qcom_pcie_parse_ports(struct qcom_pcie *pcie)
> struct device *dev = pcie->pci->dev;
> int ret = -ENODEV;
>
> + if (of_find_property(dev->of_node, "perst-gpios", NULL)) {
> + pcie->reset = devm_gpiod_get_optional(dev, "perst", 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");
This patch breaks legacy DTs (I stumbled on it on SM8350 HDK), because
now devm_gpiod_get_optional() in qcom_pcie_parse_legacy_binding()
returns -EBUSY (as the GPIO is already requested here). I'll send a
patch fixing the issue, but it's sad to see existing platforms being
broken for the sake of undeclared "mixed" case.
--
With best wishes
Dmitry