emif.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * EMIF programming
  4. *
  5. * (C) Copyright 2010
  6. * Texas Instruments, <www.ti.com>
  7. *
  8. * Aneesh V <aneesh@ti.com>
  9. */
  10. #include <common.h>
  11. #include <asm/emif.h>
  12. #include <asm/arch/sys_proto.h>
  13. #include <asm/utils.h>
  14. #ifndef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS
  15. u32 *const T_num = (u32 *)OMAP_SRAM_SCRATCH_EMIF_T_NUM;
  16. u32 *const T_den = (u32 *)OMAP_SRAM_SCRATCH_EMIF_T_DEN;
  17. #endif
  18. #ifdef CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS
  19. /* Base AC Timing values specified by JESD209-2 for 400MHz operation */
  20. static const struct lpddr2_ac_timings timings_jedec_400_mhz = {
  21. .max_freq = 400000000,
  22. .RL = 6,
  23. .tRPab = 21,
  24. .tRCD = 18,
  25. .tWR = 15,
  26. .tRASmin = 42,
  27. .tRRD = 10,
  28. .tWTRx2 = 15,
  29. .tXSR = 140,
  30. .tXPx2 = 15,
  31. .tRFCab = 130,
  32. .tRTPx2 = 15,
  33. .tCKE = 3,
  34. .tCKESR = 15,
  35. .tZQCS = 90,
  36. .tZQCL = 360,
  37. .tZQINIT = 1000,
  38. .tDQSCKMAXx2 = 11,
  39. .tRASmax = 70,
  40. .tFAW = 50
  41. };
  42. /* Base AC Timing values specified by JESD209-2 for 200 MHz operation */
  43. static const struct lpddr2_ac_timings timings_jedec_200_mhz = {
  44. .max_freq = 200000000,
  45. .RL = 3,
  46. .tRPab = 21,
  47. .tRCD = 18,
  48. .tWR = 15,
  49. .tRASmin = 42,
  50. .tRRD = 10,
  51. .tWTRx2 = 20,
  52. .tXSR = 140,
  53. .tXPx2 = 15,
  54. .tRFCab = 130,
  55. .tRTPx2 = 15,
  56. .tCKE = 3,
  57. .tCKESR = 15,
  58. .tZQCS = 90,
  59. .tZQCL = 360,
  60. .tZQINIT = 1000,
  61. .tDQSCKMAXx2 = 11,
  62. .tRASmax = 70,
  63. .tFAW = 50
  64. };
  65. /*
  66. * Min tCK values specified by JESD209-2
  67. * Min tCK specifies the minimum duration of some AC timing parameters in terms
  68. * of the number of cycles. If the calculated number of cycles based on the
  69. * absolute time value is less than the min tCK value, min tCK value should
  70. * be used instead. This typically happens at low frequencies.
  71. */
  72. static const struct lpddr2_min_tck min_tck_jedec = {
  73. .tRL = 3,
  74. .tRP_AB = 3,
  75. .tRCD = 3,
  76. .tWR = 3,
  77. .tRAS_MIN = 3,
  78. .tRRD = 2,
  79. .tWTR = 2,
  80. .tXP = 2,
  81. .tRTP = 2,
  82. .tCKE = 3,
  83. .tCKESR = 3,
  84. .tFAW = 8
  85. };
  86. static const struct lpddr2_ac_timings *jedec_ac_timings[MAX_NUM_SPEEDBINS] = {
  87. &timings_jedec_200_mhz,
  88. &timings_jedec_400_mhz
  89. };
  90. const struct lpddr2_device_timings jedec_default_timings = {
  91. .ac_timings = jedec_ac_timings,
  92. .min_tck = &min_tck_jedec
  93. };
  94. void emif_get_device_timings(u32 emif_nr,
  95. const struct lpddr2_device_timings **cs0_device_timings,
  96. const struct lpddr2_device_timings **cs1_device_timings)
  97. {
  98. /* Assume Identical devices on EMIF1 & EMIF2 */
  99. *cs0_device_timings = &jedec_default_timings;
  100. *cs1_device_timings = &jedec_default_timings;
  101. }
  102. #endif /* CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS */