common.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. {},
  28. };
  29. int __init mpc85xx_common_publish_devices(void)
  30. {
  31. return of_platform_bus_probe(NULL, mpc85xx_common_ids, NULL);
  32. }
  33. #ifdef CONFIG_CPM2
  34. static void cpm2_cascade(unsigned int irq, struct irq_desc *desc)
  35. {
  36. struct irq_chip *chip = irq_desc_get_chip(desc);
  37. int cascade_irq;
  38. while ((cascade_irq = cpm2_get_irq()) >= 0)
  39. generic_handle_irq(cascade_irq);
  40. chip->irq_eoi(&desc->irq_data);
  41. }
  42. void __init mpc85xx_cpm2_pic_init(void)
  43. {
  44. struct device_node *np;
  45. int irq;
  46. /* Setup CPM2 PIC */
  47. np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic");
  48. if (np == NULL) {
  49. printk(KERN_ERR "PIC init: can not find fsl,cpm2-pic node\n");
  50. return;
  51. }
  52. irq = irq_of_parse_and_map(np, 0);
  53. if (irq == NO_IRQ) {
  54. of_node_put(np);
  55. printk(KERN_ERR "PIC init: got no IRQ for cpm cascade\n");
  56. return;
  57. }
  58. cpm2_pic_init(np);
  59. of_node_put(np);
  60. irq_set_chained_handler(irq, cpm2_cascade);
  61. }
  62. #endif