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 static struct of_device_id __initdata mpc85xx_common_ids[] = { 15 { .type = "soc", }, 16 { .compatible = "soc", }, 17 { .compatible = "simple-bus", }, 18 { .name = "cpm", }, 19 { .name = "localbus", }, 20 { .compatible = "gianfar", }, 21 { .compatible = "fsl,qe", }, 22 { .compatible = "fsl,cpm2", }, 23 { .compatible = "fsl,srio", }, 24 /* So that the DMA channel nodes can be probed individually: */ 25 { .compatible = "fsl,eloplus-dma", }, 26 /* For the PMC driver */ 27 { .compatible = "fsl,mpc8548-guts", }, 28 /* Probably unnecessary? */ 29 { .compatible = "gpio-leds", }, 30 /* For all PCI controllers */ 31 { .compatible = "fsl,mpc8540-pci", }, 32 { .compatible = "fsl,mpc8548-pcie", }, 33 { .compatible = "fsl,p1022-pcie", }, 34 { .compatible = "fsl,p1010-pcie", }, 35 { .compatible = "fsl,p1023-pcie", }, 36 { .compatible = "fsl,p4080-pcie", }, 37 { .compatible = "fsl,qoriq-pcie-v2.4", }, 38 { .compatible = "fsl,qoriq-pcie-v2.3", }, 39 { .compatible = "fsl,qoriq-pcie-v2.2", }, 40 {}, 41 }; 42 43 int __init mpc85xx_common_publish_devices(void) 44 { 45 return of_platform_bus_probe(NULL, mpc85xx_common_ids, NULL); 46 } 47 #ifdef CONFIG_CPM2 48 static void cpm2_cascade(unsigned int irq, struct irq_desc *desc) 49 { 50 struct irq_chip *chip = irq_desc_get_chip(desc); 51 int cascade_irq; 52 53 while ((cascade_irq = cpm2_get_irq()) >= 0) 54 generic_handle_irq(cascade_irq); 55 56 chip->irq_eoi(&desc->irq_data); 57 } 58 59 60 void __init mpc85xx_cpm2_pic_init(void) 61 { 62 struct device_node *np; 63 int irq; 64 65 /* Setup CPM2 PIC */ 66 np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic"); 67 if (np == NULL) { 68 printk(KERN_ERR "PIC init: can not find fsl,cpm2-pic node\n"); 69 return; 70 } 71 irq = irq_of_parse_and_map(np, 0); 72 if (irq == NO_IRQ) { 73 of_node_put(np); 74 printk(KERN_ERR "PIC init: got no IRQ for cpm cascade\n"); 75 return; 76 } 77 78 cpm2_pic_init(np); 79 of_node_put(np); 80 irq_set_chained_handler(irq, cpm2_cascade); 81 } 82 #endif 83