15 #include <linux/module.h>
24 #include <mach/irqs.h>
26 #ifdef CONFIG_CPU_MMP2
29 #ifdef CONFIG_CPU_PXA910
59 static int max_icu_nr;
63 static void icu_mask_ack_irq(
struct irq_data *
d)
71 if (data == &icu_data[0]) {
77 #ifdef CONFIG_CPU_MMP2
87 static void icu_mask_irq(
struct irq_data *d)
95 if (data == &icu_data[0]) {
106 static void icu_unmask_irq(
struct irq_data *d)
114 if (data == &icu_data[0]) {
125 static struct irq_chip icu_irq_chip = {
127 .irq_mask = icu_mask_irq,
128 .irq_mask_ack = icu_mask_ack_irq,
129 .irq_unmask = icu_unmask_irq,
132 static void icu_mux_irq_demux(
unsigned int irq,
struct irq_desc *
desc)
139 for (i = 1; i < max_icu_nr; i++) {
141 domain = icu_data[
i].domain;
146 if (i >= max_icu_nr) {
147 pr_err(
"Spurious irq %d in MMP INTC\n", irq);
162 static int mmp_irq_domain_map(
struct irq_domain *d,
unsigned int irq,
171 const u32 *intspec,
unsigned int intsize,
172 unsigned long *out_hwirq,
173 unsigned int *out_type)
175 *out_hwirq = intspec[0];
180 .map = mmp_irq_domain_map,
181 .xlate = mmp_irq_domain_xlate,
205 icu_data[0].conf_mask = mmp_conf.
conf_mask;
206 icu_data[0].nr_irqs = 64;
207 icu_data[0].virq_base = 0;
211 for (irq = 0; irq < 64; irq++) {
217 #ifdef CONFIG_CPU_PXA910
231 icu_data[0].conf_mask = mmp2_conf.
conf_mask;
232 icu_data[0].nr_irqs = 64;
233 icu_data[0].virq_base = 0;
241 icu_data[1].nr_irqs = 2;
242 icu_data[1].cascade_irq = 4;
245 icu_data[1].virq_base, 0,
250 icu_data[2].nr_irqs = 2;
251 icu_data[2].cascade_irq = 5;
254 icu_data[2].virq_base, 0,
259 icu_data[3].nr_irqs = 3;
260 icu_data[3].cascade_irq = 9;
263 icu_data[3].virq_base, 0,
268 icu_data[4].nr_irqs = 5;
269 icu_data[4].cascade_irq = 17;
272 icu_data[4].virq_base, 0,
277 icu_data[5].nr_irqs = 15;
278 icu_data[5].cascade_irq = 35;
281 icu_data[5].virq_base, 0,
286 icu_data[6].nr_irqs = 2;
287 icu_data[6].cascade_irq = 51;
290 icu_data[6].virq_base, 0,
295 icu_data[7].nr_irqs = 2;
296 icu_data[7].cascade_irq = 55;
299 icu_data[7].virq_base, 0,
313 irq_set_chained_handler(irq, icu_mux_irq_demux);
316 irq_set_chip_and_handler(irq, &icu_irq_chip,
323 #ifdef CONFIG_CPU_MMP2
330 { .compatible =
"mrvl,mmp-intc", .data = &mmp_conf },
331 { .compatible =
"mrvl,mmp2-intc", .data = &mmp2_conf },
335 static const struct of_device_id mmp_mux_irq_match[] __initconst = {
345 int i, irq_base,
ret, irq;
355 ret = of_property_read_u32(node,
"mrvl,intc-nr-irqs",
358 pr_err(
"Not found mrvl,intc-nr-irqs property\n");
364 pr_err(
"Not found reg property\n");
371 pr_err(
"Not found reg property\n");
382 irq_base = irq_alloc_descs(-1, 0, nr_irqs, 0);
384 pr_err(
"Failed to allocate IRQ numbers for mux intc\n");
388 if (!of_property_read_u32(node,
"mrvl,clr-mfp-irq",
390 icu_data[
i].clr_mfp_irq_base = irq_base;
391 icu_data[
i].clr_mfp_hwirq = mfp_irq;
393 irq_set_chained_handler(icu_data[i].cascade_irq,
396 icu_data[
i].virq_base = irq_base;
401 for (irq = irq_base; irq < irq_base +
nr_irqs; irq++)
421 pr_err(
"Failed to find interrupt controller in arch-mmp\n");
427 ret = of_property_read_u32(node,
"mrvl,intc-nr-irqs", &nr_irqs);
429 pr_err(
"Not found mrvl,intc-nr-irqs property\n");
435 pr_err(
"Failed to get interrupt controller register\n");
441 pr_err(
"Failed to allocate IRQ numbers\n");
444 pr_err(
"ICU's irqbase should be started from 0\n");
451 icu_data[0].virq_base = 0;
456 for (irq = 0; irq <
nr_irqs; irq++)