PCI: dwc: Add API support to de-initialize host
PATCH v4 1/2 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 DesignWare core based driver implementations while adding .remove() support in their respective drivers.
---
Changes from v3:
* Added check if (pci_msi_enabled() && !pp->ops->msi_host_init) before calling dw_pcie_free_msi() API to mimic init path
Changes from v2:
* Rebased on top of linux-next top of the tree branch
Changes from v1:
* s/Designware/DesignWare
drivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++++++ drivers/pci/controller/dwc/pcie-designware.h | 5 +++++ 2 files changed, 13 insertions(+)
drivers/pci/controller/dwc/pcie-designware-host.c +8 -0
@@ -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)
drivers/pci/controller/dwc/pcie-designware.h +5 -0
@@ -348,6 +348,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)
@@ -372,6 +373,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 ;
Signature · 1 line
2.17.1
PATCH v4 2/2 PCI: dwc: Export APIs to support .remove() implementation
Export all configuration space access APIs and also other APIs to support host controller drivers of DesignWare core based implementations while adding support for .remove() hook to build their respective drivers as modules
---
Changes from v3:
* Exported only __dw_pcie_{read/write}_dbi() APIs instead of dw_pcie_read{l/w/b}_dbi & dw_pcie_write{l/w/b}_dbi APIs.
Changes from v2:
* Rebased on top of linux-next top of the tree branch
Changes from v1:
* s/Designware/DesignWare
drivers/pci/controller/dwc/pcie-designware-host.c | 4 ++++ drivers/pci/controller/dwc/pcie-designware.c | 4 ++++ 2 files changed, 8 insertions(+)
drivers/pci/controller/dwc/pcie-designware-host.c +4 -0
@@ -311,6 +311,7 @@ void dw_pcie_msi_init(struct pcie_port *pp)dw_pcie_wr_own_conf (pp,PCIE_MSI_ADDR_HI ,4 ,upper_32_bits (msi_target)); } +EXPORT_SYMBOL_GPL (dw_pcie_msi_init);int dw_pcie_host_init (struct pcie_port *pp) {
@@ -495,6 +496,7 @@ int dw_pcie_host_init(struct pcie_port *pp)dw_pcie_free_msi (pp);return ret; } +EXPORT_SYMBOL_GPL (dw_pcie_host_init);void dw_pcie_host_deinit (struct pcie_port *pp) {
@@ -503,6 +505,7 @@ void dw_pcie_host_deinit(struct pcie_port *pp)if (pci_msi_enabled () && !pp->ops->msi_host_init)dw_pcie_free_msi (pp); } +EXPORT_SYMBOL_GPL (dw_pcie_host_deinit); static int dw_pcie_access_other_conf(struct pcie_port *pp, struct pci_bus *bus, u32 devfn, int where, int size, u32 *val,
@@ -695,3 +698,4 @@ void dw_pcie_setup_rc(struct pcie_port *pp) val |=PORT_LOGIC_SPEED_CHANGE ;dw_pcie_wr_own_conf (pp,PCIE_LINK_WIDTH_SPEED_CONTROL ,4 , val); } +EXPORT_SYMBOL_GPL (dw_pcie_setup_rc);
drivers/pci/controller/dwc/pcie-designware.c +4 -0
@@ -40,6 +40,7 @@ int dw_pcie_read(void __iomem *addr, int size, u32 *val)return PCIBIOS_SUCCESSFUL ; } +EXPORT_SYMBOL_GPL (dw_pcie_read);int dw_pcie_write (void __iomem *addr,int size,u32 val) {
@@ -57,6 +58,7 @@ int dw_pcie_write(void __iomem *addr, int size, u32 val)return PCIBIOS_SUCCESSFUL ; } +EXPORT_SYMBOL_GPL (dw_pcie_write);u32 __dw_pcie_read_dbi (struct dw_pcie *pci,void __iomem *base,u32 reg,size_t size)
@@ -73,6 +75,7 @@ u32 __dw_pcie_read_dbi(struct dw_pcie *pci, void __iomem *base, u32 reg,return val; } +EXPORT_SYMBOL_GPL (__dw_pcie_read_dbi);void __dw_pcie_write_dbi (struct dw_pcie *pci,void __iomem *base,u32 reg,size_t size,u32 val)
@@ -88,6 +91,7 @@ void __dw_pcie_write_dbi(struct dw_pcie *pci, void __iomem *base, u32 reg,if (ret)dev_err (pci->dev,"Write DBI address failed\n" ); } +EXPORT_SYMBOL_GPL (__dw_pcie_write_dbi);u32 __dw_pcie_read_dbi2 (struct dw_pcie *pci,void __iomem *base,u32 reg,size_t size)
Signature · 1 line
2.17.1
Quoted 14 lines · Vidya Sagar
Add an API to group all the tasks to be done to de-initialize host which can then be called by any DesignWare core based driver implementations while adding .remove() support in their respective drivers.
Signed-off-by Vidya Sagar <[email protected]>Acked-by Gustavo Pimentel <[email protected]>---
Changes from v3:
* Added check if (pci_msi_enabled()&& !pp->ops->msi_host_init) before callingdw_pcie_free_msi()API to mimic init pathChanges from v2:
* Rebased on top of linux-next top of the tree branch
Quoted 6 lines
Changes from v1:
* s/Designware/DesignWaredrivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++++++ drivers/pci/controller/dwc/pcie-designware.h | 5 +++++ 2 files changed, 13 insertions(+)
Series doesn't apply to v5.1-rc1, what's based on ? I suspect there is a dependency on pci/keystone, given the tight timeline for the merge window, would you mind postponing it to v5.3 ?
I do not think it is urgent, I am happy to create a branch for it as soon as v5.2-rc1 is released.
Thanks,
Lorenzo
Quoted 45 lines
drivers/pci/controller/dwc/pcie-designware-host.c +8
-0@@ -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)drivers/pci/controller/dwc/pcie-designware.h +5
-0@@ -348,6 +348,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)@@ -372,6 +373,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 ;Signature · 1 line
2.17.1
Quoted 22 lines · Lorenzo Pieralisi
Quoted 14 lines · Vidya Sagar
Add an API to group all the tasks to be done to de-initialize host which can then be called by any DesignWare core based driver implementations while adding .remove() support in their respective drivers.
Signed-off-by Vidya Sagar <[email protected]>Acked-by Gustavo Pimentel <[email protected]>---
Changes from v3:
* Added check if (pci_msi_enabled()&& !pp->ops->msi_host_init) before callingdw_pcie_free_msi()API to mimic init pathChanges from v2:
* Rebased on top of linux-next top of the tree branchQuoted 6 lines
Changes from v1:
* s/Designware/DesignWaredrivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++++++ drivers/pci/controller/dwc/pcie-designware.h | 5 +++++ 2 files changed, 13 insertions(+)
Quoted 6 lines
Series doesn't apply to v5.1-rc1, what's based on ? I suspect there is a dependency on pci/keystone, given the tight timeline for the merge window, would you mind postponing it to v5.3 ?
I do not think it is urgent, I am happy to create a branch for it as soon as v5.2-rc1 is released.
I rebased my changes on top of linux-next. I see that they have conflicts on top of v5.1-rc1. Do you want me to rebase them on top of v5.1-rc1 instead of linux-next?
I'm fine with v5.2-rc1 as well.
Quoted 49 lines
Thanks,
LorenzoQuoted 45 lines
drivers/pci/controller/dwc/pcie-designware-host.c +8
-0@@ -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)drivers/pci/controller/dwc/pcie-designware.h +5
-0@@ -348,6 +348,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)@@ -372,6 +373,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 ;Signature · 1 line
2.17.1
Quoted 27 lines · Vidya Sagar
Quoted 26 lines · Lorenzo Pieralisi
Quoted 14 lines · Vidya Sagar
Add an API to group all the tasks to be done to de-initialize host which can then be called by any DesignWare core based driver implementations while adding .remove() support in their respective drivers.
Signed-off-by Vidya Sagar <[email protected]>Acked-by Gustavo Pimentel <[email protected]>---
Changes from v3:
* Added check if (pci_msi_enabled()&& !pp->ops->msi_host_init) before callingdw_pcie_free_msi()API to mimic init pathChanges from v2:
* Rebased on top of linux-next top of the tree branchQuoted 6 lines
Changes from v1:
* s/Designware/DesignWare
drivers/pci/controller/dwc/pcie-designware-host.c| 8 ++++++++ drivers/pci/controller/dwc/pcie-designware.h | 5 +++++2 files changed, 13 insertions(+)Series doesn't apply to v5.1-rc1, what's based on ? I suspect there is a dependency on pci/keystone, given the tight timeline for the merge window, would you mind postponing it to v5.3 ?
Quoted 6 lines
Quoted 2 lines
I do not think it is urgent, I am happy to create a branch for it as soon as v5.2-rc1 is released.
I rebased my changes on top of linux-next. I see that they have conflicts
on top of v5.1-rc1. Do you want me to rebase them on top of v5.1-rc1 instead
of linux-next?
I'm fine with v5.2-rc1 as well.I forgot to mention that these changes are made on top of Jisheng's patches
FWIW, Jisheng's patches are approved and applied to pci/dwc for v5.2
https://www.mail-archive.com/[email protected]/msg1968324.html
Quoted 49 lines
Quoted 48 lines
Thanks,
LorenzoQuoted 43 lines
drivers/pci/controller/dwc/pcie-designware-host.c +8
-0@@ -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)drivers/pci/controller/dwc/pcie-designware.h +5
-0@@ -348,6 +348,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)@@ -372,6 +373,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;Signature · 1 line
2.17.1
Quoted 28 lines · Vidya Sagar
Quoted 27 lines · Vidya Sagar
Quoted 26 lines · Lorenzo Pieralisi
Quoted 14 lines · Vidya Sagar
Add an API to group all the tasks to be done to de-initialize host which can then be called by any DesignWare core based driver implementations while adding .remove() support in their respective drivers.
Signed-off-by Vidya Sagar <[email protected]>Acked-by Gustavo Pimentel <[email protected]>---
Changes from v3:
* Added check if (pci_msi_enabled()&& !pp->ops->msi_host_init) before callingdw_pcie_free_msi()API to mimic init pathChanges from v2:
* Rebased on top of linux-next top of the tree branchQuoted 6 lines
Changes from v1:
* s/Designware/DesignWare
drivers/pci/controller/dwc/pcie-designware-host.c| 8 ++++++++ drivers/pci/controller/dwc/pcie-designware.h | 5 +++++2 files changed, 13 insertions(+)Series doesn't apply to v5.1-rc1, what's based on ? I suspect there is a dependency on pci/keystone, given the tight timeline for the merge window, would you mind postponing it to v5.3 ?
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I do not think it is urgent, I am happy to create a branch for it as soon as v5.2-rc1 is released.
I rebased my changes on top of linux-next. I see that they have conflicts
on top of v5.1-rc1. Do you want me to rebase them on top of v5.1-rc1 instead
of linux-next?
I'm fine with v5.2-rc1 as well.I forgot to mention that these changes are made on top of Jisheng's patchesFWIW, Jisheng's patches are approved and applied to pci/dwc for v5.2
https://www.mail-archive.com/[email protected]/msg1968324.html
Hi Lorenzo,
Now that v5.2-rc2 is also available, could you please pick up this series?
Thanks,
Vidya Sagar
Quoted 51 lines
Quoted 50 lines
Quoted 49 lines
Thanks,
LorenzoQuoted 43 lines
drivers/pci/controller/dwc/pcie-designware-host.c +8
-0@@ -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)drivers/pci/controller/dwc/pcie-designware.h +5
-0@@ -348,6 +348,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)@@ -372,6 +373,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;Signature · 1 line
2.17.1
Quoted 35 lines · Vidya Sagar
Quoted 34 lines · Vidya Sagar
Quoted 33 lines · Vidya Sagar
Quoted 22 lines · Lorenzo Pieralisi
Quoted 14 lines · Vidya Sagar
Add an API to group all the tasks to be done to de-initialize host which can then be called by any DesignWare core based driver implementations while adding .remove() support in their respective drivers.
Signed-off-by Vidya Sagar <[email protected]>Acked-by Gustavo Pimentel <[email protected]>---
Changes from v3:
* Added check if (pci_msi_enabled()&& !pp->ops->msi_host_init) before callingdw_pcie_free_msi()API to mimic init pathChanges from v2:
* Rebased on top of linux-next top of the tree branchQuoted 6 lines
Changes from v1:
* s/Designware/DesignWare
drivers/pci/controller/dwc/pcie-designware-host.c| 8 ++++++++ drivers/pci/controller/dwc/pcie-designware.h | 5 +++++2 files changed, 13 insertions(+)Quoted 6 lines
Series doesn't apply to v5.1-rc1, what's based on ? I suspect there is a dependency on pci/keystone, given the tight timeline for the merge window, would you mind postponing it to v5.3 ?
I do not think it is urgent, I am happy to create a branch for it as soon as v5.2-rc1 is released.
I rebased my changes on top of linux-next. I see that they have conflicts
on top of v5.1-rc1. Do you want me to rebase them on top of v5.1-rc1 instead
of linux-next?
I'm fine with v5.2-rc1 as well.I forgot to mention that these changes are made on top of Jisheng's patches
Quoted 9 lines
Quoted 2 lines
FWIW, Jisheng's patches are approved and applied to pci/dwc for v5.2
https://www.mail-archive.com/[email protected]/msg1968324.htmlHi Lorenzo,
Now that v5.2-rc2 is also available, could you please pick up this series?Thanks,
Vidya Sagar
Hi Bjorn / Lorenzo,
Can you please pick up these two patches?
Thanks,
Vidya Sagar
Quoted 52 lines
Quoted 51 lines
Quoted 50 lines
Quoted 49 lines
Thanks,
LorenzoQuoted 43 lines
drivers/pci/controller/dwc/pcie-designware-host.c +8
-0@@ -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)drivers/pci/controller/dwc/pcie-designware.h +5
-0@@ -348,6 +348,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)@@ -372,6 +373,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;Signature · 1 line
2.17.1
Quoted 42 lines · Vidya Sagar
Quoted 41 lines · Vidya Sagar
Quoted 28 lines · Vidya Sagar
Quoted 27 lines · Vidya Sagar
Quoted 26 lines · Lorenzo Pieralisi
Quoted 14 lines · Vidya Sagar
Add an API to group all the tasks to be done to de-initialize host which can then be called by any DesignWare core based driver implementations while adding .remove() support in their respective drivers.
Signed-off-by Vidya Sagar <[email protected]>Acked-by Gustavo Pimentel <[email protected]>---
Changes from v3:
* Added check if (pci_msi_enabled()&& !pp->ops->msi_host_init) before callingdw_pcie_free_msi()API to mimic init pathChanges from v2:
* Rebased on top of linux-next top of the tree branchQuoted 6 lines
Changes from v1:
* s/Designware/DesignWare
drivers/pci/controller/dwc/pcie-designware-host.c| 8 ++++++++ drivers/pci/controller/dwc/pcie-designware.h | 5 +++++2 files changed, 13 insertions(+)Series doesn't apply to v5.1-rc1, what's based on ? I suspect there is a dependency on pci/keystone, given the tight timeline for the merge window, would you mind postponing it to v5.3 ?
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I do not think it is urgent, I am happy to create a branch for it as soon as v5.2-rc1 is released.
I rebased my changes on top of linux-next. I see that they have conflicts
on top of v5.1-rc1. Do you want me to rebase them on top of v5.1-rc1 instead
of linux-next?
I'm fine with v5.2-rc1 as well.I forgot to mention that these changes are made on top of Jisheng's patchesFWIW, Jisheng's patches are approved and applied to pci/dwc for v5.2
https://www.mail-archive.com/[email protected]/msg1968324.htmlHi Lorenzo,
Now that v5.2-rc2 is also available, could you please pick up this series?
Quoted 8 lines
Quoted 3 lines
Thanks,
Vidya SagarHi Bjorn / Lorenzo,
Can you please pick up these two patches?Thanks,
Vidya Sagar
Apologies for pinging again. These two patches can be applied directly on top of v5.2-rc4. Please do let me know if there is anything required from my side.
Thanks,
Vidya Sagar
Quoted 54 lines
Quoted 53 lines
Quoted 52 lines
Quoted 51 lines
Quoted 50 lines
Thanks,
LorenzoQuoted 43 lines
drivers/pci/controller/dwc/pcie-designware-host.c +8
-0@@ -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)drivers/pci/controller/dwc/pcie-designware.h +5
-0@@ -348,6 +348,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)@@ -372,6 +373,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;Signature · 1 line
2.17.1
Quoted 49 lines · Vidya Sagar
Quoted 48 lines · Vidya Sagar
Quoted 35 lines · Vidya Sagar
Quoted 34 lines · Vidya Sagar
Quoted 33 lines · Vidya Sagar
Quoted 22 lines · Lorenzo Pieralisi
Quoted 14 lines · Vidya Sagar
Add an API to group all the tasks to be done to de-initialize host which can then be called by any DesignWare core based driver implementations while adding .remove() support in their respective drivers.
Signed-off-by Vidya Sagar <[email protected]>Acked-by Gustavo Pimentel <[email protected]>---
Changes from v3:
* Added check if (pci_msi_enabled()&& !pp->ops->msi_host_init) before callingdw_pcie_free_msi()API to mimic init pathChanges from v2:
* Rebased on top of linux-next top of the tree branchQuoted 6 lines
Changes from v1:
* s/Designware/DesignWare
drivers/pci/controller/dwc/pcie-designware-host.c| 8 ++++++++ drivers/pci/controller/dwc/pcie-designware.h | 5 +++++2 files changed, 13 insertions(+)Quoted 6 lines
Series doesn't apply to v5.1-rc1, what's based on ? I suspect there is a dependency on pci/keystone, given the tight timeline for the merge window, would you mind postponing it to v5.3 ?
I do not think it is urgent, I am happy to create a branch for it as soon as v5.2-rc1 is released.
I rebased my changes on top of linux-next. I see that they have conflicts
on top of v5.1-rc1. Do you want me to rebase them on top of v5.1-rc1 instead
of linux-next?
I'm fine with v5.2-rc1 as well.I forgot to mention that these changes are made on top of Jisheng's patchesQuoted 9 lines
Quoted 2 lines
FWIW, Jisheng's patches are approved and applied to pci/dwc for v5.2
https://www.mail-archive.com/[email protected]/msg1968324.htmlHi Lorenzo,
Now that v5.2-rc2 is also available, could you please pick up this series?Thanks,
Vidya SagarHi Bjorn / Lorenzo,
Can you please pick up these two patches?
Quoted 8 lines
Quoted 2 lines
Thanks,
Vidya SagarApologies for pinging again. These two patches can be applied directly on top of v5.2-rc4. Please do let me know if there is anything required from my side.
Thanks,
Vidya Sagar
Sorry for pinging again. Please let me know if these patches need to be sent again.
Thanks,
Vidya Sagar
Quoted 56 lines
Quoted 55 lines
Quoted 54 lines
Quoted 53 lines
Quoted 52 lines
Quoted 51 lines
Thanks,
LorenzoQuoted 43 lines
drivers/pci/controller/dwc/pcie-designware-host.c +8
-0@@ -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)drivers/pci/controller/dwc/pcie-designware.h +5
-0@@ -348,6 +348,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)@@ -372,6 +373,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;Signature · 1 line
2.17.1
On Tue, Jun 18, 2019 at 10:19:14AM +0530, Vidya Sagar wrote:
[...]
Quoted 2 lines
Sorry for pinging again. Please let me know if these patches need to be sent again.
No problem. We can merge the code as-is even though I have a couple of questions.
1) What about dbi2 interfaces (what an horrible name it is :() ? It is true that it is probably best to export just what we need.
2) It is not related to this patch but I fail to see the reasoning behind the __ in __dw_pci_read_dbi(), there is no no-underscore equivalent so its definition is somewhat questionable, maybe we should clean-it up (for dbi2 alike).
Lorenzo
Quoted 60 lines
Thanks,
Vidya SagarQuoted 56 lines
Quoted 55 lines
Quoted 54 lines
Quoted 53 lines
Quoted 52 lines
Quoted 51 lines
Thanks,
LorenzoQuoted 43 lines
drivers/pci/controller/dwc/pcie-designware-host.c +8
-0@@ -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)drivers/pci/controller/dwc/pcie-designware.h +5
-0@@ -348,6 +348,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)@@ -372,6 +373,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;Signature · 1 line
2.17.1
Quoted 4 lines · Lorenzo Pieralisi
On Tue, Jun 18, 2019 at 10:19:14AM +0530, Vidya Sagar wrote:
[...]
Quoted 8 lines
Quoted 2 lines
Sorry for pinging again. Please let me know if these patches need to be sent again.
No problem. We can merge the code as-is even though I have a couple of questions.
1) What about dbi2 interfaces (what an horrible name it is :() ? It is true that it is probably best to export just what we need.
I see that dbi2 API (that too only write) is used by pci-keystone and it is described as a bool driver currently. I'm not sure if it will ever be made as a modular driver.
Quoted 4 lines
2) It is not related to this patch but I fail to see the reasoning behind the __ in
__dw_pci_read_dbi(), there is no no-underscore equivalent so its definition is somewhat questionable, maybe we should clean-it up (for dbi2 alike).
Separate no-underscore versions are present in pcie-designware.h for each width (i.e. l/w/b) as inline and are calling __ versions passing size as argument.
Quoted 63 lines
Lorenzo
Quoted 60 lines
Thanks,
Vidya SagarQuoted 56 lines
Quoted 55 lines
Quoted 54 lines
Quoted 53 lines
Quoted 52 lines
Quoted 51 lines
Thanks,
LorenzoQuoted 43 lines
drivers/pci/controller/dwc/pcie-designware-host.c +8
-0@@ -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)drivers/pci/controller/dwc/pcie-designware.h +5
-0@@ -348,6 +348,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)@@ -372,6 +373,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;Signature · 1 line
2.17.1
On Tue, Jun 18, 2019 at 04:21:17PM +0530, Vidya Sagar wrote:
[...]
Quoted 7 lines
Quoted 4 lines
2) It is not related to this patch but I fail to see the reasoning behind the __ in
__dw_pci_read_dbi(), there is no no-underscore equivalent so its definition is somewhat questionable, maybe we should clean-it up (for dbi2 alike).Separate no-underscore versions are present in
pcie-designware.hfor each width (i.e. l/w/b) as inline and are calling __ versions passing size as argument.
I understand - the __ prologue was added in b50b2db266d8 maybe Kishon can help us understand the __ rationale.
I am happy to merge it as is, I was just curious about the __ annotation (not related to this patch).
Lorenzo
Quoted 63 lines
Quoted 62 lines
Lorenzo
Quoted 60 lines
Thanks,
Vidya SagarQuoted 56 lines
Quoted 55 lines
Quoted 54 lines
Quoted 53 lines
Quoted 52 lines
Quoted 51 lines
Thanks,
LorenzoQuoted 43 lines
drivers/pci/controller/dwc/pcie-designware-host.c +8
-0@@ -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)drivers/pci/controller/dwc/pcie-designware.h +5
-0@@ -348,6 +348,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)@@ -372,6 +373,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;Signature · 1 line
2.17.1
Hi Lorenzo,
Quoted 12 lines · Lorenzo Pieralisi
On Tue, Jun 18, 2019 at 04:21:17PM +0530, Vidya Sagar wrote:
[...]
Quoted 7 lines
Quoted 4 lines
2) It is not related to this patch but I fail to see the reasoning behind the __ in
__dw_pci_read_dbi(), there is no no-underscore equivalent so its definition is somewhat questionable, maybe we should clean-it up (for dbi2 alike).Separate no-underscore versions are present in
pcie-designware.hfor each width (i.e. l/w/b) as inline and are calling __ versions passing size as argument.
Quoted 5 lines
I understand - the __ prologue was added in
b50b2db266d8maybe Kishon can help us understand the __ rationale.I am happy to merge it as is, I was just curious about the __ annotation (not related to this patch).
In commit b50b2db266d8a8c303e8d88590 ("PCI: dwc: all: Modify dbi accessors to take dbi_base as argument"), dbi accessors was modified to take dbi_base as argument (since we wanted to write to dbics2 address space). We didn't want to change all the drivers invoking dbi accessors to pass the dbi_base. So we added "__" variant to take dbi_base as argument and the drivers continued to invoke existing dbi accessors which in-turn invoked "__" version with dbi_base as argument.
I agree there could be some cleanup since in commit a509d7d9af5ebf86ffbefa98e49761d ("PCI: dwc: all: Modify dbi accessors to access data of 4/2/1 bytes"), we modified __dw_pcie_readl_dbi() to __dw_pcie_write_dbi() when it could have been directly modified to dw_pcie_write_dbi().
Thanks
Kishon
Quoted 29 lines · Kishon Vijay Abraham I
Hi Lorenzo,
Quoted 12 lines · Lorenzo Pieralisi
On Tue, Jun 18, 2019 at 04:21:17PM +0530, Vidya Sagar wrote:
[...]
Quoted 7 lines
Quoted 4 lines
2) It is not related to this patch but I fail to see the reasoning behind the __ in
__dw_pci_read_dbi(), there is no no-underscore equivalent so its definition is somewhat questionable, maybe we should clean-it up (for dbi2 alike).Separate no-underscore versions are present in
pcie-designware.hfor each width (i.e. l/w/b) as inline and are calling __ versions passing size as argument.Quoted 5 lines
I understand - the __ prologue was added in
b50b2db266d8maybe Kishon can help us understand the __ rationale.I am happy to merge it as is, I was just curious about the __ annotation (not related to this patch).
In commit
b50b2db266d8a8c303e8d88590("PCI: dwc: all: Modify dbi accessors to takedbi_baseas argument"), dbi accessors was modified to takedbi_baseas argument (since we wanted to write to dbics2 address space). We didn't want to change all the drivers invoking dbi accessors to pass thedbi_base. So we added "__" variant to takedbi_baseas argument and the drivers continued to invoke existing dbi accessors which in-turn invoked "__" version withdbi_baseas argument.
Quoted 5 lines
I agree there could be some cleanup since in commit
a509d7d9af5ebf86ffbefa98e49761d("PCI: dwc: all: Modify dbi accessors to access data of 4/2/1 bytes"), we modified__dw_pcie_readl_dbi()to__dw_pcie_write_dbi()when it could have been directly modified todw_pcie_write_dbi().
Thanks. Vidya can do it as a preliminary patch, I will merge then code to export the symbols.
Lorenzo
Quoted 36 lines · Lorenzo Pieralisi
Quoted 29 lines · Kishon Vijay Abraham I
Hi Lorenzo,
Quoted 12 lines · Lorenzo Pieralisi
On Tue, Jun 18, 2019 at 04:21:17PM +0530, Vidya Sagar wrote:
[...]
Quoted 7 lines
Quoted 4 lines
2) It is not related to this patch but I fail to see the reasoning behind the __ in
__dw_pci_read_dbi(), there is no no-underscore equivalent so its definition is somewhat questionable, maybe we should clean-it up (for dbi2 alike).Separate no-underscore versions are present in
pcie-designware.hfor each width (i.e. l/w/b) as inline and are calling __ versions passing size as argument.Quoted 5 lines
I understand - the __ prologue was added in
b50b2db266d8maybe Kishon can help us understand the __ rationale.I am happy to merge it as is, I was just curious about the __ annotation (not related to this patch).
In commit
b50b2db266d8a8c303e8d88590("PCI: dwc: all: Modify dbi accessors to takedbi_baseas argument"), dbi accessors was modified to takedbi_baseas argument (since we wanted to write to dbics2 address space). We didn't want to change all the drivers invoking dbi accessors to pass thedbi_base. So we added "__" variant to takedbi_baseas argument and the drivers continued to invoke existing dbi accessors which in-turn invoked "__" version withdbi_baseas argument.Quoted 5 lines
I agree there could be some cleanup since in commit
a509d7d9af5ebf86ffbefa98e49761d("PCI: dwc: all: Modify dbi accessors to access data of 4/2/1 bytes"), we modified__dw_pcie_readl_dbi()to__dw_pcie_write_dbi()when it could have been directly modified todw_pcie_write_dbi().
Quoted 5 lines
Thanks. Vidya can do it as a preliminary patch, I will merge then code to export the symbols.
Lorenzo
Do you want me to make the change that removes "__" as part of 2/2 patch itself and then send V5 or as a separate patch?
Vidya Sagar