Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / arch / powerpc / platforms / 86xx / pic.c
blob52bbfa031531583da870458a2c41207459cd36a1
1 /*
2 * Copyright 2008 Freescale Semiconductor, Inc.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 */
10 #include <linux/stddef.h>
11 #include <linux/kernel.h>
12 #include <linux/interrupt.h>
13 #include <linux/of_platform.h>
15 #include <asm/system.h>
16 #include <asm/mpic.h>
17 #include <asm/i8259.h>
19 #ifdef CONFIG_PPC_I8259
20 static void mpc86xx_8259_cascade(unsigned int irq, struct irq_desc *desc)
22 struct irq_chip *chip = irq_desc_get_chip(desc);
23 unsigned int cascade_irq = i8259_irq();
25 if (cascade_irq != NO_IRQ)
26 generic_handle_irq(cascade_irq);
28 chip->irq_eoi(&desc->irq_data);
30 #endif /* CONFIG_PPC_I8259 */
32 void __init mpc86xx_init_irq(void)
34 #ifdef CONFIG_PPC_I8259
35 struct device_node *np;
36 struct device_node *cascade_node = NULL;
37 int cascade_irq;
38 #endif
40 struct mpic *mpic = mpic_alloc(NULL, 0,
41 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN |
42 MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
43 0, 256, " MPIC ");
44 BUG_ON(mpic == NULL);
46 mpic_init(mpic);
48 #ifdef CONFIG_PPC_I8259
49 /* Initialize i8259 controller */
50 for_each_node_by_type(np, "interrupt-controller")
51 if (of_device_is_compatible(np, "chrp,iic")) {
52 cascade_node = np;
53 break;
56 if (cascade_node == NULL) {
57 printk(KERN_DEBUG "Could not find i8259 PIC\n");
58 return;
61 cascade_irq = irq_of_parse_and_map(cascade_node, 0);
62 if (cascade_irq == NO_IRQ) {
63 printk(KERN_ERR "Failed to map cascade interrupt\n");
64 return;
67 i8259_init(cascade_node, 0);
68 of_node_put(cascade_node);
70 irq_set_chained_handler(cascade_irq, mpc86xx_8259_cascade);
71 #endif