| 1 | /* |
| 2 | * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify it |
| 5 | * under the terms and conditions of the GNU General Public License, |
| 6 | * version 2, as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope it will be useful, but WITHOUT |
| 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 11 | * more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | * |
| 16 | * See file CREDITS for list of people who contributed to this |
| 17 | * project. |
| 18 | */ |
| 19 | |
| 20 | /** |
| 21 | * Defines the SDRAM parameter structure. |
| 22 | * |
| 23 | * Note that PLLM is used by EMC. |
| 24 | */ |
| 25 | |
| 26 | #ifndef INCLUDED_NVBOOT_SDRAM_PARAM_T20_H |
| 27 | #define INCLUDED_NVBOOT_SDRAM_PARAM_T20_H |
| 28 | |
| 29 | #define NVBOOT_BCT_SDRAM_ARB_CONFIG_WORDS 27 |
| 30 | |
| 31 | typedef enum { |
| 32 | /* Specifies the memory type to be undefined */ |
| 33 | nvboot_memory_type_none = 0, |
| 34 | |
| 35 | /* Specifies the memory type to be DDR SDRAM */ |
| 36 | nvboot_memory_type_ddr, |
| 37 | |
| 38 | /* Specifies the memory type to be LPDDR SDRAM */ |
| 39 | nvboot_memory_type_lpddr, |
| 40 | |
| 41 | /* Specifies the memory type to be DDR2 SDRAM */ |
| 42 | nvboot_memory_type_ddr2, |
| 43 | |
| 44 | /* Specifies the memory type to be LPDDR2 SDRAM */ |
| 45 | nvboot_memory_type_lpddr2, |
| 46 | |
| 47 | nvboot_memory_type_num, |
| 48 | nvboot_memory_type_force32 = 0x7FFFFFF |
| 49 | } nvboot_memory_type; |
| 50 | |
| 51 | |
| 52 | /** |
| 53 | * Defines the SDRAM parameter structure |
| 54 | */ |
| 55 | typedef struct nvboot_sdram_params_rec { |
| 56 | /* Specifies the type of memory device */ |
| 57 | nvboot_memory_type memory_type; |
| 58 | |
| 59 | /* Specifies the CPCON value for PllM */ |
| 60 | uint32_t pllm_charge_pump_setup_ctrl; |
| 61 | /* Specifies the LPCON value for PllM */ |
| 62 | uint32_t pllm_loop_filter_setup_ctrl; |
| 63 | /* Specifies the M value for PllM */ |
| 64 | uint32_t pllm_input_divider; |
| 65 | /* Specifies the N value for PllM */ |
| 66 | uint32_t pllm_feedback_divider; |
| 67 | /* Specifies the P value for PllM */ |
| 68 | uint32_t pllm_post_divider; |
| 69 | /* Specifies the time to wait for PLLM to lock (in microseconds) */ |
| 70 | uint32_t pllm_stable_time; |
| 71 | |
| 72 | /* Specifies the divider for the EMC Clock Source */ |
| 73 | uint32_t emc_clock_divider; |
| 74 | |
| 75 | |
| 76 | /* Auto-calibration of EMC pads */ |
| 77 | |
| 78 | /* Specifies the value for EMC_AUTO_CAL_INTERVAL */ |
| 79 | uint32_t emc_auto_cal_interval; |
| 80 | /** |
| 81 | * Specifies the value for EMC_AUTO_CAL_CONFIG |
| 82 | * Note: Trigger bits are set by the SDRAM code. |
| 83 | */ |
| 84 | uint32_t emc_auto_cal_config; |
| 85 | /** |
| 86 | * Specifies the time for the calibration to |
| 87 | * stabilize (in microseconds) |
| 88 | */ |
| 89 | uint32_t emc_auto_cal_wait; |
| 90 | |
| 91 | /** |
| 92 | * Specifies the time to wait after pin programming (in microseconds) |
| 93 | * Dram vendors require at least 200us. |
| 94 | */ |
| 95 | uint32_t emc_pin_program_wait; |
| 96 | |
| 97 | |
| 98 | /* Timing parameters required for the SDRAM */ |
| 99 | |
| 100 | /* Specifies the value for EMC_RC */ |
| 101 | uint32_t emc_rc; |
| 102 | /* Specifies the value for EMC_RFC */ |
| 103 | uint32_t emc_rfc; |
| 104 | /* Specifies the value for EMC_RAS */ |
| 105 | uint32_t emc_ras; |
| 106 | /* Specifies the value for EMC_RP */ |
| 107 | uint32_t emc_rp; |
| 108 | /* Specifies the value for EMC_R2W */ |
| 109 | uint32_t emc_r2w; |
| 110 | /* Specifies the value for EMC_R2W */ |
| 111 | uint32_t emc_w2r; |
| 112 | /* Specifies the value for EMC_R2P */ |
| 113 | uint32_t emc_r2p; |
| 114 | /* Specifies the value for EMC_W2P */ |
| 115 | uint32_t emc_w2p; |
| 116 | /* Specifies the value for EMC_RD_RCD */ |
| 117 | uint32_t emc_rd_rcd; |
| 118 | /* Specifies the value for EMC_WR_RCD */ |
| 119 | uint32_t emc_wr_rcd; |
| 120 | /* Specifies the value for EMC_RRD */ |
| 121 | uint32_t emc_rrd; |
| 122 | /* Specifies the value for EMC_REXT */ |
| 123 | uint32_t emc_rext; |
| 124 | /* Specifies the value for EMC_WDV */ |
| 125 | uint32_t emc_wdv; |
| 126 | /* Specifies the value for EMC_QUSE */ |
| 127 | uint32_t emc_quse; |
| 128 | /* Specifies the value for EMC_QRST */ |
| 129 | uint32_t emc_qrst; |
| 130 | /* Specifies the value for EMC_QSAFE */ |
| 131 | uint32_t emc_qsafe; |
| 132 | /* Specifies the value for EMC_RDV */ |
| 133 | uint32_t emc_rdv; |
| 134 | /* Specifies the value for EMC_REFRESH */ |
| 135 | uint32_t emc_refresh; |
| 136 | /* Specifies the value for EMC_BURST_REFRESH_NUM */ |
| 137 | uint32_t emc_burst_refresh_num; |
| 138 | /* Specifies the value for EMC_PDEX2WR */ |
| 139 | uint32_t emc_pdex2wr; |
| 140 | /* Specifies the value for EMC_PDEX2RD */ |
| 141 | uint32_t emc_pdex2rd; |
| 142 | /* Specifies the value for EMC_PCHG2PDEN */ |
| 143 | uint32_t emc_pchg2pden; |
| 144 | /* Specifies the value for EMC_ACT2PDEN */ |
| 145 | uint32_t emc_act2pden; |
| 146 | /* Specifies the value for EMC_AR2PDEN */ |
| 147 | uint32_t emc_ar2pden; |
| 148 | /* Specifies the value for EMC_RW2PDEN */ |
| 149 | uint32_t emc_rw2pden; |
| 150 | /* Specifies the value for EMC_TXSR */ |
| 151 | uint32_t emc_txsr; |
| 152 | /* Specifies the value for EMC_TCKE */ |
| 153 | uint32_t emc_tcke; |
| 154 | /* Specifies the value for EMC_TFAW */ |
| 155 | uint32_t emc_tfaw; |
| 156 | /* Specifies the value for EMC_TRPAB */ |
| 157 | uint32_t emc_trpab; |
| 158 | /* Specifies the value for EMC_TCLKSTABLE */ |
| 159 | uint32_t emc_tclkstable; |
| 160 | /* Specifies the value for EMC_TCLKSTOP */ |
| 161 | uint32_t emc_tclkstop; |
| 162 | /* Specifies the value for EMC_TREFBW */ |
| 163 | uint32_t emc_trefbw; |
| 164 | /* Specifies the value for EMC_QUSE_EXTRA */ |
| 165 | uint32_t emc_quse_extra; |
| 166 | |
| 167 | |
| 168 | /* FBIO configuration values */ |
| 169 | |
| 170 | /* Specifies the value for EMC_FBIO_CFG1 */ |
| 171 | uint32_t emc_fbio_cfg1; |
| 172 | /* Specifies the value for EMC_FBIO_DQSIB_DLY */ |
| 173 | uint32_t emc_fbio_dqsib_dly; |
| 174 | /* Specifies the value for EMC_FBIO_DQSIB_DLY_MSB */ |
| 175 | uint32_t emc_fbio_dqsib_dly_msb; |
| 176 | /* Specifies the value for EMC_FBIO_QUSE_DLY */ |
| 177 | uint32_t emc_fbio_quse_dly; |
| 178 | /* Specifies the value for EMC_FBIO_QUSE_DLY_MSB */ |
| 179 | uint32_t emc_fbio_quse_dly_msb; |
| 180 | /* Specifies the value for EMC_FBIO_CFG5 */ |
| 181 | uint32_t emc_fbio_cfg5; |
| 182 | /* Specifies the value for EMC_FBIO_CFG6 */ |
| 183 | uint32_t emc_fbio_cfg6; |
| 184 | /* Specifies the value for EMC_FBIO_SPARE */ |
| 185 | uint32_t emc_fbio_spare; |
| 186 | |
| 187 | |
| 188 | /* MRS command values */ |
| 189 | |
| 190 | /* Specifies the value for EMC_MRS */ |
| 191 | uint32_t emc_mrs; |
| 192 | /* Specifies the value for EMC_EMRS */ |
| 193 | uint32_t emc_emrs; |
| 194 | /* Specifies the first of a sequence of three values for EMC_MRW */ |
| 195 | uint32_t emc_mrw1; |
| 196 | /* Specifies the second of a sequence of three values for EMC_MRW */ |
| 197 | uint32_t emc_mrw2; |
| 198 | /* Specifies the third of a sequence of three values for EMC_MRW */ |
| 199 | uint32_t emc_mrw3; |
| 200 | |
| 201 | /* Specifies the EMC_MRW reset command value */ |
| 202 | uint32_t emc_mrw_reset_command; |
| 203 | /* Specifies the EMC Reset wait time (in microseconds) */ |
| 204 | uint32_t emc_mrw_reset_ninit_wait; |
| 205 | |
| 206 | /** |
| 207 | * Specifies the value for EMC_ADR_CFG |
| 208 | * The same value is also used for MC_EMC_ADR_CFG |
| 209 | */ |
| 210 | uint32_t emc_adr_cfg; |
| 211 | /* Specifies the value for EMC_ADR_CFG_1 */ |
| 212 | uint32_t emc_adr_cfg1; |
| 213 | |
| 214 | /** |
| 215 | * Specifies the value for MC_EMEM_CFG which holds the external memory |
| 216 | * size (in KBytes) |
| 217 | * EMEM_SIZE_KB must be <= (Device size in KB * Number of Devices) |
| 218 | */ |
| 219 | uint32_t mc_emem_cfg; |
| 220 | |
| 221 | /** |
| 222 | * Specifies the value for MC_LOWLATENCY_CONFIG |
| 223 | * Mainly for LL_DRAM_INTERLEAVE: Some DRAMs do not support interleave |
| 224 | * mode. If so, turn off this bit to get the correct low-latency path |
| 225 | * behavior. Reset is ENABLED. |
| 226 | */ |
| 227 | uint32_t mc_lowlatency_config; |
| 228 | /* Specifies the value for EMC_CFG */ |
| 229 | uint32_t emc_cfg; |
| 230 | /* Specifies the value for EMC_CFG_2 */ |
| 231 | uint32_t emc_cfg2; |
| 232 | /* Specifies the value for EMC_DBG */ |
| 233 | uint32_t emc_dbg; |
| 234 | |
| 235 | /* |
| 236 | * Specifies the value for AHB_ARBITRATION_XBAR_CTRL. |
| 237 | * This is used to set the Memory Inid done |
| 238 | */ |
| 239 | uint32_t ahb_arbitration_xbar_ctrl; |
| 240 | |
| 241 | /* |
| 242 | * Specifies the value for EMC_CFG_DIG_DLL |
| 243 | * Note: Trigger bits are set by the SDRAM code. |
| 244 | */ |
| 245 | uint32_t emc_cfg_dig_dll; |
| 246 | /* Specifies the value for EMC_DLL_XFORM_DQS */ |
| 247 | uint32_t emc_dll_xform_dqs; |
| 248 | /* Specifies the value for EMC_DLL_XFORM_QUSE */ |
| 249 | uint32_t emc_dll_xform_quse; |
| 250 | |
| 251 | /* |
| 252 | * Specifies the delay after prgramming the PIN/NOP register during a |
| 253 | * WarmBoot0 sequence (in microseconds) |
| 254 | */ |
| 255 | uint32_t warm_boot_wait; |
| 256 | |
| 257 | /* Specifies the value for EMC_CTT_TERM_CTRL */ |
| 258 | uint32_t emc_ctt_term_ctrl; |
| 259 | |
| 260 | /* Specifies the value for EMC_ODT_WRITE */ |
| 261 | uint32_t emc_odt_write; |
| 262 | /* Specifies the value for EMC_ODT_WRITE */ |
| 263 | uint32_t emc_odt_read; |
| 264 | |
| 265 | /* |
| 266 | * Specifies the value for EMC_ZCAL_REF_CNT |
| 267 | * Only meaningful for LPDDR2. Set to 0 for all other memory types. |
| 268 | */ |
| 269 | uint32_t emc_zcal_ref_cnt; |
| 270 | /* |
| 271 | * Specifies the value for EMC_ZCAL_WAIT_CNT |
| 272 | * Only meaningful for LPDDR2. Set to 0 for all other memory types. |
| 273 | */ |
| 274 | uint32_t emc_zcal_wait_cnt; |
| 275 | /* |
| 276 | * Specifies the value for EMC_ZCAL_MRW_CMD |
| 277 | * Only meaningful for LPDDR2. Set to 0 for all other memory types. |
| 278 | */ |
| 279 | uint32_t emc_zcal_mrw_cmd; |
| 280 | |
| 281 | /* |
| 282 | * Specifies the MRS command value for initializing |
| 283 | * the mode register. |
| 284 | */ |
| 285 | uint32_t emc_mrs_reset_dll; |
| 286 | /* Specifies the MRW command for ZQ initialization of device 0 */ |
| 287 | uint32_t emc_mrw_zq_init_dev0; |
| 288 | /* Specifies the MRW command for ZQ initialization of device 1 */ |
| 289 | uint32_t emc_mrw_zq_init_dev1; |
| 290 | /* |
| 291 | * Specifies the wait time after programming a ZQ initialization |
| 292 | * command (in microseconds) |
| 293 | */ |
| 294 | uint32_t emc_mrw_zq_init_wait; |
| 295 | /* |
| 296 | * Specifies the wait time after sending an MRS DLL reset command |
| 297 | * (in microseconds) |
| 298 | */ |
| 299 | uint32_t emc_mrs_reset_dll_wait; |
| 300 | /* |
| 301 | * Specifies the first of two EMRS commands to initialize mode |
| 302 | * registers |
| 303 | */ |
| 304 | uint32_t emc_emrs_emr2; |
| 305 | /* |
| 306 | * Specifies the second of two EMRS commands to initialize mode |
| 307 | * registers |
| 308 | */ |
| 309 | uint32_t emc_emrs_emr3; |
| 310 | /* Specifies the EMRS command to enable the DDR2 DLL */ |
| 311 | uint32_t emc_emrs_ddr2_dll_enable; |
| 312 | /* Specifies the MRS command to reset the DDR2 DLL */ |
| 313 | uint32_t emc_mrs_ddr2_dll_reset; |
| 314 | /* Specifies the EMRS command to set OCD calibration */ |
| 315 | uint32_t emc_emrs_ddr2_ocd_calib; |
| 316 | /* |
| 317 | * Specifies the wait between initializing DDR and setting OCD |
| 318 | * calibration (in microseconds) |
| 319 | */ |
| 320 | uint32_t emc_ddr2_wait; |
| 321 | |
| 322 | |
| 323 | /* Clock trimmers */ |
| 324 | |
| 325 | /* Specifies the value for EMC_CFG_CLKTRIM_0 */ |
| 326 | uint32_t emc_cfg_clktrim0; |
| 327 | /* Specifies the value for EMC_CFG_CLKTRIM_1 */ |
| 328 | uint32_t emc_cfg_clktrim1; |
| 329 | /* Specifies the value for EMC_CFG_CLKTRIM_2 */ |
| 330 | uint32_t emc_cfg_clktrim2; |
| 331 | |
| 332 | |
| 333 | /* Pad controls */ |
| 334 | |
| 335 | /* Specifies the value for PMC_DDR_PWR */ |
| 336 | uint32_t pmc_ddr_pwr; |
| 337 | /* Specifies the value for APB_MISC_GP_XM2CFGAPADCTRL */ |
| 338 | uint32_t apb_misc_gp_xm2cfga_pad_ctrl; |
| 339 | /* Specifies the value for APB_MISC_GP_XM2CFGCPADCTRL */ |
| 340 | uint32_t apb_misc_gp_xm2cfgc_pad_ctrl; |
| 341 | /* Specifies the value for APB_MISC_GP_XM2CFGCPADCTRL2 */ |
| 342 | uint32_t apb_misc_gp_xm2cfgc_pad_ctrl2; |
| 343 | /* Specifies the value for APB_MISC_GP_XM2CFGDPADCTRL */ |
| 344 | uint32_t apb_misc_gp_xm2cfgd_pad_ctrl; |
| 345 | /* Specifies the value for APB_MISC_GP_XM2CFGDPADCTRL2 */ |
| 346 | uint32_t apb_misc_gp_xm2cfgd_pad_ctrl2; |
| 347 | /* Specifies the value for APB_MISC_GP_XM2CLKCFGPADCTRL */ |
| 348 | uint32_t apb_misc_gp_xm2clkcfg_Pad_ctrl; |
| 349 | /* Specifies the value for APB_MISC_GP_XM2COMPPADCTRL */ |
| 350 | uint32_t apb_misc_gp_xm2comp_pad_ctrl; |
| 351 | /* Specifies the value for APB_MISC_GP_XM2VTTGENPADCTRL */ |
| 352 | uint32_t apb_misc_gp_xm2vttgen_pad_ctrl; |
| 353 | |
| 354 | /* |
| 355 | * Specifies storage for arbitration configuration registers |
| 356 | * Data passed through to the Bootloader but not used by |
| 357 | * the Boot ROM |
| 358 | */ |
| 359 | uint32_t arbitration_config[NVBOOT_BCT_SDRAM_ARB_CONFIG_WORDS]; |
| 360 | } nvboot_sdram_params; |
| 361 | |
| 362 | #endif /* #ifndef INCLUDED_NVBOOT_SDRAM_PARAM_T20_H */ |
| 363 |