Skip to content

Commit 9ffa0e7

Browse files
PCI: keystone: Don't enable BAR 0 for AM654x
After 6ab15b5 ("PCI: dwc: keystone: Convert .scan_bus() callback to use add_bus"), ks_pcie_v3_65_add_bus() enabled BAR 0 for both v3.65a and v4.90a devices. On the AM654x SoC, which uses v4.90a, enabling BAR 0 causes Completion Timeouts when setting up MSI-X. These timeouts delay boot of the AM654x by about 45 seconds. Move the BAR 0 initialization to ks_pcie_msi_host_init(), which is only used for v3.65a devices, and remove ks_pcie_v3_65_add_bus(). [bhelgaas: commit log] Fixes: 6ab15b5 ("PCI: dwc: keystone: Convert .scan_bus() callback to use add_bus") Link: https://lore.kernel.org/linux-pci/[email protected] Suggested-by: Bjorn Helgaas <[email protected]> Suggested-by: Niklas Cassel <[email protected]> Suggested-by: Serge Semin <[email protected]> Signed-off-by: Siddharth Vadapalli <[email protected]> Signed-off-by: Krzysztof Wilczyński <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Niklas Cassel <[email protected]>
1 parent 5125fdc commit 9ffa0e7

File tree

1 file changed

+18
-34
lines changed

1 file changed

+18
-34
lines changed

drivers/pci/controller/dwc/pci-keystone.c

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,24 @@ static void ks_pcie_clear_dbi_mode(struct keystone_pcie *ks_pcie)
289289

290290
static int ks_pcie_msi_host_init(struct dw_pcie_rp *pp)
291291
{
292+
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
293+
struct keystone_pcie *ks_pcie = to_keystone_pcie(pci);
294+
295+
/* Configure and set up BAR0 */
296+
ks_pcie_set_dbi_mode(ks_pcie);
297+
298+
/* Enable BAR0 */
299+
dw_pcie_writel_dbi(pci, PCI_BASE_ADDRESS_0, 1);
300+
dw_pcie_writel_dbi(pci, PCI_BASE_ADDRESS_0, SZ_4K - 1);
301+
302+
ks_pcie_clear_dbi_mode(ks_pcie);
303+
304+
/*
305+
* For BAR0, just setting bus address for inbound writes (MSI) should
306+
* be sufficient. Use physical address to avoid any conflicts.
307+
*/
308+
dw_pcie_writel_dbi(pci, PCI_BASE_ADDRESS_0, ks_pcie->app.start);
309+
292310
pp->msi_irq_chip = &ks_pcie_msi_irq_chip;
293311
return dw_pcie_allocate_domains(pp);
294312
}
@@ -445,44 +463,10 @@ static struct pci_ops ks_child_pcie_ops = {
445463
.write = pci_generic_config_write,
446464
};
447465

448-
/**
449-
* ks_pcie_v3_65_add_bus() - keystone add_bus post initialization
450-
* @bus: A pointer to the PCI bus structure.
451-
*
452-
* This sets BAR0 to enable inbound access for MSI_IRQ register
453-
*/
454-
static int ks_pcie_v3_65_add_bus(struct pci_bus *bus)
455-
{
456-
struct dw_pcie_rp *pp = bus->sysdata;
457-
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
458-
struct keystone_pcie *ks_pcie = to_keystone_pcie(pci);
459-
460-
if (!pci_is_root_bus(bus))
461-
return 0;
462-
463-
/* Configure and set up BAR0 */
464-
ks_pcie_set_dbi_mode(ks_pcie);
465-
466-
/* Enable BAR0 */
467-
dw_pcie_writel_dbi(pci, PCI_BASE_ADDRESS_0, 1);
468-
dw_pcie_writel_dbi(pci, PCI_BASE_ADDRESS_0, SZ_4K - 1);
469-
470-
ks_pcie_clear_dbi_mode(ks_pcie);
471-
472-
/*
473-
* For BAR0, just setting bus address for inbound writes (MSI) should
474-
* be sufficient. Use physical address to avoid any conflicts.
475-
*/
476-
dw_pcie_writel_dbi(pci, PCI_BASE_ADDRESS_0, ks_pcie->app.start);
477-
478-
return 0;
479-
}
480-
481466
static struct pci_ops ks_pcie_ops = {
482467
.map_bus = dw_pcie_own_conf_map_bus,
483468
.read = pci_generic_config_read,
484469
.write = pci_generic_config_write,
485-
.add_bus = ks_pcie_v3_65_add_bus,
486470
};
487471

488472
/**

0 commit comments

Comments
 (0)