common.c 2.1 KB

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