MIPS: i8259: Use IRQ domains
authorAndrew Bresticker <abrestic@chromium.org>
Thu, 18 Sep 2014 21:47:11 +0000 (14:47 -0700)
committerRalf Baechle <ralf@linux-mips.org>
Mon, 24 Nov 2014 06:44:52 +0000 (07:44 +0100)
Create a legacy IRQ domain for the 16 i8259 interrupts.

Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-by: Qais Yousef <qais.yousef@imgtec.com>
Tested-by: Qais Yousef <qais.yousef@imgtec.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Bresticker <abrestic@chromium.org>
Cc: Jeffrey Deans <jeffrey.deans@imgtec.com>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Qais Yousef <qais.yousef@imgtec.com>
Cc: Jonas Gorski <jogo@openwrt.org>
Cc: John Crispin <blogic@openwrt.org>
Cc: David Daney <ddaney.cavm@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/7804/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/Kconfig
arch/mips/kernel/i8259.c

index 92033b7e275bdd0ad920930a9c6bc4c169eb6e0f..e08aeec7d916fa54d2defc49eee6db28e0089de4 100644 (file)
@@ -975,6 +975,7 @@ config SYS_SUPPORTS_HOTPLUG_CPU
 
 config I8259
        bool
+       select IRQ_DOMAIN
 
 config MIPS_BONITO64
        bool
index 50b364897dda91dfd4eb8cb8914b018ec63c386a..a74ec3ae557c0dc77d63ab835dcf9e820db8c672 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/init.h>
 #include <linux/ioport.h>
 #include <linux/interrupt.h>
+#include <linux/irqdomain.h>
 #include <linux/kernel.h>
 #include <linux/spinlock.h>
 #include <linux/syscore_ops.h>
@@ -308,6 +309,19 @@ static struct resource pic2_io_resource = {
        .flags = IORESOURCE_BUSY
 };
 
+static int i8259A_irq_domain_map(struct irq_domain *d, unsigned int virq,
+                                irq_hw_number_t hw)
+{
+       irq_set_chip_and_handler(virq, &i8259A_chip, handle_level_irq);
+       irq_set_probe(virq);
+       return 0;
+}
+
+static struct irq_domain_ops i8259A_ops = {
+       .map = i8259A_irq_domain_map,
+       .xlate = irq_domain_xlate_onecell,
+};
+
 /*
  * On systems with i8259-style interrupt controllers we assume for
  * driver compatibility reasons interrupts 0 - 15 to be the i8259
@@ -315,17 +329,17 @@ static struct resource pic2_io_resource = {
  */
 void __init init_i8259_irqs(void)
 {
-       int i;
+       struct irq_domain *domain;
 
        insert_resource(&ioport_resource, &pic1_io_resource);
        insert_resource(&ioport_resource, &pic2_io_resource);
 
        init_8259A(0);
 
-       for (i = I8259A_IRQ_BASE; i < I8259A_IRQ_BASE + 16; i++) {
-               irq_set_chip_and_handler(i, &i8259A_chip, handle_level_irq);
-               irq_set_probe(i);
-       }
+       domain = irq_domain_add_legacy(NULL, 16, I8259A_IRQ_BASE, 0,
+                                      &i8259A_ops, NULL);
+       if (!domain)
+               panic("Failed to add i8259 IRQ domain");
 
        setup_irq(I8259A_IRQ_BASE + PIC_CASCADE_IR, &irq2);
 }