fsl_ddr_dimm_params.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * Copyright 2008-2014 Freescale Semiconductor, Inc.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0
  5. */
  6. #ifndef DDR2_DIMM_PARAMS_H
  7. #define DDR2_DIMM_PARAMS_H
  8. #define EDC_DATA_PARITY 1
  9. #define EDC_ECC 2
  10. #define EDC_AC_PARITY 4
  11. /* Parameters for a DDR dimm computed from the SPD */
  12. typedef struct dimm_params_s {
  13. /* DIMM organization parameters */
  14. char mpart[19]; /* guaranteed null terminated */
  15. unsigned int n_ranks;
  16. unsigned long long rank_density;
  17. unsigned long long capacity;
  18. unsigned int data_width;
  19. unsigned int primary_sdram_width;
  20. unsigned int ec_sdram_width;
  21. unsigned int registered_dimm;
  22. unsigned int device_width; /* x4, x8, x16 components */
  23. /* SDRAM device parameters */
  24. unsigned int n_row_addr;
  25. unsigned int n_col_addr;
  26. unsigned int edc_config; /* 0 = none, 1 = parity, 2 = ECC */
  27. #ifdef CONFIG_SYS_FSL_DDR4
  28. unsigned int bank_addr_bits;
  29. unsigned int bank_group_bits;
  30. #else
  31. unsigned int n_banks_per_sdram_device;
  32. #endif
  33. unsigned int burst_lengths_bitmask; /* BL=4 bit 2, BL=8 = bit 3 */
  34. unsigned int row_density;
  35. /* used in computing base address of DIMMs */
  36. unsigned long long base_address;
  37. /* mirrored DIMMs */
  38. unsigned int mirrored_dimm; /* only for ddr3 */
  39. /* DIMM timing parameters */
  40. int mtb_ps; /* medium timebase ps */
  41. int ftb_10th_ps; /* fine timebase, in 1/10 ps */
  42. int taa_ps; /* minimum CAS latency time */
  43. int tfaw_ps; /* four active window delay */
  44. /*
  45. * SDRAM clock periods
  46. * The range for these are 1000-10000 so a short should be sufficient
  47. */
  48. int tckmin_x_ps;
  49. int tckmin_x_minus_1_ps;
  50. int tckmin_x_minus_2_ps;
  51. int tckmax_ps;
  52. /* SPD-defined CAS latencies */
  53. unsigned int caslat_x;
  54. unsigned int caslat_x_minus_1;
  55. unsigned int caslat_x_minus_2;
  56. unsigned int caslat_lowest_derated; /* Derated CAS latency */
  57. /* basic timing parameters */
  58. int trcd_ps;
  59. int trp_ps;
  60. int tras_ps;
  61. #ifdef CONFIG_SYS_FSL_DDR4
  62. int trfc1_ps;
  63. int trfc2_ps;
  64. int trfc4_ps;
  65. int trrds_ps;
  66. int trrdl_ps;
  67. int tccdl_ps;
  68. #else
  69. int twr_ps; /* maximum = 63750 ps */
  70. int trfc_ps; /* max = 255 ns + 256 ns + .75 ns
  71. = 511750 ps */
  72. int trrd_ps; /* maximum = 63750 ps */
  73. int twtr_ps; /* maximum = 63750 ps */
  74. int trtp_ps; /* byte 38, spd->trtp */
  75. #endif
  76. int trc_ps; /* maximum = 254 ns + .75 ns = 254750 ps */
  77. int refresh_rate_ps;
  78. int extended_op_srt;
  79. #if defined(CONFIG_SYS_FSL_DDR1) || defined(CONFIG_SYS_FSL_DDR2)
  80. int tis_ps; /* byte 32, spd->ca_setup */
  81. int tih_ps; /* byte 33, spd->ca_hold */
  82. int tds_ps; /* byte 34, spd->data_setup */
  83. int tdh_ps; /* byte 35, spd->data_hold */
  84. int tdqsq_max_ps; /* byte 44, spd->tdqsq */
  85. int tqhs_ps; /* byte 45, spd->tqhs */
  86. #endif
  87. /* DDR3 RDIMM */
  88. unsigned char rcw[16]; /* Register Control Word 0-15 */
  89. #ifdef CONFIG_SYS_FSL_DDR4
  90. unsigned int dq_mapping[18];
  91. unsigned int dq_mapping_ors;
  92. #endif
  93. } dimm_params_t;
  94. unsigned int ddr_compute_dimm_parameters(const unsigned int ctrl_num,
  95. const generic_spd_eeprom_t *spd,
  96. dimm_params_t *pdimm,
  97. unsigned int dimm_number);
  98. #endif