common.c 2.1 KB

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