ppc405ep.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. /*
  2. * (C) Copyright 2010
  3. * Stefan Roese, DENX Software Engineering, sr@denx.de.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  18. * MA 02111-1307 USA
  19. */
  20. #ifndef _PPC405EP_H_
  21. #define _PPC405EP_H_
  22. #define CONFIG_SDRAM_PPC4xx_IBM_SDRAM /* IBM SDRAM controller */
  23. /* Memory mapped register */
  24. #define CONFIG_SYS_PERIPHERAL_BASE 0xef600000 /* Internal Peripherals */
  25. #define CONFIG_SYS_NS16550_COM1 (CONFIG_SYS_PERIPHERAL_BASE + 0x0300)
  26. #define CONFIG_SYS_NS16550_COM2 (CONFIG_SYS_PERIPHERAL_BASE + 0x0400)
  27. #define GPIO0_BASE (CONFIG_SYS_PERIPHERAL_BASE + 0x0700)
  28. /* DCR */
  29. #define OCM0_ISCNTL 0x0019 /* OCM I-side control reg */
  30. #define OCM0_DSARC 0x001a /* OCM D-side address compare */
  31. #define OCM0_DSCNTL 0x001b /* OCM D-side control */
  32. #define CPC0_PLLMR0 0x00f0 /* PLL mode register 0 */
  33. #define CPC0_BOOT 0x00f1 /* Clock status register */
  34. #define CPC0_CR1 0x00f2 /* Chip Control 1 register */
  35. #define CPC0_EPCTL 0x00f3 /* EMAC to PHY control register */
  36. #define CPC0_PLLMR1 0x00f4 /* PLL mode register 1 */
  37. #define CPC0_UCR 0x00f5 /* UART control register */
  38. #define CPC0_SRR 0x00f6 /* Soft Reset register */
  39. #define CPC0_PCI 0x00f9 /* PCI control register */
  40. /* Defines for CPC0_EPCTL register */
  41. #define CPC0_EPCTL_E0NFE 0x80000000
  42. #define CPC0_EPCTL_E1NFE 0x40000000
  43. /* Defines for CPC0_PCI Register */
  44. #define CPC0_PCI_SPE 0x00000010 /* PCIINT/WE select */
  45. #define CPC0_PCI_HOST_CFG_EN 0x00000008 /* PCI host config Enable */
  46. #define CPC0_PCI_ARBIT_EN 0x00000001 /* PCI Internal Arb Enabled */
  47. /* Defines for CPC0_BOOR Register */
  48. #define CPC0_BOOT_SEP 0x00000002 /* serial EEPROM present */
  49. /* Bit definitions */
  50. #define PLLMR0_CPU_DIV_MASK 0x00300000 /* CPU clock divider */
  51. #define PLLMR0_CPU_DIV_BYPASS 0x00000000
  52. #define PLLMR0_CPU_DIV_2 0x00100000
  53. #define PLLMR0_CPU_DIV_3 0x00200000
  54. #define PLLMR0_CPU_DIV_4 0x00300000
  55. #define PLLMR0_CPU_TO_PLB_MASK 0x00030000 /* CPU:PLB Frequency Divisor */
  56. #define PLLMR0_CPU_PLB_DIV_1 0x00000000
  57. #define PLLMR0_CPU_PLB_DIV_2 0x00010000
  58. #define PLLMR0_CPU_PLB_DIV_3 0x00020000
  59. #define PLLMR0_CPU_PLB_DIV_4 0x00030000
  60. #define PLLMR0_OPB_TO_PLB_MASK 0x00003000 /* OPB:PLB Frequency Divisor */
  61. #define PLLMR0_OPB_PLB_DIV_1 0x00000000
  62. #define PLLMR0_OPB_PLB_DIV_2 0x00001000
  63. #define PLLMR0_OPB_PLB_DIV_3 0x00002000
  64. #define PLLMR0_OPB_PLB_DIV_4 0x00003000
  65. #define PLLMR0_EXB_TO_PLB_MASK 0x00000300 /* External Bus:PLB Divisor */
  66. #define PLLMR0_EXB_PLB_DIV_2 0x00000000
  67. #define PLLMR0_EXB_PLB_DIV_3 0x00000100
  68. #define PLLMR0_EXB_PLB_DIV_4 0x00000200
  69. #define PLLMR0_EXB_PLB_DIV_5 0x00000300
  70. #define PLLMR0_MAL_TO_PLB_MASK 0x00000030 /* MAL:PLB Divisor */
  71. #define PLLMR0_MAL_PLB_DIV_1 0x00000000
  72. #define PLLMR0_MAL_PLB_DIV_2 0x00000010
  73. #define PLLMR0_MAL_PLB_DIV_3 0x00000020
  74. #define PLLMR0_MAL_PLB_DIV_4 0x00000030
  75. #define PLLMR0_PCI_TO_PLB_MASK 0x00000003 /* PCI:PLB Frequency Divisor */
  76. #define PLLMR0_PCI_PLB_DIV_1 0x00000000
  77. #define PLLMR0_PCI_PLB_DIV_2 0x00000001
  78. #define PLLMR0_PCI_PLB_DIV_3 0x00000002
  79. #define PLLMR0_PCI_PLB_DIV_4 0x00000003
  80. #define PLLMR1_SSCS_MASK 0x80000000 /* Select system clock source */
  81. #define PLLMR1_PLLR_MASK 0x40000000 /* PLL reset */
  82. #define PLLMR1_FBMUL_MASK 0x00F00000 /* PLL feedback multiplier value */
  83. #define PLLMR1_FWDVA_MASK 0x00070000 /* PLL forward divider A value */
  84. #define PLLMR1_FWDVB_MASK 0x00007000 /* PLL forward divider B value */
  85. #define PLLMR1_TUNING_MASK 0x000003FF /* PLL tune bits */
  86. /* Defines for CPC0_PLLMR1 Register fields */
  87. #define PLL_ACTIVE 0x80000000
  88. #define CPC0_PLLMR1_SSCS 0x80000000
  89. #define PLL_RESET 0x40000000
  90. #define CPC0_PLLMR1_PLLR 0x40000000
  91. /* Feedback multiplier */
  92. #define PLL_FBKDIV 0x00F00000
  93. #define CPC0_PLLMR1_FBDV 0x00F00000
  94. #define PLL_FBKDIV_16 0x00000000
  95. #define PLL_FBKDIV_1 0x00100000
  96. #define PLL_FBKDIV_2 0x00200000
  97. #define PLL_FBKDIV_3 0x00300000
  98. #define PLL_FBKDIV_4 0x00400000
  99. #define PLL_FBKDIV_5 0x00500000
  100. #define PLL_FBKDIV_6 0x00600000
  101. #define PLL_FBKDIV_7 0x00700000
  102. #define PLL_FBKDIV_8 0x00800000
  103. #define PLL_FBKDIV_9 0x00900000
  104. #define PLL_FBKDIV_10 0x00A00000
  105. #define PLL_FBKDIV_11 0x00B00000
  106. #define PLL_FBKDIV_12 0x00C00000
  107. #define PLL_FBKDIV_13 0x00D00000
  108. #define PLL_FBKDIV_14 0x00E00000
  109. #define PLL_FBKDIV_15 0x00F00000
  110. /* Forward A divisor */
  111. #define PLL_FWDDIVA 0x00070000
  112. #define CPC0_PLLMR1_FWDVA 0x00070000
  113. #define PLL_FWDDIVA_8 0x00000000
  114. #define PLL_FWDDIVA_7 0x00010000
  115. #define PLL_FWDDIVA_6 0x00020000
  116. #define PLL_FWDDIVA_5 0x00030000
  117. #define PLL_FWDDIVA_4 0x00040000
  118. #define PLL_FWDDIVA_3 0x00050000
  119. #define PLL_FWDDIVA_2 0x00060000
  120. #define PLL_FWDDIVA_1 0x00070000
  121. /* Forward B divisor */
  122. #define PLL_FWDDIVB 0x00007000
  123. #define CPC0_PLLMR1_FWDVB 0x00007000
  124. #define PLL_FWDDIVB_8 0x00000000
  125. #define PLL_FWDDIVB_7 0x00001000
  126. #define PLL_FWDDIVB_6 0x00002000
  127. #define PLL_FWDDIVB_5 0x00003000
  128. #define PLL_FWDDIVB_4 0x00004000
  129. #define PLL_FWDDIVB_3 0x00005000
  130. #define PLL_FWDDIVB_2 0x00006000
  131. #define PLL_FWDDIVB_1 0x00007000
  132. /* PLL tune bits */
  133. #define PLL_TUNE_MASK 0x000003FF
  134. #define PLL_TUNE_2_M_3 0x00000133 /* 2 <= M <= 3 */
  135. #define PLL_TUNE_4_M_6 0x00000134 /* 3 < M <= 6 */
  136. #define PLL_TUNE_7_M_10 0x00000138 /* 6 < M <= 10 */
  137. #define PLL_TUNE_11_M_14 0x0000013C /* 10 < M <= 14 */
  138. #define PLL_TUNE_15_M_40 0x0000023E /* 14 < M <= 40 */
  139. #define PLL_TUNE_VCO_LOW 0x00000000 /* 500MHz <= VCO <= 800MHz */
  140. #define PLL_TUNE_VCO_HI 0x00000080 /* 800MHz < VCO <= 1000MHz */
  141. /* Defines for CPC0_PLLMR0 Register fields */
  142. /* CPU divisor */
  143. #define PLL_CPUDIV 0x00300000
  144. #define CPC0_PLLMR0_CCDV 0x00300000
  145. #define PLL_CPUDIV_1 0x00000000
  146. #define PLL_CPUDIV_2 0x00100000
  147. #define PLL_CPUDIV_3 0x00200000
  148. #define PLL_CPUDIV_4 0x00300000
  149. /* PLB divisor */
  150. #define PLL_PLBDIV 0x00030000
  151. #define CPC0_PLLMR0_CBDV 0x00030000
  152. #define PLL_PLBDIV_1 0x00000000
  153. #define PLL_PLBDIV_2 0x00010000
  154. #define PLL_PLBDIV_3 0x00020000
  155. #define PLL_PLBDIV_4 0x00030000
  156. /* OPB divisor */
  157. #define PLL_OPBDIV 0x00003000
  158. #define CPC0_PLLMR0_OPDV 0x00003000
  159. #define PLL_OPBDIV_1 0x00000000
  160. #define PLL_OPBDIV_2 0x00001000
  161. #define PLL_OPBDIV_3 0x00002000
  162. #define PLL_OPBDIV_4 0x00003000
  163. /* EBC divisor */
  164. #define PLL_EXTBUSDIV 0x00000300
  165. #define CPC0_PLLMR0_EPDV 0x00000300
  166. #define PLL_EXTBUSDIV_2 0x00000000
  167. #define PLL_EXTBUSDIV_3 0x00000100
  168. #define PLL_EXTBUSDIV_4 0x00000200
  169. #define PLL_EXTBUSDIV_5 0x00000300
  170. /* MAL divisor */
  171. #define PLL_MALDIV 0x00000030
  172. #define CPC0_PLLMR0_MPDV 0x00000030
  173. #define PLL_MALDIV_1 0x00000000
  174. #define PLL_MALDIV_2 0x00000010
  175. #define PLL_MALDIV_3 0x00000020
  176. #define PLL_MALDIV_4 0x00000030
  177. /* PCI divisor */
  178. #define PLL_PCIDIV 0x00000003
  179. #define CPC0_PLLMR0_PPFD 0x00000003
  180. #define PLL_PCIDIV_1 0x00000000
  181. #define PLL_PCIDIV_2 0x00000001
  182. #define PLL_PCIDIV_3 0x00000002
  183. #define PLL_PCIDIV_4 0x00000003
  184. /*
  185. * PLL settings for 266MHz CPU, 133MHz PLB/SDRAM, 66MHz EBC, 33MHz PCI,
  186. * assuming a 33.3MHz input clock to the 405EP.
  187. */
  188. #define PLLMR0_266_133_66 (PLL_CPUDIV_1 | PLL_PLBDIV_2 | \
  189. PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 | \
  190. PLL_MALDIV_1 | PLL_PCIDIV_4)
  191. #define PLLMR1_266_133_66 (PLL_FBKDIV_8 | \
  192. PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
  193. PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
  194. #define PLLMR0_133_66_66_33 (PLL_CPUDIV_1 | PLL_PLBDIV_1 | \
  195. PLL_OPBDIV_2 | PLL_EXTBUSDIV_4 | \
  196. PLL_MALDIV_1 | PLL_PCIDIV_4)
  197. #define PLLMR1_133_66_66_33 (PLL_FBKDIV_4 | \
  198. PLL_FWDDIVA_6 | PLL_FWDDIVB_6 | \
  199. PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
  200. #define PLLMR0_200_100_50_33 (PLL_CPUDIV_1 | PLL_PLBDIV_2 | \
  201. PLL_OPBDIV_2 | PLL_EXTBUSDIV_3 | \
  202. PLL_MALDIV_1 | PLL_PCIDIV_4)
  203. #define PLLMR1_200_100_50_33 (PLL_FBKDIV_6 | \
  204. PLL_FWDDIVA_4 | PLL_FWDDIVB_4 | \
  205. PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
  206. #define PLLMR0_266_133_66_33 (PLL_CPUDIV_1 | PLL_PLBDIV_2 | \
  207. PLL_OPBDIV_2 | PLL_EXTBUSDIV_4 | \
  208. PLL_MALDIV_1 | PLL_PCIDIV_4)
  209. #define PLLMR1_266_133_66_33 (PLL_FBKDIV_8 | \
  210. PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
  211. PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
  212. #define PLLMR0_266_66_33_33 (PLL_CPUDIV_1 | PLL_PLBDIV_4 | \
  213. PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 | \
  214. PLL_MALDIV_1 | PLL_PCIDIV_2)
  215. #define PLLMR1_266_66_33_33 (PLL_FBKDIV_8 | \
  216. PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
  217. PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
  218. #define PLLMR0_333_111_55_37 (PLL_CPUDIV_1 | PLL_PLBDIV_3 | \
  219. PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 | \
  220. PLL_MALDIV_1 | PLL_PCIDIV_3)
  221. #define PLLMR1_333_111_55_37 (PLL_FBKDIV_10 | \
  222. PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
  223. PLL_TUNE_15_M_40 | PLL_TUNE_VCO_HI)
  224. #define PLLMR0_333_111_55_111 (PLL_CPUDIV_1 | PLL_PLBDIV_3 | \
  225. PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 | \
  226. PLL_MALDIV_1 | PLL_PCIDIV_1)
  227. #define PLLMR1_333_111_55_111 (PLL_FBKDIV_10 | \
  228. PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
  229. PLL_TUNE_15_M_40 | PLL_TUNE_VCO_HI)
  230. #endif /* _PPC405EP_H_ */