spl.c 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. /*
  2. * SPL data and initialization for CompuLab CL-SOM-AM57x board
  3. *
  4. * (C) Copyright 2016 CompuLab, Ltd. http://compulab.co.il/
  5. *
  6. * Author: Uri Mashiach <uri.mashiach@compulab.co.il>
  7. *
  8. * SPDX-License-Identifier: GPL-2.0+
  9. */
  10. #include <asm/emif.h>
  11. #include <asm/omap_common.h>
  12. #include <asm/arch/sys_proto.h>
  13. static const struct dmm_lisa_map_regs cl_som_am57x_lisa_regs = {
  14. .dmm_lisa_map_3 = 0x80740300,
  15. .is_ma_present = 0x1
  16. };
  17. void emif_get_dmm_regs(const struct dmm_lisa_map_regs **dmm_lisa_regs)
  18. {
  19. /* Disable SDRAM controller EMIF2 for single core SOC */
  20. *dmm_lisa_regs = &cl_som_am57x_lisa_regs;
  21. if (omap_revision() == DRA722_ES1_0) {
  22. ((struct dmm_lisa_map_regs *) *dmm_lisa_regs)->dmm_lisa_map_3 =
  23. 0x80640100;
  24. }
  25. }
  26. static const struct emif_regs cl_som_am57x_emif1_ddr3_532mhz_emif_regs = {
  27. .sdram_config_init = 0x61852332,
  28. .sdram_config = 0x61852332,
  29. .sdram_config2 = 0x00000000,
  30. .ref_ctrl = 0x000040f1,
  31. .ref_ctrl_final = 0x00001040,
  32. .sdram_tim1 = 0xeeef36f3,
  33. .sdram_tim2 = 0x348f7fda,
  34. .sdram_tim3 = 0x027f88a8,
  35. .read_idle_ctrl = 0x00050000,
  36. .zq_config = 0x1007190b,
  37. .temp_alert_config = 0x00000000,
  38. .emif_ddr_phy_ctlr_1_init = 0x0034400b,
  39. .emif_ddr_phy_ctlr_1 = 0x0e34400b,
  40. .emif_ddr_ext_phy_ctrl_1 = 0x04040100,
  41. .emif_ddr_ext_phy_ctrl_2 = 0x00740074,
  42. .emif_ddr_ext_phy_ctrl_3 = 0x00780078,
  43. .emif_ddr_ext_phy_ctrl_4 = 0x007c007c,
  44. .emif_ddr_ext_phy_ctrl_5 = 0x007b007b,
  45. .emif_rd_wr_lvl_rmp_win = 0x00000000,
  46. .emif_rd_wr_lvl_rmp_ctl = 0x80000000,
  47. .emif_rd_wr_lvl_ctl = 0x00000000,
  48. .emif_rd_wr_exec_thresh = 0x00000305
  49. };
  50. /* Ext phy ctrl regs 1-35 */
  51. static const u32 cl_som_am57x_emif1_ddr3_ext_phy_ctrl_regs[] = {
  52. 0x10040100,
  53. 0x00740074,
  54. 0x00780078,
  55. 0x007c007c,
  56. 0x007b007b,
  57. 0x00800080,
  58. 0x00360036,
  59. 0x00340034,
  60. 0x00360036,
  61. 0x00350035,
  62. 0x00350035,
  63. 0x01ff01ff,
  64. 0x01ff01ff,
  65. 0x01ff01ff,
  66. 0x01ff01ff,
  67. 0x01ff01ff,
  68. 0x00430043,
  69. 0x003e003e,
  70. 0x004a004a,
  71. 0x00470047,
  72. 0x00400040,
  73. 0x00000000,
  74. 0x00600020,
  75. 0x40011080,
  76. 0x08102040,
  77. 0x00400040,
  78. 0x00400040,
  79. 0x00400040,
  80. 0x00400040,
  81. 0x00400040,
  82. 0x0,
  83. 0x0,
  84. 0x0,
  85. 0x0,
  86. 0x0
  87. };
  88. static const struct emif_regs cl_som_am57x_emif2_ddr3_532mhz_emif_regs = {
  89. .sdram_config_init = 0x61852332,
  90. .sdram_config = 0x61852332,
  91. .sdram_config2 = 0x00000000,
  92. .ref_ctrl = 0x000040f1,
  93. .ref_ctrl_final = 0x00001040,
  94. .sdram_tim1 = 0xeeef36f3,
  95. .sdram_tim2 = 0x348f7fda,
  96. .sdram_tim3 = 0x027f88a8,
  97. .read_idle_ctrl = 0x00050000,
  98. .zq_config = 0x1007190b,
  99. .temp_alert_config = 0x00000000,
  100. .emif_ddr_phy_ctlr_1_init = 0x0034400b,
  101. .emif_ddr_phy_ctlr_1 = 0x0e34400b,
  102. .emif_ddr_ext_phy_ctrl_1 = 0x04040100,
  103. .emif_ddr_ext_phy_ctrl_2 = 0x00740074,
  104. .emif_ddr_ext_phy_ctrl_3 = 0x00780078,
  105. .emif_ddr_ext_phy_ctrl_4 = 0x007c007c,
  106. .emif_ddr_ext_phy_ctrl_5 = 0x007b007b,
  107. .emif_rd_wr_lvl_rmp_win = 0x00000000,
  108. .emif_rd_wr_lvl_rmp_ctl = 0x80000000,
  109. .emif_rd_wr_lvl_ctl = 0x00000000,
  110. .emif_rd_wr_exec_thresh = 0x00000305
  111. };
  112. static const u32 cl_som_am57x_emif2_ddr3_ext_phy_ctrl_regs[] = {
  113. 0x10040100,
  114. 0x00820082,
  115. 0x008b008b,
  116. 0x00800080,
  117. 0x007e007e,
  118. 0x00800080,
  119. 0x00370037,
  120. 0x00390039,
  121. 0x00360036,
  122. 0x00370037,
  123. 0x00350035,
  124. 0x01ff01ff,
  125. 0x01ff01ff,
  126. 0x01ff01ff,
  127. 0x01ff01ff,
  128. 0x01ff01ff,
  129. 0x00540054,
  130. 0x00540054,
  131. 0x004e004e,
  132. 0x004c004c,
  133. 0x00400040,
  134. 0x00000000,
  135. 0x00600020,
  136. 0x40011080,
  137. 0x08102040,
  138. 0x00400040,
  139. 0x00400040,
  140. 0x00400040,
  141. 0x00400040,
  142. 0x00400040,
  143. 0x0,
  144. 0x0,
  145. 0x0,
  146. 0x0,
  147. 0x0
  148. };
  149. static struct vcores_data cl_som_am57x_volts = {
  150. .mpu.value[OPP_NOM] = VDD_MPU_DRA7_NOM,
  151. .mpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_MPU_NOM,
  152. .mpu.efuse.reg_bits = DRA752_EFUSE_REGBITS,
  153. .mpu.addr = TPS659038_REG_ADDR_SMPS12,
  154. .mpu.pmic = &tps659038,
  155. .eve.value[OPP_NOM] = VDD_EVE_DRA7_NOM,
  156. .eve.value[OPP_OD] = VDD_EVE_DRA7_OD,
  157. .eve.value[OPP_HIGH] = VDD_EVE_DRA7_HIGH,
  158. .eve.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_DSPEVE_NOM,
  159. .eve.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_DSPEVE_OD,
  160. .eve.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_DSPEVE_HIGH,
  161. .eve.efuse.reg_bits = DRA752_EFUSE_REGBITS,
  162. .eve.addr = TPS659038_REG_ADDR_SMPS45,
  163. .eve.pmic = &tps659038,
  164. .gpu.value[OPP_NOM] = VDD_GPU_DRA7_NOM,
  165. .gpu.value[OPP_OD] = VDD_GPU_DRA7_OD,
  166. .gpu.value[OPP_HIGH] = VDD_GPU_DRA7_HIGH,
  167. .gpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_GPU_NOM,
  168. .gpu.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_GPU_OD,
  169. .gpu.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_GPU_HIGH,
  170. .gpu.efuse.reg_bits = DRA752_EFUSE_REGBITS,
  171. .gpu.addr = TPS659038_REG_ADDR_SMPS6,
  172. .gpu.pmic = &tps659038,
  173. .core.value[OPP_NOM] = VDD_CORE_DRA7_NOM,
  174. .core.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_CORE_NOM,
  175. .core.efuse.reg_bits = DRA752_EFUSE_REGBITS,
  176. .core.addr = TPS659038_REG_ADDR_SMPS7,
  177. .core.pmic = &tps659038,
  178. .iva.value[OPP_NOM] = VDD_IVA_DRA7_NOM,
  179. .iva.value[OPP_OD] = VDD_IVA_DRA7_OD,
  180. .iva.value[OPP_HIGH] = VDD_IVA_DRA7_HIGH,
  181. .iva.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_IVA_NOM,
  182. .iva.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_IVA_OD,
  183. .iva.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_IVA_HIGH,
  184. .iva.efuse.reg_bits = DRA752_EFUSE_REGBITS,
  185. .iva.addr = TPS659038_REG_ADDR_SMPS8,
  186. .iva.pmic = &tps659038,
  187. };
  188. void hw_data_init(void)
  189. {
  190. *prcm = &dra7xx_prcm;
  191. *dplls_data = &dra7xx_dplls;
  192. *omap_vcores = &cl_som_am57x_volts;
  193. *ctrl = &dra7xx_ctrl;
  194. }
  195. void emif_get_reg_dump(u32 emif_nr, const struct emif_regs **regs)
  196. {
  197. switch (emif_nr) {
  198. case 1:
  199. *regs = &cl_som_am57x_emif1_ddr3_532mhz_emif_regs;
  200. break;
  201. case 2:
  202. *regs = &cl_som_am57x_emif2_ddr3_532mhz_emif_regs;
  203. break;
  204. }
  205. }
  206. void emif_get_ext_phy_ctrl_const_regs(u32 emif_nr, const u32 **regs, u32 *size)
  207. {
  208. switch (emif_nr) {
  209. case 1:
  210. *regs = cl_som_am57x_emif1_ddr3_ext_phy_ctrl_regs;
  211. *size = ARRAY_SIZE(cl_som_am57x_emif1_ddr3_ext_phy_ctrl_regs);
  212. break;
  213. case 2:
  214. *regs = cl_som_am57x_emif2_ddr3_ext_phy_ctrl_regs;
  215. *size = ARRAY_SIZE(cl_som_am57x_emif2_ddr3_ext_phy_ctrl_regs);
  216. break;
  217. }
  218. }