blob: eba78c85303f9f6ee27eb8d1d0c2f4221e056d65 [file] [log] [blame]
Dmitry Eremin-Solenikov543a07b2011-11-17 21:56:16 +04001/*
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 */
Rob Herring26a20562013-09-26 07:40:04 -05008
9#include <linux/of_irq.h>
Dmitry Eremin-Solenikov543a07b2011-11-17 21:56:16 +040010#include <linux/of_platform.h>
11
12#include <sysdev/cpm2_pic.h>
13
14#include "mpc85xx.h"
15
Dmitry Eremin-Solenikov46d026a2011-11-17 21:56:17 +040016static struct of_device_id __initdata mpc85xx_common_ids[] = {
17 { .type = "soc", },
18 { .compatible = "soc", },
19 { .compatible = "simple-bus", },
20 { .name = "cpm", },
21 { .name = "localbus", },
22 { .compatible = "gianfar", },
23 { .compatible = "fsl,qe", },
24 { .compatible = "fsl,cpm2", },
Kumar Gala199bfbe2011-11-24 01:00:10 -060025 { .compatible = "fsl,srio", },
Timur Tabi8a95bc82011-11-30 10:19:17 -060026 /* So that the DMA channel nodes can be probed individually: */
27 { .compatible = "fsl,eloplus-dma", },
28 /* For the PMC driver */
29 { .compatible = "fsl,mpc8548-guts", },
30 /* Probably unnecessary? */
31 { .compatible = "gpio-leds", },
Jia Hongtao905e75c2012-08-28 15:44:08 +080032 /* For all PCI controllers */
33 { .compatible = "fsl,mpc8540-pci", },
34 { .compatible = "fsl,mpc8548-pcie", },
35 { .compatible = "fsl,p1022-pcie", },
36 { .compatible = "fsl,p1010-pcie", },
37 { .compatible = "fsl,p1023-pcie", },
38 { .compatible = "fsl,p4080-pcie", },
39 { .compatible = "fsl,qoriq-pcie-v2.4", },
40 { .compatible = "fsl,qoriq-pcie-v2.3", },
41 { .compatible = "fsl,qoriq-pcie-v2.2", },
Dmitry Eremin-Solenikov46d026a2011-11-17 21:56:17 +040042 {},
43};
44
45int __init mpc85xx_common_publish_devices(void)
46{
47 return of_platform_bus_probe(NULL, mpc85xx_common_ids, NULL);
48}
Dmitry Eremin-Solenikov543a07b2011-11-17 21:56:16 +040049#ifdef CONFIG_CPM2
50static void cpm2_cascade(unsigned int irq, struct irq_desc *desc)
51{
52 struct irq_chip *chip = irq_desc_get_chip(desc);
53 int cascade_irq;
54
55 while ((cascade_irq = cpm2_get_irq()) >= 0)
56 generic_handle_irq(cascade_irq);
57
58 chip->irq_eoi(&desc->irq_data);
59}
60
61
62void __init mpc85xx_cpm2_pic_init(void)
63{
64 struct device_node *np;
65 int irq;
66
67 /* Setup CPM2 PIC */
68 np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic");
69 if (np == NULL) {
70 printk(KERN_ERR "PIC init: can not find fsl,cpm2-pic node\n");
71 return;
72 }
73 irq = irq_of_parse_and_map(np, 0);
74 if (irq == NO_IRQ) {
75 of_node_put(np);
76 printk(KERN_ERR "PIC init: got no IRQ for cpm cascade\n");
77 return;
78 }
79
80 cpm2_pic_init(np);
81 of_node_put(np);
82 irq_set_chained_handler(irq, cpm2_cascade);
83}
84#endif