irqchip/gic-v3: Fix translation of LPIs after conversion to irq_fwspec
[firefly-linux-kernel-4.4.55.git] / drivers / irqchip / irq-gic-v3.c
index 05d010b652f513561d59fc4438f230736dae8095..d7be6ddc34f685a47dad313274f209b59dff6bf5 100644 (file)
@@ -746,15 +746,19 @@ static int gic_irq_domain_translate(struct irq_domain *d,
                if (fwspec->param_count < 3)
                        return -EINVAL;
 
-               /* Get the interrupt number and add 16 to skip over SGIs */
-               *hwirq = fwspec->param[1] + 16;
-
-               /*
-                * For SPIs, we need to add 16 more to get the GIC irq
-                * ID number
-                */
-               if (!fwspec->param[0])
-                       *hwirq += 16;
+               switch (fwspec->param[0]) {
+               case 0:                 /* SPI */
+                       *hwirq = fwspec->param[1] + 32;
+                       break;
+               case 1:                 /* PPI */
+                       *hwirq = fwspec->param[1] + 16;
+                       break;
+               case GIC_IRQ_TYPE_LPI:  /* LPI */
+                       *hwirq = fwspec->param[1];
+                       break;
+               default:
+                       return -EINVAL;
+               }
 
                *type = fwspec->param[2] & IRQ_TYPE_SENSE_MASK;
                return 0;