spl.c 5.5 KB

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