[PATCH 2/3 v2] PCI: s32g: Add initial PCIe support (RC)

Manivannan Sadhasivam mani at kernel.org
Mon Sep 29 09:32:27 PDT 2025


On Mon, Sep 29, 2025 at 06:23:05PM +0200, Vincent Guittot wrote:

[...]

> > > > > +static int s32g_pcie_resume(struct device *dev)
> > > > > +{
> > > > > +     struct s32g_pcie *s32g_pp = dev_get_drvdata(dev);
> > > > > +     struct dw_pcie *pci = &s32g_pp->pci;
> > > > > +     struct dw_pcie_rp *pp = &pci->pp;
> > > > > +     int ret = 0;
> > > > > +
> > > > > +     ret = s32g_pcie_init(dev, s32g_pp);
> > > > > +     if (ret < 0)
> > > > > +             return ret;
> > > > > +
> > > > > +     ret = dw_pcie_setup_rc(pp);
> > > > > +     if (ret) {
> > > > > +             dev_err(dev, "Failed to resume DW RC: %d\n", ret);
> > > > > +             goto fail_host_init;
> > > > > +     }
> > > > > +
> > > > > +     ret = dw_pcie_start_link(pci);
> > > > > +     if (ret) {
> > > > > +             /*
> > > > > +              * We do not exit with error if link up was unsuccessful
> > > > > +              * Endpoint may not be connected.
> > > > > +              */
> > > > > +             if (dw_pcie_wait_for_link(pci))
> > > > > +                     dev_warn(pci->dev,
> > > > > +                              "Link Up failed, Endpoint may not be connected\n");
> > > > > +
> > > > > +             if (!phy_validate(s32g_pp->phy, PHY_MODE_PCIE, 0, NULL)) {
> > > > > +                     dev_err(dev, "Failed to get link up with EP connected\n");
> > > > > +                     goto fail_host_init;
> > > > > +             }
> > > > > +     }
> > > > > +
> > > > > +     ret = pci_host_probe(pp->bridge);
> > > >
> > > > Oh no... Do not call pci_host_probe() directly from glue drivers. Use
> > > > dw_pcie_host_init() to do so. This should simplify suspend and resume functions.
> > >
> > > dw_pcie_host_init() is doing much more than just init the controller
> > > as it gets resources which we haven't released during suspend.
> > >
> >
> > Any specific reason to keep resources enabled, even though you were removing the
> > Root bus? This doesn't make sense to me.
> 
> By ressources I mean everything before  dw_pcie_setup_rc()  in
> dw_pcie_host_init() which are still there after dw_pcie_host_deinit()
> in addition to being a waste of time. Also we don't need to remove
> edma and free msi
> 

Let me take a step back and ask, why do you need to remove Root bus during
suspend() and not just disable LTSSM with dw_pcie_stop_link()?

- Mani

-- 
மணிவண்ணன் சதாசிவம்



More information about the linux-arm-kernel mailing list