ARM: clps711x: Implement usage "MULTI_IRQ_HANDLER" kernel option for a platform
authorAlexander Shiyan <shc_work@mail.ru>
Sat, 17 Nov 2012 13:57:14 +0000 (17:57 +0400)
committerOlof Johansson <olof@lixom.net>
Wed, 21 Nov 2012 17:57:42 +0000 (09:57 -0800)
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Olof Johansson <olof@lixom.net>
arch/arm/Kconfig
arch/arm/mach-clps711x/autcpu12.c
arch/arm/mach-clps711x/cdb89712.c
arch/arm/mach-clps711x/clep7312.c
arch/arm/mach-clps711x/common.c
arch/arm/mach-clps711x/common.h
arch/arm/mach-clps711x/edb7211.c
arch/arm/mach-clps711x/fortunet.c
arch/arm/mach-clps711x/include/mach/entry-macro.S [deleted file]
arch/arm/mach-clps711x/p720t.c

index 0203b1bf733dd32616537be7bc996917f46eab6d..9c2c8f3c98ec9ecb1e1476aac6a54f626ac91d43 100644 (file)
@@ -371,6 +371,7 @@ config ARCH_CLPS711X
        select COMMON_CLK
        select CPU_ARM720T
        select GENERIC_CLOCKEVENTS
+       select MULTI_IRQ_HANDLER
        select NEED_MACH_MEMORY_H
        select SPARSE_IRQ
        help
index b90a31659de45027ddf2a2e435aad24966e4aba6..3de19554d8003e25760187fbb9c250597697f6c6 100644 (file)
@@ -75,6 +75,7 @@ MACHINE_START(AUTCPU12, "autronix autcpu12")
        .init_irq       = clps711x_init_irq,
        .timer          = &clps711x_timer,
        .init_machine   = autcpu12_init,
+       .handle_irq     = clps711x_handle_irq,
        .restart        = clps711x_restart,
 MACHINE_END
 
index 133794c4b654b9fbb41644126fbe6163075f88eb..60900ddf97c93fa09bc53649298a38cf32743e04 100644 (file)
@@ -142,5 +142,6 @@ MACHINE_START(CDB89712, "Cirrus-CDB89712")
        .init_irq       = clps711x_init_irq,
        .timer          = &clps711x_timer,
        .init_machine   = cdb89712_init,
+       .handle_irq     = clps711x_handle_irq,
        .restart        = clps711x_restart,
 MACHINE_END
index be776c5092ddde67eb6eebb691afee5c49355693..0b32a487183bb308702b4677686f66ddb3080fdc 100644 (file)
@@ -33,7 +33,6 @@ fixup_clep7312(struct tag *tags, char **cmdline, struct meminfo *mi)
        mi->bank[0].size = 0x01000000;
 }
 
-
 MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312")
        /* Maintainer: Nobody */
        .atag_offset    = 0x0100,
@@ -42,6 +41,6 @@ MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312")
        .map_io         = clps711x_map_io,
        .init_irq       = clps711x_init_irq,
        .timer          = &clps711x_timer,
+       .handle_irq     = clps711x_handle_irq,
        .restart        = clps711x_restart,
 MACHINE_END
-
index 286d6e6d5f5a9d69ed57fc0d914497213c4c34c9..08420244c0585102d2892a2edc03921d95e99900 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/clockchips.h>
 #include <linux/clk-provider.h>
 
+#include <asm/exception.h>
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
 #include <asm/system_misc.h>
@@ -134,13 +135,11 @@ static struct irq_chip int2_chip = {
        .irq_unmask     = int2_unmask,
 };
 
-struct clps711x_irqdesc {
+static struct {
        int                     nr;
        struct irq_chip         *chip;
        irq_flow_handler_t      handle;
-};
-
-static struct clps711x_irqdesc clps711x_irqdescs[] __initdata = {
+} clps711x_irqdescs[] __initdata = {
        { IRQ_CSINT,    &int1_chip,     handle_fasteoi_irq,     },
        { IRQ_EINT1,    &int1_chip,     handle_level_irq,       },
        { IRQ_EINT2,    &int1_chip,     handle_level_irq,       },
@@ -191,6 +190,44 @@ void __init clps711x_init_irq(void)
        }
 }
 
+inline u32 fls16(u32 x)
+{
+       u32 r = 15;
+
+       if (!(x & 0xff00)) {
+               x <<= 8;
+               r -= 8;
+       }
+       if (!(x & 0xf000)) {
+               x <<= 4;
+               r -= 4;
+       }
+       if (!(x & 0xc000)) {
+               x <<= 2;
+               r -= 2;
+       }
+       if (!(x & 0x8000))
+               r--;
+
+       return r;
+}
+
+asmlinkage void __exception_irq_entry clps711x_handle_irq(struct pt_regs *regs)
+{
+       u32 irqstat;
+       void __iomem *base = CLPS711X_VIRT_BASE;
+
+       irqstat = readl_relaxed(base + INTSR1) & readl_relaxed(base + INTMR1);
+       if (irqstat) {
+               handle_IRQ(fls16(irqstat), regs);
+               return;
+       }
+
+       irqstat = readl_relaxed(base + INTSR2) & readl_relaxed(base + INTMR2);
+       if (likely(irqstat))
+               handle_IRQ(fls16(irqstat) + 16, regs);
+}
+
 static void clps711x_clockevent_set_mode(enum clock_event_mode mode,
                                         struct clock_event_device *evt)
 {
index 28b1701b7993674c4dd2d05cf0582f942c06a19f..3c7f12cb81c1bb34e9a7f3eccbd62c03e2926c67 100644 (file)
@@ -12,5 +12,6 @@ struct sys_timer;
 
 extern void clps711x_map_io(void);
 extern void clps711x_init_irq(void);
-extern struct sys_timer clps711x_timer;
+extern void clps711x_handle_irq(struct pt_regs *regs);
 extern void clps711x_restart(char mode, const char *cmd);
+extern struct sys_timer clps711x_timer;
index 7b161dd40e8d25c4db0c14b3666400e04e2fe4b9..cc32a65d6982c480b37f531819b802ba090eed57 100644 (file)
@@ -98,5 +98,6 @@ MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
        .init_irq       = clps711x_init_irq,
        .timer          = &clps711x_timer,
        .init_machine   = edb7211_init,
+       .handle_irq     = clps711x_handle_irq,
        .restart        = clps711x_restart,
 MACHINE_END
index a5c08162bff9694af9bf416733db8d26bb547c6a..7d01255803660f84141503b39321aaf551a9b655 100644 (file)
@@ -79,5 +79,6 @@ MACHINE_START(FORTUNET, "ARM-FortuNet")
        .map_io         = clps711x_map_io,
        .init_irq       = clps711x_init_irq,
        .timer          = &clps711x_timer,
+       .handle_irq     = clps711x_handle_irq,
        .restart        = clps711x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-clps711x/include/mach/entry-macro.S b/arch/arm/mach-clps711x/include/mach/entry-macro.S
deleted file mode 100644 (file)
index 56e5c2c..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * arch/arm/mach-clps711x/include/mach/entry-macro.S
- *
- * Low-level IRQ helper macros for CLPS711X-based platforms
- *
- * This file is licensed under  the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-#include <mach/hardware.h>
-
-               .macro  get_irqnr_preamble, base, tmp
-               .endm
-
-#if (INTSR2 - INTSR1) != (INTMR2 - INTMR1)
-#error INTSR stride != INTMR stride
-#endif
-
-               .macro  get_irqnr_and_base, irqnr, stat, base, mask
-               mov     \base, #CLPS711X_VIRT_BASE
-               ldr     \stat, [\base, #INTSR1]
-               ldr     \mask, [\base, #INTMR1]
-               mov     \irqnr, #4
-               mov     \mask, \mask, lsl #16
-               and     \stat, \stat, \mask, lsr #16
-               movs    \stat, \stat, lsr #4
-               bne     1001f
-
-               add     \base, \base, #INTSR2 - INTSR1
-               ldr     \stat, [\base, #INTSR1]
-               ldr     \mask, [\base, #INTMR1]
-               mov     \irqnr, #16
-               mov     \mask, \mask, lsl #16
-               and     \stat, \stat, \mask, lsr #16
-
-1001:          tst     \stat, #255
-               addeq   \irqnr, \irqnr, #8
-               moveq   \stat, \stat, lsr #8
-               tst     \stat, #15
-               addeq   \irqnr, \irqnr, #4
-               moveq   \stat, \stat, lsr #4
-               tst     \stat, #3
-               addeq   \irqnr, \irqnr, #2
-               moveq   \stat, \stat, lsr #2
-               tst     \stat, #1
-               addeq   \irqnr, \irqnr, #1
-               moveq   \stat, \stat, lsr #1
-               tst     \stat, #1                       @ bit 0 should be set
-               .endm
-
-
index fbe75527d60b7193ca143c1a7be04dc8b6ce6c61..a58a0585e3e72a352628c1c959bba18d7efb1008 100644 (file)
@@ -142,5 +142,6 @@ MACHINE_START(P720T, "ARM-Prospector720T")
        .timer          = &clps711x_timer,
        .init_machine   = p720t_init,
        .init_late      = p720t_init_late,
+       .handle_irq     = clps711x_handle_irq,
        .restart        = clps711x_restart,
 MACHINE_END