fsl_ddr_dimm_params.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * Copyright 2008 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 DDR2 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. unsigned int n_banks_per_sdram_device;
  30. unsigned int burst_lengths_bitmask; /* BL=4 bit 2, BL=8 = bit 3 */
  31. unsigned int row_density;
  32. /* used in computing base address of DIMMs */
  33. unsigned long long base_address;
  34. /* mirrored DIMMs */
  35. unsigned int mirrored_dimm; /* only for ddr3 */
  36. /* DIMM timing parameters */
  37. unsigned int mtb_ps; /* medium timebase ps, only for ddr3 */
  38. unsigned int ftb_10th_ps; /* fine timebase, in 1/10 ps, only for ddr3 */
  39. unsigned int taa_ps; /* minimum CAS latency time, only for ddr3 */
  40. unsigned int tfaw_ps; /* four active window delay, only for ddr3 */
  41. /*
  42. * SDRAM clock periods
  43. * The range for these are 1000-10000 so a short should be sufficient
  44. */
  45. unsigned int tckmin_x_ps;
  46. unsigned int tckmin_x_minus_1_ps;
  47. unsigned int tckmin_x_minus_2_ps;
  48. unsigned int tckmax_ps;
  49. /* SPD-defined CAS latencies */
  50. unsigned int caslat_x;
  51. unsigned int caslat_x_minus_1;
  52. unsigned int caslat_x_minus_2;
  53. unsigned int caslat_lowest_derated; /* Derated CAS latency */
  54. /* basic timing parameters */
  55. unsigned int trcd_ps;
  56. unsigned int trp_ps;
  57. unsigned int tras_ps;
  58. unsigned int twr_ps; /* maximum = 63750 ps */
  59. unsigned int twtr_ps; /* maximum = 63750 ps */
  60. unsigned int trfc_ps; /* max = 255 ns + 256 ns + .75 ns
  61. = 511750 ps */
  62. unsigned int trrd_ps; /* maximum = 63750 ps */
  63. unsigned int trc_ps; /* maximum = 254 ns + .75 ns = 254750 ps */
  64. unsigned int refresh_rate_ps;
  65. unsigned int extended_op_srt;
  66. /* DDR3 doesn't need these as below */
  67. unsigned int tis_ps; /* byte 32, spd->ca_setup */
  68. unsigned int tih_ps; /* byte 33, spd->ca_hold */
  69. unsigned int tds_ps; /* byte 34, spd->data_setup */
  70. unsigned int tdh_ps; /* byte 35, spd->data_hold */
  71. unsigned int trtp_ps; /* byte 38, spd->trtp */
  72. unsigned int tdqsq_max_ps; /* byte 44, spd->tdqsq */
  73. unsigned int tqhs_ps; /* byte 45, spd->tqhs */
  74. /* DDR3 RDIMM */
  75. unsigned char rcw[16]; /* Register Control Word 0-15 */
  76. } dimm_params_t;
  77. extern unsigned int ddr_compute_dimm_parameters(
  78. const generic_spd_eeprom_t *spd,
  79. dimm_params_t *pdimm,
  80. unsigned int dimm_number);
  81. #endif