]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ARM: footbridge: use GENERIC_IRQ_MULTI_HANDLER
authorArnd Bergmann <arnd@arndb.de>
Mon, 29 Nov 2021 13:43:14 +0000 (14:43 +0100)
committerArd Biesheuvel <ardb@kernel.org>
Mon, 6 Dec 2021 11:48:47 +0000 (12:48 +0100)
Footbridge still uses the classic IRQ entry path in assembler,
but this is easily converted into an equivalent C version.

In this case, the correlation between IRQ numbers and bits in
the status register is non-obvious, and the priorities are
handled by manually checking each bit in a static order,
re-reading the status register after each handled event.

I moved the code into the new file and edited the syntax without
changing this sequence to keep the behavior as close as possible
to what it traditionally did.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Tested-by: Marc Zyngier <maz@kernel.org>
Tested-by: Vladimir Murzin <vladimir.murzin@arm.com> # ARMv7M
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
arch/arm/Kconfig
arch/arm/mach-footbridge/common.c
arch/arm/mach-footbridge/include/mach/entry-macro.S [deleted file]

index 25f1868e5703566bfc1ad3e7d545422223db5ef2..a0cc9ca66ae0cdacf8562cdff416fc5867f839d7 100644 (file)
@@ -362,6 +362,7 @@ config ARCH_FOOTBRIDGE
        select FOOTBRIDGE
        select NEED_MACH_IO_H if !MMU
        select NEED_MACH_MEMORY_H
+       select GENERIC_IRQ_MULTI_HANDLER
        help
          Support for systems based on the DC21285 companion chip
          ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder.
index eee095f0e2f6c2726e13692cd326e424a7812747..322495df271d548fd2e7476e117a5d9383e90cb0 100644 (file)
 
 #include "common.h"
 
+#include <mach/hardware.h>
+#include <mach/irqs.h>
+#include <asm/hardware/dec21285.h>
+
+static int dc21285_get_irq(void)
+{
+       void __iomem *irqstatus = (void __iomem *)CSR_IRQ_STATUS;
+       u32 mask = readl(irqstatus);
+
+       if (mask & IRQ_MASK_SDRAMPARITY)
+               return IRQ_SDRAMPARITY;
+
+       if (mask & IRQ_MASK_UART_RX)
+               return IRQ_CONRX;
+
+       if (mask & IRQ_MASK_DMA1)
+               return IRQ_DMA1;
+
+       if (mask & IRQ_MASK_DMA2)
+               return IRQ_DMA2;
+
+       if (mask & IRQ_MASK_IN0)
+               return IRQ_IN0;
+
+       if (mask & IRQ_MASK_IN1)
+               return IRQ_IN1;
+
+       if (mask & IRQ_MASK_IN2)
+               return IRQ_IN2;
+
+       if (mask & IRQ_MASK_IN3)
+               return IRQ_IN3;
+
+       if (mask & IRQ_MASK_PCI)
+               return IRQ_PCI;
+
+       if (mask & IRQ_MASK_DOORBELLHOST)
+               return IRQ_DOORBELLHOST;
+
+       if (mask & IRQ_MASK_I2OINPOST)
+               return IRQ_I2OINPOST;
+
+       if (mask & IRQ_MASK_TIMER1)
+               return IRQ_TIMER1;
+
+       if (mask & IRQ_MASK_TIMER2)
+               return IRQ_TIMER2;
+
+       if (mask & IRQ_MASK_TIMER3)
+               return IRQ_TIMER3;
+
+       if (mask & IRQ_MASK_UART_TX)
+               return IRQ_CONTX;
+
+       if (mask & IRQ_MASK_PCI_ABORT)
+               return IRQ_PCI_ABORT;
+
+       if (mask & IRQ_MASK_PCI_SERR)
+               return IRQ_PCI_SERR;
+
+       if (mask & IRQ_MASK_DISCARD_TIMER)
+               return IRQ_DISCARD_TIMER;
+
+       if (mask & IRQ_MASK_PCI_DPERR)
+               return IRQ_PCI_DPERR;
+
+       if (mask & IRQ_MASK_PCI_PERR)
+               return IRQ_PCI_PERR;
+
+       return 0;
+}
+
+static void dc21285_handle_irq(struct pt_regs *regs)
+{
+       int irq;
+       do {
+               irq = dc21285_get_irq();
+               if (!irq)
+                       break;
+
+               generic_handle_irq(irq);
+       } while (1);
+}
+
+
 unsigned int mem_fclk_21285 = 50000000;
 
 EXPORT_SYMBOL(mem_fclk_21285);
@@ -108,6 +193,8 @@ static void __init __fb_init_irq(void)
 
 void __init footbridge_init_irq(void)
 {
+       set_handle_irq(dc21285_handle_irq);
+
        __fb_init_irq();
 
        if (!footbridge_cfn_mode())
diff --git a/arch/arm/mach-footbridge/include/mach/entry-macro.S b/arch/arm/mach-footbridge/include/mach/entry-macro.S
deleted file mode 100644 (file)
index dabbd5c..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * arch/arm/mach-footbridge/include/mach/entry-macro.S
- *
- * Low-level IRQ helper macros for footbridge-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>
-#include <mach/irqs.h>
-#include <asm/hardware/dec21285.h>
-
-               .equ    dc21285_high, ARMCSR_BASE & 0xff000000
-               .equ    dc21285_low, ARMCSR_BASE & 0x00ffffff
-
-               .macro  get_irqnr_preamble, base, tmp
-               mov     \base, #dc21285_high
-               .if     dc21285_low
-               orr     \base, \base, #dc21285_low
-               .endif
-               .endm
-
-               .macro  get_irqnr_and_base, irqnr, irqstat, base, tmp
-               ldr     \irqstat, [\base, #0x180]       @ get interrupts
-
-               mov     \irqnr, #IRQ_SDRAMPARITY
-               tst     \irqstat, #IRQ_MASK_SDRAMPARITY
-               bne     1001f
-
-               tst     \irqstat, #IRQ_MASK_UART_RX
-               movne   \irqnr, #IRQ_CONRX
-               bne     1001f
-
-               tst     \irqstat, #IRQ_MASK_DMA1
-               movne   \irqnr, #IRQ_DMA1
-               bne     1001f
-
-               tst     \irqstat, #IRQ_MASK_DMA2
-               movne   \irqnr, #IRQ_DMA2
-               bne     1001f
-
-               tst     \irqstat, #IRQ_MASK_IN0
-               movne   \irqnr, #IRQ_IN0
-               bne     1001f
-
-               tst     \irqstat, #IRQ_MASK_IN1
-               movne   \irqnr, #IRQ_IN1
-               bne     1001f
-
-               tst     \irqstat, #IRQ_MASK_IN2
-               movne   \irqnr, #IRQ_IN2
-               bne     1001f
-
-               tst     \irqstat, #IRQ_MASK_IN3
-               movne   \irqnr, #IRQ_IN3
-               bne     1001f
-
-               tst     \irqstat, #IRQ_MASK_PCI
-               movne   \irqnr, #IRQ_PCI
-               bne     1001f
-
-               tst     \irqstat, #IRQ_MASK_DOORBELLHOST
-               movne   \irqnr, #IRQ_DOORBELLHOST
-               bne     1001f
-
-               tst     \irqstat, #IRQ_MASK_I2OINPOST
-               movne   \irqnr, #IRQ_I2OINPOST
-               bne     1001f
-
-               tst     \irqstat, #IRQ_MASK_TIMER1
-               movne   \irqnr, #IRQ_TIMER1
-               bne     1001f
-
-               tst     \irqstat, #IRQ_MASK_TIMER2
-               movne   \irqnr, #IRQ_TIMER2
-               bne     1001f
-
-               tst     \irqstat, #IRQ_MASK_TIMER3
-               movne   \irqnr, #IRQ_TIMER3
-               bne     1001f
-
-               tst     \irqstat, #IRQ_MASK_UART_TX
-               movne   \irqnr, #IRQ_CONTX
-               bne     1001f
-
-               tst     \irqstat, #IRQ_MASK_PCI_ABORT
-               movne   \irqnr, #IRQ_PCI_ABORT
-               bne     1001f
-
-               tst     \irqstat, #IRQ_MASK_PCI_SERR
-               movne   \irqnr, #IRQ_PCI_SERR
-               bne     1001f
-
-               tst     \irqstat, #IRQ_MASK_DISCARD_TIMER
-               movne   \irqnr, #IRQ_DISCARD_TIMER
-               bne     1001f
-
-               tst     \irqstat, #IRQ_MASK_PCI_DPERR
-               movne   \irqnr, #IRQ_PCI_DPERR
-               bne     1001f
-
-               tst     \irqstat, #IRQ_MASK_PCI_PERR
-               movne   \irqnr, #IRQ_PCI_PERR
-1001:
-               .endm
-