Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm...
[firefly-linux-kernel-4.4.55.git] / arch / tile / kernel / pci.c
index 67237d34c2e2ad7f8b3b1c43f3f28bfe4d6c1acc..b7180e6e900da624e14758138037fd103009881f 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/capability.h>
 #include <linux/sched.h>
 #include <linux/errno.h>
-#include <linux/bootmem.h>
 #include <linux/irq.h>
 #include <linux/io.h>
 #include <linux/uaccess.h>
@@ -52,6 +51,8 @@
  *
  */
 
+static int pci_probe = 1;
+
 /*
  * This flag tells if the platform is TILEmpower that needs
  * special configuration for the PLX switch chip.
@@ -144,6 +145,11 @@ int __init tile_pci_init(void)
 {
        int i;
 
+       if (!pci_probe) {
+               pr_info("PCI: disabled by boot argument\n");
+               return 0;
+       }
+
        pr_info("PCI: Searching for controllers...\n");
 
        /* Re-init number of PCIe controllers to support hot-plug feature. */
@@ -192,7 +198,6 @@ int __init tile_pci_init(void)
                        controller->hv_cfg_fd[0] = hv_cfg_fd0;
                        controller->hv_cfg_fd[1] = hv_cfg_fd1;
                        controller->hv_mem_fd = hv_mem_fd;
-                       controller->first_busno = 0;
                        controller->last_busno = 0xff;
                        controller->ops = &tile_cfg_ops;
 
@@ -283,7 +288,7 @@ int __init pcibios_init(void)
         * known to require at least 20ms here, but we use a more
         * conservative value.
         */
-       mdelay(250);
+       msleep(250);
 
        /* Scan all of the recorded PCI controllers.  */
        for (i = 0; i < TILE_NUM_PCIE; i++) {
@@ -304,18 +309,10 @@ int __init pcibios_init(void)
 
                        pr_info("PCI: initializing controller #%d\n", i);
 
-                       /*
-                        * This comes from the generic Linux PCI driver.
-                        *
-                        * It reads the PCI tree for this bus into the Linux
-                        * data structures.
-                        *
-                        * This is inlined in linux/pci.h and calls into
-                        * pci_scan_bus_parented() in probe.c.
-                        */
                        pci_add_resource(&resources, &ioport_resource);
                        pci_add_resource(&resources, &iomem_resource);
-                       bus = pci_scan_root_bus(NULL, 0, controller->ops, controller, &resources);
+                       bus = pci_scan_root_bus(NULL, 0, controller->ops,
+                                               controller, &resources);
                        controller->root_bus = bus;
                        controller->last_busno = bus->busn_res.end;
                }
@@ -388,6 +385,16 @@ void pcibios_set_master(struct pci_dev *dev)
        /* No special bus mastering setup handling. */
 }
 
+/* Process any "pci=" kernel boot arguments. */
+char *__init pcibios_setup(char *str)
+{
+       if (!strcmp(str, "off")) {
+               pci_probe = 0;
+               return NULL;
+       }
+       return str;
+}
+
 /*
  * Enable memory and/or address decoding, as appropriate, for the
  * device described by the 'dev' struct.