ppc405ep.h 8.6 KB

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