RE: [PATCH v6 05/10] PCI: designware-ep: Add ep_pre_init() callback to dw_pcie_ep_ops

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

 



Hi Manivannan,

> From: Manivannan Sadhasivam, Sent: Monday, November 14, 2022 3:20 PM
> 
> On Thu, Sep 22, 2022 at 05:06:42PM +0900, Yoshihiro Shimoda wrote:
> > Some PCIe endpoint controllers need vendor-specific initialization
> > before the common code initialization. Add a new callback function
> > ep_pre_init() for it.
> >
> 
> Why can't you call the code associated with ep_pre_init() before calling
> dw_pcie_ep_init() in probe?

For my environment (R-Car S4-8), ep_pre_init() will use pci->dbi_base and
pci->name-lanes. Calling dw_pcie_get_resources() in probe can get these values,
but it is not good way I think. So, ep_pre_init() is needed.

Best regards,
Yoshihiro Shimoda

> Thanks,
> Mani
> 
> > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>
> > ---
> >  drivers/pci/controller/dwc/pcie-designware-ep.c | 3 +++
> >  drivers/pci/controller/dwc/pcie-designware.h    | 1 +
> >  2 files changed, 4 insertions(+)
> >
> > diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c
> > index ca8f1804ee10..1b7e9e1b8d52 100644
> > --- a/drivers/pci/controller/dwc/pcie-designware-ep.c
> > +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c
> > @@ -709,6 +709,9 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep)
> >
> >  	dw_pcie_version_detect(pci);
> >
> > +	if (ep->ops->ep_pre_init)
> > +		ep->ops->ep_pre_init(ep);
> > +
> >  	dw_pcie_iatu_detect(pci);
> >
> >  	ep->ib_window_map = devm_bitmap_zalloc(dev, pci->num_ib_windows,
> > diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
> > index b541f653c209..9ed9621a12e4 100644
> > --- a/drivers/pci/controller/dwc/pcie-designware.h
> > +++ b/drivers/pci/controller/dwc/pcie-designware.h
> > @@ -317,6 +317,7 @@ struct dw_pcie_rp {
> >  };
> >
> >  struct dw_pcie_ep_ops {
> > +	void	(*ep_pre_init)(struct dw_pcie_ep *ep);
> >  	void	(*ep_init)(struct dw_pcie_ep *ep);
> >  	int	(*raise_irq)(struct dw_pcie_ep *ep, u8 func_no,
> >  			     enum pci_epc_irq_type type, u16 interrupt_num);
> > --
> > 2.25.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