hw_data.c 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774
  1. /*
  2. *
  3. * HW data initialization for OMAP5
  4. *
  5. * (C) Copyright 2013
  6. * Texas Instruments, <www.ti.com>
  7. *
  8. * Sricharan R <r.sricharan@ti.com>
  9. *
  10. * SPDX-License-Identifier: GPL-2.0+
  11. */
  12. #include <common.h>
  13. #include <palmas.h>
  14. #include <asm/arch/omap.h>
  15. #include <asm/arch/sys_proto.h>
  16. #include <asm/omap_common.h>
  17. #include <asm/arch/clock.h>
  18. #include <asm/omap_gpio.h>
  19. #include <asm/io.h>
  20. #include <asm/emif.h>
  21. struct prcm_regs const **prcm =
  22. (struct prcm_regs const **) OMAP_SRAM_SCRATCH_PRCM_PTR;
  23. struct dplls const **dplls_data =
  24. (struct dplls const **) OMAP_SRAM_SCRATCH_DPLLS_PTR;
  25. struct vcores_data const **omap_vcores =
  26. (struct vcores_data const **) OMAP_SRAM_SCRATCH_VCORES_PTR;
  27. struct omap_sys_ctrl_regs const **ctrl =
  28. (struct omap_sys_ctrl_regs const **)OMAP_SRAM_SCRATCH_SYS_CTRL;
  29. /* OPP HIGH FREQUENCY for ES2.0 */
  30. static const struct dpll_params mpu_dpll_params_1_5ghz[NUM_SYS_CLKS] = {
  31. {125, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
  32. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
  33. {625, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
  34. {625, 7, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
  35. {750, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
  36. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  37. {625, 15, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
  38. };
  39. /* OPP NOM FREQUENCY for ES1.0 */
  40. static const struct dpll_params mpu_dpll_params_800mhz[NUM_SYS_CLKS] = {
  41. {200, 2, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
  42. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
  43. {1000, 20, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
  44. {375, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
  45. {400, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
  46. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  47. {375, 17, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
  48. };
  49. /* OPP LOW FREQUENCY for ES1.0 */
  50. static const struct dpll_params mpu_dpll_params_400mhz[NUM_SYS_CLKS] = {
  51. {200, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
  52. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
  53. {1000, 20, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
  54. {375, 8, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
  55. {400, 12, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
  56. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  57. {375, 17, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
  58. };
  59. /* OPP LOW FREQUENCY for ES2.0 */
  60. static const struct dpll_params mpu_dpll_params_499mhz[NUM_SYS_CLKS] = {
  61. {499, 11, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
  62. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
  63. {297, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
  64. {493, 18, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
  65. {499, 25, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
  66. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  67. {493, 37, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
  68. };
  69. /* OPP NOM FREQUENCY for OMAP5 ES2.0, and DRA7 ES1.0 */
  70. static const struct dpll_params mpu_dpll_params_1ghz[NUM_SYS_CLKS] = {
  71. {250, 2, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
  72. {500, 9, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 20 MHz */
  73. {119, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
  74. {625, 11, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
  75. {500, 12, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
  76. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  77. {625, 23, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 38.4 MHz */
  78. };
  79. static const struct dpll_params
  80. core_dpll_params_2128mhz_ddr532[NUM_SYS_CLKS] = {
  81. {266, 2, 2, 5, 8, 4, 62, 5, -1, 5, 7, -1}, /* 12 MHz */
  82. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
  83. {443, 6, 2, 5, 8, 4, 62, 5, -1, 5, 7, -1}, /* 16.8 MHz */
  84. {277, 4, 2, 5, 8, 4, 62, 5, -1, 5, 7, -1}, /* 19.2 MHz */
  85. {368, 8, 2, 5, 8, 4, 62, 5, -1, 5, 7, -1}, /* 26 MHz */
  86. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  87. {277, 9, 2, 5, 8, 4, 62, 5, -1, 5, 7, -1} /* 38.4 MHz */
  88. };
  89. static const struct dpll_params
  90. core_dpll_params_2128mhz_ddr532_es2[NUM_SYS_CLKS] = {
  91. {266, 2, 2, 5, 8, 4, 62, 63, 6, 5, 7, 6}, /* 12 MHz */
  92. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
  93. {443, 6, 2, 5, 8, 4, 62, 63, 6, 5, 7, 6}, /* 16.8 MHz */
  94. {277, 4, 2, 5, 8, 4, 62, 63, 6, 5, 7, 6}, /* 19.2 MHz */
  95. {368, 8, 2, 5, 8, 4, 62, 63, 6, 5, 7, 6}, /* 26 MHz */
  96. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  97. {277, 9, 2, 5, 8, 4, 62, 63, 6, 5, 7, 6} /* 38.4 MHz */
  98. };
  99. static const struct dpll_params
  100. core_dpll_params_2128mhz_dra7xx[NUM_SYS_CLKS] = {
  101. {266, 2, 2, 1, -1, 4, 62, 5, -1, 5, 4, 6}, /* 12 MHz */
  102. {266, 4, 2, 1, -1, 4, 62, 5, -1, 5, 4, 6}, /* 20 MHz */
  103. {443, 6, 2, 1, -1, 4, 62, 5, -1, 5, 4, 6}, /* 16.8 MHz */
  104. {277, 4, 2, 1, -1, 4, 62, 5, -1, 5, 4, 6}, /* 19.2 MHz */
  105. {368, 8, 2, 1, -1, 4, 62, 5, -1, 5, 4, 6}, /* 26 MHz */
  106. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  107. {277, 9, 2, 1, -1, 4, 62, 5, -1, 5, 4, 6}, /* 38.4 MHz */
  108. };
  109. static const struct dpll_params
  110. core_dpll_params_2128mhz_ddr266[NUM_SYS_CLKS] = {
  111. {266, 2, 4, 8, 8, 8, 62, 10, -1, 10, 14, -1}, /* 12 MHz */
  112. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
  113. {443, 6, 4, 8, 8, 8, 62, 10, -1, 10, 14, -1}, /* 16.8 MHz */
  114. {277, 4, 4, 8, 8, 8, 62, 10, -1, 10, 14, -1}, /* 19.2 MHz */
  115. {368, 8, 4, 8, 8, 8, 62, 10, -1, 10, 14, -1}, /* 26 MHz */
  116. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  117. {277, 9, 4, 8, 8, 8, 62, 10, -1, 10, 14, -1} /* 38.4 MHz */
  118. };
  119. static const struct dpll_params
  120. core_dpll_params_2128mhz_ddr266_es2[NUM_SYS_CLKS] = {
  121. {266, 2, 4, 8, 8, 8, 62, 5, 12, 10, 14, 12}, /* 12 MHz */
  122. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
  123. {443, 6, 4, 8, 8, 8, 62, 5, 12, 10, 14, 12}, /* 16.8 MHz */
  124. {277, 4, 4, 8, 8, 8, 62, 5, 12, 10, 14, 12}, /* 19.2 MHz */
  125. {368, 8, 4, 8, 8, 8, 62, 5, 12, 10, 14, 12}, /* 26 MHz */
  126. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  127. {277, 9, 4, 8, 8, 8, 62, 5, 12, 10, 14, 12} /* 38.4 MHz */
  128. };
  129. static const struct dpll_params per_dpll_params_768mhz[NUM_SYS_CLKS] = {
  130. {32, 0, 4, 3, 6, 4, -1, 2, -1, -1, -1, -1}, /* 12 MHz */
  131. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
  132. {160, 6, 4, 3, 6, 4, -1, 2, -1, -1, -1, -1}, /* 16.8 MHz */
  133. {20, 0, 4, 3, 6, 4, -1, 2, -1, -1, -1, -1}, /* 19.2 MHz */
  134. {192, 12, 4, 3, 6, 4, -1, 2, -1, -1, -1, -1}, /* 26 MHz */
  135. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  136. {10, 0, 4, 3, 6, 4, -1, 2, -1, -1, -1, -1} /* 38.4 MHz */
  137. };
  138. static const struct dpll_params per_dpll_params_768mhz_es2[NUM_SYS_CLKS] = {
  139. {32, 0, 4, 3, 3, 4, -1, 2, -1, -1, -1, -1}, /* 12 MHz */
  140. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
  141. {160, 6, 4, 3, 3, 4, -1, 2, -1, -1, -1, -1}, /* 16.8 MHz */
  142. {20, 0, 4, 3, 3, 4, -1, 2, -1, -1, -1, -1}, /* 19.2 MHz */
  143. {192, 12, 4, 3, 3, 4, -1, 2, -1, -1, -1, -1}, /* 26 MHz */
  144. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  145. {10, 0, 4, 3, 3, 4, -1, 2, -1, -1, -1, -1} /* 38.4 MHz */
  146. };
  147. static const struct dpll_params per_dpll_params_768mhz_dra7xx[NUM_SYS_CLKS] = {
  148. {32, 0, 4, 1, 3, 4, 4, 2, -1, -1, -1, -1}, /* 12 MHz */
  149. {96, 4, 4, 1, 3, 4, 4, 2, -1, -1, -1, -1}, /* 20 MHz */
  150. {160, 6, 4, 1, 3, 4, 4, 2, -1, -1, -1, -1}, /* 16.8 MHz */
  151. {20, 0, 4, 1, 3, 4, 4, 2, -1, -1, -1, -1}, /* 19.2 MHz */
  152. {192, 12, 4, 1, 3, 4, 4, 2, -1, -1, -1, -1}, /* 26 MHz */
  153. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  154. {10, 0, 4, 1, 3, 4, 4, 2, -1, -1, -1, -1}, /* 38.4 MHz */
  155. };
  156. static const struct dpll_params iva_dpll_params_2330mhz[NUM_SYS_CLKS] = {
  157. {1165, 11, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
  158. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
  159. {208, 2, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
  160. {182, 2, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
  161. {224, 4, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
  162. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  163. {91, 2, -1, -1, 5, 6, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
  164. };
  165. static const struct dpll_params iva_dpll_params_2330mhz_dra7xx[NUM_SYS_CLKS] = {
  166. {1165, 11, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
  167. {233, 3, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 20 MHz */
  168. {208, 2, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
  169. {182, 2, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
  170. {224, 4, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
  171. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  172. {91, 2, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 38.4 MHz */
  173. };
  174. /* ABE M & N values with sys_clk as source */
  175. static const struct dpll_params
  176. abe_dpll_params_sysclk_196608khz[NUM_SYS_CLKS] = {
  177. {49, 5, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
  178. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */
  179. {35, 5, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
  180. {46, 8, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
  181. {34, 8, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
  182. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  183. {64, 24, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */
  184. };
  185. /* ABE M & N values with 32K clock as source */
  186. static const struct dpll_params abe_dpll_params_32k_196608khz = {
  187. 750, 0, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1
  188. };
  189. /* ABE M & N values with sysclk2(22.5792 MHz) as input */
  190. static const struct dpll_params
  191. abe_dpll_params_sysclk2_361267khz[NUM_SYS_CLKS] = {
  192. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
  193. {16, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 20 MHz */
  194. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
  195. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
  196. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
  197. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  198. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 38.4 MHz */
  199. };
  200. static const struct dpll_params usb_dpll_params_1920mhz[NUM_SYS_CLKS] = {
  201. {400, 4, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
  202. {480, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 20 MHz */
  203. {400, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
  204. {400, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
  205. {480, 12, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
  206. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  207. {400, 15, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 38.4 MHz */
  208. };
  209. static const struct dpll_params ddr_dpll_params_2664mhz[NUM_SYS_CLKS] = {
  210. {111, 0, 2, 1, 8, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
  211. {333, 4, 2, 1, 8, -1, -1, -1, -1, -1, -1, -1}, /* 20 MHz */
  212. {555, 6, 2, 1, 8, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
  213. {555, 7, 2, 1, 8, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
  214. {666, 12, 2, 1, 8, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
  215. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  216. {555, 15, 2, 1, 8, -1, -1, -1, -1, -1, -1, -1}, /* 38.4 MHz */
  217. };
  218. static const struct dpll_params ddr_dpll_params_2128mhz[NUM_SYS_CLKS] = {
  219. {266, 2, 2, 1, 8, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */
  220. {266, 4, 2, 1, 8, -1, -1, -1, -1, -1, -1, -1}, /* 20 MHz */
  221. {190, 2, 2, 1, 8, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */
  222. {665, 11, 2, 1, 8, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */
  223. {532, 12, 2, 1, 8, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */
  224. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  225. {665, 23, 2, 1, 8, -1, -1, -1, -1, -1, -1, -1}, /* 38.4 MHz */
  226. };
  227. static const struct dpll_params gmac_dpll_params_2000mhz[NUM_SYS_CLKS] = {
  228. {250, 2, 4, 10, 40, 8, 10, -1, -1, -1, -1, -1}, /* 12 MHz */
  229. {250, 4, 4, 10, 40, 8, 10, -1, -1, -1, -1, -1}, /* 20 MHz */
  230. {119, 1, 4, 10, 40, 8, 10, -1, -1, -1, -1, -1}, /* 16.8 MHz */
  231. {625, 11, 4, 10, 40, 8, 10, -1, -1, -1, -1, -1}, /* 19.2 MHz */
  232. {500, 12, 4, 10, 40, 8, 10, -1, -1, -1, -1, -1}, /* 26 MHz */
  233. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */
  234. {625, 23, 4, 10, 40, 8, 10, -1, -1, -1, -1, -1}, /* 38.4 MHz */
  235. };
  236. struct dplls omap5_dplls_es1 = {
  237. .mpu = mpu_dpll_params_800mhz,
  238. .core = core_dpll_params_2128mhz_ddr532,
  239. .per = per_dpll_params_768mhz,
  240. .iva = iva_dpll_params_2330mhz,
  241. #ifdef CONFIG_SYS_OMAP_ABE_SYSCK
  242. .abe = abe_dpll_params_sysclk_196608khz,
  243. #else
  244. .abe = &abe_dpll_params_32k_196608khz,
  245. #endif
  246. .usb = usb_dpll_params_1920mhz,
  247. .ddr = NULL
  248. };
  249. struct dplls omap5_dplls_es2 = {
  250. .mpu = mpu_dpll_params_1ghz,
  251. .core = core_dpll_params_2128mhz_ddr532_es2,
  252. .per = per_dpll_params_768mhz_es2,
  253. .iva = iva_dpll_params_2330mhz,
  254. #ifdef CONFIG_SYS_OMAP_ABE_SYSCK
  255. .abe = abe_dpll_params_sysclk_196608khz,
  256. #else
  257. .abe = &abe_dpll_params_32k_196608khz,
  258. #endif
  259. .usb = usb_dpll_params_1920mhz,
  260. .ddr = NULL
  261. };
  262. struct dplls dra7xx_dplls = {
  263. .mpu = mpu_dpll_params_1ghz,
  264. .core = core_dpll_params_2128mhz_dra7xx,
  265. .per = per_dpll_params_768mhz_dra7xx,
  266. .abe = abe_dpll_params_sysclk2_361267khz,
  267. .iva = iva_dpll_params_2330mhz_dra7xx,
  268. .usb = usb_dpll_params_1920mhz,
  269. .ddr = ddr_dpll_params_2128mhz,
  270. .gmac = gmac_dpll_params_2000mhz,
  271. };
  272. struct dplls dra72x_dplls = {
  273. .mpu = mpu_dpll_params_1ghz,
  274. .core = core_dpll_params_2128mhz_dra7xx,
  275. .per = per_dpll_params_768mhz_dra7xx,
  276. .abe = abe_dpll_params_sysclk2_361267khz,
  277. .iva = iva_dpll_params_2330mhz_dra7xx,
  278. .usb = usb_dpll_params_1920mhz,
  279. .ddr = ddr_dpll_params_2664mhz,
  280. .gmac = gmac_dpll_params_2000mhz,
  281. };
  282. struct pmic_data palmas = {
  283. .base_offset = PALMAS_SMPS_BASE_VOLT_UV,
  284. .step = 10000, /* 10 mV represented in uV */
  285. /*
  286. * Offset codes 1-6 all give the base voltage in Palmas
  287. * Offset code 0 switches OFF the SMPS
  288. */
  289. .start_code = 6,
  290. .i2c_slave_addr = SMPS_I2C_SLAVE_ADDR,
  291. .pmic_bus_init = sri2c_init,
  292. .pmic_write = omap_vc_bypass_send_value,
  293. };
  294. /* The TPS659038 and TPS65917 are software-compatible, use common struct */
  295. struct pmic_data tps659038 = {
  296. .base_offset = PALMAS_SMPS_BASE_VOLT_UV,
  297. .step = 10000, /* 10 mV represented in uV */
  298. /*
  299. * Offset codes 1-6 all give the base voltage in Palmas
  300. * Offset code 0 switches OFF the SMPS
  301. */
  302. .start_code = 6,
  303. .i2c_slave_addr = TPS659038_I2C_SLAVE_ADDR,
  304. .pmic_bus_init = gpi2c_init,
  305. .pmic_write = palmas_i2c_write_u8,
  306. };
  307. struct vcores_data omap5430_volts = {
  308. .mpu.value = VDD_MPU,
  309. .mpu.addr = SMPS_REG_ADDR_12_MPU,
  310. .mpu.pmic = &palmas,
  311. .core.value = VDD_CORE,
  312. .core.addr = SMPS_REG_ADDR_8_CORE,
  313. .core.pmic = &palmas,
  314. .mm.value = VDD_MM,
  315. .mm.addr = SMPS_REG_ADDR_45_IVA,
  316. .mm.pmic = &palmas,
  317. };
  318. struct vcores_data omap5430_volts_es2 = {
  319. .mpu.value = VDD_MPU_ES2,
  320. .mpu.addr = SMPS_REG_ADDR_12_MPU,
  321. .mpu.pmic = &palmas,
  322. .mpu.abb_tx_done_mask = OMAP_ABB_MPU_TXDONE_MASK,
  323. .core.value = VDD_CORE_ES2,
  324. .core.addr = SMPS_REG_ADDR_8_CORE,
  325. .core.pmic = &palmas,
  326. .mm.value = VDD_MM_ES2,
  327. .mm.addr = SMPS_REG_ADDR_45_IVA,
  328. .mm.pmic = &palmas,
  329. .mm.abb_tx_done_mask = OMAP_ABB_MM_TXDONE_MASK,
  330. };
  331. /*
  332. * Enable essential clock domains, modules and
  333. * do some additional special settings needed
  334. */
  335. void enable_basic_clocks(void)
  336. {
  337. u32 const clk_domains_essential[] = {
  338. (*prcm)->cm_l4per_clkstctrl,
  339. (*prcm)->cm_l3init_clkstctrl,
  340. (*prcm)->cm_memif_clkstctrl,
  341. (*prcm)->cm_l4cfg_clkstctrl,
  342. #ifdef CONFIG_DRIVER_TI_CPSW
  343. (*prcm)->cm_gmac_clkstctrl,
  344. #endif
  345. 0
  346. };
  347. u32 const clk_modules_hw_auto_essential[] = {
  348. (*prcm)->cm_l3_gpmc_clkctrl,
  349. (*prcm)->cm_memif_emif_1_clkctrl,
  350. (*prcm)->cm_memif_emif_2_clkctrl,
  351. (*prcm)->cm_l4cfg_l4_cfg_clkctrl,
  352. (*prcm)->cm_wkup_gpio1_clkctrl,
  353. (*prcm)->cm_l4per_gpio2_clkctrl,
  354. (*prcm)->cm_l4per_gpio3_clkctrl,
  355. (*prcm)->cm_l4per_gpio4_clkctrl,
  356. (*prcm)->cm_l4per_gpio5_clkctrl,
  357. (*prcm)->cm_l4per_gpio6_clkctrl,
  358. (*prcm)->cm_l4per_gpio7_clkctrl,
  359. (*prcm)->cm_l4per_gpio8_clkctrl,
  360. 0
  361. };
  362. u32 const clk_modules_explicit_en_essential[] = {
  363. (*prcm)->cm_wkup_gptimer1_clkctrl,
  364. (*prcm)->cm_l3init_hsmmc1_clkctrl,
  365. (*prcm)->cm_l3init_hsmmc2_clkctrl,
  366. (*prcm)->cm_l4per_gptimer2_clkctrl,
  367. (*prcm)->cm_wkup_wdtimer2_clkctrl,
  368. (*prcm)->cm_l4per_uart3_clkctrl,
  369. (*prcm)->cm_l4per_i2c1_clkctrl,
  370. #ifdef CONFIG_DRIVER_TI_CPSW
  371. (*prcm)->cm_gmac_gmac_clkctrl,
  372. #endif
  373. #ifdef CONFIG_TI_QSPI
  374. (*prcm)->cm_l4per_qspi_clkctrl,
  375. #endif
  376. 0
  377. };
  378. /* Enable optional additional functional clock for GPIO4 */
  379. setbits_le32((*prcm)->cm_l4per_gpio4_clkctrl,
  380. GPIO4_CLKCTRL_OPTFCLKEN_MASK);
  381. /* Enable 96 MHz clock for MMC1 & MMC2 */
  382. setbits_le32((*prcm)->cm_l3init_hsmmc1_clkctrl,
  383. HSMMC_CLKCTRL_CLKSEL_MASK);
  384. setbits_le32((*prcm)->cm_l3init_hsmmc2_clkctrl,
  385. HSMMC_CLKCTRL_CLKSEL_MASK);
  386. /* Set the correct clock dividers for mmc */
  387. setbits_le32((*prcm)->cm_l3init_hsmmc1_clkctrl,
  388. HSMMC_CLKCTRL_CLKSEL_DIV_MASK);
  389. setbits_le32((*prcm)->cm_l3init_hsmmc2_clkctrl,
  390. HSMMC_CLKCTRL_CLKSEL_DIV_MASK);
  391. /* Select 32KHz clock as the source of GPTIMER1 */
  392. setbits_le32((*prcm)->cm_wkup_gptimer1_clkctrl,
  393. GPTIMER1_CLKCTRL_CLKSEL_MASK);
  394. do_enable_clocks(clk_domains_essential,
  395. clk_modules_hw_auto_essential,
  396. clk_modules_explicit_en_essential,
  397. 1);
  398. #ifdef CONFIG_TI_QSPI
  399. setbits_le32((*prcm)->cm_l4per_qspi_clkctrl, (1<<24));
  400. #endif
  401. /* Enable SCRM OPT clocks for PER and CORE dpll */
  402. setbits_le32((*prcm)->cm_wkupaon_scrm_clkctrl,
  403. OPTFCLKEN_SCRM_PER_MASK);
  404. setbits_le32((*prcm)->cm_wkupaon_scrm_clkctrl,
  405. OPTFCLKEN_SCRM_CORE_MASK);
  406. }
  407. void enable_basic_uboot_clocks(void)
  408. {
  409. u32 const clk_domains_essential[] = {
  410. #if defined(CONFIG_DRA7XX) || defined(CONFIG_AM57XX)
  411. (*prcm)->cm_ipu_clkstctrl,
  412. #endif
  413. 0
  414. };
  415. u32 const clk_modules_hw_auto_essential[] = {
  416. (*prcm)->cm_l3init_hsusbtll_clkctrl,
  417. 0
  418. };
  419. u32 const clk_modules_explicit_en_essential[] = {
  420. (*prcm)->cm_l4per_mcspi1_clkctrl,
  421. (*prcm)->cm_l4per_i2c2_clkctrl,
  422. (*prcm)->cm_l4per_i2c3_clkctrl,
  423. (*prcm)->cm_l4per_i2c4_clkctrl,
  424. #if defined(CONFIG_DRA7XX) || defined(CONFIG_AM57XX)
  425. (*prcm)->cm_ipu_i2c5_clkctrl,
  426. #else
  427. (*prcm)->cm_l4per_i2c5_clkctrl,
  428. #endif
  429. (*prcm)->cm_l3init_hsusbhost_clkctrl,
  430. (*prcm)->cm_l3init_fsusb_clkctrl,
  431. 0
  432. };
  433. do_enable_clocks(clk_domains_essential,
  434. clk_modules_hw_auto_essential,
  435. clk_modules_explicit_en_essential,
  436. 1);
  437. }
  438. #ifdef CONFIG_TI_EDMA3
  439. void enable_edma3_clocks(void)
  440. {
  441. u32 const clk_domains_edma3[] = {
  442. 0
  443. };
  444. u32 const clk_modules_hw_auto_edma3[] = {
  445. (*prcm)->cm_l3main1_tptc1_clkctrl,
  446. (*prcm)->cm_l3main1_tptc2_clkctrl,
  447. 0
  448. };
  449. u32 const clk_modules_explicit_en_edma3[] = {
  450. 0
  451. };
  452. do_enable_clocks(clk_domains_edma3,
  453. clk_modules_hw_auto_edma3,
  454. clk_modules_explicit_en_edma3,
  455. 1);
  456. }
  457. void disable_edma3_clocks(void)
  458. {
  459. u32 const clk_domains_edma3[] = {
  460. 0
  461. };
  462. u32 const clk_modules_disable_edma3[] = {
  463. (*prcm)->cm_l3main1_tptc1_clkctrl,
  464. (*prcm)->cm_l3main1_tptc2_clkctrl,
  465. 0
  466. };
  467. do_disable_clocks(clk_domains_edma3,
  468. clk_modules_disable_edma3,
  469. 1);
  470. }
  471. #endif
  472. #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
  473. void enable_usb_clocks(int index)
  474. {
  475. u32 cm_l3init_usb_otg_ss_clkctrl = 0;
  476. if (index == 0) {
  477. cm_l3init_usb_otg_ss_clkctrl =
  478. (*prcm)->cm_l3init_usb_otg_ss1_clkctrl;
  479. /* Enable 960 MHz clock for dwc3 */
  480. setbits_le32((*prcm)->cm_l3init_usb_otg_ss1_clkctrl,
  481. OPTFCLKEN_REFCLK960M);
  482. /* Enable 32 KHz clock for USB_PHY1 */
  483. setbits_le32((*prcm)->cm_coreaon_usb_phy1_core_clkctrl,
  484. USBPHY_CORE_CLKCTRL_OPTFCLKEN_CLK32K);
  485. /* Enable 32 KHz clock for USB_PHY3 */
  486. if (is_dra7xx())
  487. setbits_le32((*prcm)->cm_coreaon_usb_phy3_core_clkctrl,
  488. USBPHY_CORE_CLKCTRL_OPTFCLKEN_CLK32K);
  489. } else if (index == 1) {
  490. cm_l3init_usb_otg_ss_clkctrl =
  491. (*prcm)->cm_l3init_usb_otg_ss2_clkctrl;
  492. /* Enable 960 MHz clock for dwc3 */
  493. setbits_le32((*prcm)->cm_l3init_usb_otg_ss2_clkctrl,
  494. OPTFCLKEN_REFCLK960M);
  495. /* Enable 32 KHz clock for dwc3 */
  496. setbits_le32((*prcm)->cm_coreaon_usb_phy2_core_clkctrl,
  497. USBPHY_CORE_CLKCTRL_OPTFCLKEN_CLK32K);
  498. /* Enable 60 MHz clock for USB2PHY2 */
  499. setbits_le32((*prcm)->cm_coreaon_l3init_60m_gfclk_clkctrl,
  500. L3INIT_CLKCTRL_OPTFCLKEN_60M_GFCLK);
  501. }
  502. u32 const clk_domains_usb[] = {
  503. 0
  504. };
  505. u32 const clk_modules_hw_auto_usb[] = {
  506. (*prcm)->cm_l3init_ocp2scp1_clkctrl,
  507. cm_l3init_usb_otg_ss_clkctrl,
  508. 0
  509. };
  510. u32 const clk_modules_explicit_en_usb[] = {
  511. 0
  512. };
  513. do_enable_clocks(clk_domains_usb,
  514. clk_modules_hw_auto_usb,
  515. clk_modules_explicit_en_usb,
  516. 1);
  517. }
  518. void disable_usb_clocks(int index)
  519. {
  520. u32 cm_l3init_usb_otg_ss_clkctrl = 0;
  521. if (index == 0) {
  522. cm_l3init_usb_otg_ss_clkctrl =
  523. (*prcm)->cm_l3init_usb_otg_ss1_clkctrl;
  524. /* Disable 960 MHz clock for dwc3 */
  525. clrbits_le32((*prcm)->cm_l3init_usb_otg_ss1_clkctrl,
  526. OPTFCLKEN_REFCLK960M);
  527. /* Disable 32 KHz clock for USB_PHY1 */
  528. clrbits_le32((*prcm)->cm_coreaon_usb_phy1_core_clkctrl,
  529. USBPHY_CORE_CLKCTRL_OPTFCLKEN_CLK32K);
  530. /* Disable 32 KHz clock for USB_PHY3 */
  531. if (is_dra7xx())
  532. clrbits_le32((*prcm)->cm_coreaon_usb_phy3_core_clkctrl,
  533. USBPHY_CORE_CLKCTRL_OPTFCLKEN_CLK32K);
  534. } else if (index == 1) {
  535. cm_l3init_usb_otg_ss_clkctrl =
  536. (*prcm)->cm_l3init_usb_otg_ss2_clkctrl;
  537. /* Disable 960 MHz clock for dwc3 */
  538. clrbits_le32((*prcm)->cm_l3init_usb_otg_ss2_clkctrl,
  539. OPTFCLKEN_REFCLK960M);
  540. /* Disable 32 KHz clock for dwc3 */
  541. clrbits_le32((*prcm)->cm_coreaon_usb_phy2_core_clkctrl,
  542. USBPHY_CORE_CLKCTRL_OPTFCLKEN_CLK32K);
  543. /* Disable 60 MHz clock for USB2PHY2 */
  544. clrbits_le32((*prcm)->cm_coreaon_l3init_60m_gfclk_clkctrl,
  545. L3INIT_CLKCTRL_OPTFCLKEN_60M_GFCLK);
  546. }
  547. u32 const clk_domains_usb[] = {
  548. 0
  549. };
  550. u32 const clk_modules_disable[] = {
  551. (*prcm)->cm_l3init_ocp2scp1_clkctrl,
  552. cm_l3init_usb_otg_ss_clkctrl,
  553. 0
  554. };
  555. do_disable_clocks(clk_domains_usb,
  556. clk_modules_disable,
  557. 1);
  558. }
  559. #endif
  560. const struct ctrl_ioregs ioregs_omap5430 = {
  561. .ctrl_ddrch = DDR_IO_I_34OHM_SR_FASTEST_WD_DQ_NO_PULL_DQS_PULL_DOWN,
  562. .ctrl_lpddr2ch = DDR_IO_I_34OHM_SR_FASTEST_WD_CK_CKE_NCS_CA_PULL_DOWN,
  563. .ctrl_ddrio_0 = DDR_IO_0_DDR2_DQ_INT_EN_ALL_DDR3_CA_DIS_ALL,
  564. .ctrl_ddrio_1 = DDR_IO_1_DQ_OUT_EN_ALL_DQ_INT_EN_ALL,
  565. .ctrl_ddrio_2 = DDR_IO_2_CA_OUT_EN_ALL_CA_INT_EN_ALL,
  566. };
  567. const struct ctrl_ioregs ioregs_omap5432_es1 = {
  568. .ctrl_ddrch = DDR_IO_I_40OHM_SR_FAST_WD_DQ_NO_PULL_DQS_NO_PULL,
  569. .ctrl_lpddr2ch = 0x0,
  570. .ctrl_ddr3ch = DDR_IO_I_40OHM_SR_SLOWEST_WD_DQ_NO_PULL_DQS_NO_PULL,
  571. .ctrl_ddrio_0 = DDR_IO_0_VREF_CELLS_DDR3_VALUE,
  572. .ctrl_ddrio_1 = DDR_IO_1_VREF_CELLS_DDR3_VALUE,
  573. .ctrl_ddrio_2 = DDR_IO_2_VREF_CELLS_DDR3_VALUE,
  574. .ctrl_emif_sdram_config_ext = SDRAM_CONFIG_EXT_RD_LVL_11_SAMPLES,
  575. .ctrl_emif_sdram_config_ext_final = SDRAM_CONFIG_EXT_RD_LVL_4_SAMPLES,
  576. };
  577. const struct ctrl_ioregs ioregs_omap5432_es2 = {
  578. .ctrl_ddrch = DDR_IO_I_40OHM_SR_FAST_WD_DQ_NO_PULL_DQS_NO_PULL_ES2,
  579. .ctrl_lpddr2ch = 0x0,
  580. .ctrl_ddr3ch = DDR_IO_I_40OHM_SR_SLOWEST_WD_DQ_NO_PULL_DQS_NO_PULL_ES2,
  581. .ctrl_ddrio_0 = DDR_IO_0_VREF_CELLS_DDR3_VALUE_ES2,
  582. .ctrl_ddrio_1 = DDR_IO_1_VREF_CELLS_DDR3_VALUE_ES2,
  583. .ctrl_ddrio_2 = DDR_IO_2_VREF_CELLS_DDR3_VALUE_ES2,
  584. .ctrl_emif_sdram_config_ext = SDRAM_CONFIG_EXT_RD_LVL_11_SAMPLES,
  585. .ctrl_emif_sdram_config_ext_final = SDRAM_CONFIG_EXT_RD_LVL_4_SAMPLES,
  586. };
  587. const struct ctrl_ioregs ioregs_dra7xx_es1 = {
  588. .ctrl_ddrch = 0x40404040,
  589. .ctrl_lpddr2ch = 0x40404040,
  590. .ctrl_ddr3ch = 0x80808080,
  591. .ctrl_ddrio_0 = 0x00094A40,
  592. .ctrl_ddrio_1 = 0x04A52000,
  593. .ctrl_ddrio_2 = 0x84210000,
  594. .ctrl_emif_sdram_config_ext = 0x0001C1A7,
  595. .ctrl_emif_sdram_config_ext_final = 0x0001C1A7,
  596. .ctrl_ddr_ctrl_ext_0 = 0xA2000000,
  597. };
  598. const struct ctrl_ioregs ioregs_dra72x_es1 = {
  599. .ctrl_ddrch = 0x40404040,
  600. .ctrl_lpddr2ch = 0x40404040,
  601. .ctrl_ddr3ch = 0x60606080,
  602. .ctrl_ddrio_0 = 0x00094A40,
  603. .ctrl_ddrio_1 = 0x04A52000,
  604. .ctrl_ddrio_2 = 0x84210000,
  605. .ctrl_emif_sdram_config_ext = 0x0001C1A7,
  606. .ctrl_emif_sdram_config_ext_final = 0x0001C1A7,
  607. .ctrl_ddr_ctrl_ext_0 = 0xA2000000,
  608. };
  609. const struct ctrl_ioregs ioregs_dra72x_es2 = {
  610. .ctrl_ddrch = 0x40404040,
  611. .ctrl_lpddr2ch = 0x40404040,
  612. .ctrl_ddr3ch = 0x60606060,
  613. .ctrl_ddrio_0 = 0x00094A40,
  614. .ctrl_ddrio_1 = 0x00000000,
  615. .ctrl_ddrio_2 = 0x00000000,
  616. .ctrl_emif_sdram_config_ext = 0x0001C1A7,
  617. .ctrl_emif_sdram_config_ext_final = 0x0001C1A7,
  618. .ctrl_ddr_ctrl_ext_0 = 0xA2000000,
  619. };
  620. void __weak hw_data_init(void)
  621. {
  622. u32 omap_rev = omap_revision();
  623. switch (omap_rev) {
  624. case OMAP5430_ES1_0:
  625. case OMAP5432_ES1_0:
  626. *prcm = &omap5_es1_prcm;
  627. *dplls_data = &omap5_dplls_es1;
  628. *omap_vcores = &omap5430_volts;
  629. *ctrl = &omap5_ctrl;
  630. break;
  631. case OMAP5430_ES2_0:
  632. case OMAP5432_ES2_0:
  633. *prcm = &omap5_es2_prcm;
  634. *dplls_data = &omap5_dplls_es2;
  635. *omap_vcores = &omap5430_volts_es2;
  636. *ctrl = &omap5_ctrl;
  637. break;
  638. case DRA752_ES1_0:
  639. case DRA752_ES1_1:
  640. case DRA752_ES2_0:
  641. *prcm = &dra7xx_prcm;
  642. *dplls_data = &dra7xx_dplls;
  643. *ctrl = &dra7xx_ctrl;
  644. break;
  645. case DRA722_ES1_0:
  646. case DRA722_ES2_0:
  647. *prcm = &dra7xx_prcm;
  648. *dplls_data = &dra72x_dplls;
  649. *ctrl = &dra7xx_ctrl;
  650. break;
  651. default:
  652. printf("\n INVALID OMAP REVISION ");
  653. }
  654. }
  655. void get_ioregs(const struct ctrl_ioregs **regs)
  656. {
  657. u32 omap_rev = omap_revision();
  658. switch (omap_rev) {
  659. case OMAP5430_ES1_0:
  660. case OMAP5430_ES2_0:
  661. *regs = &ioregs_omap5430;
  662. break;
  663. case OMAP5432_ES1_0:
  664. *regs = &ioregs_omap5432_es1;
  665. break;
  666. case OMAP5432_ES2_0:
  667. *regs = &ioregs_omap5432_es2;
  668. break;
  669. case DRA752_ES1_0:
  670. case DRA752_ES1_1:
  671. case DRA752_ES2_0:
  672. *regs = &ioregs_dra7xx_es1;
  673. break;
  674. case DRA722_ES1_0:
  675. *regs = &ioregs_dra72x_es1;
  676. break;
  677. case DRA722_ES2_0:
  678. *regs = &ioregs_dra72x_es2;
  679. break;
  680. default:
  681. printf("\n INVALID OMAP REVISION ");
  682. }
  683. }