mpc85xx_ads.c 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /*
  2. * MPC85xx setup and early boot code plus other random bits.
  3. *
  4. * Maintained by Kumar Gala (see MAINTAINERS for contact information)
  5. *
  6. * Copyright 2005 Freescale Semiconductor Inc.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation; either version 2 of the License, or (at your
  11. * option) any later version.
  12. */
  13. #include <linux/stddef.h>
  14. #include <linux/kernel.h>
  15. #include <linux/pci.h>
  16. #include <linux/kdev_t.h>
  17. #include <linux/delay.h>
  18. #include <linux/seq_file.h>
  19. #include <linux/of_platform.h>
  20. #include <asm/time.h>
  21. #include <asm/machdep.h>
  22. #include <asm/pci-bridge.h>
  23. #include <asm/mpic.h>
  24. #include <mm/mmu_decl.h>
  25. #include <asm/udbg.h>
  26. #include <sysdev/fsl_soc.h>
  27. #include <sysdev/fsl_pci.h>
  28. #ifdef CONFIG_CPM2
  29. #include <asm/cpm2.h>
  30. #include <sysdev/cpm2_pic.h>
  31. #endif
  32. #include "mpc85xx.h"
  33. static void __init mpc85xx_ads_pic_init(void)
  34. {
  35. struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN,
  36. 0, 256, " OpenPIC ");
  37. BUG_ON(mpic == NULL);
  38. mpic_init(mpic);
  39. mpc85xx_cpm2_pic_init();
  40. }
  41. /*
  42. * Setup the architecture
  43. */
  44. #ifdef CONFIG_CPM2
  45. struct cpm_pin {
  46. int port, pin, flags;
  47. };
  48. static const struct cpm_pin mpc8560_ads_pins[] = {
  49. /* SCC1 */
  50. {3, 29, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
  51. {3, 30, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
  52. {3, 31, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
  53. /* SCC2 */
  54. {2, 12, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
  55. {2, 13, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
  56. {3, 26, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
  57. {3, 27, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
  58. {3, 28, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
  59. /* FCC2 */
  60. {1, 18, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
  61. {1, 19, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
  62. {1, 20, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
  63. {1, 21, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
  64. {1, 22, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
  65. {1, 23, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
  66. {1, 24, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
  67. {1, 25, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
  68. {1, 26, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
  69. {1, 27, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
  70. {1, 28, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
  71. {1, 29, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
  72. {1, 30, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
  73. {1, 31, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
  74. {2, 18, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* CLK14 */
  75. {2, 19, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* CLK13 */
  76. /* FCC3 */
  77. {1, 4, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
  78. {1, 5, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
  79. {1, 6, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
  80. {1, 8, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
  81. {1, 9, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
  82. {1, 10, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
  83. {1, 11, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
  84. {1, 12, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
  85. {1, 13, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
  86. {1, 14, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
  87. {1, 15, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
  88. {1, 16, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
  89. {1, 17, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
  90. {2, 16, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* CLK16 */
  91. {2, 17, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* CLK15 */
  92. {2, 27, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
  93. };
  94. static void __init init_ioports(void)
  95. {
  96. int i;
  97. for (i = 0; i < ARRAY_SIZE(mpc8560_ads_pins); i++) {
  98. const struct cpm_pin *pin = &mpc8560_ads_pins[i];
  99. cpm2_set_pin(pin->port, pin->pin, pin->flags);
  100. }
  101. cpm2_clk_setup(CPM_CLK_SCC1, CPM_BRG1, CPM_CLK_RX);
  102. cpm2_clk_setup(CPM_CLK_SCC1, CPM_BRG1, CPM_CLK_TX);
  103. cpm2_clk_setup(CPM_CLK_SCC2, CPM_BRG2, CPM_CLK_RX);
  104. cpm2_clk_setup(CPM_CLK_SCC2, CPM_BRG2, CPM_CLK_TX);
  105. cpm2_clk_setup(CPM_CLK_FCC2, CPM_CLK13, CPM_CLK_RX);
  106. cpm2_clk_setup(CPM_CLK_FCC2, CPM_CLK14, CPM_CLK_TX);
  107. cpm2_clk_setup(CPM_CLK_FCC3, CPM_CLK15, CPM_CLK_RX);
  108. cpm2_clk_setup(CPM_CLK_FCC3, CPM_CLK16, CPM_CLK_TX);
  109. }
  110. #endif
  111. static void __init mpc85xx_ads_setup_arch(void)
  112. {
  113. if (ppc_md.progress)
  114. ppc_md.progress("mpc85xx_ads_setup_arch()", 0);
  115. #ifdef CONFIG_CPM2
  116. cpm2_reset();
  117. init_ioports();
  118. #endif
  119. fsl_pci_assign_primary();
  120. }
  121. static void mpc85xx_ads_show_cpuinfo(struct seq_file *m)
  122. {
  123. uint pvid, svid, phid1;
  124. pvid = mfspr(SPRN_PVR);
  125. svid = mfspr(SPRN_SVR);
  126. seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
  127. seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
  128. seq_printf(m, "SVR\t\t: 0x%x\n", svid);
  129. /* Display cpu Pll setting */
  130. phid1 = mfspr(SPRN_HID1);
  131. seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
  132. }
  133. machine_arch_initcall(mpc85xx_ads, mpc85xx_common_publish_devices);
  134. /*
  135. * Called very early, device-tree isn't unflattened
  136. */
  137. static int __init mpc85xx_ads_probe(void)
  138. {
  139. return of_machine_is_compatible("MPC85xxADS");
  140. }
  141. define_machine(mpc85xx_ads) {
  142. .name = "MPC85xx ADS",
  143. .probe = mpc85xx_ads_probe,
  144. .setup_arch = mpc85xx_ads_setup_arch,
  145. .init_IRQ = mpc85xx_ads_pic_init,
  146. .show_cpuinfo = mpc85xx_ads_show_cpuinfo,
  147. .get_irq = mpic_get_irq,
  148. .calibrate_decr = generic_calibrate_decr,
  149. .progress = udbg_progress,
  150. };