These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / bcma / main.c
index 9635f10..59d8d0d 100644 (file)
@@ -7,11 +7,14 @@
 
 #include "bcma_private.h"
 #include <linux/module.h>
+#include <linux/mmc/sdio_func.h>
 #include <linux/platform_device.h>
+#include <linux/pci.h>
 #include <linux/bcma/bcma.h>
 #include <linux/slab.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
+#include <linux/of_platform.h>
 
 MODULE_DESCRIPTION("Broadcom's specific AMBA driver");
 MODULE_LICENSE("GPL");
@@ -268,6 +271,28 @@ void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core)
        }
 }
 
+struct device *bcma_bus_get_host_dev(struct bcma_bus *bus)
+{
+       switch (bus->hosttype) {
+       case BCMA_HOSTTYPE_PCI:
+               if (bus->host_pci)
+                       return &bus->host_pci->dev;
+               else
+                       return NULL;
+       case BCMA_HOSTTYPE_SOC:
+               if (bus->host_pdev)
+                       return &bus->host_pdev->dev;
+               else
+                       return NULL;
+       case BCMA_HOSTTYPE_SDIO:
+               if (bus->host_sdio)
+                       return &bus->host_sdio->dev;
+               else
+                       return NULL;
+       }
+       return NULL;
+}
+
 void bcma_init_bus(struct bcma_bus *bus)
 {
        mutex_lock(&bcma_buses_mutex);
@@ -387,6 +412,7 @@ int bcma_bus_register(struct bcma_bus *bus)
 {
        int err;
        struct bcma_device *core;
+       struct device *dev;
 
        /* Scan for devices (cores) */
        err = bcma_bus_scan(bus);
@@ -409,6 +435,11 @@ int bcma_bus_register(struct bcma_bus *bus)
                bcma_core_pci_early_init(&bus->drv_pci[0]);
        }
 
+       dev = bcma_bus_get_host_dev(bus);
+       if (dev) {
+               of_platform_default_populate(dev->of_node, NULL, dev);
+       }
+
        /* Cores providing flash access go before SPROM init */
        list_for_each_entry(core, &bus->cores, list) {
                if (bcma_is_core_needed_early(core->id.id))