spl.c 5.7 KB

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