[PATCH v2 5/7] PCI: intel-gw: Remove atu base assignment

Florian Eckert posted 7 patches 1 week ago
There is a newer version of this series
[PATCH v2 5/7] PCI: intel-gw: Remove atu base assignment
Posted by Florian Eckert 1 week ago
If no ATU resource is defined in the DTS, the default value is 0x300000[1].
This is set during probing in the function 'dw_pcie_get_resources()'[2].
The driver overwrites this again when its init callback is called in its
'intel_pcie_host_setup()' [3] function. This is because the value here is
'0xC0000' rather than '0x300000'. This callback is called by the dwc core
via 'pp->ops->init' [4].

function callstack:
intel_pcie_probe()
  dw_pcie_host_init()
    dw_pcie_host_get_resources()
      dw_pcie_get_resources() [2]
    pp->ops->init = intel_pcie_rc_init()
                      intel_pcie_host_setup() [3]

As backwards compatibility is not an issue here [5], the value for the ATU
resource is moved to the DTS and is therefore loaded by the dwc core. It
is therefore no longer necessary to overwrite the pci->atu_base address in
the init callback. The DTS must be modified so that the additional resource
is loaded correctly by the DWC core.

[1] https://elixir.bootlin.com/linux/v6.19.10/source/drivers/pci/controller/dwc/pcie-designware.h#L292
[2] https://elixir.bootlin.com/linux/v6.19.10/source/drivers/pci/controller/dwc/pcie-designware.c#L150
[3] https://elixir.bootlin.com/linux/v6.19.10/source/drivers/pci/controller/dwc/pcie-intel-gw.c#L301
[4] https://elixir.bootlin.com/linux/v6.19.10/source/drivers/pci/controller/dwc/pcie-designware-host.c#L589
[5] https://lore.kernel.org/all/BY3PR19MB507667CE7531D863E1E5F8AEBDD82@BY3PR19MB5076.namprd19.prod.outlook.com/

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
---
 drivers/pci/controller/dwc/pcie-intel-gw.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-intel-gw.c b/drivers/pci/controller/dwc/pcie-intel-gw.c
index 24c463781f1e31d5617a5ff81bdbce563ed5a1d0..f41b64ac48d5c05e6b0e5b14c3e0cd7a4c407d16 100644
--- a/drivers/pci/controller/dwc/pcie-intel-gw.c
+++ b/drivers/pci/controller/dwc/pcie-intel-gw.c
@@ -310,8 +310,6 @@ static int intel_pcie_host_setup(struct intel_pcie *pcie)
 		goto clk_err;
 	}
 
-	pci->atu_base = pci->dbi_base + 0xC0000;
-
 	ret = phy_init(pcie->phy);
 	if (ret)
 		goto phy_err;

-- 
2.47.3