From d6a73823dfca8921326fdc3d5f1e12b0b0863cfc Mon Sep 17 00:00:00 2001
From: Siddharth Vadapalli <s-vadapalli@ti.com>
Date: Wed, 18 Oct 2023 14:38:18 +0530
Subject: [PATCH] PCI: keystone: Fix ks_pcie_v3_65_add_bus() for AM654x SoC

In the process of converting .scan_bus() callbacks to .add_bus(), the
ks_pcie_v3_65_scan_bus() function was changed to ks_pcie_v3_65_add_bus().
However, ks_pcie_v3_65_scan_bus() belonged to:
"struct dw_pcie_host_ops ks_pcie_host_ops"
which is specific to DW PCIe IP-core version 3.65a. On the other hand,
ks_pcie_v3_65_add_bus() has been added to:
"struct pci_ops ks_pcie_ops"
which is shared with DW PCIe IP-core version 4.90a as well.

AM654x SoC uses DW PCIe IP-core version 4.90a and ks_pcie_v3_65_add_bus()
is not applicable to it and shouldn't be invoked. Thus, make use of the
"is_am6" flag and change ks_pcie_v3_65_add_bus() to no-op for AM654x SoC.

Fixes: 6ab15b5e7057 ("PCI: dwc: keystone: Convert .scan_bus() callback to use add_bus")
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
---
 drivers/pci/controller/dwc/pci-keystone.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c
index befb5045b8665..3f83ca8e95b5e 100644
--- a/drivers/pci/controller/dwc/pci-keystone.c
+++ b/drivers/pci/controller/dwc/pci-keystone.c
@@ -564,7 +564,7 @@ static int ks_pcie_v3_65_add_bus(struct pci_bus *bus)
 	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
 	struct keystone_pcie *ks_pcie = to_keystone_pcie(pci);
 
-	if (!pci_is_root_bus(bus))
+	if (!pci_is_root_bus(bus) || ks_pcie->is_am6)
 		return 0;
 
 	/* Configure and set up BAR0 */
-- 
GitLab