aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-versatile
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2011-01-19 10:32:15 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-02-19 06:11:33 -0500
commitc41b16f8c9d9dc74ed5669d4a3e3d42374c9e609 (patch)
tree0e7ee2bef09e6c752cda71087795bd40f0f35177 /arch/arm/mach-versatile
parentdc37c31bbfaf87118d6c827be0a38a512a40b741 (diff)
ARM: integrator/versatile: consolidate FPGA IRQ handling code
Consolidate the FPGA IRQ handling code. Integrator/AP and Versatile have one FPGA-based IRQ handler each. Integrator/CP has three. Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-versatile')
-rw-r--r--arch/arm/mach-versatile/core.c57
-rw-r--r--arch/arm/mach-versatile/include/mach/hardware.h2
2 files changed, 7 insertions, 52 deletions
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 630a1c96f90b..eb7ffa0ee8b5 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -51,6 +51,7 @@
51#include <asm/hardware/timer-sp.h> 51#include <asm/hardware/timer-sp.h>
52 52
53#include <plat/clcd.h> 53#include <plat/clcd.h>
54#include <plat/fpga-irq.h>
54#include <plat/sched_clock.h> 55#include <plat/sched_clock.h>
55 56
56#include "core.h" 57#include "core.h"
@@ -64,47 +65,12 @@
64#define VA_VIC_BASE __io_address(VERSATILE_VIC_BASE) 65#define VA_VIC_BASE __io_address(VERSATILE_VIC_BASE)
65#define VA_SIC_BASE __io_address(VERSATILE_SIC_BASE) 66#define VA_SIC_BASE __io_address(VERSATILE_SIC_BASE)
66 67
67static void sic_mask_irq(struct irq_data *d) 68static struct fpga_irq_data sic_irq = {
68{ 69 .base = VA_SIC_BASE,
69 unsigned int irq = d->irq - IRQ_SIC_START; 70 .irq_start = IRQ_SIC_START,
70 71 .chip.name = "SIC",
71 writel(1 << irq, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR);
72}
73
74static void sic_unmask_irq(struct irq_data *d)
75{
76 unsigned int irq = d->irq - IRQ_SIC_START;
77
78 writel(1 << irq, VA_SIC_BASE + SIC_IRQ_ENABLE_SET);
79}
80
81static struct irq_chip sic_chip = {
82 .name = "SIC",
83 .irq_ack = sic_mask_irq,
84 .irq_mask = sic_mask_irq,
85 .irq_unmask = sic_unmask_irq,
86}; 72};
87 73
88static void
89sic_handle_irq(unsigned int irq, struct irq_desc *desc)
90{
91 unsigned long status = readl(VA_SIC_BASE + SIC_IRQ_STATUS);
92
93 if (status == 0) {
94 do_bad_IRQ(irq, desc);
95 return;
96 }
97
98 do {
99 irq = ffs(status) - 1;
100 status &= ~(1 << irq);
101
102 irq += IRQ_SIC_START;
103
104 generic_handle_irq(irq);
105 } while (status);
106}
107
108#if 1 74#if 1
109#define IRQ_MMCI0A IRQ_VICSOURCE22 75#define IRQ_MMCI0A IRQ_VICSOURCE22
110#define IRQ_AACI IRQ_VICSOURCE24 76#define IRQ_AACI IRQ_VICSOURCE24
@@ -119,22 +85,11 @@ sic_handle_irq(unsigned int irq, struct irq_desc *desc)
119 85
120void __init versatile_init_irq(void) 86void __init versatile_init_irq(void)
121{ 87{
122 unsigned int i;
123
124 vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0, 0); 88 vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0, 0);
125 89
126 set_irq_chained_handler(IRQ_VICSOURCE31, sic_handle_irq);
127
128 /* Do second interrupt controller */
129 writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR); 90 writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR);
130 91
131 for (i = IRQ_SIC_START; i <= IRQ_SIC_END; i++) { 92 fpga_irq_init(IRQ_VICSOURCE31, ~PIC_MASK, &sic_irq);
132 if ((PIC_MASK & (1 << (i - IRQ_SIC_START))) == 0) {
133 set_irq_chip(i, &sic_chip);
134 set_irq_handler(i, handle_level_irq);
135 set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
136 }
137 }
138 93
139 /* 94 /*
140 * Interrupts on secondary controller from 0 to 8 are routed to 95 * Interrupts on secondary controller from 0 to 8 are routed to
diff --git a/arch/arm/mach-versatile/include/mach/hardware.h b/arch/arm/mach-versatile/include/mach/hardware.h
index b5e75bb44965..6911e1f5f156 100644
--- a/arch/arm/mach-versatile/include/mach/hardware.h
+++ b/arch/arm/mach-versatile/include/mach/hardware.h
@@ -39,6 +39,6 @@
39/* macro to get at IO space when running virtually */ 39/* macro to get at IO space when running virtually */
40#define IO_ADDRESS(x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000) 40#define IO_ADDRESS(x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000)
41 41
42#define __io_address(n) __io(IO_ADDRESS(n)) 42#define __io_address(n) ((void __iomem __force *)IO_ADDRESS(n))
43 43
44#endif 44#endif