Lines Matching refs:bus

76 static u16 bcma_cc_core_id(struct bcma_bus *bus)  in bcma_cc_core_id()  argument
78 if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) in bcma_cc_core_id()
83 struct bcma_device *bcma_find_core_unit(struct bcma_bus *bus, u16 coreid, in bcma_find_core_unit() argument
88 list_for_each_entry(core, &bus->cores, list) { in bcma_find_core_unit()
110 bcma_warn(core->bus, "Timeout waiting for register 0x%04X!\n", reg); in bcma_wait_value()
189 bcma_debug(core->bus, "bcma_of_get_irq() failed with rc=%d\n", in bcma_of_get_irq()
222 struct bcma_bus *bus = core->bus; in bcma_core_irq() local
225 switch (bus->hosttype) { in bcma_core_irq()
227 return bus->host_pci->irq; in bcma_core_irq()
229 if (bus->drv_mips.core && num == 0) { in bcma_core_irq()
233 if (bus->host_pdev) in bcma_core_irq()
234 return bcma_of_get_irq(bus->host_pdev, core, num); in bcma_core_irq()
244 void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core) in bcma_prepare_core() argument
247 core->dev.bus = &bcma_bus_type; in bcma_prepare_core()
248 dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index); in bcma_prepare_core()
250 switch (bus->hosttype) { in bcma_prepare_core()
252 core->dev.parent = &bus->host_pci->dev; in bcma_prepare_core()
253 core->dma_dev = &bus->host_pci->dev; in bcma_prepare_core()
254 core->irq = bus->host_pci->irq; in bcma_prepare_core()
258 if (bus->host_pdev) { in bcma_prepare_core()
259 core->dma_dev = &bus->host_pdev->dev; in bcma_prepare_core()
260 core->dev.parent = &bus->host_pdev->dev; in bcma_prepare_core()
261 bcma_of_fill_device(bus->host_pdev, core); in bcma_prepare_core()
271 void bcma_init_bus(struct bcma_bus *bus) in bcma_init_bus() argument
274 bus->num = bcma_bus_next_num++; in bcma_init_bus()
277 INIT_LIST_HEAD(&bus->cores); in bcma_init_bus()
278 bus->nr_cores = 0; in bcma_init_bus()
280 bcma_detect_chip(bus); in bcma_init_bus()
283 static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core) in bcma_register_core() argument
289 bcma_err(bus, "Could not register dev for core 0x%03X\n", in bcma_register_core()
297 static int bcma_register_devices(struct bcma_bus *bus) in bcma_register_devices() argument
302 list_for_each_entry(core, &bus->cores, list) { in bcma_register_devices()
325 bcma_register_core(bus, core); in bcma_register_devices()
329 if (bus->drv_cc.pflash.present) { in bcma_register_devices()
332 bcma_err(bus, "Error registering parallel flash\n"); in bcma_register_devices()
337 if (bus->drv_cc.sflash.present) { in bcma_register_devices()
340 bcma_err(bus, "Error registering serial flash\n"); in bcma_register_devices()
345 if (bus->drv_cc.nflash.present) { in bcma_register_devices()
348 bcma_err(bus, "Error registering NAND flash\n"); in bcma_register_devices()
351 err = bcma_gpio_init(&bus->drv_cc); in bcma_register_devices()
353 bcma_debug(bus, "GPIO driver not activated\n"); in bcma_register_devices()
355 bcma_err(bus, "Error registering GPIO driver: %i\n", err); in bcma_register_devices()
357 if (bus->hosttype == BCMA_HOSTTYPE_SOC) { in bcma_register_devices()
358 err = bcma_chipco_watchdog_register(&bus->drv_cc); in bcma_register_devices()
360 bcma_err(bus, "Error registering watchdog driver\n"); in bcma_register_devices()
366 void bcma_unregister_cores(struct bcma_bus *bus) in bcma_unregister_cores() argument
370 list_for_each_entry_safe(core, tmp, &bus->cores, list) { in bcma_unregister_cores()
376 if (bus->hosttype == BCMA_HOSTTYPE_SOC) in bcma_unregister_cores()
377 platform_device_unregister(bus->drv_cc.watchdog); in bcma_unregister_cores()
380 list_for_each_entry_safe(core, tmp, &bus->cores, list) { in bcma_unregister_cores()
386 int bcma_bus_register(struct bcma_bus *bus) in bcma_bus_register() argument
392 err = bcma_bus_scan(bus); in bcma_bus_register()
394 bcma_err(bus, "Failed to scan: %d\n", err); in bcma_bus_register()
399 core = bcma_find_core(bus, bcma_cc_core_id(bus)); in bcma_bus_register()
401 bus->drv_cc.core = core; in bcma_bus_register()
402 bcma_core_chipcommon_early_init(&bus->drv_cc); in bcma_bus_register()
406 core = bcma_find_core(bus, BCMA_CORE_PCIE); in bcma_bus_register()
408 bus->drv_pci[0].core = core; in bcma_bus_register()
409 bcma_core_pci_early_init(&bus->drv_pci[0]); in bcma_bus_register()
413 list_for_each_entry(core, &bus->cores, list) { in bcma_bus_register()
415 bcma_register_core(bus, core); in bcma_bus_register()
419 err = bcma_sprom_get(bus); in bcma_bus_register()
421 bcma_err(bus, "No SPROM available\n"); in bcma_bus_register()
423 bcma_err(bus, "Failed to get SPROM: %d\n", err); in bcma_bus_register()
426 core = bcma_find_core(bus, bcma_cc_core_id(bus)); in bcma_bus_register()
428 bus->drv_cc.core = core; in bcma_bus_register()
429 bcma_core_chipcommon_init(&bus->drv_cc); in bcma_bus_register()
433 core = bcma_find_core(bus, BCMA_CORE_NS_CHIPCOMMON_B); in bcma_bus_register()
435 bus->drv_cc_b.core = core; in bcma_bus_register()
436 bcma_core_chipcommon_b_init(&bus->drv_cc_b); in bcma_bus_register()
440 core = bcma_find_core(bus, BCMA_CORE_MIPS_74K); in bcma_bus_register()
442 bus->drv_mips.core = core; in bcma_bus_register()
443 bcma_core_mips_init(&bus->drv_mips); in bcma_bus_register()
447 core = bcma_find_core_unit(bus, BCMA_CORE_PCIE, 0); in bcma_bus_register()
449 bus->drv_pci[0].core = core; in bcma_bus_register()
450 bcma_core_pci_init(&bus->drv_pci[0]); in bcma_bus_register()
454 core = bcma_find_core_unit(bus, BCMA_CORE_PCIE, 1); in bcma_bus_register()
456 bus->drv_pci[1].core = core; in bcma_bus_register()
457 bcma_core_pci_init(&bus->drv_pci[1]); in bcma_bus_register()
461 core = bcma_find_core_unit(bus, BCMA_CORE_PCIE2, 0); in bcma_bus_register()
463 bus->drv_pcie2.core = core; in bcma_bus_register()
464 bcma_core_pcie2_init(&bus->drv_pcie2); in bcma_bus_register()
468 core = bcma_find_core(bus, BCMA_CORE_4706_MAC_GBIT_COMMON); in bcma_bus_register()
470 bus->drv_gmac_cmn.core = core; in bcma_bus_register()
471 bcma_core_gmac_cmn_init(&bus->drv_gmac_cmn); in bcma_bus_register()
475 bcma_register_devices(bus); in bcma_bus_register()
477 bcma_info(bus, "Bus registered\n"); in bcma_bus_register()
482 void bcma_bus_unregister(struct bcma_bus *bus) in bcma_bus_unregister() argument
486 err = bcma_gpio_unregister(&bus->drv_cc); in bcma_bus_unregister()
488 bcma_err(bus, "Some GPIOs are still in use.\n"); in bcma_bus_unregister()
490 bcma_err(bus, "Can not unregister GPIO driver: %i\n", err); in bcma_bus_unregister()
492 bcma_core_chipcommon_b_free(&bus->drv_cc_b); in bcma_bus_unregister()
494 bcma_unregister_cores(bus); in bcma_bus_unregister()
502 int __init bcma_bus_early_register(struct bcma_bus *bus) in bcma_bus_early_register() argument
508 err = bcma_bus_scan(bus); in bcma_bus_early_register()
510 bcma_err(bus, "Failed to scan bus: %d\n", err); in bcma_bus_early_register()
515 core = bcma_find_core(bus, bcma_cc_core_id(bus)); in bcma_bus_early_register()
517 bus->drv_cc.core = core; in bcma_bus_early_register()
518 bcma_core_chipcommon_early_init(&bus->drv_cc); in bcma_bus_early_register()
522 core = bcma_find_core(bus, BCMA_CORE_MIPS_74K); in bcma_bus_early_register()
524 bus->drv_mips.core = core; in bcma_bus_early_register()
525 bcma_core_mips_early_init(&bus->drv_mips); in bcma_bus_early_register()
528 bcma_info(bus, "Early bus registered\n"); in bcma_bus_early_register()
534 int bcma_bus_suspend(struct bcma_bus *bus) in bcma_bus_suspend() argument
538 list_for_each_entry(core, &bus->cores, list) { in bcma_bus_suspend()
549 int bcma_bus_resume(struct bcma_bus *bus) in bcma_bus_resume() argument
554 if (bus->drv_cc.core) { in bcma_bus_resume()
555 bus->drv_cc.setup_done = false; in bcma_bus_resume()
556 bcma_core_chipcommon_init(&bus->drv_cc); in bcma_bus_resume()
559 list_for_each_entry(core, &bus->cores, list) { in bcma_bus_resume()
575 drv->drv.bus = &bcma_bus_type; in __bcma_driver_register()