Re: [PATCH v8 2/5] PCI: dwc: Add support for ELBI resource mapping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 01, 2025 at 07:18:17PM +0530, Manivannan Sadhasivam wrote:
> On Thu, Aug 28, 2025 at 01:04:23PM GMT, Krishna Chaitanya Chundru wrote:
> > External Local Bus Interface(ELBI) registers are optional registers in
> > DWC IPs having vendor specific registers.
> > 
> > Since ELBI register space is applicable for all DWC based controllers,
> > move the resource get code to DWC core and make it optional.
> 
> As discussed offline, this changes also warrants switching the glue
> drivers to use 'dw_pci::elbi' base instead of their own. So I've
> ammended this commit to include those changes also while applying
> (which was straightforward).

I'm glad if we can do this in the DWC core instead of individual
drivers, but in the case of qcom, this changes the mapping from using
devm_pci_remap_cfgspace() to using devm_ioremap_resource():

  qcom_pcie_ep_get_io_resources
    platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi")
    devm_pci_remap_cfg_resource
      devm_pci_remap_cfgspace
        pci_remap_cfgspace
          ioremap_np                  # (except on arch/arm)

  dw_pcie_get_resources
    platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi")
    devm_ioremap_resource
      __devm_ioremap_resource(..., DEVM_IOREMAP)
        __devm_ioremap
          switch (type)
          case DEVM_IOREMAP: ioremap

I assume this change from ioremap_np() to ioremap() is fine, but
please verify and update the commit log to mention this change and
explain why it's ok.

(I don't think the qcom changes were posted to the mailing list; you
can see them here:
https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/commit/?h=controller/dwc-ecam&id=d39e0103e38f9889271a77a837b6179b42d6730d)

> > Suggested-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx>
> > Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx>
> > Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@xxxxxxxxxxxxxxxx>
> > ---
> >  drivers/pci/controller/dwc/pcie-designware.c | 9 +++++++++
> >  drivers/pci/controller/dwc/pcie-designware.h | 1 +
> >  2 files changed, 10 insertions(+)
> > 
> > diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
> > index 89aad5a08928cc29870ab258d33bee9ff8f83143..4684c671a81bee468f686a83cc992433b38af59d 100644
> > --- a/drivers/pci/controller/dwc/pcie-designware.c
> > +++ b/drivers/pci/controller/dwc/pcie-designware.c
> > @@ -167,6 +167,15 @@ int dw_pcie_get_resources(struct dw_pcie *pci)
> >  		}
> >  	}
> >  
> > +	if (!pci->elbi_base) {
> > +		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi");
> > +		if (res) {
> > +			pci->elbi_base = devm_ioremap_resource(pci->dev, res);
> > +			if (IS_ERR(pci->elbi_base))
> > +				return PTR_ERR(pci->elbi_base);
> > +		}
> > +	}
> > +
> >  	/* LLDD is supposed to manually switch the clocks and resets state */
> >  	if (dw_pcie_cap_is(pci, REQ_RES)) {
> >  		ret = dw_pcie_get_clocks(pci);
> > diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
> > index 00f52d472dcdd794013a865ad6c4c7cc251edb48..ceb022506c3191cd8fe580411526e20cc3758fed 100644
> > --- a/drivers/pci/controller/dwc/pcie-designware.h
> > +++ b/drivers/pci/controller/dwc/pcie-designware.h
> > @@ -492,6 +492,7 @@ struct dw_pcie {
> >  	resource_size_t		dbi_phys_addr;
> >  	void __iomem		*dbi_base2;
> >  	void __iomem		*atu_base;
> > +	void __iomem		*elbi_base;
> >  	resource_size_t		atu_phys_addr;
> >  	size_t			atu_size;
> >  	resource_size_t		parent_bus_offset;
> > 
> > -- 
> > 2.34.1
> > 
> 
> -- 
> மணிவண்ணன் சதாசிவம்




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux