mpc85xx_rdb.c 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. /*
  2. * MPC85xx RDB Board Setup
  3. *
  4. * Copyright 2009,2012 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/time.h>
  20. #include <asm/machdep.h>
  21. #include <asm/pci-bridge.h>
  22. #include <mm/mmu_decl.h>
  23. #include <asm/prom.h>
  24. #include <asm/udbg.h>
  25. #include <asm/mpic.h>
  26. #include <asm/qe.h>
  27. #include <asm/qe_ic.h>
  28. #include <asm/fsl_guts.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. #ifdef CONFIG_QUICC_ENGINE
  75. struct device_node *np;
  76. #endif
  77. if (ppc_md.progress)
  78. ppc_md.progress("mpc85xx_rdb_setup_arch()", 0);
  79. mpc85xx_smp_init();
  80. fsl_pci_assign_primary();
  81. #ifdef CONFIG_QUICC_ENGINE
  82. np = of_find_compatible_node(NULL, NULL, "fsl,qe");
  83. if (!np) {
  84. pr_err("%s: Could not find Quicc Engine node\n", __func__);
  85. goto qe_fail;
  86. }
  87. qe_reset();
  88. of_node_put(np);
  89. np = of_find_node_by_name(NULL, "par_io");
  90. if (np) {
  91. struct device_node *ucc;
  92. par_io_init(np);
  93. of_node_put(np);
  94. for_each_node_by_name(ucc, "ucc")
  95. par_io_of_config(ucc);
  96. }
  97. #if defined(CONFIG_UCC_GETH) || defined(CONFIG_SERIAL_QE)
  98. if (machine_is(p1025_rdb)) {
  99. struct ccsr_guts __iomem *guts;
  100. np = of_find_node_by_name(NULL, "global-utilities");
  101. if (np) {
  102. guts = of_iomap(np, 0);
  103. if (!guts) {
  104. pr_err("mpc85xx-rdb: could not map global utilities register\n");
  105. } else {
  106. /* P1025 has pins muxed for QE and other functions. To
  107. * enable QE UEC mode, we need to set bit QE0 for UCC1
  108. * in Eth mode, QE0 and QE3 for UCC5 in Eth mode, QE9
  109. * and QE12 for QE MII management singals in PMUXCR
  110. * register.
  111. */
  112. setbits32(&guts->pmuxcr, MPC85xx_PMUXCR_QE(0) |
  113. MPC85xx_PMUXCR_QE(3) |
  114. MPC85xx_PMUXCR_QE(9) |
  115. MPC85xx_PMUXCR_QE(12));
  116. iounmap(guts);
  117. }
  118. of_node_put(np);
  119. }
  120. }
  121. #endif
  122. qe_fail:
  123. #endif /* CONFIG_QUICC_ENGINE */
  124. printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n");
  125. }
  126. machine_arch_initcall(p2020_rdb, mpc85xx_common_publish_devices);
  127. machine_arch_initcall(p2020_rdb_pc, mpc85xx_common_publish_devices);
  128. machine_arch_initcall(p1020_mbg_pc, mpc85xx_common_publish_devices);
  129. machine_arch_initcall(p1020_rdb, mpc85xx_common_publish_devices);
  130. machine_arch_initcall(p1020_rdb_pc, mpc85xx_common_publish_devices);
  131. machine_arch_initcall(p1020_rdb_pd, mpc85xx_common_publish_devices);
  132. machine_arch_initcall(p1020_utm_pc, mpc85xx_common_publish_devices);
  133. machine_arch_initcall(p1021_rdb_pc, mpc85xx_common_publish_devices);
  134. machine_arch_initcall(p1025_rdb, mpc85xx_common_publish_devices);
  135. machine_arch_initcall(p1024_rdb, mpc85xx_common_publish_devices);
  136. /*
  137. * Called very early, device-tree isn't unflattened
  138. */
  139. static int __init p2020_rdb_probe(void)
  140. {
  141. unsigned long root = of_get_flat_dt_root();
  142. if (of_flat_dt_is_compatible(root, "fsl,P2020RDB"))
  143. return 1;
  144. return 0;
  145. }
  146. static int __init p1020_rdb_probe(void)
  147. {
  148. unsigned long root = of_get_flat_dt_root();
  149. if (of_flat_dt_is_compatible(root, "fsl,P1020RDB"))
  150. return 1;
  151. return 0;
  152. }
  153. static int __init p1020_rdb_pc_probe(void)
  154. {
  155. unsigned long root = of_get_flat_dt_root();
  156. return of_flat_dt_is_compatible(root, "fsl,P1020RDB-PC");
  157. }
  158. static int __init p1020_rdb_pd_probe(void)
  159. {
  160. unsigned long root = of_get_flat_dt_root();
  161. return of_flat_dt_is_compatible(root, "fsl,P1020RDB-PD");
  162. }
  163. static int __init p1021_rdb_pc_probe(void)
  164. {
  165. unsigned long root = of_get_flat_dt_root();
  166. if (of_flat_dt_is_compatible(root, "fsl,P1021RDB-PC"))
  167. return 1;
  168. return 0;
  169. }
  170. static int __init p2020_rdb_pc_probe(void)
  171. {
  172. unsigned long root = of_get_flat_dt_root();
  173. if (of_flat_dt_is_compatible(root, "fsl,P2020RDB-PC"))
  174. return 1;
  175. return 0;
  176. }
  177. static int __init p1025_rdb_probe(void)
  178. {
  179. unsigned long root = of_get_flat_dt_root();
  180. return of_flat_dt_is_compatible(root, "fsl,P1025RDB");
  181. }
  182. static int __init p1020_mbg_pc_probe(void)
  183. {
  184. unsigned long root = of_get_flat_dt_root();
  185. return of_flat_dt_is_compatible(root, "fsl,P1020MBG-PC");
  186. }
  187. static int __init p1020_utm_pc_probe(void)
  188. {
  189. unsigned long root = of_get_flat_dt_root();
  190. return of_flat_dt_is_compatible(root, "fsl,P1020UTM-PC");
  191. }
  192. static int __init p1024_rdb_probe(void)
  193. {
  194. unsigned long root = of_get_flat_dt_root();
  195. return of_flat_dt_is_compatible(root, "fsl,P1024RDB");
  196. }
  197. define_machine(p2020_rdb) {
  198. .name = "P2020 RDB",
  199. .probe = p2020_rdb_probe,
  200. .setup_arch = mpc85xx_rdb_setup_arch,
  201. .init_IRQ = mpc85xx_rdb_pic_init,
  202. #ifdef CONFIG_PCI
  203. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  204. #endif
  205. .get_irq = mpic_get_irq,
  206. .restart = fsl_rstcr_restart,
  207. .calibrate_decr = generic_calibrate_decr,
  208. .progress = udbg_progress,
  209. };
  210. define_machine(p1020_rdb) {
  211. .name = "P1020 RDB",
  212. .probe = p1020_rdb_probe,
  213. .setup_arch = mpc85xx_rdb_setup_arch,
  214. .init_IRQ = mpc85xx_rdb_pic_init,
  215. #ifdef CONFIG_PCI
  216. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  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(p1021_rdb_pc) {
  224. .name = "P1021 RDB-PC",
  225. .probe = p1021_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. #endif
  231. .get_irq = mpic_get_irq,
  232. .restart = fsl_rstcr_restart,
  233. .calibrate_decr = generic_calibrate_decr,
  234. .progress = udbg_progress,
  235. };
  236. define_machine(p2020_rdb_pc) {
  237. .name = "P2020RDB-PC",
  238. .probe = p2020_rdb_pc_probe,
  239. .setup_arch = mpc85xx_rdb_setup_arch,
  240. .init_IRQ = mpc85xx_rdb_pic_init,
  241. #ifdef CONFIG_PCI
  242. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  243. #endif
  244. .get_irq = mpic_get_irq,
  245. .restart = fsl_rstcr_restart,
  246. .calibrate_decr = generic_calibrate_decr,
  247. .progress = udbg_progress,
  248. };
  249. define_machine(p1025_rdb) {
  250. .name = "P1025 RDB",
  251. .probe = p1025_rdb_probe,
  252. .setup_arch = mpc85xx_rdb_setup_arch,
  253. .init_IRQ = mpc85xx_rdb_pic_init,
  254. #ifdef CONFIG_PCI
  255. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  256. #endif
  257. .get_irq = mpic_get_irq,
  258. .restart = fsl_rstcr_restart,
  259. .calibrate_decr = generic_calibrate_decr,
  260. .progress = udbg_progress,
  261. };
  262. define_machine(p1020_mbg_pc) {
  263. .name = "P1020 MBG-PC",
  264. .probe = p1020_mbg_pc_probe,
  265. .setup_arch = mpc85xx_rdb_setup_arch,
  266. .init_IRQ = mpc85xx_rdb_pic_init,
  267. #ifdef CONFIG_PCI
  268. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  269. #endif
  270. .get_irq = mpic_get_irq,
  271. .restart = fsl_rstcr_restart,
  272. .calibrate_decr = generic_calibrate_decr,
  273. .progress = udbg_progress,
  274. };
  275. define_machine(p1020_utm_pc) {
  276. .name = "P1020 UTM-PC",
  277. .probe = p1020_utm_pc_probe,
  278. .setup_arch = mpc85xx_rdb_setup_arch,
  279. .init_IRQ = mpc85xx_rdb_pic_init,
  280. #ifdef CONFIG_PCI
  281. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  282. #endif
  283. .get_irq = mpic_get_irq,
  284. .restart = fsl_rstcr_restart,
  285. .calibrate_decr = generic_calibrate_decr,
  286. .progress = udbg_progress,
  287. };
  288. define_machine(p1020_rdb_pc) {
  289. .name = "P1020RDB-PC",
  290. .probe = p1020_rdb_pc_probe,
  291. .setup_arch = mpc85xx_rdb_setup_arch,
  292. .init_IRQ = mpc85xx_rdb_pic_init,
  293. #ifdef CONFIG_PCI
  294. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  295. #endif
  296. .get_irq = mpic_get_irq,
  297. .restart = fsl_rstcr_restart,
  298. .calibrate_decr = generic_calibrate_decr,
  299. .progress = udbg_progress,
  300. };
  301. define_machine(p1020_rdb_pd) {
  302. .name = "P1020RDB-PD",
  303. .probe = p1020_rdb_pd_probe,
  304. .setup_arch = mpc85xx_rdb_setup_arch,
  305. .init_IRQ = mpc85xx_rdb_pic_init,
  306. #ifdef CONFIG_PCI
  307. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  308. #endif
  309. .get_irq = mpic_get_irq,
  310. .restart = fsl_rstcr_restart,
  311. .calibrate_decr = generic_calibrate_decr,
  312. .progress = udbg_progress,
  313. };
  314. define_machine(p1024_rdb) {
  315. .name = "P1024 RDB",
  316. .probe = p1024_rdb_probe,
  317. .setup_arch = mpc85xx_rdb_setup_arch,
  318. .init_IRQ = mpc85xx_rdb_pic_init,
  319. #ifdef CONFIG_PCI
  320. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  321. #endif
  322. .get_irq = mpic_get_irq,
  323. .restart = fsl_rstcr_restart,
  324. .calibrate_decr = generic_calibrate_decr,
  325. .progress = udbg_progress,
  326. };