C6X: remove megamod-pic requirement on direct-mapped core pic
authorMark Salter <msalter@redhat.com>
Thu, 19 Jul 2012 01:11:59 +0000 (21:11 -0400)
committerMark Salter <msalter@redhat.com>
Thu, 19 Jul 2012 03:43:37 +0000 (23:43 -0400)
The megamodule PIC cascades a number of interrupt sources into the core
priority PIC. The megamodule code depends on the core hardware interrupt
numbers being mapped one-to-one with regard to linux interrupt numbers.
This patch removes that dependence in order to pave the way for removing
the direct mapping in the core PIC code.

Signed-off-by: Mark Salter <msalter@redhat.com>
arch/c6x/platforms/megamod-pic.c

index c1c4e2ae3f85be2804d4987c149a65d5e03ec66c..74e3371eb8245bc4c769eff1b8923707c0fc883f 100644 (file)
@@ -243,27 +243,37 @@ static struct megamod_pic * __init init_megamod_pic(struct device_node *np)
         * as their interrupt parent.
         */
        for (i = 0; i < NR_COMBINERS; i++) {
+               struct irq_data *irq_data;
+               irq_hw_number_t hwirq;
 
                irq = irq_of_parse_and_map(np, i);
                if (irq == NO_IRQ)
                        continue;
 
+               irq_data = irq_get_irq_data(irq);
+               if (!irq_data) {
+                       pr_err("%s: combiner-%d no irq_data for virq %d!\n",
+                              np->full_name, i, irq);
+                       continue;
+               }
+
+               hwirq = irq_data->hwirq;
+
                /*
-                * We count on the core priority interrupts (4 - 15) being
-                * direct mapped. Check that device tree provided something
-                * in that range.
+                * Check that device tree provided something in the range
+                * of the core priority interrupts (4 - 15).
                 */
-               if (irq < 4 || irq >= NR_PRIORITY_IRQS) {
-                       pr_err("%s: combiner-%d virq %d out of range!\n",
-                                np->full_name, i, irq);
+               if (hwirq < 4 || hwirq >= NR_PRIORITY_IRQS) {
+                       pr_err("%s: combiner-%d core irq %ld out of range!\n",
+                              np->full_name, i, hwirq);
                        continue;
                }
 
                /* record the mapping */
-               mapping[irq - 4] = i;
+               mapping[hwirq - 4] = i;
 
-               pr_debug("%s: combiner-%d cascading to virq %d\n",
-                        np->full_name, i, irq);
+               pr_debug("%s: combiner-%d cascading to hwirq %ld\n",
+                        np->full_name, i, hwirq);
 
                cascade_data[i].pic = pic;
                cascade_data[i].index = i;