diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2012-11-21 18:15:17 -0500 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2012-11-21 18:15:17 -0500 |
commit | dad4191d79bded6674529084bcf842c00e4d874a (patch) | |
tree | 72d072bf30441da7e745ba28c10af91ce570b40e /arch/arm/mach-omap2/omap_hwmod.c | |
parent | e6d3a8b0bdcd8f323488a52927682190aee5488e (diff) |
ARM: OMAP2+: hwmod: Add possibility to count hwmod resources based on type
Add flags parameter for omap_hwmod_count_resources() so users can tell which
type of resources they are interested when counting them in hwmod database.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: BenoƮt Cousson <b-cousson@ti.com>
[paul@pwsan.com: updated to apply]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/mach-omap2/omap_hwmod.c')
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 083adbed0bfd..a8090907fe35 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -3427,7 +3427,7 @@ int omap_hwmod_reset(struct omap_hwmod *oh) | |||
3427 | /** | 3427 | /** |
3428 | * omap_hwmod_count_resources - count number of struct resources needed by hwmod | 3428 | * omap_hwmod_count_resources - count number of struct resources needed by hwmod |
3429 | * @oh: struct omap_hwmod * | 3429 | * @oh: struct omap_hwmod * |
3430 | * @res: pointer to the first element of an array of struct resource to fill | 3430 | * @flags: Type of resources to include when counting (IRQ/DMA/MEM) |
3431 | * | 3431 | * |
3432 | * Count the number of struct resource array elements necessary to | 3432 | * Count the number of struct resource array elements necessary to |
3433 | * contain omap_hwmod @oh resources. Intended to be called by code | 3433 | * contain omap_hwmod @oh resources. Intended to be called by code |
@@ -3440,20 +3440,25 @@ int omap_hwmod_reset(struct omap_hwmod *oh) | |||
3440 | * resource IDs. | 3440 | * resource IDs. |
3441 | * | 3441 | * |
3442 | */ | 3442 | */ |
3443 | int omap_hwmod_count_resources(struct omap_hwmod *oh) | 3443 | int omap_hwmod_count_resources(struct omap_hwmod *oh, unsigned long flags) |
3444 | { | 3444 | { |
3445 | struct omap_hwmod_ocp_if *os; | 3445 | int ret = 0; |
3446 | struct list_head *p; | ||
3447 | int ret; | ||
3448 | int i = 0; | ||
3449 | 3446 | ||
3450 | ret = _count_mpu_irqs(oh) + _count_sdma_reqs(oh); | 3447 | if (flags & IORESOURCE_IRQ) |
3448 | ret += _count_mpu_irqs(oh); | ||
3451 | 3449 | ||
3452 | p = oh->slave_ports.next; | 3450 | if (flags & IORESOURCE_DMA) |
3451 | ret += _count_sdma_reqs(oh); | ||
3453 | 3452 | ||
3454 | while (i < oh->slaves_cnt) { | 3453 | if (flags & IORESOURCE_MEM) { |
3455 | os = _fetch_next_ocp_if(&p, &i); | 3454 | int i = 0; |
3456 | ret += _count_ocp_if_addr_spaces(os); | 3455 | struct omap_hwmod_ocp_if *os; |
3456 | struct list_head *p = oh->slave_ports.next; | ||
3457 | |||
3458 | while (i < oh->slaves_cnt) { | ||
3459 | os = _fetch_next_ocp_if(&p, &i); | ||
3460 | ret += _count_ocp_if_addr_spaces(os); | ||
3461 | } | ||
3457 | } | 3462 | } |
3458 | 3463 | ||
3459 | return ret; | 3464 | return ret; |