PCI: dwc: Add API support to de-initialize host

Add an API to group all the tasks to be done to de-initialize host which
can then be called by any dwc core based driver implementations
while adding .remove() support in their respective drivers.

Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
This commit is contained in:
Vidya Sagar 2019-06-25 14:52:36 +05:30 committed by Lorenzo Pieralisi
parent a188339ca5
commit 9d071cade3
2 changed files with 13 additions and 0 deletions

View File

@ -496,6 +496,14 @@ int dw_pcie_host_init(struct pcie_port *pp)
return ret;
}
void dw_pcie_host_deinit(struct pcie_port *pp)
{
pci_stop_root_bus(pp->root_bus);
pci_remove_root_bus(pp->root_bus);
if (pci_msi_enabled() && !pp->ops->msi_host_init)
dw_pcie_free_msi(pp);
}
static int dw_pcie_access_other_conf(struct pcie_port *pp, struct pci_bus *bus,
u32 devfn, int where, int size, u32 *val,
bool write)

View File

@ -351,6 +351,7 @@ void dw_pcie_msi_init(struct pcie_port *pp);
void dw_pcie_free_msi(struct pcie_port *pp);
void dw_pcie_setup_rc(struct pcie_port *pp);
int dw_pcie_host_init(struct pcie_port *pp);
void dw_pcie_host_deinit(struct pcie_port *pp);
int dw_pcie_allocate_domains(struct pcie_port *pp);
#else
static inline irqreturn_t dw_handle_msi_irq(struct pcie_port *pp)
@ -375,6 +376,10 @@ static inline int dw_pcie_host_init(struct pcie_port *pp)
return 0;
}
static inline void dw_pcie_host_deinit(struct pcie_port *pp)
{
}
static inline int dw_pcie_allocate_domains(struct pcie_port *pp)
{
return 0;