common.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Routines common to most mpc85xx-based boards.
  4. */
  5. #include <linux/of_irq.h>
  6. #include <linux/of_platform.h>
  7. #include <asm/fsl_pm.h>
  8. #include <soc/fsl/qe/qe.h>
  9. #include <sysdev/cpm2_pic.h>
  10. #include "mpc85xx.h"
  11. const struct fsl_pm_ops *qoriq_pm_ops;
  12. static const struct of_device_id mpc85xx_common_ids[] __initconst = {
  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. { .compatible = "fsl,fman", },
  39. {},
  40. };
  41. int __init mpc85xx_common_publish_devices(void)
  42. {
  43. return of_platform_bus_probe(NULL, mpc85xx_common_ids, NULL);
  44. }
  45. #ifdef CONFIG_CPM2
  46. static void cpm2_cascade(struct irq_desc *desc)
  47. {
  48. struct irq_chip *chip = irq_desc_get_chip(desc);
  49. int cascade_irq;
  50. while ((cascade_irq = cpm2_get_irq()) >= 0)
  51. generic_handle_irq(cascade_irq);
  52. chip->irq_eoi(&desc->irq_data);
  53. }
  54. void __init mpc85xx_cpm2_pic_init(void)
  55. {
  56. struct device_node *np;
  57. int irq;
  58. /* Setup CPM2 PIC */
  59. np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic");
  60. if (np == NULL) {
  61. printk(KERN_ERR "PIC init: can not find fsl,cpm2-pic node\n");
  62. return;
  63. }
  64. irq = irq_of_parse_and_map(np, 0);
  65. if (!irq) {
  66. of_node_put(np);
  67. printk(KERN_ERR "PIC init: got no IRQ for cpm cascade\n");
  68. return;
  69. }
  70. cpm2_pic_init(np);
  71. of_node_put(np);
  72. irq_set_chained_handler(irq, cpm2_cascade);
  73. }
  74. #endif
  75. #ifdef CONFIG_QUICC_ENGINE
  76. void __init mpc85xx_qe_par_io_init(void)
  77. {
  78. struct device_node *np;
  79. np = of_find_node_by_name(NULL, "par_io");
  80. if (np) {
  81. struct device_node *ucc;
  82. par_io_init(np);
  83. of_node_put(np);
  84. for_each_node_by_name(ucc, "ucc")
  85. par_io_of_config(ucc);
  86. }
  87. }
  88. #endif