fsl_ddr_dimm_params.h 3.1 KB

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