Lines Matching full:bus
3 * Bus scanning
95 static u32 bcma_scan_read32(struct bcma_bus *bus, u8 current_coreidx, in bcma_scan_read32() argument
98 return readl(bus->mmio + offset); in bcma_scan_read32()
101 static void bcma_scan_switch_core(struct bcma_bus *bus, u32 addr) in bcma_scan_switch_core() argument
103 if (bus->hosttype == BCMA_HOSTTYPE_PCI) in bcma_scan_switch_core()
104 pci_write_config_dword(bus->host_pci, BCMA_PCI_BAR0_WIN, in bcma_scan_switch_core()
108 static u32 bcma_erom_get_ent(struct bcma_bus *bus, u32 **eromptr) in bcma_erom_get_ent() argument
120 static s32 bcma_erom_get_ci(struct bcma_bus *bus, u32 **eromptr) in bcma_erom_get_ci() argument
122 u32 ent = bcma_erom_get_ent(bus, eromptr); in bcma_erom_get_ci()
130 static bool bcma_erom_is_end(struct bcma_bus *bus, u32 **eromptr) in bcma_erom_is_end() argument
132 u32 ent = bcma_erom_get_ent(bus, eromptr); in bcma_erom_is_end()
137 static bool bcma_erom_is_bridge(struct bcma_bus *bus, u32 **eromptr) in bcma_erom_is_bridge() argument
139 u32 ent = bcma_erom_get_ent(bus, eromptr); in bcma_erom_is_bridge()
146 static void bcma_erom_skip_component(struct bcma_bus *bus, u32 **eromptr) in bcma_erom_skip_component() argument
150 ent = bcma_erom_get_ent(bus, eromptr); in bcma_erom_skip_component()
160 static s32 bcma_erom_get_mst_port(struct bcma_bus *bus, u32 **eromptr) in bcma_erom_get_mst_port() argument
162 u32 ent = bcma_erom_get_ent(bus, eromptr); in bcma_erom_get_mst_port()
170 static s32 bcma_erom_get_addr_desc(struct bcma_bus *bus, u32 **eromptr, in bcma_erom_get_addr_desc() argument
176 u32 ent = bcma_erom_get_ent(bus, eromptr); in bcma_erom_get_addr_desc()
187 addrh = bcma_erom_get_ent(bus, eromptr); in bcma_erom_get_addr_desc()
192 size = bcma_erom_get_ent(bus, eromptr); in bcma_erom_get_addr_desc()
195 sizeh = bcma_erom_get_ent(bus, eromptr); in bcma_erom_get_addr_desc()
203 static struct bcma_device *bcma_find_core_by_index(struct bcma_bus *bus, in bcma_find_core_by_index() argument
208 list_for_each_entry(core, &bus->cores, list) { in bcma_find_core_by_index()
215 static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, in bcma_get_next_core() argument
225 cia = bcma_erom_get_ci(bus, eromptr); in bcma_get_next_core()
228 if (bcma_erom_is_end(bus, eromptr)) in bcma_get_next_core()
232 cib = bcma_erom_get_ci(bus, eromptr); in bcma_get_next_core()
249 bcma_erom_skip_component(bus, eromptr); in bcma_get_next_core()
258 bcma_erom_skip_component(bus, eromptr); in bcma_get_next_core()
262 if (bcma_erom_is_bridge(bus, eromptr)) { in bcma_get_next_core()
263 bcma_erom_skip_component(bus, eromptr); in bcma_get_next_core()
267 if (bcma_find_core_by_index(bus, core_num)) { in bcma_get_next_core()
268 bcma_erom_skip_component(bus, eromptr); in bcma_get_next_core()
278 bcma_erom_skip_component(bus, eromptr); in bcma_get_next_core()
284 s32 mst_port_d = bcma_erom_get_mst_port(bus, eromptr); in bcma_get_next_core()
292 tmp = bcma_erom_get_addr_desc(bus, eromptr, in bcma_get_next_core()
309 tmp = bcma_erom_get_addr_desc(bus, eromptr, in bcma_get_next_core()
327 tmp = bcma_erom_get_addr_desc(bus, eromptr, in bcma_get_next_core()
340 if (bus->hosttype == BCMA_HOSTTYPE_SOC) { in bcma_get_next_core()
353 void bcma_init_bus(struct bcma_bus *bus) in bcma_init_bus() argument
357 if (bus->init_done) in bcma_init_bus()
360 INIT_LIST_HEAD(&bus->cores); in bcma_init_bus()
361 bus->nr_cores = 0; in bcma_init_bus()
363 bcma_scan_switch_core(bus, BCMA_ADDR_BASE); in bcma_init_bus()
365 tmp = bcma_scan_read32(bus, 0, BCMA_CC_ID); in bcma_init_bus()
366 bus->chipinfo.id = (tmp & BCMA_CC_ID_ID) >> BCMA_CC_ID_ID_SHIFT; in bcma_init_bus()
367 bus->chipinfo.rev = (tmp & BCMA_CC_ID_REV) >> BCMA_CC_ID_REV_SHIFT; in bcma_init_bus()
368 bus->chipinfo.pkg = (tmp & BCMA_CC_ID_PKG) >> BCMA_CC_ID_PKG_SHIFT; in bcma_init_bus()
369 bus->init_done = true; in bcma_init_bus()
372 int bcma_bus_scan(struct bcma_bus *bus) in bcma_bus_scan() argument
379 bcma_init_bus(bus); in bcma_bus_scan()
381 erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM); in bcma_bus_scan()
382 if (bus->hosttype == BCMA_HOSTTYPE_SOC) { in bcma_bus_scan()
387 eromptr = bus->mmio; in bcma_bus_scan()
392 bcma_scan_switch_core(bus, erombase); in bcma_bus_scan()
399 core->bus = bus; in bcma_bus_scan()
401 err = bcma_get_next_core(bus, &eromptr, NULL, core_num, core); in bcma_bus_scan()
416 bus->nr_cores++; in bcma_bus_scan()
424 list_add(&core->list, &bus->cores); in bcma_bus_scan()
427 if (bus->hosttype == BCMA_HOSTTYPE_SOC) in bcma_bus_scan()
433 int __init bcma_bus_scan_early(struct bcma_bus *bus, in bcma_bus_scan_early() argument
443 erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM); in bcma_bus_scan_early()
444 if (bus->hosttype == BCMA_HOSTTYPE_SOC) { in bcma_bus_scan_early()
449 eromptr = bus->mmio; in bcma_bus_scan_early()
454 bcma_scan_switch_core(bus, erombase); in bcma_bus_scan_early()
459 core->bus = bus; in bcma_bus_scan_early()
461 err = bcma_get_next_core(bus, &eromptr, match, core_num, core); in bcma_bus_scan_early()
473 bus->nr_cores++; in bcma_bus_scan_early()
480 list_add(&core->list, &bus->cores); in bcma_bus_scan_early()
485 if (bus->hosttype == BCMA_HOSTTYPE_SOC) in bcma_bus_scan_early()