fsl_ddr_dimm_params.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. /* SDRAM device parameters */
  25. unsigned int n_row_addr;
  26. unsigned int n_col_addr;
  27. unsigned int edc_config; /* 0 = none, 1 = parity, 2 = ECC */
  28. unsigned int n_banks_per_sdram_device;
  29. unsigned int burst_lengths_bitmask; /* BL=4 bit 2, BL=8 = bit 3 */
  30. unsigned int row_density;
  31. /* used in computing base address of DIMMs */
  32. unsigned long long base_address;
  33. /* mirrored DIMMs */
  34. unsigned int mirrored_dimm; /* only for ddr3 */
  35. /* DIMM timing parameters */
  36. unsigned int mtb_ps; /* medium timebase ps, only for ddr3 */
  37. unsigned int tAA_ps; /* minimum CAS latency time, only for ddr3 */
  38. unsigned int tFAW_ps; /* four active window delay, only for ddr3 */
  39. /*
  40. * SDRAM clock periods
  41. * The range for these are 1000-10000 so a short should be sufficient
  42. */
  43. unsigned int tCKmin_X_ps;
  44. unsigned int tCKmin_X_minus_1_ps;
  45. unsigned int tCKmin_X_minus_2_ps;
  46. unsigned int tCKmax_ps;
  47. /* SPD-defined CAS latencies */
  48. unsigned int caslat_X;
  49. unsigned int caslat_X_minus_1;
  50. unsigned int caslat_X_minus_2;
  51. unsigned int caslat_lowest_derated; /* Derated CAS latency */
  52. /* basic timing parameters */
  53. unsigned int tRCD_ps;
  54. unsigned int tRP_ps;
  55. unsigned int tRAS_ps;
  56. unsigned int tWR_ps; /* maximum = 63750 ps */
  57. unsigned int tWTR_ps; /* maximum = 63750 ps */
  58. unsigned int tRFC_ps; /* max = 255 ns + 256 ns + .75 ns
  59. = 511750 ps */
  60. unsigned int tRRD_ps; /* maximum = 63750 ps */
  61. unsigned int tRC_ps; /* maximum = 254 ns + .75 ns = 254750 ps */
  62. unsigned int refresh_rate_ps;
  63. /* DDR3 doesn't need these as below */
  64. unsigned int tIS_ps; /* byte 32, spd->ca_setup */
  65. unsigned int tIH_ps; /* byte 33, spd->ca_hold */
  66. unsigned int tDS_ps; /* byte 34, spd->data_setup */
  67. unsigned int tDH_ps; /* byte 35, spd->data_hold */
  68. unsigned int tRTP_ps; /* byte 38, spd->trtp */
  69. unsigned int tDQSQ_max_ps; /* byte 44, spd->tdqsq */
  70. unsigned int tQHS_ps; /* byte 45, spd->tqhs */
  71. /* DDR3 RDIMM */
  72. unsigned char rcw[16]; /* Register Control Word 0-15 */
  73. } dimm_params_t;
  74. extern unsigned int ddr_compute_dimm_parameters(
  75. const generic_spd_eeprom_t *spd,
  76. dimm_params_t *pdimm,
  77. unsigned int dimm_number);
  78. #endif