1 --- a/arch/mips/bcm47xx/setup.c
2 +++ b/arch/mips/bcm47xx/setup.c
3 @@ -194,6 +194,10 @@ static void __init bcm47xx_register_bcma
5 err = bcma_host_soc_register(&bcm47xx_bus.bcma);
7 + panic("Failed to register BCMA bus (err %d)", err);
9 + err = bcma_host_soc_init(&bcm47xx_bus.bcma);
11 panic("Failed to initialize BCMA bus (err %d)", err);
13 bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo, NULL);
14 --- a/drivers/bcma/host_pci.c
15 +++ b/drivers/bcma/host_pci.c
16 @@ -208,6 +208,9 @@ static int bcma_host_pci_probe(struct pc
17 bus->boardinfo.vendor = bus->host_pci->subsystem_vendor;
18 bus->boardinfo.type = bus->host_pci->subsystem_device;
20 + /* Initialize struct, detect chip */
24 err = bcma_bus_register(bus);
26 @@ -282,6 +285,7 @@ static const struct pci_device_id bcma_p
27 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) },
28 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) },
29 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) },
30 + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) }, /* 0xA8DB */
33 MODULE_DEVICE_TABLE(pci, bcma_pci_bridge_tbl);
34 --- a/drivers/bcma/host_soc.c
35 +++ b/drivers/bcma/host_soc.c
36 @@ -165,7 +165,6 @@ static const struct bcma_host_ops bcma_h
37 int __init bcma_host_soc_register(struct bcma_soc *soc)
39 struct bcma_bus *bus = &soc->bus;
42 /* iomap only first core. We have to read some register on this core
44 @@ -178,7 +177,18 @@ int __init bcma_host_soc_register(struct
45 bus->hosttype = BCMA_HOSTTYPE_SOC;
46 bus->ops = &bcma_host_soc_ops;
49 + /* Initialize struct, detect chip */
55 +int __init bcma_host_soc_init(struct bcma_soc *soc)
57 + struct bcma_bus *bus = &soc->bus;
60 + /* Scan bus and initialize it */
61 err = bcma_bus_early_register(bus, &soc->core_cc, &soc->core_mips);
64 --- a/drivers/bcma/main.c
65 +++ b/drivers/bcma/main.c
66 @@ -111,10 +111,53 @@ static void bcma_release_core_dev(struct
70 -static int bcma_register_cores(struct bcma_bus *bus)
71 +static bool bcma_is_core_needed_early(u16 core_id)
74 + case BCMA_CORE_NS_NAND:
75 + case BCMA_CORE_NS_QSPI:
82 +static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
86 + core->dev.release = bcma_release_core_dev;
87 + core->dev.bus = &bcma_bus_type;
88 + dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index);
90 + switch (bus->hosttype) {
91 + case BCMA_HOSTTYPE_PCI:
92 + core->dev.parent = &bus->host_pci->dev;
93 + core->dma_dev = &bus->host_pci->dev;
94 + core->irq = bus->host_pci->irq;
96 + case BCMA_HOSTTYPE_SOC:
97 + core->dev.dma_mask = &core->dev.coherent_dma_mask;
98 + core->dma_dev = &core->dev;
100 + case BCMA_HOSTTYPE_SDIO:
104 + err = device_register(&core->dev);
106 + bcma_err(bus, "Could not register dev for core 0x%03X\n",
108 + put_device(&core->dev);
111 + core->dev_registered = true;
114 +static int bcma_register_devices(struct bcma_bus *bus)
116 struct bcma_device *core;
117 - int err, dev_id = 0;
120 list_for_each_entry(core, &bus->cores, list) {
121 /* We support that cores ourself */
122 @@ -129,39 +172,16 @@ static int bcma_register_cores(struct bc
126 + /* Early cores were already registered */
127 + if (bcma_is_core_needed_early(core->id.id))
130 /* Only first GMAC core on BCM4706 is connected and working */
131 if (core->id.id == BCMA_CORE_4706_MAC_GBIT &&
135 - core->dev.release = bcma_release_core_dev;
136 - core->dev.bus = &bcma_bus_type;
137 - dev_set_name(&core->dev, "bcma%d:%d", bus->num, dev_id);
139 - switch (bus->hosttype) {
140 - case BCMA_HOSTTYPE_PCI:
141 - core->dev.parent = &bus->host_pci->dev;
142 - core->dma_dev = &bus->host_pci->dev;
143 - core->irq = bus->host_pci->irq;
145 - case BCMA_HOSTTYPE_SOC:
146 - core->dev.dma_mask = &core->dev.coherent_dma_mask;
147 - core->dma_dev = &core->dev;
149 - case BCMA_HOSTTYPE_SDIO:
153 - err = device_register(&core->dev);
156 - "Could not register dev for core 0x%03X\n",
158 - put_device(&core->dev);
161 - core->dev_registered = true;
163 + bcma_register_core(bus, core);
166 #ifdef CONFIG_BCMA_DRIVER_MIPS
167 @@ -238,6 +258,12 @@ int bcma_bus_register(struct bcma_bus *b
168 bcma_core_chipcommon_early_init(&bus->drv_cc);
171 + /* Cores providing flash access go before SPROM init */
172 + list_for_each_entry(core, &bus->cores, list) {
173 + if (bcma_is_core_needed_early(core->id.id))
174 + bcma_register_core(bus, core);
177 /* Try to get SPROM */
178 err = bcma_sprom_get(bus);
179 if (err == -ENOENT) {
180 @@ -288,7 +314,7 @@ int bcma_bus_register(struct bcma_bus *b
183 /* Register found cores */
184 - bcma_register_cores(bus);
185 + bcma_register_devices(bus);
187 bcma_info(bus, "Bus registered\n");
189 @@ -325,8 +351,6 @@ int __init bcma_bus_early_register(struc
190 struct bcma_device *core;
191 struct bcma_device_id match;
193 - bcma_init_bus(bus);
195 match.manuf = BCMA_MANUF_BCM;
196 match.id = bcma_cc_core_id(bus);
197 match.class = BCMA_CL_SIM;
198 --- a/drivers/bcma/scan.c
199 +++ b/drivers/bcma/scan.c
200 @@ -438,9 +438,6 @@ void bcma_init_bus(struct bcma_bus *bus)
202 struct bcma_chipinfo *chipinfo = &(bus->chipinfo);
204 - if (bus->init_done)
207 INIT_LIST_HEAD(&bus->cores);
210 @@ -452,8 +449,6 @@ void bcma_init_bus(struct bcma_bus *bus)
211 chipinfo->pkg = (tmp & BCMA_CC_ID_PKG) >> BCMA_CC_ID_PKG_SHIFT;
212 bcma_info(bus, "Found chip with id 0x%04X, rev 0x%02X and package 0x%02X\n",
213 chipinfo->id, chipinfo->rev, chipinfo->pkg);
215 - bus->init_done = true;
218 int bcma_bus_scan(struct bcma_bus *bus)
219 @@ -463,8 +458,6 @@ int bcma_bus_scan(struct bcma_bus *bus)
221 int err, core_num = 0;
223 - bcma_init_bus(bus);
225 erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM);
226 if (bus->hosttype == BCMA_HOSTTYPE_SOC) {
227 eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE);
228 --- a/include/linux/bcma/bcma.h
229 +++ b/include/linux/bcma/bcma.h
230 @@ -332,7 +332,6 @@ struct bcma_bus {
231 struct bcma_device *mapped_core;
232 struct list_head cores;
237 struct bcma_drv_cc drv_cc;
238 --- a/include/linux/bcma/bcma_soc.h
239 +++ b/include/linux/bcma/bcma_soc.h
240 @@ -10,6 +10,7 @@ struct bcma_soc {
243 int __init bcma_host_soc_register(struct bcma_soc *soc);
244 +int __init bcma_host_soc_init(struct bcma_soc *soc);
246 int bcma_bus_register(struct bcma_bus *bus);