fsl_ddr_sdram.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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 FSL_DDR_MEMCTL_H
  9. #define FSL_DDR_MEMCTL_H
  10. /*
  11. * Pick a basic DDR Technology.
  12. */
  13. #include <ddr_spd.h>
  14. #define SDRAM_TYPE_DDR1 2
  15. #define SDRAM_TYPE_DDR2 3
  16. #define SDRAM_TYPE_LPDDR1 6
  17. #define SDRAM_TYPE_DDR3 7
  18. #if defined(CONFIG_FSL_DDR1)
  19. #define FSL_DDR_MIN_TCKE_PULSE_WIDTH_DDR (1)
  20. typedef ddr1_spd_eeprom_t generic_spd_eeprom_t;
  21. #ifndef CONFIG_FSL_SDRAM_TYPE
  22. #define CONFIG_FSL_SDRAM_TYPE SDRAM_TYPE_DDR1
  23. #endif
  24. #elif defined(CONFIG_FSL_DDR2)
  25. #define FSL_DDR_MIN_TCKE_PULSE_WIDTH_DDR (3)
  26. typedef ddr2_spd_eeprom_t generic_spd_eeprom_t;
  27. #ifndef CONFIG_FSL_SDRAM_TYPE
  28. #define CONFIG_FSL_SDRAM_TYPE SDRAM_TYPE_DDR2
  29. #endif
  30. #elif defined(CONFIG_FSL_DDR3)
  31. #define FSL_DDR_MIN_TCKE_PULSE_WIDTH_DDR (3) /* FIXME */
  32. typedef ddr3_spd_eeprom_t generic_spd_eeprom_t;
  33. #endif
  34. /* Record of register values computed */
  35. typedef struct fsl_ddr_cfg_regs_s {
  36. struct {
  37. unsigned int bnds;
  38. unsigned int config;
  39. unsigned int config_2;
  40. } cs[CONFIG_CHIP_SELECTS_PER_CTRL];
  41. unsigned int timing_cfg_3;
  42. unsigned int timing_cfg_0;
  43. unsigned int timing_cfg_1;
  44. unsigned int timing_cfg_2;
  45. unsigned int ddr_sdram_cfg;
  46. unsigned int ddr_sdram_cfg_2;
  47. unsigned int ddr_sdram_mode;
  48. unsigned int ddr_sdram_mode_2;
  49. unsigned int ddr_sdram_md_cntl;
  50. unsigned int ddr_sdram_interval;
  51. unsigned int ddr_data_init;
  52. unsigned int ddr_sdram_clk_cntl;
  53. unsigned int ddr_init_addr;
  54. unsigned int ddr_init_ext_addr;
  55. unsigned int timing_cfg_4;
  56. unsigned int timing_cfg_5;
  57. unsigned int ddr_zq_cntl;
  58. unsigned int ddr_wrlvl_cntl;
  59. unsigned int ddr_pd_cntl;
  60. unsigned int ddr_sr_cntr;
  61. unsigned int ddr_sdram_rcw_1;
  62. unsigned int ddr_sdram_rcw_2;
  63. } fsl_ddr_cfg_regs_t;
  64. typedef struct memctl_options_partial_s {
  65. unsigned int all_DIMMs_ECC_capable;
  66. unsigned int all_DIMMs_tCKmax_ps;
  67. unsigned int all_DIMMs_burst_lengths_bitmask;
  68. unsigned int all_DIMMs_registered;
  69. unsigned int all_DIMMs_unbuffered;
  70. /* unsigned int lowest_common_SPD_caslat; */
  71. unsigned int all_DIMMs_minimum_tRCD_ps;
  72. } memctl_options_partial_t;
  73. /*
  74. * Generalized parameters for memory controller configuration,
  75. * might be a little specific to the FSL memory controller
  76. */
  77. typedef struct memctl_options_s {
  78. /*
  79. * Memory organization parameters
  80. *
  81. * if DIMM is present in the system
  82. * where DIMMs are with respect to chip select
  83. * where chip selects are with respect to memory boundaries
  84. */
  85. unsigned int registered_dimm_en; /* use registered DIMM support */
  86. /* Options local to a Chip Select */
  87. struct cs_local_opts_s {
  88. unsigned int auto_precharge;
  89. unsigned int odt_rd_cfg;
  90. unsigned int odt_wr_cfg;
  91. } cs_local_opts[CONFIG_CHIP_SELECTS_PER_CTRL];
  92. /* Special configurations for chip select */
  93. unsigned int memctl_interleaving;
  94. unsigned int memctl_interleaving_mode;
  95. unsigned int ba_intlv_ctl;
  96. /* Operational mode parameters */
  97. unsigned int ECC_mode; /* Use ECC? */
  98. /* Initialize ECC using memory controller? */
  99. unsigned int ECC_init_using_memctl;
  100. unsigned int DQS_config; /* Use DQS? maybe only with DDR2? */
  101. /* SREN - self-refresh during sleep */
  102. unsigned int self_refresh_in_sleep;
  103. unsigned int dynamic_power; /* DYN_PWR */
  104. /* memory data width to use (16-bit, 32-bit, 64-bit) */
  105. unsigned int data_bus_width;
  106. unsigned int burst_length; /* 4, 8 */
  107. /* Global Timing Parameters */
  108. unsigned int cas_latency_override;
  109. unsigned int cas_latency_override_value;
  110. unsigned int use_derated_caslat;
  111. unsigned int additive_latency_override;
  112. unsigned int additive_latency_override_value;
  113. unsigned int clk_adjust; /* */
  114. unsigned int cpo_override;
  115. unsigned int write_data_delay; /* DQS adjust */
  116. unsigned int half_strength_driver_enable;
  117. unsigned int twoT_en;
  118. unsigned int threeT_en;
  119. unsigned int bstopre;
  120. unsigned int tCKE_clock_pulse_width_ps; /* tCKE */
  121. unsigned int tFAW_window_four_activates_ps; /* tFAW -- FOUR_ACT */
  122. } memctl_options_t;
  123. extern phys_size_t fsl_ddr_sdram(void);
  124. #endif