Re: [PATCH V8 05/13] PCI: imx6: Add support for parsing the reset property in new Root Port binding
From: Manivannan Sadhasivam
Date: Mon Mar 16 2026 - 02:04:43 EST
On Fri, Mar 13, 2026 at 10:08:15AM +0800, Sherry Sun wrote:
> The current DT binding for pci-imx6 specifies the 'reset-gpios' property
> in the host bridge node. However, the PERST# signal logically belongs to
> individual Root Ports rather than the host bridge itself. This becomes
> important when supporting PCIe KeyE connector and PCI power control
> framework for pci-imx6 driver, which requires properties to be specified
> in Root Port nodes.
>
> With the common Root Port parsing now handled in dw_pcie_host_init(),
> update the reset GPIO handling to use the parsed port list from
> bridge->ports. To maintain DT backwards compatibility, fallback to the
> legacy method of parsing the host bridge node if the reset property is
> not present in the Root Port node (indicated by an empty ports list).
>
> Signed-off-by: Sherry Sun <sherry.sun@xxxxxxx>
> ---
> drivers/pci/controller/dwc/pci-imx6.c | 74 +++++++++++++++++++++------
> 1 file changed, 59 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index 83beca5a1fc2..cb18e1579788 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -34,6 +34,7 @@
> #include <linux/pm_runtime.h>
>
> #include "../../pci.h"
> +#include "../pci-host-common.h"
> #include "pcie-designware.h"
>
> #define IMX8MQ_GPR_PCIE_REF_USE_PAD BIT(9)
> @@ -150,7 +151,6 @@ struct imx_lut_data {
>
> struct imx_pcie {
> struct dw_pcie *pci;
> - struct gpio_desc *reset_gpiod;
> struct clk_bulk_data *clks;
> int num_clks;
> bool supports_clkreq;
> @@ -1222,6 +1222,44 @@ static void imx_pcie_disable_device(struct pci_host_bridge *bridge,
> imx_pcie_remove_lut(imx_pcie, pci_dev_id(pdev));
> }
>
> +static int imx_pcie_parse_legacy_binding(struct imx_pcie *pcie)
> +{
> + struct device *dev = pcie->pci->dev;
> + struct pci_host_bridge *bridge = pcie->pci->pp.bridge;
> + struct pci_host_port *port;
> + struct gpio_desc *reset;
> +
> + if (!bridge) {
> + dev_err(dev, "Bridge not allocated yet\n");
> + return -EINVAL;
> + }
> +
> + /*
> + * For DT backward compatibility: if no Root Port nodes were parsed
> + * (indicated by empty ports list), parse reset-gpios from the host
> + * bridge node.
> + */
> + if (!list_empty(&bridge->ports))
You should move this check and the comment to imx_pcie_host_init() and call
imx_pcie_parse_legacy_binding() conditionally to make it clear that this is a
fallback.
- Mani
--
மணிவண்ணன் சதாசிவம்