[PATCH 2/2] PCI: imx6: Add imx_pcie_perst_found() to inspect the parsed result
Hongxing Zhu
hongxing.zhu at nxp.com
Thu May 21 23:05:30 PDT 2026
> -----Original Message-----
> From: Sherry Sun (OSS) <sherry.sun at oss.nxp.com>
> Sent: Friday, May 22, 2026 11:44 AM
> To: Hongxing Zhu <hongxing.zhu at nxp.com>; l.stach at pengutronix.de; Frank Li
> <frank.li at nxp.com>; bhelgaas at google.com; lpieralisi at kernel.org;
> kwilczynski at kernel.org; mani at kernel.org; robh at kernel.org;
> s.hauer at pengutronix.de; kernel at pengutronix.de; festevam at gmail.com;
> will at kernel.org
> Cc: imx at lists.linux.dev; linux-pci at vger.kernel.org; linux-arm-
> kernel at lists.infradead.org; linux-kernel at vger.kernel.org; Sherry Sun
> <sherry.sun at nxp.com>
> Subject: [PATCH 2/2] PCI: imx6: Add imx_pcie_perst_found() to inspect the
> parsed result
>
> From: Sherry Sun <sherry.sun at nxp.com>
>
> Since pci_host_common_parse_port() doesn't return failure for "property not
> found"(-ENODEV), the caller should inspect the parsed result and decide whether
One space should be placed before (-ENODEV).
> to fall back to the legacy binding.
> Add imx_pcie_perst_found() to inspect the parsed result.
>
> Signed-off-by: Sherry Sun <sherry.sun at nxp.com>
Reviewed-by: Richard Zhu <hongxing.zhu at nxp.com>
Best Regards
Richard Zhu
> ---
> drivers/pci/controller/dwc/pci-imx6.c | 25 +++++++++++++++++--------
> 1 file changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c
> b/drivers/pci/controller/dwc/pci-imx6.c
> index b137551871fc..34756f28fcc6 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -1287,6 +1287,18 @@ static void imx_pcie_assert_perst(struct imx_pcie
> *imx_pcie, bool assert)
> }
> }
>
> +static bool imx_pcie_perst_found(struct pci_host_bridge *bridge) {
> + struct pci_host_port *port;
> +
> + list_for_each_entry(port, &bridge->ports, list) {
> + if (!list_empty(&port->perst))
> + return true;
> + }
> +
> + return false;
> +}
> +
> static int imx_pcie_host_init(struct dw_pcie_rp *pp) {
> struct dw_pcie *pci = to_dw_pcie_from_pp(pp); @@ -1299,15 +1311,12
> @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp)
> /* Parse Root Port nodes if present */
> ret = pci_host_common_parse_ports(dev, bridge);
> if (ret) {
> - if (ret != -ENODEV) {
> - dev_err(dev, "Failed to parse Root Port
> nodes: %d\n", ret);
> - return ret;
> - }
> + dev_err(dev, "Failed to parse Root Port nodes: %d\n",
> ret);
> + return ret;
> + }
>
> - /*
> - * Fall back to legacy binding for DT backwards
> - * compatibility
> - */
> + /* Fallback to legacy binding for DT backwards compatibility. */
> + if (!imx_pcie_perst_found(bridge)) {
> ret = imx_pcie_parse_legacy_binding(imx_pcie);
> if (ret)
> return ret;
> --
> 2.37.1
More information about the linux-arm-kernel
mailing list