Merge tag 'kvm-ppc-next-5.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/paulu...
[linux-2.6-microblaze.git] / drivers / pci / controller / pcie-xilinx.c
index 98e5529..8523be6 100644 (file)
@@ -98,7 +98,6 @@
  * @reg_base: IO Mapped Register Base
  * @irq: Interrupt number
  * @msi_pages: MSI pages
- * @root_busno: Root Bus number
  * @dev: Device pointer
  * @msi_domain: MSI IRQ domain pointer
  * @leg_domain: Legacy IRQ domain pointer
@@ -108,7 +107,6 @@ struct xilinx_pcie_port {
        void __iomem *reg_base;
        u32 irq;
        unsigned long msi_pages;
-       u8 root_busno;
        struct device *dev;
        struct irq_domain *msi_domain;
        struct irq_domain *leg_domain;
@@ -162,14 +160,13 @@ static bool xilinx_pcie_valid_device(struct pci_bus *bus, unsigned int devfn)
        struct xilinx_pcie_port *port = bus->sysdata;
 
        /* Check if link is up when trying to access downstream ports */
-       if (bus->number != port->root_busno)
+       if (!pci_is_root_bus(bus)) {
                if (!xilinx_pcie_link_up(port))
                        return false;
-
-       /* Only one device down on each root port */
-       if (bus->number == port->root_busno && devfn > 0)
+       } else if (devfn > 0) {
+               /* Only one device down on each root port */
                return false;
-
+       }
        return true;
 }
 
@@ -616,7 +613,6 @@ static int xilinx_pcie_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
        struct xilinx_pcie_port *port;
-       struct pci_bus *bus, *child;
        struct pci_host_bridge *bridge;
        int err;
 
@@ -645,35 +641,14 @@ static int xilinx_pcie_probe(struct platform_device *pdev)
                return err;
        }
 
-       err = pci_parse_request_of_pci_ranges(dev, &bridge->windows,
-                                             &bridge->dma_ranges, NULL);
-       if (err) {
-               dev_err(dev, "Getting bridge resources failed\n");
-               return err;
-       }
-
-       bridge->dev.parent = dev;
        bridge->sysdata = port;
-       bridge->busnr = 0;
        bridge->ops = &xilinx_pcie_ops;
-       bridge->map_irq = of_irq_parse_and_map_pci;
-       bridge->swizzle_irq = pci_common_swizzle;
 
 #ifdef CONFIG_PCI_MSI
        xilinx_pcie_msi_chip.dev = dev;
        bridge->msi = &xilinx_pcie_msi_chip;
 #endif
-       err = pci_scan_root_bus_bridge(bridge);
-       if (err < 0)
-               return err;
-
-       bus = bridge->bus;
-
-       pci_assign_unassigned_bus_resources(bus);
-       list_for_each_entry(child, &bus->children, node)
-               pcie_bus_configure_settings(child);
-       pci_bus_add_devices(bus);
-       return 0;
+       return pci_host_probe(bridge);
 }
 
 static const struct of_device_id xilinx_pcie_of_match[] = {