PCI: rcar: Add R8A7794 support
[firefly-linux-kernel-4.4.55.git] / drivers / pci / probe.c
index 8177f3b0449152a7c01136a1925f4bfcf885cf8a..8361d27e5ecad82ff9767c3d55a019a66f884046 100644 (file)
@@ -326,8 +326,7 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
                struct resource *res = &dev->resource[PCI_ROM_RESOURCE];
                dev->rom_base_reg = rom;
                res->flags = IORESOURCE_MEM | IORESOURCE_PREFETCH |
-                               IORESOURCE_READONLY | IORESOURCE_CACHEABLE |
-                               IORESOURCE_SIZEALIGN;
+                               IORESOURCE_READONLY | IORESOURCE_SIZEALIGN;
                __pci_read_base(dev, pci_bar_mem32, res, rom);
        }
 }
@@ -677,15 +676,20 @@ static struct irq_domain *pci_host_bridge_msi_domain(struct pci_bus *bus)
 static void pci_set_bus_msi_domain(struct pci_bus *bus)
 {
        struct irq_domain *d;
+       struct pci_bus *b;
 
        /*
-        * Either bus is the root, and we must obtain it from the
-        * firmware, or we inherit it from the bridge device.
+        * The bus can be a root bus, a subordinate bus, or a virtual bus
+        * created by an SR-IOV device.  Walk up to the first bridge device
+        * found or derive the domain from the host bridge.
         */
-       if (pci_is_root_bus(bus))
-               d = pci_host_bridge_msi_domain(bus);
-       else
-               d = dev_get_msi_domain(&bus->self->dev);
+       for (b = bus, d = NULL; !d && !pci_is_root_bus(b); b = b->parent) {
+               if (b->self)
+                       d = dev_get_msi_domain(&b->self->dev);
+       }
+
+       if (!d)
+               d = pci_host_bridge_msi_domain(b);
 
        dev_set_msi_domain(&bus->dev, d);
 }
@@ -856,9 +860,6 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass)
                        child->bridge_ctl = bctl;
                }
 
-               /* Read and initialize bridge resources */
-               pci_read_bridge_bases(child);
-
                cmax = pci_scan_child_bus(child);
                if (cmax > subordinate)
                        dev_warn(&dev->dev, "bridge has subordinate %02x but max busn %02x\n",
@@ -919,9 +920,6 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass)
 
                if (!is_cardbus) {
                        child->bridge_ctl = bctl;
-
-                       /* Read and initialize bridge resources */
-                       pci_read_bridge_bases(child);
                        max = pci_scan_child_bus(child);
                } else {
                        /*