^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * Broadcom specific AMBA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Bus subsystem
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Licensed under the GNU/GPL. See COPYING for details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include "bcma_private.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/mmc/sdio_func.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/pci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/bcma/bcma.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/of_address.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/of_irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/of_platform.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) MODULE_DESCRIPTION("Broadcom's specific AMBA driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) /* contains the number the next bus should get. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) static unsigned int bcma_bus_next_num = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) /* bcma_buses_mutex locks the bcma_bus_next_num */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) static DEFINE_MUTEX(bcma_buses_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) static int bcma_bus_match(struct device *dev, struct device_driver *drv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) static int bcma_device_probe(struct device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) static int bcma_device_remove(struct device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) static int bcma_device_uevent(struct device *dev, struct kobj_uevent_env *env);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) static ssize_t manuf_show(struct device *dev, struct device_attribute *attr, char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct bcma_device *core = container_of(dev, struct bcma_device, dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) return sprintf(buf, "0x%03X\n", core->id.manuf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) static DEVICE_ATTR_RO(manuf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) static ssize_t id_show(struct device *dev, struct device_attribute *attr, char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) struct bcma_device *core = container_of(dev, struct bcma_device, dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) return sprintf(buf, "0x%03X\n", core->id.id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) static DEVICE_ATTR_RO(id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) static ssize_t rev_show(struct device *dev, struct device_attribute *attr, char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) struct bcma_device *core = container_of(dev, struct bcma_device, dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) return sprintf(buf, "0x%02X\n", core->id.rev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) static DEVICE_ATTR_RO(rev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) static ssize_t class_show(struct device *dev, struct device_attribute *attr, char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) struct bcma_device *core = container_of(dev, struct bcma_device, dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) return sprintf(buf, "0x%X\n", core->id.class);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) static DEVICE_ATTR_RO(class);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) static struct attribute *bcma_device_attrs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) &dev_attr_manuf.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) &dev_attr_id.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) &dev_attr_rev.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) &dev_attr_class.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) ATTRIBUTE_GROUPS(bcma_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) static struct bus_type bcma_bus_type = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) .name = "bcma",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) .match = bcma_bus_match,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) .probe = bcma_device_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) .remove = bcma_device_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) .uevent = bcma_device_uevent,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) .dev_groups = bcma_device_groups,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) static u16 bcma_cc_core_id(struct bcma_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) return BCMA_CORE_4706_CHIPCOMMON;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) return BCMA_CORE_CHIPCOMMON;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) struct bcma_device *bcma_find_core_unit(struct bcma_bus *bus, u16 coreid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) u8 unit)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) struct bcma_device *core;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) list_for_each_entry(core, &bus->cores, list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) if (core->id.id == coreid && core->core_unit == unit)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) return core;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) EXPORT_SYMBOL_GPL(bcma_find_core_unit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) int timeout)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) unsigned long deadline = jiffies + timeout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) u32 val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) do {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) val = bcma_read32(core, reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) if ((val & mask) == value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) cpu_relax();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) udelay(10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) } while (!time_after_eq(jiffies, deadline));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) bcma_warn(core->bus, "Timeout waiting for register 0x%04X!\n", reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) static void bcma_release_core_dev(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) struct bcma_device *core = container_of(dev, struct bcma_device, dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) if (core->io_addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) iounmap(core->io_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) if (core->io_wrap)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) iounmap(core->io_wrap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) kfree(core);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) static bool bcma_is_core_needed_early(u16 core_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) switch (core_id) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) case BCMA_CORE_NS_NAND:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) case BCMA_CORE_NS_QSPI:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) static struct device_node *bcma_of_find_child_device(struct device *parent,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) struct bcma_device *core)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) struct device_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) u64 size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) const __be32 *reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) if (!parent->of_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) for_each_child_of_node(parent->of_node, node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) reg = of_get_address(node, 0, &size, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) if (!reg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) if (of_translate_address(node, reg) == core->addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) return node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) static int bcma_of_irq_parse(struct device *parent,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) struct bcma_device *core,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) struct of_phandle_args *out_irq, int num)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) __be32 laddr[1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) if (core->dev.of_node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) rc = of_irq_parse_one(core->dev.of_node, num, out_irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) if (!rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) out_irq->np = parent->of_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) out_irq->args_count = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) out_irq->args[0] = num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) laddr[0] = cpu_to_be32(core->addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) return of_irq_parse_raw(laddr, out_irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) static unsigned int bcma_of_get_irq(struct device *parent,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) struct bcma_device *core, int num)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) struct of_phandle_args out_irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) if (!IS_ENABLED(CONFIG_OF_IRQ) || !parent->of_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) ret = bcma_of_irq_parse(parent, core, &out_irq, num);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) bcma_debug(core->bus, "bcma_of_get_irq() failed with rc=%d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) return irq_create_of_mapping(&out_irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) static void bcma_of_fill_device(struct device *parent,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) struct bcma_device *core)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) struct device_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) node = bcma_of_find_child_device(parent, core);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) if (node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) core->dev.of_node = node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) core->irq = bcma_of_get_irq(parent, core, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) of_dma_configure(&core->dev, node, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) unsigned int bcma_core_irq(struct bcma_device *core, int num)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) struct bcma_bus *bus = core->bus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) unsigned int mips_irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) switch (bus->hosttype) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) case BCMA_HOSTTYPE_PCI:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) return bus->host_pci->irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) case BCMA_HOSTTYPE_SOC:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) if (bus->drv_mips.core && num == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) mips_irq = bcma_core_mips_irq(core);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) return mips_irq <= 4 ? mips_irq + 2 : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) if (bus->dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) return bcma_of_get_irq(bus->dev, core, num);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) case BCMA_HOSTTYPE_SDIO:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) EXPORT_SYMBOL(bcma_core_irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) device_initialize(&core->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) core->dev.release = bcma_release_core_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) core->dev.bus = &bcma_bus_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) core->dev.parent = bus->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) if (bus->dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) bcma_of_fill_device(bus->dev, core);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) switch (bus->hosttype) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) case BCMA_HOSTTYPE_PCI:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) core->dma_dev = bus->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) core->irq = bus->host_pci->irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) case BCMA_HOSTTYPE_SOC:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) if (IS_ENABLED(CONFIG_OF) && bus->dev) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) core->dma_dev = bus->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) core->dev.dma_mask = &core->dev.coherent_dma_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) core->dma_dev = &core->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) case BCMA_HOSTTYPE_SDIO:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) void bcma_init_bus(struct bcma_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) mutex_lock(&bcma_buses_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) bus->num = bcma_bus_next_num++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) mutex_unlock(&bcma_buses_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) INIT_LIST_HEAD(&bus->cores);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) bus->nr_cores = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) bcma_detect_chip(bus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) err = device_add(&core->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) bcma_err(bus, "Could not register dev for core 0x%03X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) core->id.id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) core->dev_registered = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) static int bcma_register_devices(struct bcma_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) struct bcma_device *core;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) list_for_each_entry(core, &bus->cores, list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) /* We support that cores ourself */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) switch (core->id.id) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) case BCMA_CORE_4706_CHIPCOMMON:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) case BCMA_CORE_CHIPCOMMON:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) case BCMA_CORE_NS_CHIPCOMMON_B:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) case BCMA_CORE_PCI:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) case BCMA_CORE_PCIE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) case BCMA_CORE_PCIE2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) case BCMA_CORE_MIPS_74K:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) case BCMA_CORE_4706_MAC_GBIT_COMMON:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) /* Early cores were already registered */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) if (bcma_is_core_needed_early(core->id.id))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) /* Only first GMAC core on BCM4706 is connected and working */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) if (core->id.id == BCMA_CORE_4706_MAC_GBIT &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) core->core_unit > 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) bcma_register_core(bus, core);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) #ifdef CONFIG_BCMA_PFLASH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) if (bus->drv_cc.pflash.present) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) err = platform_device_register(&bcma_pflash_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) if (err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) bcma_err(bus, "Error registering parallel flash\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) #ifdef CONFIG_BCMA_SFLASH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) if (bus->drv_cc.sflash.present) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) err = platform_device_register(&bcma_sflash_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) if (err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) bcma_err(bus, "Error registering serial flash\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) #ifdef CONFIG_BCMA_NFLASH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) if (bus->drv_cc.nflash.present) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) err = platform_device_register(&bcma_nflash_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) if (err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) bcma_err(bus, "Error registering NAND flash\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) err = bcma_gpio_init(&bus->drv_cc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) if (err == -ENOTSUPP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) bcma_debug(bus, "GPIO driver not activated\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) else if (err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) bcma_err(bus, "Error registering GPIO driver: %i\n", err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) if (bus->hosttype == BCMA_HOSTTYPE_SOC) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) err = bcma_chipco_watchdog_register(&bus->drv_cc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) if (err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) bcma_err(bus, "Error registering watchdog driver\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) void bcma_unregister_cores(struct bcma_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) struct bcma_device *core, *tmp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) list_for_each_entry_safe(core, tmp, &bus->cores, list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) if (!core->dev_registered)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) list_del(&core->list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) device_unregister(&core->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) if (bus->hosttype == BCMA_HOSTTYPE_SOC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) platform_device_unregister(bus->drv_cc.watchdog);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) /* Now noone uses internally-handled cores, we can free them */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) list_for_each_entry_safe(core, tmp, &bus->cores, list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) list_del(&core->list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) put_device(&core->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) int bcma_bus_register(struct bcma_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) struct bcma_device *core;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) /* Scan for devices (cores) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) err = bcma_bus_scan(bus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) bcma_err(bus, "Failed to scan: %d\n", err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) /* Early init CC core */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) core = bcma_find_core(bus, bcma_cc_core_id(bus));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) if (core) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) bus->drv_cc.core = core;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) bcma_core_chipcommon_early_init(&bus->drv_cc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) /* Early init PCIE core */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) core = bcma_find_core(bus, BCMA_CORE_PCIE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) if (core) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) bus->drv_pci[0].core = core;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) bcma_core_pci_early_init(&bus->drv_pci[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) if (bus->dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) of_platform_default_populate(bus->dev->of_node, NULL, bus->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) /* Cores providing flash access go before SPROM init */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) list_for_each_entry(core, &bus->cores, list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) if (bcma_is_core_needed_early(core->id.id))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) bcma_register_core(bus, core);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) /* Try to get SPROM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) err = bcma_sprom_get(bus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) if (err == -ENOENT) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) bcma_err(bus, "No SPROM available\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) } else if (err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) bcma_err(bus, "Failed to get SPROM: %d\n", err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) /* Init CC core */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) core = bcma_find_core(bus, bcma_cc_core_id(bus));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) if (core) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) bus->drv_cc.core = core;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) bcma_core_chipcommon_init(&bus->drv_cc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) /* Init CC core */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) core = bcma_find_core(bus, BCMA_CORE_NS_CHIPCOMMON_B);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) if (core) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) bus->drv_cc_b.core = core;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) bcma_core_chipcommon_b_init(&bus->drv_cc_b);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) /* Init MIPS core */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) core = bcma_find_core(bus, BCMA_CORE_MIPS_74K);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) if (core) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) bus->drv_mips.core = core;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) bcma_core_mips_init(&bus->drv_mips);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) /* Init PCIE core */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) core = bcma_find_core_unit(bus, BCMA_CORE_PCIE, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) if (core) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) bus->drv_pci[0].core = core;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) bcma_core_pci_init(&bus->drv_pci[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) /* Init PCIE core */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) core = bcma_find_core_unit(bus, BCMA_CORE_PCIE, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) if (core) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) bus->drv_pci[1].core = core;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) bcma_core_pci_init(&bus->drv_pci[1]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) /* Init PCIe Gen 2 core */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) core = bcma_find_core_unit(bus, BCMA_CORE_PCIE2, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) if (core) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) bus->drv_pcie2.core = core;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) bcma_core_pcie2_init(&bus->drv_pcie2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) /* Init GBIT MAC COMMON core */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) core = bcma_find_core(bus, BCMA_CORE_4706_MAC_GBIT_COMMON);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) if (core) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) bus->drv_gmac_cmn.core = core;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) bcma_core_gmac_cmn_init(&bus->drv_gmac_cmn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) /* Register found cores */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) bcma_register_devices(bus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) bcma_info(bus, "Bus registered\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) void bcma_bus_unregister(struct bcma_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) err = bcma_gpio_unregister(&bus->drv_cc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) if (err == -EBUSY)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) bcma_err(bus, "Some GPIOs are still in use.\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) else if (err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) bcma_err(bus, "Can not unregister GPIO driver: %i\n", err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) bcma_core_chipcommon_b_free(&bus->drv_cc_b);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) bcma_unregister_cores(bus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) * This is a special version of bus registration function designed for SoCs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) * It scans bus and performs basic initialization of main cores only.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) * Please note it requires memory allocation, however it won't try to sleep.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) int __init bcma_bus_early_register(struct bcma_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) struct bcma_device *core;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) /* Scan for devices (cores) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) err = bcma_bus_scan(bus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) bcma_err(bus, "Failed to scan bus: %d\n", err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) /* Early init CC core */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) core = bcma_find_core(bus, bcma_cc_core_id(bus));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) if (core) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) bus->drv_cc.core = core;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) bcma_core_chipcommon_early_init(&bus->drv_cc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) /* Early init MIPS core */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) core = bcma_find_core(bus, BCMA_CORE_MIPS_74K);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) if (core) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) bus->drv_mips.core = core;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) bcma_core_mips_early_init(&bus->drv_mips);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) bcma_info(bus, "Early bus registered\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) #ifdef CONFIG_PM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) int bcma_bus_suspend(struct bcma_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) struct bcma_device *core;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) list_for_each_entry(core, &bus->cores, list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) struct device_driver *drv = core->dev.driver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) if (drv) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) struct bcma_driver *adrv = container_of(drv, struct bcma_driver, drv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) if (adrv->suspend)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) adrv->suspend(core);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) int bcma_bus_resume(struct bcma_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) struct bcma_device *core;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) /* Init CC core */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) if (bus->drv_cc.core) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) bus->drv_cc.setup_done = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) bcma_core_chipcommon_init(&bus->drv_cc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) list_for_each_entry(core, &bus->cores, list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) struct device_driver *drv = core->dev.driver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) if (drv) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) struct bcma_driver *adrv = container_of(drv, struct bcma_driver, drv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) if (adrv->resume)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) adrv->resume(core);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) int __bcma_driver_register(struct bcma_driver *drv, struct module *owner)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) drv->drv.name = drv->name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) drv->drv.bus = &bcma_bus_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) drv->drv.owner = owner;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) return driver_register(&drv->drv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) EXPORT_SYMBOL_GPL(__bcma_driver_register);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) void bcma_driver_unregister(struct bcma_driver *drv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) driver_unregister(&drv->drv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) EXPORT_SYMBOL_GPL(bcma_driver_unregister);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) static int bcma_bus_match(struct device *dev, struct device_driver *drv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) struct bcma_device *core = container_of(dev, struct bcma_device, dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) struct bcma_driver *adrv = container_of(drv, struct bcma_driver, drv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) const struct bcma_device_id *cid = &core->id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) const struct bcma_device_id *did;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) for (did = adrv->id_table; did->manuf || did->id || did->rev; did++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) if ((did->manuf == cid->manuf || did->manuf == BCMA_ANY_MANUF) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) (did->id == cid->id || did->id == BCMA_ANY_ID) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) (did->rev == cid->rev || did->rev == BCMA_ANY_REV) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) (did->class == cid->class || did->class == BCMA_ANY_CLASS))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) static int bcma_device_probe(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) struct bcma_device *core = container_of(dev, struct bcma_device, dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) struct bcma_driver *adrv = container_of(dev->driver, struct bcma_driver,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) drv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) int err = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) get_device(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) if (adrv->probe)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) err = adrv->probe(core);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) if (err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) put_device(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) static int bcma_device_remove(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) struct bcma_device *core = container_of(dev, struct bcma_device, dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) struct bcma_driver *adrv = container_of(dev->driver, struct bcma_driver,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) drv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) if (adrv->remove)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) adrv->remove(core);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) put_device(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) static int bcma_device_uevent(struct device *dev, struct kobj_uevent_env *env)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) struct bcma_device *core = container_of(dev, struct bcma_device, dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) return add_uevent_var(env,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) "MODALIAS=bcma:m%04Xid%04Xrev%02Xcl%02X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) core->id.manuf, core->id.id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) core->id.rev, core->id.class);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) static unsigned int bcma_bus_registered;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) * If built-in, bus has to be registered early, before any driver calls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) * bcma_driver_register.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) * Otherwise registering driver would trigger BUG in driver_register.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) static int __init bcma_init_bus_register(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) if (bcma_bus_registered)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) err = bus_register(&bcma_bus_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) if (!err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) bcma_bus_registered = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) #ifndef MODULE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) fs_initcall(bcma_init_bus_register);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) /* Main initialization has to be done with SPI/mtd/NAND/SPROM available */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) static int __init bcma_modinit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) err = bcma_init_bus_register();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) if (err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) err = bcma_host_soc_register_driver();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) pr_err("SoC host initialization failed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) err = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) #ifdef CONFIG_BCMA_HOST_PCI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) err = bcma_host_pci_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) pr_err("PCI host initialization failed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) err = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) module_init(bcma_modinit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) static void __exit bcma_modexit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) #ifdef CONFIG_BCMA_HOST_PCI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) bcma_host_pci_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) bcma_host_soc_unregister_driver();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) bus_unregister(&bcma_bus_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) module_exit(bcma_modexit)