@@ -83,6 +83,14 @@ void dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar)
}
EXPORT_SYMBOL_GPL(dw_pcie_ep_reset_bar);
+static void dw_pcie_ep_reset_all_bars(struct dw_pcie *pci)
+{
+ enum pci_barno bar;
+
+ for (bar = BAR_0; bar < PCI_STD_NUM_BARS; bar++)
+ dw_pcie_ep_reset_bar(pci, bar);
+}
+
static u8 __dw_pcie_ep_find_next_cap(struct dw_pcie_ep *ep, u8 func_no,
u8 cap_ptr, u8 cap)
{
@@ -751,6 +759,8 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep)
if (ep->ops->ep_init)
ep->ops->ep_init(ep);
+ if (ep->reset_all_bars)
+ dw_pcie_ep_reset_all_bars(pci);
ret = pci_epc_mem_init(epc, ep->phys_base, ep->addr_size,
ep->page_size);
@@ -322,6 +322,7 @@ struct dw_pcie_ep {
void __iomem *msi_mem;
phys_addr_t msi_mem_phys;
struct pci_epf_bar *epf_bar[PCI_STD_NUM_BARS];
+ bool reset_all_bars;
};
struct dw_pcie_ops {
Some PCIe endpoint drivers reset all BARs in each ep_init() ops. So, we can reset the BARs into the common code if the flag is set. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> --- drivers/pci/controller/dwc/pcie-designware-ep.c | 10 ++++++++++ drivers/pci/controller/dwc/pcie-designware.h | 1 + 2 files changed, 11 insertions(+)