sdram_elpida.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /*
  2. * Timing and Organization details of the Elpida parts used in OMAP5
  3. * EVM
  4. *
  5. * (C) Copyright 2010
  6. * Texas Instruments, <www.ti.com>
  7. *
  8. * Aneesh V <aneesh@ti.com>
  9. * Sricharan R <r.sricharan@ti.com>
  10. *
  11. * See file CREDITS for list of people who contributed to this
  12. * project.
  13. *
  14. * This program is free software; you can redistribute it and/or
  15. * modify it under the terms of the GNU General Public License as
  16. * published by the Free Software Foundation; either version 2 of
  17. * the License, or (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, write to the Free Software
  26. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  27. * MA 02111-1307 USA
  28. */
  29. #include <asm/emif.h>
  30. #include <asm/arch/sys_proto.h>
  31. /*
  32. * This file provides details of the LPDDR2 SDRAM parts used on OMAP5
  33. * EVM. Since the parts used and geometry are identical for
  34. * evm for a given OMAP5 revision, this information is kept
  35. * here instead of being in board directory. However the key functions
  36. * exported are weakly linked so that they can be over-ridden in the board
  37. * directory if there is a OMAP5 board in the future that uses a different
  38. * memory device or geometry.
  39. *
  40. * For any new board with different memory devices over-ride one or more
  41. * of the following functions as per the CONFIG flags you intend to enable:
  42. * - emif_get_reg_dump()
  43. * - emif_get_dmm_regs()
  44. * - emif_get_device_details()
  45. * - emif_get_device_timings()
  46. */
  47. #ifdef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS
  48. const struct emif_regs emif_regs_elpida_532_mhz_1cs = {
  49. .sdram_config_init = 0x80801aB2,
  50. .sdram_config = 0x808022B2,
  51. .ref_ctrl = 0x0000081A,
  52. .sdram_tim1 = 0x772F6873,
  53. .sdram_tim2 = 0x304A129A,
  54. .sdram_tim3 = 0x02F7E45F,
  55. .read_idle_ctrl = 0x00050000,
  56. .zq_config = 0x000B3215,
  57. .temp_alert_config = 0x08000A05,
  58. .emif_ddr_phy_ctlr_1_init = 0x0E38200D,
  59. .emif_ddr_phy_ctlr_1 = 0x0E38200D
  60. };
  61. const struct dmm_lisa_map_regs lisa_map_4G_x_1_x_2 = {
  62. .dmm_lisa_map_0 = 0xFF020100,
  63. .dmm_lisa_map_1 = 0,
  64. .dmm_lisa_map_2 = 0,
  65. .dmm_lisa_map_3 = 0x80640300
  66. };
  67. static void emif_get_reg_dump_sdp(u32 emif_nr, const struct emif_regs **regs)
  68. {
  69. *regs = &emif_regs_elpida_532_mhz_1cs;
  70. }
  71. void emif_get_reg_dump(u32 emif_nr, const struct emif_regs **regs)
  72. __attribute__((weak, alias("emif_get_reg_dump_sdp")));
  73. static void emif_get_dmm_regs_sdp(const struct dmm_lisa_map_regs
  74. **dmm_lisa_regs)
  75. {
  76. *dmm_lisa_regs = &lisa_map_4G_x_1_x_2;
  77. }
  78. void emif_get_dmm_regs(const struct dmm_lisa_map_regs **dmm_lisa_regs)
  79. __attribute__((weak, alias("emif_get_dmm_regs_sdp")));
  80. #else
  81. static const struct lpddr2_device_details elpida_4G_S4_details = {
  82. .type = LPDDR2_TYPE_S4,
  83. .density = LPDDR2_DENSITY_4Gb,
  84. .io_width = LPDDR2_IO_WIDTH_32,
  85. .manufacturer = LPDDR2_MANUFACTURER_ELPIDA
  86. };
  87. static void emif_get_device_details_sdp(u32 emif_nr,
  88. struct lpddr2_device_details *cs0_device_details,
  89. struct lpddr2_device_details *cs1_device_details)
  90. {
  91. /* EMIF1 & EMIF2 have identical configuration */
  92. *cs0_device_details = elpida_4G_S4_details;
  93. /* Nothing is conected on cs1 */
  94. cs1_device_details = NULL;
  95. }
  96. void emif_get_device_details(u32 emif_nr,
  97. struct lpddr2_device_details *cs0_device_details,
  98. struct lpddr2_device_details *cs1_device_details)
  99. __attribute__((weak, alias("emif_get_device_details_sdp")));
  100. #endif /* CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS */
  101. #ifndef CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS
  102. static const struct lpddr2_ac_timings timings_jedec_532_mhz = {
  103. .max_freq = 532000000,
  104. .RL = 8,
  105. .tRPab = 21,
  106. .tRCD = 18,
  107. .tWR = 15,
  108. .tRASmin = 42,
  109. .tRRD = 10,
  110. .tWTRx2 = 15,
  111. .tXSR = 140,
  112. .tXPx2 = 15,
  113. .tRFCab = 130,
  114. .tRTPx2 = 15,
  115. .tCKE = 3,
  116. .tCKESR = 15,
  117. .tZQCS = 90,
  118. .tZQCL = 360,
  119. .tZQINIT = 1000,
  120. .tDQSCKMAXx2 = 11,
  121. .tRASmax = 70,
  122. .tFAW = 50
  123. };
  124. static const struct lpddr2_min_tck min_tck_elpida = {
  125. .tRL = 3,
  126. .tRP_AB = 3,
  127. .tRCD = 3,
  128. .tWR = 3,
  129. .tRAS_MIN = 3,
  130. .tRRD = 2,
  131. .tWTR = 2,
  132. .tXP = 2,
  133. .tRTP = 2,
  134. .tCKE = 3,
  135. .tCKESR = 3,
  136. .tFAW = 8
  137. };
  138. static const struct lpddr2_ac_timings *elpida_ac_timings[MAX_NUM_SPEEDBINS] = {
  139. &timings_jedec_532_mhz
  140. };
  141. static const struct lpddr2_device_timings elpida_4G_S4_timings = {
  142. .ac_timings = elpida_ac_timings,
  143. .min_tck = &min_tck_elpida,
  144. };
  145. void emif_get_device_timings_sdp(u32 emif_nr,
  146. const struct lpddr2_device_timings **cs0_device_timings,
  147. const struct lpddr2_device_timings **cs1_device_timings)
  148. {
  149. /* Identical devices on EMIF1 & EMIF2 */
  150. *cs0_device_timings = &elpida_4G_S4_timings;
  151. *cs1_device_timings = NULL;
  152. }
  153. void emif_get_device_timings(u32 emif_nr,
  154. const struct lpddr2_device_timings **cs0_device_timings,
  155. const struct lpddr2_device_timings **cs1_device_timings)
  156. __attribute__((weak, alias("emif_get_device_timings_sdp")));
  157. #endif /* CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS */