aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorenzo Pieralisi <lorenzo.pieralisi@arm.com>2015-07-29 07:33:18 -0400
committerBjorn Helgaas <bhelgaas@google.com>2015-08-20 13:02:50 -0400
commit8953aab1e80fd299d6185a57edaff733fa5c6a55 (patch)
tree8ed339530355c4f6465700d0828f2cacdef5f3c2
parentd2a7926d42b3b46e45b4e44dc3302b2701ec0856 (diff)
ARM/PCI, designware, xilinx: Use pci_scan_root_bus_msi()
ARM previously stored the msi_controller pointer in its sysdata, struct pci_sys_data, and implemented pcibios_msi_controller() to retrieve it. That made PCI host controller drivers specific to ARM because they had to put the msi_controller pointer in the ARM-specific pci_sys_data. There is now a generic mechanism, pci_scan_root_bus_msi(), for giving the msi_controller pointer to the PCI core. Use this for all ARM systems and for the DesignWare and Xilinx PCI host controller drivers. This removes an ARM dependency from the DesignWare, DRA7xx, EXYNOS, i.MX6, Keystone, Layerscape, SPEAr13xx, and Xilinx drivers. [bhelgaas: changelog, split into separate patch] Suggested-by: Russell King <linux@arm.linux.org.uk> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Jingoo Han <jingoohan1@gmail.com> CC: Pratyush Anand <pratyush.anand@gmail.com> CC: Arnd Bergmann <arnd@arndb.de> CC: Simon Horman <horms@verge.net.au> CC: Russell King <linux@arm.linux.org.uk> CC: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> CC: Thierry Reding <thierry.reding@gmail.com> CC: Michal Simek <michal.simek@xilinx.com> CC: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r--arch/arm/include/asm/mach/pci.h2
-rw-r--r--arch/arm/kernel/bios32.c5
-rw-r--r--drivers/pci/host/pcie-designware.c12
-rw-r--r--drivers/pci/host/pcie-xilinx.c11
4 files changed, 20 insertions, 10 deletions
diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h
index 28b9bb35949e..c074e7a319e7 100644
--- a/arch/arm/include/asm/mach/pci.h
+++ b/arch/arm/include/asm/mach/pci.h
@@ -19,9 +19,7 @@ struct pci_bus;
19struct device; 19struct device;
20 20
21struct hw_pci { 21struct hw_pci {
22#ifdef CONFIG_PCI_MSI
23 struct msi_controller *msi_ctrl; 22 struct msi_controller *msi_ctrl;
24#endif
25 struct pci_ops *ops; 23 struct pci_ops *ops;
26 int nr_controllers; 24 int nr_controllers;
27 void **private_data; 25 void **private_data;
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index 4e95260efb39..283bc1c7b502 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -486,8 +486,9 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
486 if (hw->scan) 486 if (hw->scan)
487 sys->bus = hw->scan(nr, sys); 487 sys->bus = hw->scan(nr, sys);
488 else 488 else
489 sys->bus = pci_scan_root_bus(parent, sys->busnr, 489 sys->bus = pci_scan_root_bus_msi(parent,
490 hw->ops, sys, &sys->resources); 490 sys->busnr, hw->ops, sys,
491 &sys->resources, hw->msi_ctrl);
491 492
492 if (WARN(!sys->bus, "PCI: unable to scan bus!")) { 493 if (WARN(!sys->bus, "PCI: unable to scan bus!")) {
493 kfree(sys); 494 kfree(sys);
diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
index 69486be7181e..fe11cc175f77 100644
--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -526,7 +526,6 @@ int dw_pcie_host_init(struct pcie_port *pp)
526 526
527#ifdef CONFIG_PCI_MSI 527#ifdef CONFIG_PCI_MSI
528 dw_pcie_msi_chip.dev = pp->dev; 528 dw_pcie_msi_chip.dev = pp->dev;
529 dw_pci.msi_ctrl = &dw_pcie_msi_chip;
530#endif 529#endif
531 530
532 dw_pci.nr_controllers = 1; 531 dw_pci.nr_controllers = 1;
@@ -708,8 +707,15 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
708 struct pcie_port *pp = sys_to_pcie(sys); 707 struct pcie_port *pp = sys_to_pcie(sys);
709 708
710 pp->root_bus_nr = sys->busnr; 709 pp->root_bus_nr = sys->busnr;
711 bus = pci_scan_root_bus(pp->dev, sys->busnr, 710
712 &dw_pcie_ops, sys, &sys->resources); 711 if (IS_ENABLED(CONFIG_PCI_MSI))
712 bus = pci_scan_root_bus_msi(pp->dev, sys->busnr, &dw_pcie_ops,
713 sys, &sys->resources,
714 &dw_pcie_msi_chip);
715 else
716 bus = pci_scan_root_bus(pp->dev, sys->busnr, &dw_pcie_ops,
717 sys, &sys->resources);
718
713 if (!bus) 719 if (!bus)
714 return NULL; 720 return NULL;
715 721
diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c
index f1a06a091ccb..38d3114b97d3 100644
--- a/drivers/pci/host/pcie-xilinx.c
+++ b/drivers/pci/host/pcie-xilinx.c
@@ -647,9 +647,15 @@ static struct pci_bus *xilinx_pcie_scan_bus(int nr, struct pci_sys_data *sys)
647 struct pci_bus *bus; 647 struct pci_bus *bus;
648 648
649 port->root_busno = sys->busnr; 649 port->root_busno = sys->busnr;
650 bus = pci_scan_root_bus(port->dev, sys->busnr, &xilinx_pcie_ops,
651 sys, &sys->resources);
652 650
651 if (IS_ENABLED(CONFIG_PCI_MSI))
652 bus = pci_scan_root_bus_msi(port->dev, sys->busnr,
653 &xilinx_pcie_ops, sys,
654 &sys->resources,
655 &xilinx_pcie_msi_chip);
656 else
657 bus = pci_scan_root_bus(port->dev, sys->busnr,
658 &xilinx_pcie_ops, sys, &sys->resources);
653 return bus; 659 return bus;
654} 660}
655 661
@@ -847,7 +853,6 @@ static int xilinx_pcie_probe(struct platform_device *pdev)
847 853
848#ifdef CONFIG_PCI_MSI 854#ifdef CONFIG_PCI_MSI
849 xilinx_pcie_msi_chip.dev = port->dev; 855 xilinx_pcie_msi_chip.dev = port->dev;
850 hw.msi_ctrl = &xilinx_pcie_msi_chip;
851#endif 856#endif
852 pci_common_init_dev(dev, &hw); 857 pci_common_init_dev(dev, &hw);
853 858