emif.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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> for OMAP4
  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. #define print_timing_reg(reg) debug(#reg" - 0x%08x\n", (reg))
  16. static u32 *const T_num = (u32 *)OMAP_SRAM_SCRATCH_EMIF_T_NUM;
  17. static u32 *const T_den = (u32 *)OMAP_SRAM_SCRATCH_EMIF_T_DEN;
  18. #endif
  19. #ifdef CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS
  20. /* Base AC Timing values specified by JESD209-2 for 532MHz operation */
  21. static const struct lpddr2_ac_timings timings_jedec_532_mhz = {
  22. .max_freq = 532000000,
  23. .RL = 8,
  24. .tRPab = 21,
  25. .tRCD = 18,
  26. .tWR = 15,
  27. .tRASmin = 42,
  28. .tRRD = 10,
  29. .tWTRx2 = 15,
  30. .tXSR = 140,
  31. .tXPx2 = 15,
  32. .tRFCab = 130,
  33. .tRTPx2 = 15,
  34. .tCKE = 3,
  35. .tCKESR = 15,
  36. .tZQCS = 90,
  37. .tZQCL = 360,
  38. .tZQINIT = 1000,
  39. .tDQSCKMAXx2 = 11,
  40. .tRASmax = 70,
  41. .tFAW = 50
  42. };
  43. /*
  44. * Min tCK values specified by JESD209-2
  45. * Min tCK specifies the minimum duration of some AC timing parameters in terms
  46. * of the number of cycles. If the calculated number of cycles based on the
  47. * absolute time value is less than the min tCK value, min tCK value should
  48. * be used instead. This typically happens at low frequencies.
  49. */
  50. static const struct lpddr2_min_tck min_tck_jedec = {
  51. .tRL = 3,
  52. .tRP_AB = 3,
  53. .tRCD = 3,
  54. .tWR = 3,
  55. .tRAS_MIN = 3,
  56. .tRRD = 2,
  57. .tWTR = 2,
  58. .tXP = 2,
  59. .tRTP = 2,
  60. .tCKE = 3,
  61. .tCKESR = 3,
  62. .tFAW = 8
  63. };
  64. static const struct lpddr2_ac_timings const*
  65. jedec_ac_timings[MAX_NUM_SPEEDBINS] = {
  66. &timings_jedec_532_mhz
  67. };
  68. static const struct lpddr2_device_timings jedec_default_timings = {
  69. .ac_timings = jedec_ac_timings,
  70. .min_tck = &min_tck_jedec
  71. };
  72. void emif_get_device_timings(u32 emif_nr,
  73. const struct lpddr2_device_timings **cs0_device_timings,
  74. const struct lpddr2_device_timings **cs1_device_timings)
  75. {
  76. /* Assume Identical devices on EMIF1 & EMIF2 */
  77. *cs0_device_timings = &jedec_default_timings;
  78. *cs1_device_timings = NULL;
  79. }
  80. #endif /* CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS */