IRQCHIP: mips-gic: Add function for retrieving FDC IRQ
authorJames Hogan <james.hogan@imgtec.com>
Thu, 29 Jan 2015 11:14:09 +0000 (11:14 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 31 Mar 2015 10:04:12 +0000 (12:04 +0200)
Add a function to the MIPS GIC driver for retrieving the Fast Debug
Channel (FDC) interrupt number, similar to the existing ones for the
timer and perf counter interrupts. This will be used by platform
implementations of get_c0_fdc_int() if a GIC is present.

A workaround exists for interAptiv and proAptiv which claim to be able
to route the FDC interrupt but don't seem to be able to in practice (at
least on Malta).

[ralf@linux-mips.org: Fix conflict.]

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Andrew Bresticker <abrestic@chromium.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/9142/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
drivers/irqchip/irq-mips-gic.c
include/linux/irqchip/mips-gic.h

index c8699eec3930a9f16c4932a177cc8648e5681db5..827cf9b9db395b4216631767d24c0a32ae4dd3b1 100644 (file)
@@ -227,6 +227,29 @@ int gic_get_c0_perfcount_int(void)
                                  GIC_LOCAL_TO_HWIRQ(GIC_LOCAL_INT_PERFCTR));
 }
 
+int gic_get_c0_fdc_int(void)
+{
+       if (!gic_local_irq_is_routable(GIC_LOCAL_INT_FDC)) {
+               /* Is the FDC IRQ even present? */
+               if (cp0_fdc_irq < 0)
+                       return -1;
+               return MIPS_CPU_IRQ_BASE + cp0_fdc_irq;
+       }
+
+       /*
+        * Some cores claim the FDC is routable but it doesn't actually seem to
+        * be connected.
+        */
+       switch (current_cpu_type()) {
+       case CPU_INTERAPTIV:
+       case CPU_PROAPTIV:
+               return -1;
+       }
+
+       return irq_create_mapping(gic_irq_domain,
+                                 GIC_LOCAL_TO_HWIRQ(GIC_LOCAL_INT_FDC));
+}
+
 static void gic_handle_shared_int(void)
 {
        unsigned int i, intr, virq;
index 2e79b4bb2d75b8e5bd5dbd3fbc047725267b0690..83099e5ab2c4c748893e1324086f9106d1216a45 100644 (file)
@@ -251,4 +251,5 @@ extern unsigned int plat_ipi_call_int_xlate(unsigned int);
 extern unsigned int plat_ipi_resched_int_xlate(unsigned int);
 extern int gic_get_c0_compare_int(void);
 extern int gic_get_c0_perfcount_int(void);
+extern int gic_get_c0_fdc_int(void);
 #endif /* __LINUX_IRQCHIP_MIPS_GIC_H */