Merge branch 'drm-patches' of master.kernel.org:/pub/scm/linux/kernel/git/airlied...
[linux-drm-fsl-dcu.git] / arch / mips / pci / pci.c
index ba66f8c9bd4eec824b21882d8129d284289cf6dc..8108231f2e20909ed0057a792a4f3265827fac8f 100644 (file)
@@ -6,7 +6,6 @@
  *
  * Copyright (C) 2003, 04 Ralf Baechle (ralf@linux-mips.org)
  */
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/bootmem.h>
@@ -78,8 +77,28 @@ pcibios_align_resource(void *data, struct resource *res,
 
 void __init register_pci_controller(struct pci_controller *hose)
 {
+       if (request_resource(&iomem_resource, hose->mem_resource) < 0)
+               goto out;
+       if (request_resource(&ioport_resource, hose->io_resource) < 0) {
+               release_resource(hose->mem_resource);
+               goto out;
+       }
+
        *hose_tail = hose;
        hose_tail = &hose->next;
+
+       /*
+        * Do not panic here but later - this might hapen before console init.
+        */
+       if (!hose->io_map_base) {
+               printk(KERN_WARNING
+                      "registering PCI controller with io_map_base unset\n");
+       }
+       return;
+
+out:
+       printk(KERN_WARNING
+              "Skipping PCI bus scan due to resource conflict\n");
 }
 
 /* Most MIPS systems have straight-forward swizzling needs.  */
@@ -114,11 +133,6 @@ static int __init pcibios_init(void)
        /* Scan all of the recorded PCI controllers.  */
        for (next_busno = 0, hose = hose_head; hose; hose = hose->next) {
 
-               if (request_resource(&iomem_resource, hose->mem_resource) < 0)
-                       goto out;
-               if (request_resource(&ioport_resource, hose->io_resource) < 0)
-                       goto out_free_mem_resource;
-
                if (!hose->iommu)
                        PCI_DMA_BUS_IS_PHYS = 1;
 
@@ -137,14 +151,6 @@ static int __init pcibios_init(void)
                                need_domain_info = 1;
                        }
                }
-               continue;
-
-out_free_mem_resource:
-               release_resource(hose->mem_resource);
-
-out:
-               printk(KERN_WARNING
-                      "Skipping PCI bus scan due to resource conflict\n");
        }
 
        if (!pci_probe_only)
@@ -224,7 +230,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
        return pcibios_plat_dev_init(dev);
 }
 
-static void __init pcibios_fixup_device_resources(struct pci_dev *dev,
+static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev,
        struct pci_bus *bus)
 {
        /* Update device resources.  */