aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/omap_hwmod.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2017-10-10 17:27:19 -0400
committerTony Lindgren <tony@atomide.com>2017-10-10 17:27:19 -0400
commitfe97874a41bf911350bae6bda7fc044d12c76a4a (patch)
treeeea07fbd29d510bef970d923cf9db611bf4b6ebf /arch/arm/mach-omap2/omap_hwmod.c
parent3da521672568702c58767de69b5b0b58c8095fae (diff)
ARM: OMAP2+: Drop omap_hwmod_irq_info
With the previous patches removing the need for legacy IRQs now that all of mach-omap2 is booting in device tree only mode, we can drop struct omap_hwmod_irq_info. Note that we can now also finally drop omap4_xlate_irq. Cc: Lokesh Vutla <lokeshvutla@ti.com> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Paul Walmsley <paul@pwsan.com> Cc: Tero Kristo <t-kristo@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/omap_hwmod.c')
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c100
1 files changed, 4 insertions, 96 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index de69fb37098c..5a0fbdec339a 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1102,29 +1102,6 @@ static int _omap4_wait_target_disable(struct omap_hwmod *oh)
1102} 1102}
1103 1103
1104/** 1104/**
1105 * _count_mpu_irqs - count the number of MPU IRQ lines associated with @oh
1106 * @oh: struct omap_hwmod *oh
1107 *
1108 * Count and return the number of MPU IRQs associated with the hwmod
1109 * @oh. Used to allocate struct resource data. Returns 0 if @oh is
1110 * NULL.
1111 */
1112static int _count_mpu_irqs(struct omap_hwmod *oh)
1113{
1114 struct omap_hwmod_irq_info *ohii;
1115 int i = 0;
1116
1117 if (!oh || !oh->mpu_irqs)
1118 return 0;
1119
1120 do {
1121 ohii = &oh->mpu_irqs[i++];
1122 } while (ohii->irq != -1);
1123
1124 return i-1;
1125}
1126
1127/**
1128 * _count_sdma_reqs - count the number of SDMA request lines associated with @oh 1105 * _count_sdma_reqs - count the number of SDMA request lines associated with @oh
1129 * @oh: struct omap_hwmod *oh 1106 * @oh: struct omap_hwmod *oh
1130 * 1107 *
@@ -1171,50 +1148,6 @@ static int _count_ocp_if_addr_spaces(struct omap_hwmod_ocp_if *os)
1171} 1148}
1172 1149
1173/** 1150/**
1174 * _get_mpu_irq_by_name - fetch MPU interrupt line number by name
1175 * @oh: struct omap_hwmod * to operate on
1176 * @name: pointer to the name of the MPU interrupt number to fetch (optional)
1177 * @irq: pointer to an unsigned int to store the MPU IRQ number to
1178 *
1179 * Retrieve a MPU hardware IRQ line number named by @name associated
1180 * with the IP block pointed to by @oh. The IRQ number will be filled
1181 * into the address pointed to by @dma. When @name is non-null, the
1182 * IRQ line number associated with the named entry will be returned.
1183 * If @name is null, the first matching entry will be returned. Data
1184 * order is not meaningful in hwmod data, so callers are strongly
1185 * encouraged to use a non-null @name whenever possible to avoid
1186 * unpredictable effects if hwmod data is later added that causes data
1187 * ordering to change. Returns 0 upon success or a negative error
1188 * code upon error.
1189 */
1190static int _get_mpu_irq_by_name(struct omap_hwmod *oh, const char *name,
1191 unsigned int *irq)
1192{
1193 int i;
1194 bool found = false;
1195
1196 if (!oh->mpu_irqs)
1197 return -ENOENT;
1198
1199 i = 0;
1200 while (oh->mpu_irqs[i].irq != -1) {
1201 if (name == oh->mpu_irqs[i].name ||
1202 !strcmp(name, oh->mpu_irqs[i].name)) {
1203 found = true;
1204 break;
1205 }
1206 i++;
1207 }
1208
1209 if (!found)
1210 return -ENOENT;
1211
1212 *irq = oh->mpu_irqs[i].irq;
1213
1214 return 0;
1215}
1216
1217/**
1218 * _get_sdma_req_by_name - fetch SDMA request line ID by name 1151 * _get_sdma_req_by_name - fetch SDMA request line ID by name
1219 * @oh: struct omap_hwmod * to operate on 1152 * @oh: struct omap_hwmod * to operate on
1220 * @name: pointer to the name of the SDMA request line to fetch (optional) 1153 * @name: pointer to the name of the SDMA request line to fetch (optional)
@@ -3452,9 +3385,6 @@ int omap_hwmod_count_resources(struct omap_hwmod *oh, unsigned long flags)
3452{ 3385{
3453 int ret = 0; 3386 int ret = 0;
3454 3387
3455 if (flags & IORESOURCE_IRQ)
3456 ret += _count_mpu_irqs(oh);
3457
3458 if (flags & IORESOURCE_DMA) 3388 if (flags & IORESOURCE_DMA)
3459 ret += _count_sdma_reqs(oh); 3389 ret += _count_sdma_reqs(oh);
3460 3390
@@ -3481,25 +3411,10 @@ int omap_hwmod_count_resources(struct omap_hwmod *oh, unsigned long flags)
3481int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res) 3411int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res)
3482{ 3412{
3483 struct omap_hwmod_ocp_if *os; 3413 struct omap_hwmod_ocp_if *os;
3484 int i, j, mpu_irqs_cnt, sdma_reqs_cnt, addr_cnt; 3414 int i, j, sdma_reqs_cnt, addr_cnt;
3485 int r = 0; 3415 int r = 0;
3486 3416
3487 /* For each IRQ, DMA, memory area, fill in array.*/ 3417 /* For each DMA, memory area, fill in array.*/
3488
3489 mpu_irqs_cnt = _count_mpu_irqs(oh);
3490 for (i = 0; i < mpu_irqs_cnt; i++) {
3491 unsigned int irq;
3492
3493 if (oh->xlate_irq)
3494 irq = oh->xlate_irq((oh->mpu_irqs + i)->irq);
3495 else
3496 irq = (oh->mpu_irqs + i)->irq;
3497 (res + r)->name = (oh->mpu_irqs + i)->name;
3498 (res + r)->start = irq;
3499 (res + r)->end = irq;
3500 (res + r)->flags = IORESOURCE_IRQ;
3501 r++;
3502 }
3503 3418
3504 sdma_reqs_cnt = _count_sdma_reqs(oh); 3419 sdma_reqs_cnt = _count_sdma_reqs(oh);
3505 for (i = 0; i < sdma_reqs_cnt; i++) { 3420 for (i = 0; i < sdma_reqs_cnt; i++) {
@@ -3578,20 +3493,13 @@ int omap_hwmod_get_resource_byname(struct omap_hwmod *oh, unsigned int type,
3578 const char *name, struct resource *rsrc) 3493 const char *name, struct resource *rsrc)
3579{ 3494{
3580 int r; 3495 int r;
3581 unsigned int irq, dma; 3496 unsigned int dma;
3582 u32 pa_start, pa_end; 3497 u32 pa_start, pa_end;
3583 3498
3584 if (!oh || !rsrc) 3499 if (!oh || !rsrc)
3585 return -EINVAL; 3500 return -EINVAL;
3586 3501
3587 if (type == IORESOURCE_IRQ) { 3502 if (type == IORESOURCE_DMA) {
3588 r = _get_mpu_irq_by_name(oh, name, &irq);
3589 if (r)
3590 return r;
3591
3592 rsrc->start = irq;
3593 rsrc->end = irq;
3594 } else if (type == IORESOURCE_DMA) {
3595 r = _get_sdma_req_by_name(oh, name, &dma); 3503 r = _get_sdma_req_by_name(oh, name, &dma);
3596 if (r) 3504 if (r)
3597 return r; 3505 return r;