aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bcma/scan.c
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2015-01-19 02:30:30 -0500
committerKalle Valo <kvalo@codeaurora.org>2015-01-23 14:47:55 -0500
commitc5ed1df781cb544d4e4d189bb5b6ec7336d8888c (patch)
treed335c7b14b4be734e3ca6d79f9516e5473b387c7 /drivers/bcma/scan.c
parent908414af255ea974bd0cfe54918d7957cd457d15 (diff)
bcma: use standard bus scanning during early register
Starting with kernel 3.19-rc1 early registration of bcma on MIPS is done a bit later, with memory allocator available. This allows us to simplify code by using standard bus scanning method. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/bcma/scan.c')
-rw-r--r--drivers/bcma/scan.c62
1 files changed, 4 insertions, 58 deletions
diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c
index 5328ee5b4df0..df806b9c5490 100644
--- a/drivers/bcma/scan.c
+++ b/drivers/bcma/scan.c
@@ -461,6 +461,10 @@ int bcma_bus_scan(struct bcma_bus *bus)
461 461
462 int err, core_num = 0; 462 int err, core_num = 0;
463 463
464 /* Skip if bus was already scanned (e.g. during early register) */
465 if (bus->nr_cores)
466 return 0;
467
464 erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM); 468 erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM);
465 if (bus->hosttype == BCMA_HOSTTYPE_SOC) { 469 if (bus->hosttype == BCMA_HOSTTYPE_SOC) {
466 eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE); 470 eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE);
@@ -519,61 +523,3 @@ out:
519 523
520 return err; 524 return err;
521} 525}
522
523int __init bcma_bus_scan_early(struct bcma_bus *bus,
524 struct bcma_device_id *match,
525 struct bcma_device *core)
526{
527 u32 erombase;
528 u32 __iomem *eromptr, *eromend;
529
530 int err = -ENODEV;
531 int core_num = 0;
532
533 erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM);
534 if (bus->hosttype == BCMA_HOSTTYPE_SOC) {
535 eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE);
536 if (!eromptr)
537 return -ENOMEM;
538 } else {
539 eromptr = bus->mmio;
540 }
541
542 eromend = eromptr + BCMA_CORE_SIZE / sizeof(u32);
543
544 bcma_scan_switch_core(bus, erombase);
545
546 while (eromptr < eromend) {
547 memset(core, 0, sizeof(*core));
548 INIT_LIST_HEAD(&core->list);
549 core->bus = bus;
550
551 err = bcma_get_next_core(bus, &eromptr, match, core_num, core);
552 if (err == -ENODEV) {
553 core_num++;
554 continue;
555 } else if (err == -ENXIO)
556 continue;
557 else if (err == -ESPIPE)
558 break;
559 else if (err < 0)
560 goto out;
561
562 core->core_index = core_num++;
563 bus->nr_cores++;
564 bcma_info(bus, "Core %d found: %s (manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n",
565 core->core_index, bcma_device_name(&core->id),
566 core->id.manuf, core->id.id, core->id.rev,
567 core->id.class);
568
569 list_add_tail(&core->list, &bus->cores);
570 err = 0;
571 break;
572 }
573
574out:
575 if (bus->hosttype == BCMA_HOSTTYPE_SOC)
576 iounmap(eromptr);
577
578 return err;
579}