Lines Matching refs:bus
223 drv->drv.bus = &mips_cdmm_bustype; in BUILD_PERCPU_HELPER()
289 struct mips_cdmm_bus *bus, **bus_p; in mips_cdmm_get_bus() local
304 bus = *bus_p; in mips_cdmm_get_bus()
306 if (unlikely(!bus)) { in mips_cdmm_get_bus()
307 bus = kzalloc(sizeof(*bus), GFP_ATOMIC); in mips_cdmm_get_bus()
308 if (unlikely(!bus)) in mips_cdmm_get_bus()
309 bus = ERR_PTR(-ENOMEM); in mips_cdmm_get_bus()
311 *bus_p = bus; in mips_cdmm_get_bus()
314 return bus; in mips_cdmm_get_bus()
356 static int mips_cdmm_setup(struct mips_cdmm_bus *bus) in mips_cdmm_setup() argument
361 if (IS_ERR(bus)) in mips_cdmm_setup()
362 return PTR_ERR(bus); in mips_cdmm_setup()
366 if (bus->offline) { in mips_cdmm_setup()
368 if (bus->phys == mips_cdmm_cur_base()) in mips_cdmm_setup()
374 bus->offline = false; in mips_cdmm_setup()
375 } else if (bus->phys > 1) { in mips_cdmm_setup()
380 if (!bus->phys) in mips_cdmm_setup()
381 bus->phys = mips_cdmm_cur_base(); in mips_cdmm_setup()
383 if (!bus->phys) in mips_cdmm_setup()
384 bus->phys = mips_cdmm_phys_base(); in mips_cdmm_setup()
386 if (!bus->phys) in mips_cdmm_setup()
387 bus->phys = mips_cdmm_default_base; in mips_cdmm_setup()
389 if (!bus->phys) { in mips_cdmm_setup()
390 bus->phys = 1; in mips_cdmm_setup()
400 if (bus->phys == 1) { in mips_cdmm_setup()
405 mips_cdmm_default_base = bus->phys; in mips_cdmm_setup()
408 smp_processor_id(), &bus->phys); in mips_cdmm_setup()
413 cdmmbase |= (bus->phys >> MIPS_CDMMBASE_ADDR_START) in mips_cdmm_setup()
419 bus->regs = (void __iomem *)CKSEG1ADDR(bus->phys); in mips_cdmm_setup()
420 bus->drbs = 1 + ((cdmmbase & MIPS_CDMMBASE_SIZE) >> in mips_cdmm_setup()
422 bus->drbs_reserved = !!(cdmmbase & MIPS_CDMMBASE_CI); in mips_cdmm_setup()
448 struct mips_cdmm_bus *bus; in mips_cdmm_early_probe() local
457 bus = mips_cdmm_get_bus(); in mips_cdmm_early_probe()
458 err = mips_cdmm_setup(bus); in mips_cdmm_early_probe()
463 drb = bus->drbs_reserved; in mips_cdmm_early_probe()
464 cdmm = bus->regs; in mips_cdmm_early_probe()
467 for (; drb < bus->drbs; drb += size + 1) { in mips_cdmm_early_probe()
497 static void mips_cdmm_bus_discover(struct mips_cdmm_bus *bus) in mips_cdmm_bus_discover() argument
508 drb = bus->drbs_reserved; in mips_cdmm_bus_discover()
509 cdmm = bus->regs; in mips_cdmm_bus_discover()
512 bus->discovered = true; in mips_cdmm_bus_discover()
513 pr_info("cdmm%u discovery (%u blocks)\n", cpu, bus->drbs); in mips_cdmm_bus_discover()
514 for (; drb < bus->drbs; drb += size + 1) { in mips_cdmm_bus_discover()
533 dev->res.start = bus->phys + drb * CDMM_DRB_SIZE; in mips_cdmm_bus_discover()
534 dev->res.end = bus->phys + in mips_cdmm_bus_discover()
540 dev->dev.bus = &mips_cdmm_bustype; in mips_cdmm_bus_discover()
606 struct mips_cdmm_bus *bus; in BUILD_PERDEV_HELPER() local
617 bus = mips_cdmm_get_bus(); in BUILD_PERDEV_HELPER()
618 if (!IS_ERR(bus)) in BUILD_PERDEV_HELPER()
619 bus->offline = true; in BUILD_PERDEV_HELPER()
638 struct mips_cdmm_bus *bus; in mips_cdmm_cpu_online() local
641 bus = mips_cdmm_get_bus(); in mips_cdmm_cpu_online()
642 ret = mips_cdmm_setup(bus); in mips_cdmm_cpu_online()
647 bus->offline = false; in mips_cdmm_cpu_online()
649 if (!bus->discovered) in mips_cdmm_cpu_online()
650 mips_cdmm_bus_discover(bus); in mips_cdmm_cpu_online()