@@ -671,6 +671,9 @@ void dw_pcie_ep_exit(struct dw_pcie_ep *ep)
struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
struct pci_epc *epc = ep->epc;
+ if (ep->ops->ep_deinit)
+ ep->ops->ep_deinit(ep);
+
dw_pcie_edma_remove(pci);
if (ep->intx_mem)
@@ -784,6 +787,9 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep)
ep->phys_base = res->start;
ep->addr_size = resource_size(res);
+ if (ep->ops->ep_pre_init)
+ ep->ops->ep_pre_init(ep);
+
dw_pcie_version_detect(pci);
dw_pcie_iatu_detect(pci);
@@ -336,7 +336,9 @@ 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);
+ void (*ep_deinit)(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);
const struct pci_epc_features* (*get_features)(struct dw_pcie_ep *ep);
Renesas R-Car Gen4 PCIe controllers require vender-specific initialization before .ep_init(). To use dw->dbi and dw->num-lanes in the initialization code, introduce .ep_pre_init() into struct dw_pcie_ep_ops. Also introduce .ep_deinit() to disable the controller by using vender-specific de-initialization. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> --- drivers/pci/controller/dwc/pcie-designware-ep.c | 6 ++++++ drivers/pci/controller/dwc/pcie-designware.h | 2 ++ 2 files changed, 8 insertions(+)