Lines Matching +full:drv +full:- +full:id

29 static int bcma_bus_match(struct device *dev, const struct device_driver *drv);
37 return sprintf(buf, "0x%03X\n", core->id.manuf); in manuf_show()
44 return sprintf(buf, "0x%03X\n", core->id.id); in id_show()
46 static DEVICE_ATTR_RO(id);
51 return sprintf(buf, "0x%02X\n", core->id.rev); in rev_show()
58 return sprintf(buf, "0x%X\n", core->id.class); in class_show()
82 if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) in bcma_cc_core_id()
92 list_for_each_entry(core, &bus->cores, list) { in bcma_find_core_unit()
93 if (core->id.id == coreid && core->core_unit == unit) in bcma_find_core_unit()
114 bcma_warn(core->bus, "Timeout waiting for register 0x%04X!\n", reg); in bcma_wait_value()
122 if (core->io_addr) in bcma_release_core_dev()
123 iounmap(core->io_addr); in bcma_release_core_dev()
124 if (core->io_wrap) in bcma_release_core_dev()
125 iounmap(core->io_wrap); in bcma_release_core_dev()
146 if (!parent->of_node) in bcma_of_find_child_device()
149 for_each_child_of_node(parent->of_node, node) { in bcma_of_find_child_device()
154 if (res.start == core->addr) in bcma_of_find_child_device()
167 if (core->dev.of_node) { in bcma_of_irq_parse()
168 rc = of_irq_parse_one(core->dev.of_node, num, out_irq); in bcma_of_irq_parse()
173 out_irq->np = parent->of_node; in bcma_of_irq_parse()
174 out_irq->args_count = 1; in bcma_of_irq_parse()
175 out_irq->args[0] = num; in bcma_of_irq_parse()
177 laddr[0] = cpu_to_be32(core->addr); in bcma_of_irq_parse()
187 if (!IS_ENABLED(CONFIG_OF_IRQ) || !parent->of_node) in bcma_of_get_irq()
192 bcma_debug(core->bus, "bcma_of_get_irq() failed with rc=%d\n", in bcma_of_get_irq()
207 core->dev.of_node = node; in bcma_of_fill_device()
209 core->irq = bcma_of_get_irq(parent, core, 0); in bcma_of_fill_device()
211 of_dma_configure(&core->dev, node, false); in bcma_of_fill_device()
216 struct bcma_bus *bus = core->bus; in bcma_core_irq()
219 switch (bus->hosttype) { in bcma_core_irq()
221 return bus->host_pci->irq; in bcma_core_irq()
223 if (bus->drv_mips.core && num == 0) { in bcma_core_irq()
227 if (bus->dev) in bcma_core_irq()
228 return bcma_of_get_irq(bus->dev, core, num); in bcma_core_irq()
240 device_initialize(&core->dev); in bcma_prepare_core()
241 core->dev.release = bcma_release_core_dev; in bcma_prepare_core()
242 core->dev.bus = &bcma_bus_type; in bcma_prepare_core()
243 dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index); in bcma_prepare_core()
244 core->dev.parent = bus->dev; in bcma_prepare_core()
245 if (bus->dev) in bcma_prepare_core()
246 bcma_of_fill_device(bus->dev, core); in bcma_prepare_core()
248 switch (bus->hosttype) { in bcma_prepare_core()
250 core->dma_dev = bus->dev; in bcma_prepare_core()
251 core->irq = bus->host_pci->irq; in bcma_prepare_core()
254 if (IS_ENABLED(CONFIG_OF) && bus->dev) { in bcma_prepare_core()
255 core->dma_dev = bus->dev; in bcma_prepare_core()
257 core->dev.dma_mask = &core->dev.coherent_dma_mask; in bcma_prepare_core()
258 core->dma_dev = &core->dev; in bcma_prepare_core()
269 bus->num = bcma_bus_next_num++; in bcma_init_bus()
272 INIT_LIST_HEAD(&bus->cores); in bcma_init_bus()
273 bus->nr_cores = 0; in bcma_init_bus()
282 err = device_add(&core->dev); in bcma_register_core()
285 core->id.id); in bcma_register_core()
288 core->dev_registered = true; in bcma_register_core()
296 list_for_each_entry(core, &bus->cores, list) { in bcma_register_devices()
298 switch (core->id.id) { in bcma_register_devices()
311 if (bcma_is_core_needed_early(core->id.id)) in bcma_register_devices()
315 if (core->id.id == BCMA_CORE_4706_MAC_GBIT && in bcma_register_devices()
316 core->core_unit > 0) in bcma_register_devices()
323 if (bus->drv_cc.pflash.present) { in bcma_register_devices()
331 if (bus->drv_cc.sflash.present) { in bcma_register_devices()
339 if (bus->drv_cc.nflash.present) { in bcma_register_devices()
345 err = bcma_gpio_init(&bus->drv_cc); in bcma_register_devices()
346 if (err == -ENOTSUPP) in bcma_register_devices()
353 if (bus->hosttype == BCMA_HOSTTYPE_SOC) { in bcma_register_devices()
354 err = bcma_chipco_watchdog_register(&bus->drv_cc); in bcma_register_devices()
366 list_for_each_entry_safe(core, tmp, &bus->cores, list) { in bcma_unregister_cores()
367 if (!core->dev_registered) in bcma_unregister_cores()
369 list_del(&core->list); in bcma_unregister_cores()
370 device_unregister(&core->dev); in bcma_unregister_cores()
372 if (bus->hosttype == BCMA_HOSTTYPE_SOC) in bcma_unregister_cores()
373 platform_device_unregister(bus->drv_cc.watchdog); in bcma_unregister_cores()
375 /* Now no one uses internally-handled cores, we can free them */ in bcma_unregister_cores()
376 list_for_each_entry_safe(core, tmp, &bus->cores, list) { in bcma_unregister_cores()
377 list_del(&core->list); in bcma_unregister_cores()
378 put_device(&core->dev); in bcma_unregister_cores()
397 bus->drv_cc.core = core; in bcma_bus_register()
398 bcma_core_chipcommon_early_init(&bus->drv_cc); in bcma_bus_register()
404 bus->drv_pci[0].core = core; in bcma_bus_register()
405 bcma_core_pci_early_init(&bus->drv_pci[0]); in bcma_bus_register()
408 if (bus->dev) in bcma_bus_register()
409 of_platform_default_populate(bus->dev->of_node, NULL, bus->dev); in bcma_bus_register()
412 list_for_each_entry(core, &bus->cores, list) { in bcma_bus_register()
413 if (bcma_is_core_needed_early(core->id.id)) in bcma_bus_register()
419 if (err == -ENOENT) { in bcma_bus_register()
427 bus->drv_cc.core = core; in bcma_bus_register()
428 bcma_core_chipcommon_init(&bus->drv_cc); in bcma_bus_register()
434 bus->drv_cc_b.core = core; in bcma_bus_register()
435 bcma_core_chipcommon_b_init(&bus->drv_cc_b); in bcma_bus_register()
441 bus->drv_mips.core = core; in bcma_bus_register()
442 bcma_core_mips_init(&bus->drv_mips); in bcma_bus_register()
448 bus->drv_pci[0].core = core; in bcma_bus_register()
449 bcma_core_pci_init(&bus->drv_pci[0]); in bcma_bus_register()
455 bus->drv_pci[1].core = core; in bcma_bus_register()
456 bcma_core_pci_init(&bus->drv_pci[1]); in bcma_bus_register()
462 bus->drv_pcie2.core = core; in bcma_bus_register()
463 bcma_core_pcie2_init(&bus->drv_pcie2); in bcma_bus_register()
469 bus->drv_gmac_cmn.core = core; in bcma_bus_register()
470 bcma_core_gmac_cmn_init(&bus->drv_gmac_cmn); in bcma_bus_register()
485 err = bcma_gpio_unregister(&bus->drv_cc); in bcma_bus_unregister()
486 if (err == -EBUSY) in bcma_bus_unregister()
491 bcma_core_chipcommon_b_free(&bus->drv_cc_b); in bcma_bus_unregister()
510 return -1; in bcma_bus_early_register()
516 bus->drv_cc.core = core; in bcma_bus_early_register()
517 bcma_core_chipcommon_early_init(&bus->drv_cc); in bcma_bus_early_register()
523 bus->drv_mips.core = core; in bcma_bus_early_register()
524 bcma_core_mips_early_init(&bus->drv_mips); in bcma_bus_early_register()
537 list_for_each_entry(core, &bus->cores, list) { in bcma_bus_suspend()
538 struct device_driver *drv = core->dev.driver; in bcma_bus_suspend() local
539 if (drv) { in bcma_bus_suspend()
540 struct bcma_driver *adrv = container_of(drv, struct bcma_driver, drv); in bcma_bus_suspend()
541 if (adrv->suspend) in bcma_bus_suspend()
542 adrv->suspend(core); in bcma_bus_suspend()
553 if (bus->drv_cc.core) { in bcma_bus_resume()
554 bus->drv_cc.setup_done = false; in bcma_bus_resume()
555 bcma_core_chipcommon_init(&bus->drv_cc); in bcma_bus_resume()
558 list_for_each_entry(core, &bus->cores, list) { in bcma_bus_resume()
559 struct device_driver *drv = core->dev.driver; in bcma_bus_resume() local
560 if (drv) { in bcma_bus_resume()
561 struct bcma_driver *adrv = container_of(drv, struct bcma_driver, drv); in bcma_bus_resume()
562 if (adrv->resume) in bcma_bus_resume()
563 adrv->resume(core); in bcma_bus_resume()
571 int __bcma_driver_register(struct bcma_driver *drv, struct module *owner) in __bcma_driver_register() argument
573 drv->drv.name = drv->name; in __bcma_driver_register()
574 drv->drv.bus = &bcma_bus_type; in __bcma_driver_register()
575 drv->drv.owner = owner; in __bcma_driver_register()
577 return driver_register(&drv->drv); in __bcma_driver_register()
581 void bcma_driver_unregister(struct bcma_driver *drv) in bcma_driver_unregister() argument
583 driver_unregister(&drv->drv); in bcma_driver_unregister()
587 static int bcma_bus_match(struct device *dev, const struct device_driver *drv) in bcma_bus_match() argument
590 const struct bcma_driver *adrv = container_of_const(drv, struct bcma_driver, drv); in bcma_bus_match()
591 const struct bcma_device_id *cid = &core->id; in bcma_bus_match()
594 for (did = adrv->id_table; did->manuf || did->id || did->rev; did++) { in bcma_bus_match()
595 if ((did->manuf == cid->manuf || did->manuf == BCMA_ANY_MANUF) && in bcma_bus_match()
596 (did->id == cid->id || did->id == BCMA_ANY_ID) && in bcma_bus_match()
597 (did->rev == cid->rev || did->rev == BCMA_ANY_REV) && in bcma_bus_match()
598 (did->class == cid->class || did->class == BCMA_ANY_CLASS)) in bcma_bus_match()
607 struct bcma_driver *adrv = container_of(dev->driver, struct bcma_driver, in bcma_device_probe()
608 drv); in bcma_device_probe()
612 if (adrv->probe) in bcma_device_probe()
613 err = adrv->probe(core); in bcma_device_probe()
623 struct bcma_driver *adrv = container_of(dev->driver, struct bcma_driver, in bcma_device_remove()
624 drv); in bcma_device_remove()
626 if (adrv->remove) in bcma_device_remove()
627 adrv->remove(core); in bcma_device_remove()
637 core->id.manuf, core->id.id, in bcma_device_uevent()
638 core->id.rev, core->id.class); in bcma_device_uevent()
644 * If built-in, bus has to be registered early, before any driver calls