aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/omap_hwmod.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/omap_hwmod.c')
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 21e3eb8e83c1..d1a8bdefea3f 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -702,6 +702,29 @@ static int _count_mpu_irqs(struct omap_hwmod *oh)
702} 702}
703 703
704/** 704/**
705 * _count_sdma_reqs - count the number of SDMA request lines associated with @oh
706 * @oh: struct omap_hwmod *oh
707 *
708 * Count and return the number of SDMA request lines associated with
709 * the hwmod @oh. Used to allocate struct resource data. Returns 0
710 * if @oh is NULL.
711 */
712static int _count_sdma_reqs(struct omap_hwmod *oh)
713{
714 struct omap_hwmod_dma_info *ohdi;
715 int i = 0;
716
717 if (!oh || !oh->sdma_reqs)
718 return 0;
719
720 do {
721 ohdi = &oh->sdma_reqs[i++];
722 } while (ohdi->dma_req != -1);
723
724 return i;
725}
726
727/**
705 * _count_ocp_if_addr_spaces - count the number of address space entries for @oh 728 * _count_ocp_if_addr_spaces - count the number of address space entries for @oh
706 * @oh: struct omap_hwmod *oh 729 * @oh: struct omap_hwmod *oh
707 * 730 *
@@ -1987,7 +2010,7 @@ int omap_hwmod_count_resources(struct omap_hwmod *oh)
1987{ 2010{
1988 int ret, i; 2011 int ret, i;
1989 2012
1990 ret = _count_mpu_irqs(oh) + oh->sdma_reqs_cnt; 2013 ret = _count_mpu_irqs(oh) + _count_sdma_reqs(oh);
1991 2014
1992 for (i = 0; i < oh->slaves_cnt; i++) 2015 for (i = 0; i < oh->slaves_cnt; i++)
1993 ret += _count_ocp_if_addr_spaces(oh->slaves[i]); 2016 ret += _count_ocp_if_addr_spaces(oh->slaves[i]);
@@ -2007,7 +2030,7 @@ int omap_hwmod_count_resources(struct omap_hwmod *oh)
2007 */ 2030 */
2008int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res) 2031int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res)
2009{ 2032{
2010 int i, j, mpu_irqs_cnt; 2033 int i, j, mpu_irqs_cnt, sdma_reqs_cnt;
2011 int r = 0; 2034 int r = 0;
2012 2035
2013 /* For each IRQ, DMA, memory area, fill in array.*/ 2036 /* For each IRQ, DMA, memory area, fill in array.*/
@@ -2021,7 +2044,8 @@ int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res)
2021 r++; 2044 r++;
2022 } 2045 }
2023 2046
2024 for (i = 0; i < oh->sdma_reqs_cnt; i++) { 2047 sdma_reqs_cnt = _count_sdma_reqs(oh);
2048 for (i = 0; i < sdma_reqs_cnt; i++) {
2025 (res + r)->name = (oh->sdma_reqs + i)->name; 2049 (res + r)->name = (oh->sdma_reqs + i)->name;
2026 (res + r)->start = (oh->sdma_reqs + i)->dma_req; 2050 (res + r)->start = (oh->sdma_reqs + i)->dma_req;
2027 (res + r)->end = (oh->sdma_reqs + i)->dma_req; 2051 (res + r)->end = (oh->sdma_reqs + i)->dma_req;