aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/85xx/mpc85xx_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/85xx/mpc85xx_common.c')
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_common.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_common.c b/arch/powerpc/platforms/85xx/mpc85xx_common.c
new file mode 100644
index 00000000000..49d781c3696
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/mpc85xx_common.c
@@ -0,0 +1,49 @@
1/*
2 * Routines common to most mpc85xx-based boards.
3 *
4 * This is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#include <linux/of_platform.h>
9
10#include <sysdev/cpm2_pic.h>
11
12#include "mpc85xx.h"
13
14#ifdef CONFIG_CPM2
15static void cpm2_cascade(unsigned int irq, struct irq_desc *desc)
16{
17 struct irq_chip *chip = irq_desc_get_chip(desc);
18 int cascade_irq;
19
20 while ((cascade_irq = cpm2_get_irq()) >= 0)
21 generic_handle_irq(cascade_irq);
22
23 chip->irq_eoi(&desc->irq_data);
24}
25
26
27void __init mpc85xx_cpm2_pic_init(void)
28{
29 struct device_node *np;
30 int irq;
31
32 /* Setup CPM2 PIC */
33 np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic");
34 if (np == NULL) {
35 printk(KERN_ERR "PIC init: can not find fsl,cpm2-pic node\n");
36 return;
37 }
38 irq = irq_of_parse_and_map(np, 0);
39 if (irq == NO_IRQ) {
40 of_node_put(np);
41 printk(KERN_ERR "PIC init: got no IRQ for cpm cascade\n");
42 return;
43 }
44
45 cpm2_pic_init(np);
46 of_node_put(np);
47 irq_set_chained_handler(irq, cpm2_cascade);
48}
49#endif