Lines Matching refs:bus
160 static u32 scan_read32(struct ssb_bus *bus, u8 current_coreidx, in scan_read32() argument
165 switch (bus->bustype) { in scan_read32()
173 ssb_pcmcia_switch_segment(bus, 1); in scan_read32()
176 ssb_pcmcia_switch_segment(bus, 0); in scan_read32()
177 lo = readw(bus->mmio + offset); in scan_read32()
178 hi = readw(bus->mmio + offset + 2); in scan_read32()
182 return ssb_sdio_scan_read32(bus, offset); in scan_read32()
184 return readl(bus->mmio + offset); in scan_read32()
187 static int scan_switchcore(struct ssb_bus *bus, u8 coreidx) in scan_switchcore() argument
189 switch (bus->bustype) { in scan_switchcore()
193 return ssb_pci_switch_coreidx(bus, coreidx); in scan_switchcore()
195 return ssb_pcmcia_switch_coreidx(bus, coreidx); in scan_switchcore()
197 return ssb_sdio_scan_switch_coreidx(bus, coreidx); in scan_switchcore()
202 void ssb_iounmap(struct ssb_bus *bus) in ssb_iounmap() argument
204 switch (bus->bustype) { in ssb_iounmap()
207 iounmap(bus->mmio); in ssb_iounmap()
211 pci_iounmap(bus->host_pci, bus->mmio); in ssb_iounmap()
219 bus->mmio = NULL; in ssb_iounmap()
220 bus->mapped_device = NULL; in ssb_iounmap()
223 static void __iomem *ssb_ioremap(struct ssb_bus *bus, in ssb_ioremap() argument
228 switch (bus->bustype) { in ssb_ioremap()
237 mmio = pci_iomap(bus->host_pci, 0, ~0UL); in ssb_ioremap()
251 static int we_support_multiple_80211_cores(struct ssb_bus *bus) in we_support_multiple_80211_cores() argument
259 if (bus->bustype == SSB_BUSTYPE_PCI) { in we_support_multiple_80211_cores()
260 if (bus->host_pci->vendor == PCI_VENDOR_ID_BROADCOM && in we_support_multiple_80211_cores()
261 ((bus->host_pci->device == 0x4313) || in we_support_multiple_80211_cores()
262 (bus->host_pci->device == 0x431A) || in we_support_multiple_80211_cores()
263 (bus->host_pci->device == 0x4321) || in we_support_multiple_80211_cores()
264 (bus->host_pci->device == 0x4324))) in we_support_multiple_80211_cores()
271 int ssb_bus_scan(struct ssb_bus *bus, in ssb_bus_scan() argument
281 mmio = ssb_ioremap(bus, baseaddr); in ssb_bus_scan()
284 bus->mmio = mmio; in ssb_bus_scan()
286 err = scan_switchcore(bus, 0); /* Switch to first core */ in ssb_bus_scan()
290 idhi = scan_read32(bus, 0, SSB_IDHIGH); in ssb_bus_scan()
295 bus->nr_devices = 0; in ssb_bus_scan()
297 tmp = scan_read32(bus, 0, SSB_CHIPCO_CHIPID); in ssb_bus_scan()
299 bus->chip_id = (tmp & SSB_CHIPCO_IDMASK); in ssb_bus_scan()
300 bus->chip_rev = (tmp & SSB_CHIPCO_REVMASK) >> in ssb_bus_scan()
302 bus->chip_package = (tmp & SSB_CHIPCO_PACKMASK) >> in ssb_bus_scan()
305 bus->nr_devices = (tmp & SSB_CHIPCO_NRCORESMASK) >> in ssb_bus_scan()
308 tmp = scan_read32(bus, 0, SSB_CHIPCO_CAP); in ssb_bus_scan()
309 bus->chipco.capabilities = tmp; in ssb_bus_scan()
311 if (bus->bustype == SSB_BUSTYPE_PCI) { in ssb_bus_scan()
312 bus->chip_id = pcidev_to_chipid(bus->host_pci); in ssb_bus_scan()
313 bus->chip_rev = bus->host_pci->revision; in ssb_bus_scan()
314 bus->chip_package = 0; in ssb_bus_scan()
316 bus->chip_id = 0x4710; in ssb_bus_scan()
317 bus->chip_rev = 0; in ssb_bus_scan()
318 bus->chip_package = 0; in ssb_bus_scan()
322 bus->chip_id, bus->chip_rev, bus->chip_package); in ssb_bus_scan()
323 if (!bus->nr_devices) in ssb_bus_scan()
324 bus->nr_devices = chipid_to_nrcores(bus->chip_id); in ssb_bus_scan()
325 if (bus->nr_devices > ARRAY_SIZE(bus->devices)) { in ssb_bus_scan()
327 SSB_MAX_NR_CORES, bus->nr_devices); in ssb_bus_scan()
331 if (bus->bustype == SSB_BUSTYPE_SSB) { in ssb_bus_scan()
337 mmio = ioremap(baseaddr, SSB_CORE_SIZE * bus->nr_devices); in ssb_bus_scan()
340 bus->mmio = mmio; in ssb_bus_scan()
344 for (i = 0, dev_i = 0; i < bus->nr_devices; i++) { in ssb_bus_scan()
345 err = scan_switchcore(bus, i); in ssb_bus_scan()
348 dev = &(bus->devices[dev_i]); in ssb_bus_scan()
350 idhi = scan_read32(bus, i, SSB_IDHIGH); in ssb_bus_scan()
356 dev->bus = bus; in ssb_bus_scan()
357 dev->ops = bus->ops; in ssb_bus_scan()
367 if (!we_support_multiple_80211_cores(bus)) { in ssb_bus_scan()
375 if (bus->extif.dev) { in ssb_bus_scan()
379 bus->extif.dev = dev; in ssb_bus_scan()
383 if (bus->chipco.dev) { in ssb_bus_scan()
387 bus->chipco.dev = dev; in ssb_bus_scan()
392 if (bus->mipscore.dev) { in ssb_bus_scan()
396 bus->mipscore.dev = dev; in ssb_bus_scan()
402 if (bus->bustype == SSB_BUSTYPE_PCI) { in ssb_bus_scan()
407 if (pci_is_pcie(bus->host_pci)) in ssb_bus_scan()
410 if (!pci_is_pcie(bus->host_pci)) in ssb_bus_scan()
414 if (bus->pcicore.dev) { in ssb_bus_scan()
418 bus->pcicore.dev = dev; in ssb_bus_scan()
422 if (bus->bustype == SSB_BUSTYPE_PCI) { in ssb_bus_scan()
423 if (bus->host_pci->vendor == PCI_VENDOR_ID_BROADCOM && in ssb_bus_scan()
424 (bus->host_pci->device & 0xFF00) == 0x4300) { in ssb_bus_scan()
438 bus->nr_devices = dev_i; in ssb_bus_scan()
444 ssb_iounmap(bus); in ssb_bus_scan()