diff mbox series

[v5,05/12] PCI: dwc: Add ep_pre_init() callback to dw_pcie_ep_ops

Message ID 20220905071257.1059436-6-yoshihiro.shimoda.uh@renesas.com (mailing list archive)
State Superseded
Delegated to: Lorenzo Pieralisi
Headers show
Series treewide: PCI: renesas: Add R-Car Gen4 PCIe support | expand

Commit Message

Yoshihiro Shimoda Sept. 5, 2022, 7:12 a.m. UTC
Some PCIe endpoint controller needs vendor-specific initialization
before the common code initialization. Add a nwe callback function
ep_pre_init() for it.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/pci/controller/dwc/pcie-designware-ep.c | 3 +++
 drivers/pci/controller/dwc/pcie-designware.h    | 1 +
 2 files changed, 4 insertions(+)

Comments

Bjorn Helgaas Sept. 20, 2022, 8:03 p.m. UTC | #1
"PCI: designware-ep" in the prefix, since this is specific to ep.

There are several "PCI: dwc" prefixes, but those are typically things
that affect several dwc-based drivers.

On Mon, Sep 05, 2022 at 04:12:50PM +0900, Yoshihiro Shimoda wrote:
> Some PCIe endpoint controller needs vendor-specific initialization
> before the common code initialization. Add a nwe callback function
> ep_pre_init() for it.

s/Some ... controller needs/Some ... controllers need/
s/nwe/new/
diff mbox series

Patch

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);