9 #include <linux/module.h>
12 #include <linux/slab.h>
18 static unsigned int bcma_bus_next_num = 0;
24 static int bcma_device_probe(
struct device *
dev);
25 static int bcma_device_remove(
struct device *
dev);
31 return sprintf(buf,
"0x%03X\n", core->
id.manuf);
36 return sprintf(buf,
"0x%03X\n", core->
id.id);
41 return sprintf(buf,
"0x%02X\n", core->
id.rev);
46 return sprintf(buf,
"0x%X\n", core->
id.class);
56 static struct bus_type bcma_bus_type = {
58 .match = bcma_bus_match,
59 .probe = bcma_device_probe,
60 .remove = bcma_device_remove,
61 .uevent = bcma_device_uevent,
62 .dev_attrs = bcma_device_attrs,
77 if (core->
id.id == coreid)
84 static void bcma_release_core_dev(
struct device *
dev)
94 static int bcma_register_cores(
struct bcma_bus *bus)
101 switch (core->
id.id) {
111 core->
dev.release = bcma_release_core_dev;
112 core->
dev.bus = &bcma_bus_type;
122 core->
dev.dma_mask = &core->
dev.coherent_dma_mask;
132 "Could not register dev for core 0x%03X\n",
140 #ifdef CONFIG_BCMA_SFLASH
141 if (bus->
drv_cc.sflash.present) {
144 bcma_err(bus,
"Error registering serial flash\n");
148 #ifdef CONFIG_BCMA_NFLASH
149 if (bus->
drv_cc.nflash.present) {
152 bcma_err(bus,
"Error registering NAND flash\n");
159 static void bcma_unregister_cores(
struct bcma_bus *bus)
176 bus->
num = bcma_bus_next_num++;
182 bcma_err(bus,
"Failed to scan: %d\n", err);
217 bcma_err(bus,
"No SPROM available\n");
219 bcma_err(bus,
"Failed to get SPROM: %d\n", err);
222 bcma_register_cores(bus);
237 bcma_unregister_cores(bus);
255 match.
id = bcma_cc_core_id(bus);
262 bcma_err(bus,
"Failed to scan for common core: %d\n", err);
274 bcma_err(bus,
"Failed to scan for mips core: %d\n", err);
292 bcma_info(bus,
"Early bus registered\n");
298 int bcma_bus_suspend(
struct bcma_bus *bus)
313 int bcma_bus_resume(
struct bcma_bus *bus)
319 bus->
drv_cc.setup_done =
false;
339 drv->
drv.bus = &bcma_bus_type;
369 static int bcma_device_probe(
struct device *dev)
377 err = adrv->
probe(core);
382 static int bcma_device_remove(
struct device *dev)
399 "MODALIAS=bcma:m%04Xid%04Xrev%02Xcl%02X",
400 core->
id.manuf, core->
id.id,
401 core->
id.rev, core->
id.class);
404 static int __init bcma_modinit(
void)
412 #ifdef CONFIG_BCMA_HOST_PCI
415 pr_err(
"PCI host initialization failed\n");
424 static void __exit bcma_modexit(
void)
426 #ifdef CONFIG_BCMA_HOST_PCI