diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2011-07-22 19:20:08 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-08-08 14:29:25 -0400 |
commit | ecd177c21640e92b059a71139f5850243a8f0942 (patch) | |
tree | 70ed92f7b63087bec0a6036dca1c81403d65c86d /drivers/bcma/scan.c | |
parent | 517f43e5a922d51ac960424de4f72676fe6a7390 (diff) |
bcma: add SOC bus
This patch adds support for using bcma on a Broadcom SoC as the system
bus. An SoC like the bcm4716 could register this bus and use it to
searches for the bcma cores and register the devices on this bus.
BCMA_HOSTTYPE_NONE was intended for SoCs at first but BCMA_HOSTTYPE_SOC
is a better name.
Acked-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/bcma/scan.c')
-rw-r--r-- | drivers/bcma/scan.c | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c index bf9f80652773..0ea390f9aa9e 100644 --- a/drivers/bcma/scan.c +++ b/drivers/bcma/scan.c | |||
@@ -337,6 +337,16 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, | |||
337 | } | 337 | } |
338 | } | 338 | } |
339 | } | 339 | } |
340 | if (bus->hosttype == BCMA_HOSTTYPE_SOC) { | ||
341 | core->io_addr = ioremap_nocache(core->addr, BCMA_CORE_SIZE); | ||
342 | if (!core->io_addr) | ||
343 | return -ENOMEM; | ||
344 | core->io_wrap = ioremap_nocache(core->wrap, BCMA_CORE_SIZE); | ||
345 | if (!core->io_wrap) { | ||
346 | iounmap(core->io_addr); | ||
347 | return -ENOMEM; | ||
348 | } | ||
349 | } | ||
340 | return 0; | 350 | return 0; |
341 | } | 351 | } |
342 | 352 | ||
@@ -369,7 +379,14 @@ int bcma_bus_scan(struct bcma_bus *bus) | |||
369 | bcma_init_bus(bus); | 379 | bcma_init_bus(bus); |
370 | 380 | ||
371 | erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM); | 381 | erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM); |
372 | eromptr = bus->mmio; | 382 | if (bus->hosttype == BCMA_HOSTTYPE_SOC) { |
383 | eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE); | ||
384 | if (!eromptr) | ||
385 | return -ENOMEM; | ||
386 | } else { | ||
387 | eromptr = bus->mmio; | ||
388 | } | ||
389 | |||
373 | eromend = eromptr + BCMA_CORE_SIZE / sizeof(u32); | 390 | eromend = eromptr + BCMA_CORE_SIZE / sizeof(u32); |
374 | 391 | ||
375 | bcma_scan_switch_core(bus, erombase); | 392 | bcma_scan_switch_core(bus, erombase); |
@@ -404,6 +421,9 @@ int bcma_bus_scan(struct bcma_bus *bus) | |||
404 | list_add(&core->list, &bus->cores); | 421 | list_add(&core->list, &bus->cores); |
405 | } | 422 | } |
406 | 423 | ||
424 | if (bus->hosttype == BCMA_HOSTTYPE_SOC) | ||
425 | iounmap(eromptr); | ||
426 | |||
407 | return 0; | 427 | return 0; |
408 | } | 428 | } |
409 | 429 | ||
@@ -414,10 +434,18 @@ int __init bcma_bus_scan_early(struct bcma_bus *bus, | |||
414 | u32 erombase; | 434 | u32 erombase; |
415 | u32 __iomem *eromptr, *eromend; | 435 | u32 __iomem *eromptr, *eromend; |
416 | 436 | ||
417 | int err, core_num = 0; | 437 | int err = -ENODEV; |
438 | int core_num = 0; | ||
418 | 439 | ||
419 | erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM); | 440 | erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM); |
420 | eromptr = bus->mmio; | 441 | if (bus->hosttype == BCMA_HOSTTYPE_SOC) { |
442 | eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE); | ||
443 | if (!eromptr) | ||
444 | return -ENOMEM; | ||
445 | } else { | ||
446 | eromptr = bus->mmio; | ||
447 | } | ||
448 | |||
421 | eromend = eromptr + BCMA_CORE_SIZE / sizeof(u32); | 449 | eromend = eromptr + BCMA_CORE_SIZE / sizeof(u32); |
422 | 450 | ||
423 | bcma_scan_switch_core(bus, erombase); | 451 | bcma_scan_switch_core(bus, erombase); |
@@ -447,8 +475,12 @@ int __init bcma_bus_scan_early(struct bcma_bus *bus, | |||
447 | core->id.class); | 475 | core->id.class); |
448 | 476 | ||
449 | list_add(&core->list, &bus->cores); | 477 | list_add(&core->list, &bus->cores); |
450 | return 0; | 478 | err = 0; |
479 | break; | ||
451 | } | 480 | } |
452 | 481 | ||
453 | return -ENODEV; | 482 | if (bus->hosttype == BCMA_HOSTTYPE_SOC) |
483 | iounmap(eromptr); | ||
484 | |||
485 | return err; | ||
454 | } | 486 | } |