Message ID | 20220503214638.1895-5-Sergey.Semin@baikalelectronics.ru (mailing list archive) |
---|---|
State | Accepted |
Commit | 36286b4ec2daf7f405b344dc3cb2f8a4e351b117 |
Delegated to: | Lorenzo Pieralisi |
Headers | show |
Series | PCI: dwc: Add dma-ranges/YAML-schema/Baikal-T1 support | expand |
On Wed, May 04, 2022 at 12:46:25AM +0300, Serge Semin wrote: > The iATU detection procedure was introduced in the commit 281f1f99cf3a > ("PCI: dwc: Detect number of iATU windows"). A bit later the procedure > execution was moved to Host/EP-specific methods in the framework of commit > 8bcca2658558 ("PCI: dwc: Move iATU detection earlier"). The later > modification wasn't done in the most optimal way since the "addr_space" > CSR region resource doesn't depend on anything detected in the > dw_pcie_iatu_detect() method. Thus the detection can be postponed to be > executed after the resource request which can fail and make the detection > pointless. It will be also helpful for the dw_pcie_ep_init() method > readability since we are about to add the IP-core version and eDMA module > (a bit later) detection procedures. > > Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru> > > --- > > Changelog v2: > - This is a new patch added on v2 iteration of the series. > --- > drivers/pci/controller/dwc/pcie-designware-ep.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Reviewed-by: Rob Herring <robh@kernel.org>
diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c index 7ad349c32082..c152021d0bf6 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -708,8 +708,6 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) } } - dw_pcie_iatu_detect(pci); - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "addr_space"); if (!res) return -EINVAL; @@ -717,6 +715,8 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) ep->phys_base = res->start; ep->addr_size = resource_size(res); + dw_pcie_iatu_detect(pci); + ep->ib_window_map = devm_kcalloc(dev, BITS_TO_LONGS(pci->num_ib_windows), sizeof(long),
The iATU detection procedure was introduced in the commit 281f1f99cf3a ("PCI: dwc: Detect number of iATU windows"). A bit later the procedure execution was moved to Host/EP-specific methods in the framework of commit 8bcca2658558 ("PCI: dwc: Move iATU detection earlier"). The later modification wasn't done in the most optimal way since the "addr_space" CSR region resource doesn't depend on anything detected in the dw_pcie_iatu_detect() method. Thus the detection can be postponed to be executed after the resource request which can fail and make the detection pointless. It will be also helpful for the dw_pcie_ep_init() method readability since we are about to add the IP-core version and eDMA module (a bit later) detection procedures. Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru> --- Changelog v2: - This is a new patch added on v2 iteration of the series. --- drivers/pci/controller/dwc/pcie-designware-ep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)