common.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Routines common to most mpc85xx-based boards.
  4. */
  5. #include <linux/of.h>
  6. #include <linux/of_irq.h>
  7. #include <linux/of_platform.h>
  8. #include <asm/fsl_pm.h>
  9. #include <soc/fsl/qe/qe.h>
  10. #include <sysdev/cpm2_pic.h>
  11. #include "mpc85xx.h"
  12. const struct fsl_pm_ops *qoriq_pm_ops;
  13. static const struct of_device_id mpc85xx_common_ids[] __initconst = {
  14. { .type = "soc", },
  15. { .compatible = "soc", },
  16. { .compatible = "simple-bus", },
  17. { .name = "cpm", },
  18. { .name = "localbus", },
  19. { .compatible = "gianfar", },
  20. { .compatible = "fsl,qe", },
  21. { .compatible = "fsl,cpm2", },
  22. { .compatible = "fsl,srio", },
  23. /* So that the DMA channel nodes can be probed individually: */
  24. { .compatible = "fsl,eloplus-dma", },
  25. /* For the PMC driver */
  26. { .compatible = "fsl,mpc8548-guts", },
  27. /* Probably unnecessary? */
  28. { .compatible = "gpio-leds", },
  29. /* For all PCI controllers */
  30. { .compatible = "fsl,mpc8540-pci", },
  31. { .compatible = "fsl,mpc8548-pcie", },
  32. { .compatible = "fsl,p1022-pcie", },
  33. { .compatible = "fsl,p1010-pcie", },
  34. { .compatible = "fsl,p1023-pcie", },
  35. { .compatible = "fsl,p4080-pcie", },
  36. { .compatible = "fsl,qoriq-pcie-v2.4", },
  37. { .compatible = "fsl,qoriq-pcie-v2.3", },
  38. { .compatible = "fsl,qoriq-pcie-v2.2", },
  39. { .compatible = "fsl,fman", },
  40. {},
  41. };
  42. int __init mpc85xx_common_publish_devices(void)
  43. {
  44. return of_platform_bus_probe(NULL, mpc85xx_common_ids, NULL);
  45. }
  46. #ifdef CONFIG_CPM2
  47. static void cpm2_cascade(struct irq_desc *desc)
  48. {
  49. struct irq_chip *chip = irq_desc_get_chip(desc);
  50. int cascade_irq;
  51. while ((cascade_irq = cpm2_get_irq()) >= 0)
  52. generic_handle_irq(cascade_irq);
  53. chip->irq_eoi(&desc->irq_data);
  54. }
  55. void __init mpc85xx_cpm2_pic_init(void)
  56. {
  57. struct device_node *np;
  58. int irq;
  59. /* Setup CPM2 PIC */
  60. np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic");
  61. if (np == NULL) {
  62. printk(KERN_ERR "PIC init: can not find fsl,cpm2-pic node\n");
  63. return;
  64. }
  65. irq = irq_of_parse_and_map(np, 0);
  66. if (!irq) {
  67. of_node_put(np);
  68. printk(KERN_ERR "PIC init: got no IRQ for cpm cascade\n");
  69. return;
  70. }
  71. cpm2_pic_init(np);
  72. of_node_put(np);
  73. irq_set_chained_handler(irq, cpm2_cascade);
  74. }
  75. #endif
  76. #ifdef CONFIG_QUICC_ENGINE
  77. void __init mpc85xx_qe_par_io_init(void)
  78. {
  79. struct device_node *np;
  80. np = of_find_node_by_name(NULL, "par_io");
  81. if (np) {
  82. struct device_node *ucc;
  83. par_io_init(np);
  84. of_node_put(np);
  85. for_each_node_by_name(ucc, "ucc")
  86. par_io_of_config(ucc);
  87. }
  88. }
  89. #endif