19 #include <linux/kernel.h>
22 #include <linux/module.h>
27 #include <mach/irqs.h>
62 static struct intc_vect intcs_vectors[] = {
122 { 0xffd20184, 0xffd201c4, 8,
125 { 0xffd20188, 0xffd201c8, 8,
128 { 0xffd2018c, 0xffd201cc, 8,
131 { 0xffd20190, 0xffd201d0, 8,
134 { 0xffd20194, 0xffd201d4, 8,
137 { 0xffd20198, 0xffd201d8, 8,
140 { 0xffd2019c, 0xffd201dc, 8,
143 { 0xffd201a0, 0xffd201e0, 8,
146 { 0xffd201a4, 0xffd201e4, 8,
149 { 0xffd201ac, 0xffd201ec, 8,
152 { 0xffd201b0, 0xffd201f0, 8,
155 { 0xffd50180, 0xffd501c0, 8,
158 { 0xffd50190, 0xffd501d0, 8,
161 { 0xffd50194, 0xffd501d4, 8,
164 { 0xffd50198, 0xffd501d8, 8,
167 { 0xffd5019c, 0xffd501dc, 8,
170 { 0xffd501a0, 0xffd501e0, 8,
173 { 0xffd501a4, 0xffd501e4, 8,
176 { 0xffd501a8, 0xffd501e8, 8,
179 { 0xffd60180, 0xffd601c0, 8,
188 { 0xffd20008, 0, 16, 4, {
BBIF2, 0, 0, 0 } },
196 { 0xffd2001c, 0, 16, 4, {
VINT, 0, 0, 0 } },
197 { 0xffd20020, 0, 16, 4, { 0,
MSIOF,
TSIF0, 0 } },
199 { 0xffd20028, 0, 16, 4, { 0,
ASA,
LMB,
PEP } },
200 { 0xffd20030, 0, 16, 4, { 0, 0, 0,
RWDT0 } },
201 { 0xffd50000, 0, 16, 4, {
RTDMAC_2, 0, 0, 0 } },
202 { 0xffd50004, 0, 16, 4, {
RTDMAC_3, 0, 0, 0 } },
203 { 0xffd50020, 0, 16, 4, {
FRC, 0, 0, 0 } },
205 { 0xffd50028, 0, 16, 4, {
SPU2, 0,
FSI, 0 } },
206 { 0xffd50030, 0, 16, 4, {
TMU1, 0, 0,
TSIF2 } },
207 { 0xffd50034, 0, 16, 4, {
CMT4, 0, 0, 0 } },
217 { 0xffd60000, 0, 16, 4, {
SPUV, 0, 0, 0 } },
220 static struct resource intcs_resources[] __initdata = {
238 static struct intc_desc intcs_desc __initdata = {
239 .
name =
"sh73a0-intcs",
240 .resource = intcs_resources,
242 .hw =
INTC_HW_DESC(intcs_vectors, intcs_groups, intcs_mask_registers,
246 static struct irqaction sh73a0_intcs_cascade;
257 static int sh73a0_set_wake(
struct irq_data *
data,
unsigned int on)
262 #define RELOC_BASE 0x1200
265 #define INTCS_VECT_RELOC(n, vect) INTCS_VECT((n), (vect) + RELOC_BASE)
279 return gic_spi((vect >> 5) + 1);
282 static int to_intca_reloc_irq(
struct irq_data *data)
287 #define irq_cb(cb, irq) irq_get_chip(irq)->cb(irq_get_irq_data(irq))
288 #define irq_cbp(cb, irq, p...) irq_get_chip(irq)->cb(irq_get_irq_data(irq), p)
290 static void intca_gic_enable(
struct irq_data *data)
292 irq_cb(irq_unmask, to_intca_reloc_irq(data));
293 irq_cb(irq_unmask, to_gic_irq(data));
296 static void intca_gic_disable(
struct irq_data *data)
298 irq_cb(irq_mask, to_gic_irq(data));
299 irq_cb(irq_mask, to_intca_reloc_irq(data));
302 static void intca_gic_mask_ack(
struct irq_data *data)
304 irq_cb(irq_mask, to_gic_irq(data));
305 irq_cb(irq_mask_ack, to_intca_reloc_irq(data));
308 static void intca_gic_eoi(
struct irq_data *data)
310 irq_cb(irq_eoi, to_gic_irq(data));
313 static int intca_gic_set_type(
struct irq_data *data,
unsigned int type)
315 return irq_cbp(irq_set_type, to_intca_reloc_irq(data), type);
318 static int intca_gic_set_wake(
struct irq_data *data,
unsigned int on)
320 return irq_cbp(irq_set_wake, to_intca_reloc_irq(data), on);
324 static int intca_gic_set_affinity(
struct irq_data *data,
328 return irq_cbp(irq_set_affinity, to_gic_irq(data), cpumask, force);
334 .irq_mask = intca_gic_disable,
335 .irq_unmask = intca_gic_enable,
336 .irq_mask_ack = intca_gic_mask_ack,
337 .irq_eoi = intca_gic_eoi,
338 .irq_enable = intca_gic_enable,
339 .irq_disable = intca_gic_disable,
340 .irq_shutdown = intca_gic_disable,
341 .irq_set_type = intca_gic_set_type,
342 .irq_set_wake = intca_gic_set_wake,
344 .irq_set_affinity = intca_gic_set_affinity,
348 static int to_intc_vect(
int irq)
350 unsigned int irq_pin = irq -
gic_spi(1);
358 return offs + (irq_pin << 5);
361 static irqreturn_t sh73a0_irq_pin_demux(
int irq,
void *dev_id)
367 static struct irqaction sh73a0_irq_pin_cascade[32];
369 #define PINTER0_PHYS 0xe69000a0
370 #define PINTER1_PHYS 0xe69000a4
371 #define PINTER0_VIRT IOMEM(0xe69000a0)
372 #define PINTER1_VIRT IOMEM(0xe69000a4)
373 #define PINTRR0 IOMEM(0xe69000d0)
374 #define PINTRR1 IOMEM(0xe69000d4)
376 #define PINT0A_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT0_IRQ(irq))
377 #define PINT0B_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT0_IRQ(irq + 8))
378 #define PINT0C_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT0_IRQ(irq + 16))
379 #define PINT0D_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT0_IRQ(irq + 24))
380 #define PINT1E_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT1_IRQ(irq))
396 static struct irqaction sh73a0_pint0_cascade;
397 static struct irqaction sh73a0_pint1_cascade;
399 static void pint_demux(
void __iomem *rr,
void __iomem *er,
int base_irq)
404 for (k = 0; k < 32; k++) {
405 if (value & (1 << (31 - k))) {
412 static irqreturn_t sh73a0_pint0_demux(
int irq,
void *dev_id)
418 static irqreturn_t sh73a0_pint1_demux(
int irq,
void *dev_id)
431 gic_init(0, 29, gic_dist_base, gic_cpu_base);
440 sh73a0_intcs_cascade.name =
"INTCS cascade";
441 sh73a0_intcs_cascade.handler = sh73a0_intcs_demux;
442 sh73a0_intcs_cascade.dev_id = intevtsa;
446 for (k = 0; k < 32; k++) {
447 sh73a0_irq_pin_cascade[
k].name =
"INTCA-GIC cascade";
448 sh73a0_irq_pin_cascade[
k].handler = sh73a0_irq_pin_demux;
459 sh73a0_pint0_cascade.name =
"PINT0 cascade";
460 sh73a0_pint0_cascade.handler = sh73a0_pint0_demux;
463 sh73a0_pint1_cascade.name =
"PINT1 cascade";
464 sh73a0_pint1_cascade.handler = sh73a0_pint1_demux;