summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2014-09-08 19:50:53 +0000
committerHauke Mehrtens <hauke@hauke-m.de>2014-09-08 19:50:53 +0000
commit8313b329c6235272204a53b2c24e4694b94ad8f4 (patch)
treeffe29a8822bcf6fb56d07ea669f3842328ccf131 /target
parente030c505029f7662eecb8fa0608379fb5e72a423 (diff)
downloadmtk-20170518-8313b329c6235272204a53b2c24e4694b94ad8f4.zip
mtk-20170518-8313b329c6235272204a53b2c24e4694b94ad8f4.tar.gz
mtk-20170518-8313b329c6235272204a53b2c24e4694b94ad8f4.tar.bz2
kernel: add bcma patches sent upstream but not pushed yet
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 42448
Diffstat (limited to 'target')
-rw-r--r--target/linux/bcm53xx/patches-3.14/120-bcma-register-bcma-as-device-tree-driver.patch11
-rw-r--r--target/linux/bcm53xx/patches-3.14/121-bcma-get-irqs-from-dt.patch38
-rw-r--r--target/linux/bcm53xx/patches-3.14/142-bcma-add-support-for-chipcommon-B-core.patch8
-rw-r--r--target/linux/bcm53xx/patches-3.14/160-bcma-add-PCI-IDs-for-more-devices.patch32
-rw-r--r--target/linux/generic/patches-3.10/026-bcma-sent.patch247
-rw-r--r--target/linux/generic/patches-3.14/026-bcma-sent.patch247
6 files changed, 524 insertions, 59 deletions
diff --git a/target/linux/bcm53xx/patches-3.14/120-bcma-register-bcma-as-device-tree-driver.patch b/target/linux/bcm53xx/patches-3.14/120-bcma-register-bcma-as-device-tree-driver.patch
index 317fbdc..9027f48 100644
--- a/target/linux/bcm53xx/patches-3.14/120-bcma-register-bcma-as-device-tree-driver.patch
+++ b/target/linux/bcm53xx/patches-3.14/120-bcma-register-bcma-as-device-tree-driver.patch
@@ -76,15 +76,15 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
#include <linux/bcma/bcma.h>
#include <linux/bcma/bcma_soc.h>
-@@ -173,6 +176,7 @@ int __init bcma_host_soc_register(struct
+@@ -176,6 +179,7 @@ int __init bcma_host_soc_register(struct
/* Host specific */
bus->hosttype = BCMA_HOSTTYPE_SOC;
bus->ops = &bcma_host_soc_ops;
+ bus->host_pdev = NULL;
- /* Register */
- err = bcma_bus_early_register(bus, &soc->core_cc, &soc->core_mips);
-@@ -181,3 +185,69 @@ int __init bcma_host_soc_register(struct
+ /* Initialize struct, detect chip */
+ bcma_init_bus(bus);
+@@ -195,3 +199,72 @@ int __init bcma_host_soc_init(struct bcm
return err;
}
@@ -112,6 +112,9 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+ bus->ops = &bcma_host_soc_ops;
+ bus->host_pdev = pdev;
+
++ /* Initialize struct, detect chip */
++ bcma_init_bus(bus);
++
+ /* Register */
+ err = bcma_bus_register(bus);
+ if (err)
diff --git a/target/linux/bcm53xx/patches-3.14/121-bcma-get-irqs-from-dt.patch b/target/linux/bcm53xx/patches-3.14/121-bcma-get-irqs-from-dt.patch
index d9a831c..02cf1ea 100644
--- a/target/linux/bcm53xx/patches-3.14/121-bcma-get-irqs-from-dt.patch
+++ b/target/linux/bcm53xx/patches-3.14/121-bcma-get-irqs-from-dt.patch
@@ -24,8 +24,8 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
MODULE_DESCRIPTION("Broadcom's specific AMBA driver");
MODULE_LICENSE("GPL");
-@@ -120,6 +122,38 @@ static void bcma_release_core_dev(struct
- kfree(core);
+@@ -131,6 +133,38 @@ static bool bcma_is_core_needed_early(u1
+ return false;
}
+static struct device_node *bcma_of_find_child_device(struct platform_device *parent,
@@ -60,21 +60,21 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+ core->irq = irq_of_parse_and_map(node, 0);
+}
+
- static int bcma_register_cores(struct bcma_bus *bus)
+ static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
{
- struct bcma_device *core;
-@@ -155,7 +189,13 @@ static int bcma_register_cores(struct bc
- break;
- case BCMA_HOSTTYPE_SOC:
- core->dev.dma_mask = &core->dev.coherent_dma_mask;
-- core->dma_dev = &core->dev;
-+ if (bus->host_pdev) {
-+ core->dma_dev = &bus->host_pdev->dev;
-+ core->dev.parent = &bus->host_pdev->dev;
-+ bcma_of_fill_device(bus->host_pdev, core);
-+ } else {
-+ core->dma_dev = &core->dev;
-+ }
- break;
- case BCMA_HOSTTYPE_SDIO:
- break;
+ int err;
+@@ -147,7 +181,13 @@ static void bcma_register_core(struct bc
+ break;
+ case BCMA_HOSTTYPE_SOC:
+ core->dev.dma_mask = &core->dev.coherent_dma_mask;
+- core->dma_dev = &core->dev;
++ if (bus->host_pdev) {
++ core->dma_dev = &bus->host_pdev->dev;
++ core->dev.parent = &bus->host_pdev->dev;
++ bcma_of_fill_device(bus->host_pdev, core);
++ } else {
++ core->dma_dev = &core->dev;
++ }
+ break;
+ case BCMA_HOSTTYPE_SDIO:
+ break;
diff --git a/target/linux/bcm53xx/patches-3.14/142-bcma-add-support-for-chipcommon-B-core.patch b/target/linux/bcm53xx/patches-3.14/142-bcma-add-support-for-chipcommon-B-core.patch
index c744e38..59b94c1 100644
--- a/target/linux/bcm53xx/patches-3.14/142-bcma-add-support-for-chipcommon-B-core.patch
+++ b/target/linux/bcm53xx/patches-3.14/142-bcma-add-support-for-chipcommon-B-core.patch
@@ -105,7 +105,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+}
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
-@@ -164,6 +164,7 @@ static int bcma_register_cores(struct bc
+@@ -213,6 +213,7 @@ static int bcma_register_devices(struct
switch (core->id.id) {
case BCMA_CORE_4706_CHIPCOMMON:
case BCMA_CORE_CHIPCOMMON:
@@ -113,7 +113,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
case BCMA_CORE_PCI:
case BCMA_CORE_PCIE:
case BCMA_CORE_PCIE2:
-@@ -301,6 +302,13 @@ int bcma_bus_register(struct bcma_bus *b
+@@ -327,6 +328,13 @@ int bcma_bus_register(struct bcma_bus *b
bcma_core_chipcommon_init(&bus->drv_cc);
}
@@ -127,7 +127,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
/* Init MIPS core */
core = bcma_find_core(bus, BCMA_CORE_MIPS_74K);
if (core) {
-@@ -355,6 +363,8 @@ void bcma_bus_unregister(struct bcma_bus
+@@ -381,6 +389,8 @@ void bcma_bus_unregister(struct bcma_bus
else if (err)
bcma_err(bus, "Can not unregister GPIO driver: %i\n", err);
@@ -148,7 +148,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
default:
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
-@@ -338,6 +338,7 @@ struct bcma_bus {
+@@ -337,6 +337,7 @@ struct bcma_bus {
u8 num;
struct bcma_drv_cc drv_cc;
diff --git a/target/linux/bcm53xx/patches-3.14/160-bcma-add-PCI-IDs-for-more-devices.patch b/target/linux/bcm53xx/patches-3.14/160-bcma-add-PCI-IDs-for-more-devices.patch
deleted file mode 100644
index 13c4e06..0000000
--- a/target/linux/bcm53xx/patches-3.14/160-bcma-add-PCI-IDs-for-more-devices.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 5274195ed2aefa21bcc69de7ecbd13a88bd3f357 Mon Sep 17 00:00:00 2001
-From: Hauke Mehrtens <hauke@hauke-m.de>
-Date: Sat, 23 Aug 2014 17:58:11 +0200
-Subject: [PATCH 11/17] bcma: add PCI ID for spromless BCM43217
-
-This adds the PCI ID a BCM43217 without a sprom.
-This devices was found on a Netgear R6250 attached to a BCM4708 ARM SoC.
-
-bcma: bus1: Found chip with id 0xA8D1, rev 0x00 and package 0x08
-bcma: bus1: Core 0 found: ChipCommon (manuf 0x4BF, id 0x800, rev 0x27, class 0x0)
-bcma: bus1: Core 1 found: IEEE 802.11 (manuf 0x4BF, id 0x812, rev 0x1E, class 0x0)
-bcma: bus1: Core 2 found: PCIe (manuf 0x4BF, id 0x820, rev 0x14, class 0x0)
-
-b43-phy0: Broadcom 43217 WLAN found (core revision 30)
-b43-phy0: Found PHY: Analog 9, Type 4 (N), Revision 17
-b43-phy0: Found Radio: Manuf 0x17F, ID 0x2057, Revision 14, Version 1
-
-Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
----
- drivers/bcma/host_pci.c | 1 +
- 1 file changed, 1 insertion(+)
-
---- a/drivers/bcma/host_pci.c
-+++ b/drivers/bcma/host_pci.c
-@@ -282,6 +282,7 @@ static const struct pci_device_id bcma_p
- { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) },
- { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) },
- { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) },
-+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) }, /* 0xA8DB */
- { 0, },
- };
- MODULE_DEVICE_TABLE(pci, bcma_pci_bridge_tbl);
diff --git a/target/linux/generic/patches-3.10/026-bcma-sent.patch b/target/linux/generic/patches-3.10/026-bcma-sent.patch
new file mode 100644
index 0000000..9bf5976
--- /dev/null
+++ b/target/linux/generic/patches-3.10/026-bcma-sent.patch
@@ -0,0 +1,247 @@
+--- a/arch/mips/bcm47xx/setup.c
++++ b/arch/mips/bcm47xx/setup.c
+@@ -194,6 +194,10 @@ static void __init bcm47xx_register_bcma
+
+ err = bcma_host_soc_register(&bcm47xx_bus.bcma);
+ if (err)
++ panic("Failed to register BCMA bus (err %d)", err);
++
++ err = bcma_host_soc_init(&bcm47xx_bus.bcma);
++ if (err)
+ panic("Failed to initialize BCMA bus (err %d)", err);
+
+ bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo, NULL);
+--- a/drivers/bcma/host_pci.c
++++ b/drivers/bcma/host_pci.c
+@@ -208,6 +208,9 @@ static int bcma_host_pci_probe(struct pc
+ bus->boardinfo.vendor = bus->host_pci->subsystem_vendor;
+ bus->boardinfo.type = bus->host_pci->subsystem_device;
+
++ /* Initialize struct, detect chip */
++ bcma_init_bus(bus);
++
+ /* Register */
+ err = bcma_bus_register(bus);
+ if (err)
+@@ -282,6 +285,7 @@ static const struct pci_device_id bcma_p
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) },
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) },
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) },
++ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) }, /* 0xA8DB */
+ { 0, },
+ };
+ MODULE_DEVICE_TABLE(pci, bcma_pci_bridge_tbl);
+--- a/drivers/bcma/host_soc.c
++++ b/drivers/bcma/host_soc.c
+@@ -165,7 +165,6 @@ static const struct bcma_host_ops bcma_h
+ int __init bcma_host_soc_register(struct bcma_soc *soc)
+ {
+ struct bcma_bus *bus = &soc->bus;
+- int err;
+
+ /* iomap only first core. We have to read some register on this core
+ * to scan the bus.
+@@ -178,7 +177,18 @@ int __init bcma_host_soc_register(struct
+ bus->hosttype = BCMA_HOSTTYPE_SOC;
+ bus->ops = &bcma_host_soc_ops;
+
+- /* Register */
++ /* Initialize struct, detect chip */
++ bcma_init_bus(bus);
++
++ return 0;
++}
++
++int __init bcma_host_soc_init(struct bcma_soc *soc)
++{
++ struct bcma_bus *bus = &soc->bus;
++ int err;
++
++ /* Scan bus and initialize it */
+ err = bcma_bus_early_register(bus, &soc->core_cc, &soc->core_mips);
+ if (err)
+ iounmap(bus->mmio);
+--- a/drivers/bcma/main.c
++++ b/drivers/bcma/main.c
+@@ -111,10 +111,53 @@ static void bcma_release_core_dev(struct
+ kfree(core);
+ }
+
+-static int bcma_register_cores(struct bcma_bus *bus)
++static bool bcma_is_core_needed_early(u16 core_id)
++{
++ switch (core_id) {
++ case BCMA_CORE_NS_NAND:
++ case BCMA_CORE_NS_QSPI:
++ return true;
++ }
++
++ return false;
++}
++
++static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
++{
++ int err;
++
++ core->dev.release = bcma_release_core_dev;
++ core->dev.bus = &bcma_bus_type;
++ dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index);
++
++ switch (bus->hosttype) {
++ case BCMA_HOSTTYPE_PCI:
++ core->dev.parent = &bus->host_pci->dev;
++ core->dma_dev = &bus->host_pci->dev;
++ core->irq = bus->host_pci->irq;
++ break;
++ case BCMA_HOSTTYPE_SOC:
++ core->dev.dma_mask = &core->dev.coherent_dma_mask;
++ core->dma_dev = &core->dev;
++ break;
++ case BCMA_HOSTTYPE_SDIO:
++ break;
++ }
++
++ err = device_register(&core->dev);
++ if (err) {
++ bcma_err(bus, "Could not register dev for core 0x%03X\n",
++ core->id.id);
++ put_device(&core->dev);
++ return;
++ }
++ core->dev_registered = true;
++}
++
++static int bcma_register_devices(struct bcma_bus *bus)
+ {
+ struct bcma_device *core;
+- int err, dev_id = 0;
++ int err;
+
+ list_for_each_entry(core, &bus->cores, list) {
+ /* We support that cores ourself */
+@@ -129,39 +172,16 @@ static int bcma_register_cores(struct bc
+ continue;
+ }
+
++ /* Early cores were already registered */
++ if (bcma_is_core_needed_early(core->id.id))
++ continue;
++
+ /* Only first GMAC core on BCM4706 is connected and working */
+ if (core->id.id == BCMA_CORE_4706_MAC_GBIT &&
+ core->core_unit > 0)
+ continue;
+
+- core->dev.release = bcma_release_core_dev;
+- core->dev.bus = &bcma_bus_type;
+- dev_set_name(&core->dev, "bcma%d:%d", bus->num, dev_id);
+-
+- switch (bus->hosttype) {
+- case BCMA_HOSTTYPE_PCI:
+- core->dev.parent = &bus->host_pci->dev;
+- core->dma_dev = &bus->host_pci->dev;
+- core->irq = bus->host_pci->irq;
+- break;
+- case BCMA_HOSTTYPE_SOC:
+- core->dev.dma_mask = &core->dev.coherent_dma_mask;
+- core->dma_dev = &core->dev;
+- break;
+- case BCMA_HOSTTYPE_SDIO:
+- break;
+- }
+-
+- err = device_register(&core->dev);
+- if (err) {
+- bcma_err(bus,
+- "Could not register dev for core 0x%03X\n",
+- core->id.id);
+- put_device(&core->dev);
+- continue;
+- }
+- core->dev_registered = true;
+- dev_id++;
++ bcma_register_core(bus, core);
+ }
+
+ #ifdef CONFIG_BCMA_DRIVER_MIPS
+@@ -238,6 +258,12 @@ int bcma_bus_register(struct bcma_bus *b
+ bcma_core_chipcommon_early_init(&bus->drv_cc);
+ }
+
++ /* 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))
++ bcma_register_core(bus, core);
++ }
++
+ /* Try to get SPROM */
+ err = bcma_sprom_get(bus);
+ if (err == -ENOENT) {
+@@ -288,7 +314,7 @@ int bcma_bus_register(struct bcma_bus *b
+ }
+
+ /* Register found cores */
+- bcma_register_cores(bus);
++ bcma_register_devices(bus);
+
+ bcma_info(bus, "Bus registered\n");
+
+@@ -325,8 +351,6 @@ int __init bcma_bus_early_register(struc
+ struct bcma_device *core;
+ struct bcma_device_id match;
+
+- bcma_init_bus(bus);
+-
+ match.manuf = BCMA_MANUF_BCM;
+ match.id = bcma_cc_core_id(bus);
+ match.class = BCMA_CL_SIM;
+--- a/drivers/bcma/scan.c
++++ b/drivers/bcma/scan.c
+@@ -438,9 +438,6 @@ void bcma_init_bus(struct bcma_bus *bus)
+ s32 tmp;
+ struct bcma_chipinfo *chipinfo = &(bus->chipinfo);
+
+- if (bus->init_done)
+- return;
+-
+ INIT_LIST_HEAD(&bus->cores);
+ bus->nr_cores = 0;
+
+@@ -452,8 +449,6 @@ void bcma_init_bus(struct bcma_bus *bus)
+ chipinfo->pkg = (tmp & BCMA_CC_ID_PKG) >> BCMA_CC_ID_PKG_SHIFT;
+ bcma_info(bus, "Found chip with id 0x%04X, rev 0x%02X and package 0x%02X\n",
+ chipinfo->id, chipinfo->rev, chipinfo->pkg);
+-
+- bus->init_done = true;
+ }
+
+ int bcma_bus_scan(struct bcma_bus *bus)
+@@ -463,8 +458,6 @@ int bcma_bus_scan(struct bcma_bus *bus)
+
+ int err, core_num = 0;
+
+- bcma_init_bus(bus);
+-
+ erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM);
+ if (bus->hosttype == BCMA_HOSTTYPE_SOC) {
+ eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE);
+--- a/include/linux/bcma/bcma.h
++++ b/include/linux/bcma/bcma.h
+@@ -332,7 +332,6 @@ struct bcma_bus {
+ struct bcma_device *mapped_core;
+ struct list_head cores;
+ u8 nr_cores;
+- u8 init_done:1;
+ u8 num;
+
+ struct bcma_drv_cc drv_cc;
+--- a/include/linux/bcma/bcma_soc.h
++++ b/include/linux/bcma/bcma_soc.h
+@@ -10,6 +10,7 @@ struct bcma_soc {
+ };
+
+ int __init bcma_host_soc_register(struct bcma_soc *soc);
++int __init bcma_host_soc_init(struct bcma_soc *soc);
+
+ int bcma_bus_register(struct bcma_bus *bus);
+
diff --git a/target/linux/generic/patches-3.14/026-bcma-sent.patch b/target/linux/generic/patches-3.14/026-bcma-sent.patch
new file mode 100644
index 0000000..a205c52
--- /dev/null
+++ b/target/linux/generic/patches-3.14/026-bcma-sent.patch
@@ -0,0 +1,247 @@
+--- a/arch/mips/bcm47xx/setup.c
++++ b/arch/mips/bcm47xx/setup.c
+@@ -202,6 +202,10 @@ static void __init bcm47xx_register_bcma
+
+ err = bcma_host_soc_register(&bcm47xx_bus.bcma);
+ if (err)
++ panic("Failed to register BCMA bus (err %d)", err);
++
++ err = bcma_host_soc_init(&bcm47xx_bus.bcma);
++ if (err)
+ panic("Failed to initialize BCMA bus (err %d)", err);
+
+ bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo, NULL);
+--- a/drivers/bcma/host_pci.c
++++ b/drivers/bcma/host_pci.c
+@@ -208,6 +208,9 @@ static int bcma_host_pci_probe(struct pc
+ bus->boardinfo.vendor = bus->host_pci->subsystem_vendor;
+ bus->boardinfo.type = bus->host_pci->subsystem_device;
+
++ /* Initialize struct, detect chip */
++ bcma_init_bus(bus);
++
+ /* Register */
+ err = bcma_bus_register(bus);
+ if (err)
+@@ -282,6 +285,7 @@ static const struct pci_device_id bcma_p
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) },
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) },
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) },
++ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) }, /* 0xA8DB */
+ { 0, },
+ };
+ MODULE_DEVICE_TABLE(pci, bcma_pci_bridge_tbl);
+--- a/drivers/bcma/host_soc.c
++++ b/drivers/bcma/host_soc.c
+@@ -165,7 +165,6 @@ static const struct bcma_host_ops bcma_h
+ int __init bcma_host_soc_register(struct bcma_soc *soc)
+ {
+ struct bcma_bus *bus = &soc->bus;
+- int err;
+
+ /* iomap only first core. We have to read some register on this core
+ * to scan the bus.
+@@ -178,7 +177,18 @@ int __init bcma_host_soc_register(struct
+ bus->hosttype = BCMA_HOSTTYPE_SOC;
+ bus->ops = &bcma_host_soc_ops;
+
+- /* Register */
++ /* Initialize struct, detect chip */
++ bcma_init_bus(bus);
++
++ return 0;
++}
++
++int __init bcma_host_soc_init(struct bcma_soc *soc)
++{
++ struct bcma_bus *bus = &soc->bus;
++ int err;
++
++ /* Scan bus and initialize it */
+ err = bcma_bus_early_register(bus, &soc->core_cc, &soc->core_mips);
+ if (err)
+ iounmap(bus->mmio);
+--- a/drivers/bcma/main.c
++++ b/drivers/bcma/main.c
+@@ -120,10 +120,53 @@ static void bcma_release_core_dev(struct
+ kfree(core);
+ }
+
+-static int bcma_register_cores(struct bcma_bus *bus)
++static bool bcma_is_core_needed_early(u16 core_id)
++{
++ switch (core_id) {
++ case BCMA_CORE_NS_NAND:
++ case BCMA_CORE_NS_QSPI:
++ return true;
++ }
++
++ return false;
++}
++
++static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
++{
++ int err;
++
++ core->dev.release = bcma_release_core_dev;
++ core->dev.bus = &bcma_bus_type;
++ dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index);
++
++ switch (bus->hosttype) {
++ case BCMA_HOSTTYPE_PCI:
++ core->dev.parent = &bus->host_pci->dev;
++ core->dma_dev = &bus->host_pci->dev;
++ core->irq = bus->host_pci->irq;
++ break;
++ case BCMA_HOSTTYPE_SOC:
++ core->dev.dma_mask = &core->dev.coherent_dma_mask;
++ core->dma_dev = &core->dev;
++ break;
++ case BCMA_HOSTTYPE_SDIO:
++ break;
++ }
++
++ err = device_register(&core->dev);
++ if (err) {
++ bcma_err(bus, "Could not register dev for core 0x%03X\n",
++ core->id.id);
++ put_device(&core->dev);
++ return;
++ }
++ core->dev_registered = true;
++}
++
++static int bcma_register_devices(struct bcma_bus *bus)
+ {
+ struct bcma_device *core;
+- int err, dev_id = 0;
++ int err;
+
+ list_for_each_entry(core, &bus->cores, list) {
+ /* We support that cores ourself */
+@@ -138,39 +181,16 @@ static int bcma_register_cores(struct bc
+ continue;
+ }
+
++ /* Early cores were already registered */
++ if (bcma_is_core_needed_early(core->id.id))
++ continue;
++
+ /* Only first GMAC core on BCM4706 is connected and working */
+ if (core->id.id == BCMA_CORE_4706_MAC_GBIT &&
+ core->core_unit > 0)
+ continue;
+
+- core->dev.release = bcma_release_core_dev;
+- core->dev.bus = &bcma_bus_type;
+- dev_set_name(&core->dev, "bcma%d:%d", bus->num, dev_id);
+-
+- switch (bus->hosttype) {
+- case BCMA_HOSTTYPE_PCI:
+- core->dev.parent = &bus->host_pci->dev;
+- core->dma_dev = &bus->host_pci->dev;
+- core->irq = bus->host_pci->irq;
+- break;
+- case BCMA_HOSTTYPE_SOC:
+- core->dev.dma_mask = &core->dev.coherent_dma_mask;
+- core->dma_dev = &core->dev;
+- break;
+- case BCMA_HOSTTYPE_SDIO:
+- break;
+- }
+-
+- err = device_register(&core->dev);
+- if (err) {
+- bcma_err(bus,
+- "Could not register dev for core 0x%03X\n",
+- core->id.id);
+- put_device(&core->dev);
+- continue;
+- }
+- core->dev_registered = true;
+- dev_id++;
++ bcma_register_core(bus, core);
+ }
+
+ #ifdef CONFIG_BCMA_DRIVER_MIPS
+@@ -247,6 +267,12 @@ int bcma_bus_register(struct bcma_bus *b
+ bcma_core_chipcommon_early_init(&bus->drv_cc);
+ }
+
++ /* 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))
++ bcma_register_core(bus, core);
++ }
++
+ /* Try to get SPROM */
+ err = bcma_sprom_get(bus);
+ if (err == -ENOENT) {
+@@ -297,7 +323,7 @@ int bcma_bus_register(struct bcma_bus *b
+ }
+
+ /* Register found cores */
+- bcma_register_cores(bus);
++ bcma_register_devices(bus);
+
+ bcma_info(bus, "Bus registered\n");
+
+@@ -334,8 +360,6 @@ int __init bcma_bus_early_register(struc
+ struct bcma_device *core;
+ struct bcma_device_id match;
+
+- bcma_init_bus(bus);
+-
+ match.manuf = BCMA_MANUF_BCM;
+ match.id = bcma_cc_core_id(bus);
+ match.class = BCMA_CL_SIM;
+--- a/drivers/bcma/scan.c
++++ b/drivers/bcma/scan.c
+@@ -438,9 +438,6 @@ void bcma_init_bus(struct bcma_bus *bus)
+ s32 tmp;
+ struct bcma_chipinfo *chipinfo = &(bus->chipinfo);
+
+- if (bus->init_done)
+- return;
+-
+ INIT_LIST_HEAD(&bus->cores);
+ bus->nr_cores = 0;
+
+@@ -452,8 +449,6 @@ void bcma_init_bus(struct bcma_bus *bus)
+ chipinfo->pkg = (tmp & BCMA_CC_ID_PKG) >> BCMA_CC_ID_PKG_SHIFT;
+ bcma_info(bus, "Found chip with id 0x%04X, rev 0x%02X and package 0x%02X\n",
+ chipinfo->id, chipinfo->rev, chipinfo->pkg);
+-
+- bus->init_done = true;
+ }
+
+ int bcma_bus_scan(struct bcma_bus *bus)
+@@ -463,8 +458,6 @@ int bcma_bus_scan(struct bcma_bus *bus)
+
+ int err, core_num = 0;
+
+- bcma_init_bus(bus);
+-
+ erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM);
+ if (bus->hosttype == BCMA_HOSTTYPE_SOC) {
+ eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE);
+--- a/include/linux/bcma/bcma.h
++++ b/include/linux/bcma/bcma.h
+@@ -332,7 +332,6 @@ struct bcma_bus {
+ struct bcma_device *mapped_core;
+ struct list_head cores;
+ u8 nr_cores;
+- u8 init_done:1;
+ u8 num;
+
+ struct bcma_drv_cc drv_cc;
+--- a/include/linux/bcma/bcma_soc.h
++++ b/include/linux/bcma/bcma_soc.h
+@@ -10,6 +10,7 @@ struct bcma_soc {
+ };
+
+ int __init bcma_host_soc_register(struct bcma_soc *soc);
++int __init bcma_host_soc_init(struct bcma_soc *soc);
+
+ int bcma_bus_register(struct bcma_bus *bus);
+