7 #include <linux/module.h>
11 #include <asm/exception.h>
15 #define IRQ_STATUS 0x00
16 #define IRQ_RAW_STATUS 0x04
17 #define IRQ_ENABLE_SET 0x08
18 #define IRQ_ENABLE_CLEAR 0x0c
19 #define INT_SOFT_SET 0x10
20 #define INT_SOFT_CLEAR 0x14
21 #define FIQ_STATUS 0x20
22 #define FIQ_RAW_STATUS 0x24
23 #define FIQ_ENABLE 0x28
24 #define FIQ_ENABLE_SET 0x28
25 #define FIQ_ENABLE_CLEAR 0x2C
44 static struct fpga_irq_data fpga_irq_devices[CONFIG_PLAT_VERSATILE_FPGA_IRQ_NR];
45 static int fpga_irq_id;
47 static void fpga_irq_mask(
struct irq_data *
d)
55 static void fpga_irq_unmask(
struct irq_data *
d)
63 static void fpga_irq_handle(
unsigned int irq,
struct irq_desc *
desc)
74 irq =
ffs(status) - 1;
75 status &= ~(1 << irq);
92 irq =
ffs(status) - 1;
109 for (i = 0, handled = 0; i < fpga_irq_id; ++
i)
110 handled |= handle_one_fpga(&fpga_irq_devices[i], regs);
114 static int fpga_irqdomain_map(
struct irq_domain *
d,
unsigned int irq,
120 if (!(f->
valid & (1 << hwirq)))
123 irq_set_chip_and_handler(irq, &f->
chip,
131 .map = fpga_irqdomain_map,
139 if (fpga_irq_id >=
ARRAY_SIZE(fpga_irq_devices)) {
140 printk(
KERN_ERR "%s: too few FPGA IRQ controllers, increase CONFIG_PLAT_VERSATILE_FPGA_IRQ_NR\n", __func__);
143 f = &fpga_irq_devices[fpga_irq_id];
146 f->
chip.irq_ack = fpga_irq_mask;
147 f->
chip.irq_mask = fpga_irq_mask;
148 f->
chip.irq_unmask = fpga_irq_unmask;
160 f = fpga_irq_prep_struct(base, name, valid);
164 if (parent_irq != -1) {
166 irq_set_chained_handler(parent_irq, fpga_irq_handle);
170 &fpga_irqdomain_ops, f);
171 pr_info(
"FPGA IRQ chip %d \"%s\" @ %p, %u irqs\n",
188 WARN(!base,
"unable to map fpga irq registers\n");
190 if (of_property_read_u32(node,
"clear-mask", &clear_mask))
193 if (of_property_read_u32(node,
"valid-mask", &valid_mask))
196 f = fpga_irq_prep_struct(base, node->
name, valid_mask);
206 pr_info(
"FPGA IRQ chip %d \"%s\" @ %p, %u irqs\n",