[PATCH 11/19] PCI: Move setting pci_host_bridge.busnr out of host drivers

Rob Herring robh at kernel.org
Thu Jul 23 12:55:55 EDT 2020


On Thu, Jul 23, 2020 at 10:21 AM Lorenzo Pieralisi
<lorenzo.pieralisi at arm.com> wrote:
>
> On Thu, Jul 23, 2020 at 09:26:01AM -0600, Rob Herring wrote:
> > On Tue, Jul 21, 2020 at 8:25 PM Rob Herring <robh at kernel.org> wrote:
> > >
> > > Most host drivers only parse the DT bus range to set the root bus number
> > > in pci_host_bridge.busnr. The ones that don't set busnr are buggy in
> > > that they ignore what's in DT. Let's set busnr in pci_scan_root_bus_bridge()
> > > where we already check for the bus resource and remove setting it in
> > > host drivers.
> > >
> > > Cc: Jingoo Han <jingoohan1 at gmail.com>
> > > Cc: Gustavo Pimentel <gustavo.pimentel at synopsys.com>
> > > Cc: Lorenzo Pieralisi <lorenzo.pieralisi at arm.com>
> > > Cc: Bjorn Helgaas <bhelgaas at google.com>
> > > Cc: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
> > > Cc: Will Deacon <will at kernel.org>
> > > Cc: Thierry Reding <thierry.reding at gmail.com>
> > > Cc: Jonathan Hunter <jonathanh at nvidia.com>
> > > Cc: Linus Walleij <linus.walleij at linaro.org>
> > > Cc: Ryder Lee <ryder.lee at mediatek.com>
> > > Cc: Marek Vasut <marek.vasut+renesas at gmail.com>
> > > Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh at renesas.com>
> > > Cc: linux-tegra at vger.kernel.org
> > > Cc: linux-mediatek at lists.infradead.org
> > > Cc: linux-renesas-soc at vger.kernel.org
> > > Signed-off-by: Rob Herring <robh at kernel.org>
> > > ---
> > >  drivers/pci/controller/dwc/pcie-designware-host.c | 4 ----
> > >  drivers/pci/controller/dwc/pcie-designware.h      | 1 -
> > >  drivers/pci/controller/pci-aardvark.c             | 5 ++---
> > >  drivers/pci/controller/pci-host-common.c          | 1 -
> > >  drivers/pci/controller/pci-tegra.c                | 4 +---
> > >  drivers/pci/controller/pci-v3-semi.c              | 2 --
> > >  drivers/pci/controller/pcie-mediatek.c            | 8 +-------
> > >  drivers/pci/controller/pcie-rcar-host.c           | 1 -
> > >  drivers/pci/probe.c                               | 1 +
> > >  9 files changed, 5 insertions(+), 22 deletions(-)
> > >
> > > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> > > index 9e8a9cfc6d3a..fa922cb876a3 100644
> > > --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> > > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> > > @@ -374,9 +374,6 @@ int dw_pcie_host_init(struct pcie_port *pp)
> > >                         pp->cfg0_base = pp->cfg->start;
> > >                         pp->cfg1_base = pp->cfg->start + pp->cfg0_size;
> > >                         break;
> > > -               case IORESOURCE_BUS:
> > > -                       pp->busn = win->res;
> > > -                       break;
> > >                 }
> > >         }
> > >
> >
> > > diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
> > > index fd2146298b58..9fb44290ed43 100644
> > > --- a/drivers/pci/controller/dwc/pcie-designware.h
> > > +++ b/drivers/pci/controller/dwc/pcie-designware.h
> > > @@ -188,7 +188,6 @@ struct pcie_port {
> > >         struct resource         *cfg;
> > >         struct resource         *io;
> > >         struct resource         *mem;
> > > -       struct resource         *busn;
> > >         int                     irq;
> > >         const struct dw_pcie_host_ops *ops;
> > >         int                     msi_irq;
> >
> > These 2 hunks should be dropped as they are breaking the Amazon driver.
> >
> > Lorenzo, do you want to fixup or I can send a fix?
>
> Done (I have not removed the hunk below though):

Right, that's correct. I'll post a separate patch removing 'pp->busn'
as that's available from the bridge struct. The bridge struct
surprisingly is not accessible from the DWC structs. I guess that's
why there's a bunch of duplication of data.

Rob

> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index 9e8a9cfc6d3a..9775558acdc8 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -474,7 +474,6 @@ int dw_pcie_host_init(struct pcie_port *pp)
>         }
>
>         bridge->sysdata = pp;
> -       bridge->busnr = pp->busn->start;
>         bridge->ops = &dw_pcie_ops;
>         bridge->map_irq = of_irq_parse_and_map_pci;
>         bridge->swizzle_irq = pci_common_swizzle;



More information about the Linux-mediatek mailing list