mpc85xx_rdb.c 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. /*
  2. * MPC85xx RDB Board Setup
  3. *
  4. * Copyright 2009,2012-2013 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 <linux/fsl/guts.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 <asm/qe.h>
  28. #include <asm/qe_ic.h>
  29. #include <sysdev/fsl_soc.h>
  30. #include <sysdev/fsl_pci.h>
  31. #include "smp.h"
  32. #include "mpc85xx.h"
  33. #undef DEBUG
  34. #ifdef DEBUG
  35. #define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
  36. #else
  37. #define DBG(fmt, args...)
  38. #endif
  39. void __init mpc85xx_rdb_pic_init(void)
  40. {
  41. struct mpic *mpic;
  42. unsigned long root = of_get_flat_dt_root();
  43. #ifdef CONFIG_QUICC_ENGINE
  44. struct device_node *np;
  45. #endif
  46. if (of_flat_dt_is_compatible(root, "fsl,MPC85XXRDB-CAMP")) {
  47. mpic = mpic_alloc(NULL, 0, MPIC_NO_RESET |
  48. MPIC_BIG_ENDIAN |
  49. MPIC_SINGLE_DEST_CPU,
  50. 0, 256, " OpenPIC ");
  51. } else {
  52. mpic = mpic_alloc(NULL, 0,
  53. MPIC_BIG_ENDIAN |
  54. MPIC_SINGLE_DEST_CPU,
  55. 0, 256, " OpenPIC ");
  56. }
  57. BUG_ON(mpic == NULL);
  58. mpic_init(mpic);
  59. #ifdef CONFIG_QUICC_ENGINE
  60. np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
  61. if (np) {
  62. qe_ic_init(np, 0, qe_ic_cascade_low_mpic,
  63. qe_ic_cascade_high_mpic);
  64. of_node_put(np);
  65. } else
  66. pr_err("%s: Could not find qe-ic node\n", __func__);
  67. #endif
  68. }
  69. /*
  70. * Setup the architecture
  71. */
  72. static void __init mpc85xx_rdb_setup_arch(void)
  73. {
  74. if (ppc_md.progress)
  75. ppc_md.progress("mpc85xx_rdb_setup_arch()", 0);
  76. mpc85xx_smp_init();
  77. fsl_pci_assign_primary();
  78. #ifdef CONFIG_QUICC_ENGINE
  79. mpc85xx_qe_init();
  80. mpc85xx_qe_par_io_init();
  81. #if defined(CONFIG_UCC_GETH) || defined(CONFIG_SERIAL_QE)
  82. if (machine_is(p1025_rdb)) {
  83. struct device_node *np;
  84. struct ccsr_guts __iomem *guts;
  85. np = of_find_node_by_name(NULL, "global-utilities");
  86. if (np) {
  87. guts = of_iomap(np, 0);
  88. if (!guts) {
  89. pr_err("mpc85xx-rdb: could not map global utilities register\n");
  90. } else {
  91. /* P1025 has pins muxed for QE and other functions. To
  92. * enable QE UEC mode, we need to set bit QE0 for UCC1
  93. * in Eth mode, QE0 and QE3 for UCC5 in Eth mode, QE9
  94. * and QE12 for QE MII management singals in PMUXCR
  95. * register.
  96. */
  97. setbits32(&guts->pmuxcr, MPC85xx_PMUXCR_QE(0) |
  98. MPC85xx_PMUXCR_QE(3) |
  99. MPC85xx_PMUXCR_QE(9) |
  100. MPC85xx_PMUXCR_QE(12));
  101. iounmap(guts);
  102. }
  103. of_node_put(np);
  104. }
  105. }
  106. #endif
  107. #endif /* CONFIG_QUICC_ENGINE */
  108. printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n");
  109. }
  110. machine_arch_initcall(p2020_rdb, mpc85xx_common_publish_devices);
  111. machine_arch_initcall(p2020_rdb_pc, mpc85xx_common_publish_devices);
  112. machine_arch_initcall(p1020_mbg_pc, mpc85xx_common_publish_devices);
  113. machine_arch_initcall(p1020_rdb, mpc85xx_common_publish_devices);
  114. machine_arch_initcall(p1020_rdb_pc, mpc85xx_common_publish_devices);
  115. machine_arch_initcall(p1020_rdb_pd, mpc85xx_common_publish_devices);
  116. machine_arch_initcall(p1020_utm_pc, mpc85xx_common_publish_devices);
  117. machine_arch_initcall(p1021_rdb_pc, mpc85xx_common_publish_devices);
  118. machine_arch_initcall(p1025_rdb, mpc85xx_common_publish_devices);
  119. machine_arch_initcall(p1024_rdb, mpc85xx_common_publish_devices);
  120. /*
  121. * Called very early, device-tree isn't unflattened
  122. */
  123. static int __init p2020_rdb_probe(void)
  124. {
  125. unsigned long root = of_get_flat_dt_root();
  126. if (of_flat_dt_is_compatible(root, "fsl,P2020RDB"))
  127. return 1;
  128. return 0;
  129. }
  130. static int __init p1020_rdb_probe(void)
  131. {
  132. unsigned long root = of_get_flat_dt_root();
  133. if (of_flat_dt_is_compatible(root, "fsl,P1020RDB"))
  134. return 1;
  135. return 0;
  136. }
  137. static int __init p1020_rdb_pc_probe(void)
  138. {
  139. unsigned long root = of_get_flat_dt_root();
  140. return of_flat_dt_is_compatible(root, "fsl,P1020RDB-PC");
  141. }
  142. static int __init p1020_rdb_pd_probe(void)
  143. {
  144. unsigned long root = of_get_flat_dt_root();
  145. return of_flat_dt_is_compatible(root, "fsl,P1020RDB-PD");
  146. }
  147. static int __init p1021_rdb_pc_probe(void)
  148. {
  149. unsigned long root = of_get_flat_dt_root();
  150. if (of_flat_dt_is_compatible(root, "fsl,P1021RDB-PC"))
  151. return 1;
  152. return 0;
  153. }
  154. static int __init p2020_rdb_pc_probe(void)
  155. {
  156. unsigned long root = of_get_flat_dt_root();
  157. if (of_flat_dt_is_compatible(root, "fsl,P2020RDB-PC"))
  158. return 1;
  159. return 0;
  160. }
  161. static int __init p1025_rdb_probe(void)
  162. {
  163. unsigned long root = of_get_flat_dt_root();
  164. return of_flat_dt_is_compatible(root, "fsl,P1025RDB");
  165. }
  166. static int __init p1020_mbg_pc_probe(void)
  167. {
  168. unsigned long root = of_get_flat_dt_root();
  169. return of_flat_dt_is_compatible(root, "fsl,P1020MBG-PC");
  170. }
  171. static int __init p1020_utm_pc_probe(void)
  172. {
  173. unsigned long root = of_get_flat_dt_root();
  174. return of_flat_dt_is_compatible(root, "fsl,P1020UTM-PC");
  175. }
  176. static int __init p1024_rdb_probe(void)
  177. {
  178. unsigned long root = of_get_flat_dt_root();
  179. return of_flat_dt_is_compatible(root, "fsl,P1024RDB");
  180. }
  181. define_machine(p2020_rdb) {
  182. .name = "P2020 RDB",
  183. .probe = p2020_rdb_probe,
  184. .setup_arch = mpc85xx_rdb_setup_arch,
  185. .init_IRQ = mpc85xx_rdb_pic_init,
  186. #ifdef CONFIG_PCI
  187. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  188. .pcibios_fixup_phb = fsl_pcibios_fixup_phb,
  189. #endif
  190. .get_irq = mpic_get_irq,
  191. .restart = fsl_rstcr_restart,
  192. .calibrate_decr = generic_calibrate_decr,
  193. .progress = udbg_progress,
  194. };
  195. define_machine(p1020_rdb) {
  196. .name = "P1020 RDB",
  197. .probe = p1020_rdb_probe,
  198. .setup_arch = mpc85xx_rdb_setup_arch,
  199. .init_IRQ = mpc85xx_rdb_pic_init,
  200. #ifdef CONFIG_PCI
  201. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  202. .pcibios_fixup_phb = fsl_pcibios_fixup_phb,
  203. #endif
  204. .get_irq = mpic_get_irq,
  205. .restart = fsl_rstcr_restart,
  206. .calibrate_decr = generic_calibrate_decr,
  207. .progress = udbg_progress,
  208. };
  209. define_machine(p1021_rdb_pc) {
  210. .name = "P1021 RDB-PC",
  211. .probe = p1021_rdb_pc_probe,
  212. .setup_arch = mpc85xx_rdb_setup_arch,
  213. .init_IRQ = mpc85xx_rdb_pic_init,
  214. #ifdef CONFIG_PCI
  215. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  216. .pcibios_fixup_phb = fsl_pcibios_fixup_phb,
  217. #endif
  218. .get_irq = mpic_get_irq,
  219. .restart = fsl_rstcr_restart,
  220. .calibrate_decr = generic_calibrate_decr,
  221. .progress = udbg_progress,
  222. };
  223. define_machine(p2020_rdb_pc) {
  224. .name = "P2020RDB-PC",
  225. .probe = p2020_rdb_pc_probe,
  226. .setup_arch = mpc85xx_rdb_setup_arch,
  227. .init_IRQ = mpc85xx_rdb_pic_init,
  228. #ifdef CONFIG_PCI
  229. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  230. .pcibios_fixup_phb = fsl_pcibios_fixup_phb,
  231. #endif
  232. .get_irq = mpic_get_irq,
  233. .restart = fsl_rstcr_restart,
  234. .calibrate_decr = generic_calibrate_decr,
  235. .progress = udbg_progress,
  236. };
  237. define_machine(p1025_rdb) {
  238. .name = "P1025 RDB",
  239. .probe = p1025_rdb_probe,
  240. .setup_arch = mpc85xx_rdb_setup_arch,
  241. .init_IRQ = mpc85xx_rdb_pic_init,
  242. #ifdef CONFIG_PCI
  243. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  244. .pcibios_fixup_phb = fsl_pcibios_fixup_phb,
  245. #endif
  246. .get_irq = mpic_get_irq,
  247. .restart = fsl_rstcr_restart,
  248. .calibrate_decr = generic_calibrate_decr,
  249. .progress = udbg_progress,
  250. };
  251. define_machine(p1020_mbg_pc) {
  252. .name = "P1020 MBG-PC",
  253. .probe = p1020_mbg_pc_probe,
  254. .setup_arch = mpc85xx_rdb_setup_arch,
  255. .init_IRQ = mpc85xx_rdb_pic_init,
  256. #ifdef CONFIG_PCI
  257. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  258. .pcibios_fixup_phb = fsl_pcibios_fixup_phb,
  259. #endif
  260. .get_irq = mpic_get_irq,
  261. .restart = fsl_rstcr_restart,
  262. .calibrate_decr = generic_calibrate_decr,
  263. .progress = udbg_progress,
  264. };
  265. define_machine(p1020_utm_pc) {
  266. .name = "P1020 UTM-PC",
  267. .probe = p1020_utm_pc_probe,
  268. .setup_arch = mpc85xx_rdb_setup_arch,
  269. .init_IRQ = mpc85xx_rdb_pic_init,
  270. #ifdef CONFIG_PCI
  271. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  272. .pcibios_fixup_phb = fsl_pcibios_fixup_phb,
  273. #endif
  274. .get_irq = mpic_get_irq,
  275. .restart = fsl_rstcr_restart,
  276. .calibrate_decr = generic_calibrate_decr,
  277. .progress = udbg_progress,
  278. };
  279. define_machine(p1020_rdb_pc) {
  280. .name = "P1020RDB-PC",
  281. .probe = p1020_rdb_pc_probe,
  282. .setup_arch = mpc85xx_rdb_setup_arch,
  283. .init_IRQ = mpc85xx_rdb_pic_init,
  284. #ifdef CONFIG_PCI
  285. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  286. .pcibios_fixup_phb = fsl_pcibios_fixup_phb,
  287. #endif
  288. .get_irq = mpic_get_irq,
  289. .restart = fsl_rstcr_restart,
  290. .calibrate_decr = generic_calibrate_decr,
  291. .progress = udbg_progress,
  292. };
  293. define_machine(p1020_rdb_pd) {
  294. .name = "P1020RDB-PD",
  295. .probe = p1020_rdb_pd_probe,
  296. .setup_arch = mpc85xx_rdb_setup_arch,
  297. .init_IRQ = mpc85xx_rdb_pic_init,
  298. #ifdef CONFIG_PCI
  299. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  300. .pcibios_fixup_phb = fsl_pcibios_fixup_phb,
  301. #endif
  302. .get_irq = mpic_get_irq,
  303. .restart = fsl_rstcr_restart,
  304. .calibrate_decr = generic_calibrate_decr,
  305. .progress = udbg_progress,
  306. };
  307. define_machine(p1024_rdb) {
  308. .name = "P1024 RDB",
  309. .probe = p1024_rdb_probe,
  310. .setup_arch = mpc85xx_rdb_setup_arch,
  311. .init_IRQ = mpc85xx_rdb_pic_init,
  312. #ifdef CONFIG_PCI
  313. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  314. .pcibios_fixup_phb = fsl_pcibios_fixup_phb,
  315. #endif
  316. .get_irq = mpic_get_irq,
  317. .restart = fsl_rstcr_restart,
  318. .calibrate_decr = generic_calibrate_decr,
  319. .progress = udbg_progress,
  320. };