mpc85xx_rdb.c 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. /*
  2. * MPC85xx RDB Board Setup
  3. *
  4. * Copyright 2009 Freescale Semiconductor Inc.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2 of the License, or (at your
  9. * option) any later version.
  10. */
  11. #include <linux/stddef.h>
  12. #include <linux/kernel.h>
  13. #include <linux/pci.h>
  14. #include <linux/kdev_t.h>
  15. #include <linux/delay.h>
  16. #include <linux/seq_file.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/of_platform.h>
  19. #include <asm/system.h>
  20. #include <asm/time.h>
  21. #include <asm/machdep.h>
  22. #include <asm/pci-bridge.h>
  23. #include <mm/mmu_decl.h>
  24. #include <asm/prom.h>
  25. #include <asm/udbg.h>
  26. #include <asm/mpic.h>
  27. #include <sysdev/fsl_soc.h>
  28. #include <sysdev/fsl_pci.h>
  29. #include "smp.h"
  30. #include "mpc85xx.h"
  31. #undef DEBUG
  32. #ifdef DEBUG
  33. #define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
  34. #else
  35. #define DBG(fmt, args...)
  36. #endif
  37. void __init mpc85xx_rdb_pic_init(void)
  38. {
  39. struct mpic *mpic;
  40. unsigned long root = of_get_flat_dt_root();
  41. if (of_flat_dt_is_compatible(root, "fsl,MPC85XXRDB-CAMP")) {
  42. mpic = mpic_alloc(NULL, 0, MPIC_NO_RESET |
  43. MPIC_BIG_ENDIAN |
  44. MPIC_SINGLE_DEST_CPU,
  45. 0, 256, " OpenPIC ");
  46. } else {
  47. mpic = mpic_alloc(NULL, 0,
  48. MPIC_BIG_ENDIAN |
  49. MPIC_SINGLE_DEST_CPU,
  50. 0, 256, " OpenPIC ");
  51. }
  52. BUG_ON(mpic == NULL);
  53. mpic_init(mpic);
  54. }
  55. /*
  56. * Setup the architecture
  57. */
  58. static void __init mpc85xx_rdb_setup_arch(void)
  59. {
  60. #ifdef CONFIG_PCI
  61. struct device_node *np;
  62. #endif
  63. if (ppc_md.progress)
  64. ppc_md.progress("mpc85xx_rdb_setup_arch()", 0);
  65. #ifdef CONFIG_PCI
  66. for_each_node_by_type(np, "pci") {
  67. if (of_device_is_compatible(np, "fsl,mpc8548-pcie"))
  68. fsl_add_bridge(np, 0);
  69. }
  70. #endif
  71. mpc85xx_smp_init();
  72. printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n");
  73. }
  74. machine_device_initcall(p2020_rdb, mpc85xx_common_publish_devices);
  75. machine_device_initcall(p2020_rdb_pc, mpc85xx_common_publish_devices);
  76. machine_device_initcall(p1020_mbg_pc, mpc85xx_common_publish_devices);
  77. machine_device_initcall(p1020_rdb, mpc85xx_common_publish_devices);
  78. machine_device_initcall(p1021_rdb_pc, mpc85xx_common_publish_devices);
  79. machine_device_initcall(p1025_rdb, mpc85xx_common_publish_devices);
  80. /*
  81. * Called very early, device-tree isn't unflattened
  82. */
  83. static int __init p2020_rdb_probe(void)
  84. {
  85. unsigned long root = of_get_flat_dt_root();
  86. if (of_flat_dt_is_compatible(root, "fsl,P2020RDB"))
  87. return 1;
  88. return 0;
  89. }
  90. static int __init p1020_rdb_probe(void)
  91. {
  92. unsigned long root = of_get_flat_dt_root();
  93. if (of_flat_dt_is_compatible(root, "fsl,P1020RDB"))
  94. return 1;
  95. return 0;
  96. }
  97. static int __init p1021_rdb_pc_probe(void)
  98. {
  99. unsigned long root = of_get_flat_dt_root();
  100. if (of_flat_dt_is_compatible(root, "fsl,P1021RDB-PC"))
  101. return 1;
  102. return 0;
  103. }
  104. static int __init p2020_rdb_pc_probe(void)
  105. {
  106. unsigned long root = of_get_flat_dt_root();
  107. if (of_flat_dt_is_compatible(root, "fsl,P2020RDB-PC"))
  108. return 1;
  109. return 0;
  110. }
  111. static int __init p1025_rdb_probe(void)
  112. {
  113. unsigned long root = of_get_flat_dt_root();
  114. return of_flat_dt_is_compatible(root, "fsl,P1025RDB");
  115. }
  116. static int __init p1020_mbg_pc_probe(void)
  117. {
  118. unsigned long root = of_get_flat_dt_root();
  119. return of_flat_dt_is_compatible(root, "fsl,P1020MBG-PC");
  120. }
  121. define_machine(p2020_rdb) {
  122. .name = "P2020 RDB",
  123. .probe = p2020_rdb_probe,
  124. .setup_arch = mpc85xx_rdb_setup_arch,
  125. .init_IRQ = mpc85xx_rdb_pic_init,
  126. #ifdef CONFIG_PCI
  127. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  128. #endif
  129. .get_irq = mpic_get_irq,
  130. .restart = fsl_rstcr_restart,
  131. .calibrate_decr = generic_calibrate_decr,
  132. .progress = udbg_progress,
  133. };
  134. define_machine(p1020_rdb) {
  135. .name = "P1020 RDB",
  136. .probe = p1020_rdb_probe,
  137. .setup_arch = mpc85xx_rdb_setup_arch,
  138. .init_IRQ = mpc85xx_rdb_pic_init,
  139. #ifdef CONFIG_PCI
  140. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  141. #endif
  142. .get_irq = mpic_get_irq,
  143. .restart = fsl_rstcr_restart,
  144. .calibrate_decr = generic_calibrate_decr,
  145. .progress = udbg_progress,
  146. };
  147. define_machine(p1021_rdb_pc) {
  148. .name = "P1021 RDB-PC",
  149. .probe = p1021_rdb_pc_probe,
  150. .setup_arch = mpc85xx_rdb_setup_arch,
  151. .init_IRQ = mpc85xx_rdb_pic_init,
  152. #ifdef CONFIG_PCI
  153. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  154. #endif
  155. .get_irq = mpic_get_irq,
  156. .restart = fsl_rstcr_restart,
  157. .calibrate_decr = generic_calibrate_decr,
  158. .progress = udbg_progress,
  159. };
  160. define_machine(p2020_rdb_pc) {
  161. .name = "P2020RDB-PC",
  162. .probe = p2020_rdb_pc_probe,
  163. .setup_arch = mpc85xx_rdb_setup_arch,
  164. .init_IRQ = mpc85xx_rdb_pic_init,
  165. #ifdef CONFIG_PCI
  166. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  167. #endif
  168. .get_irq = mpic_get_irq,
  169. .restart = fsl_rstcr_restart,
  170. .calibrate_decr = generic_calibrate_decr,
  171. .progress = udbg_progress,
  172. };
  173. define_machine(p1025_rdb) {
  174. .name = "P1025 RDB",
  175. .probe = p1025_rdb_probe,
  176. .setup_arch = mpc85xx_rdb_setup_arch,
  177. .init_IRQ = mpc85xx_rdb_pic_init,
  178. #ifdef CONFIG_PCI
  179. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  180. #endif
  181. .get_irq = mpic_get_irq,
  182. .restart = fsl_rstcr_restart,
  183. .calibrate_decr = generic_calibrate_decr,
  184. .progress = udbg_progress,
  185. };
  186. define_machine(p1020_mbg_pc) {
  187. .name = "P1020 MBG-PC",
  188. .probe = p1020_mbg_pc_probe,
  189. .setup_arch = mpc85xx_rdb_setup_arch,
  190. .init_IRQ = mpc85xx_rdb_pic_init,
  191. #ifdef CONFIG_PCI
  192. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  193. #endif
  194. .get_irq = mpic_get_irq,
  195. .restart = fsl_rstcr_restart,
  196. .calibrate_decr = generic_calibrate_decr,
  197. .progress = udbg_progress,
  198. };