common.c 1.5 KB

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