Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * arch/arm/mach-dove/irq.c
0004  *
0005  * Dove IRQ handling.
0006  */
0007 #include <linux/init.h>
0008 #include <linux/irq.h>
0009 #include <linux/io.h>
0010 #include <asm/exception.h>
0011 
0012 #include <plat/irq.h>
0013 #include <plat/orion-gpio.h>
0014 
0015 #include "pm.h"
0016 #include "bridge-regs.h"
0017 #include "common.h"
0018 
0019 static int __initdata gpio0_irqs[4] = {
0020     IRQ_DOVE_GPIO_0_7,
0021     IRQ_DOVE_GPIO_8_15,
0022     IRQ_DOVE_GPIO_16_23,
0023     IRQ_DOVE_GPIO_24_31,
0024 };
0025 
0026 static int __initdata gpio1_irqs[4] = {
0027     IRQ_DOVE_HIGH_GPIO,
0028     0,
0029     0,
0030     0,
0031 };
0032 
0033 static int __initdata gpio2_irqs[4] = {
0034     0,
0035     0,
0036     0,
0037     0,
0038 };
0039 
0040 static void __iomem *dove_irq_base = IRQ_VIRT_BASE;
0041 
0042 static asmlinkage void
0043 __exception_irq_entry dove_legacy_handle_irq(struct pt_regs *regs)
0044 {
0045     u32 stat;
0046 
0047     stat = readl_relaxed(dove_irq_base + IRQ_CAUSE_LOW_OFF);
0048     stat &= readl_relaxed(dove_irq_base + IRQ_MASK_LOW_OFF);
0049     if (stat) {
0050         unsigned int hwirq = 1 + __fls(stat);
0051         handle_IRQ(hwirq, regs);
0052         return;
0053     }
0054     stat = readl_relaxed(dove_irq_base + IRQ_CAUSE_HIGH_OFF);
0055     stat &= readl_relaxed(dove_irq_base + IRQ_MASK_HIGH_OFF);
0056     if (stat) {
0057         unsigned int hwirq = 33 + __fls(stat);
0058         handle_IRQ(hwirq, regs);
0059         return;
0060     }
0061 }
0062 
0063 void __init dove_init_irq(void)
0064 {
0065     orion_irq_init(1, IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF);
0066     orion_irq_init(33, IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF);
0067 
0068     set_handle_irq(dove_legacy_handle_irq);
0069 
0070     /*
0071      * Initialize gpiolib for GPIOs 0-71.
0072      */
0073     orion_gpio_init(0, 32, DOVE_GPIO_LO_VIRT_BASE, 0,
0074             IRQ_DOVE_GPIO_START, gpio0_irqs);
0075 
0076     orion_gpio_init(32, 32, DOVE_GPIO_HI_VIRT_BASE, 0,
0077             IRQ_DOVE_GPIO_START + 32, gpio1_irqs);
0078 
0079     orion_gpio_init(64, 8, DOVE_GPIO2_VIRT_BASE, 0,
0080             IRQ_DOVE_GPIO_START + 64, gpio2_irqs);
0081 }