lc_common_dimm_params.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  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. #include <common.h>
  9. #include <fsl_ddr_sdram.h>
  10. #include <fsl_ddr.h>
  11. #if defined(CONFIG_SYS_FSL_DDR3) || defined(CONFIG_SYS_FSL_DDR4)
  12. static unsigned int
  13. compute_cas_latency(const dimm_params_t *dimm_params,
  14. common_timing_params_t *outpdimm,
  15. unsigned int number_of_dimms)
  16. {
  17. unsigned int i;
  18. unsigned int common_caslat;
  19. unsigned int caslat_actual;
  20. unsigned int retry = 16;
  21. unsigned int tmp;
  22. const unsigned int mclk_ps = get_memory_clk_period_ps();
  23. #ifdef CONFIG_SYS_FSL_DDR3
  24. const unsigned int taamax = 20000;
  25. #else
  26. const unsigned int taamax = 18000;
  27. #endif
  28. /* compute the common CAS latency supported between slots */
  29. tmp = dimm_params[0].caslat_x;
  30. for (i = 1; i < number_of_dimms; i++) {
  31. if (dimm_params[i].n_ranks)
  32. tmp &= dimm_params[i].caslat_x;
  33. }
  34. common_caslat = tmp;
  35. /* validate if the memory clk is in the range of dimms */
  36. if (mclk_ps < outpdimm->tckmin_x_ps) {
  37. printf("DDR clock (MCLK cycle %u ps) is faster than "
  38. "the slowest DIMM(s) (tCKmin %u ps) can support.\n",
  39. mclk_ps, outpdimm->tckmin_x_ps);
  40. }
  41. #ifdef CONFIG_SYS_FSL_DDR4
  42. if (mclk_ps > outpdimm->tckmax_ps) {
  43. printf("DDR clock (MCLK cycle %u ps) is slower than DIMM(s) (tCKmax %u ps) can support.\n",
  44. mclk_ps, outpdimm->tckmax_ps);
  45. }
  46. #endif
  47. /* determine the acutal cas latency */
  48. caslat_actual = (outpdimm->taamin_ps + mclk_ps - 1) / mclk_ps;
  49. /* check if the dimms support the CAS latency */
  50. while (!(common_caslat & (1 << caslat_actual)) && retry > 0) {
  51. caslat_actual++;
  52. retry--;
  53. }
  54. /* once the caculation of caslat_actual is completed
  55. * we must verify that this CAS latency value does not
  56. * exceed tAAmax, which is 20 ns for all DDR3 speed grades,
  57. * 18ns for all DDR4 speed grades.
  58. */
  59. if (caslat_actual * mclk_ps > taamax) {
  60. printf("The choosen cas latency %d is too large\n",
  61. caslat_actual);
  62. }
  63. outpdimm->lowest_common_spd_caslat = caslat_actual;
  64. debug("lowest_common_spd_caslat is 0x%x\n", caslat_actual);
  65. return 0;
  66. }
  67. #else /* for DDR1 and DDR2 */
  68. static unsigned int
  69. compute_cas_latency(const dimm_params_t *dimm_params,
  70. common_timing_params_t *outpdimm,
  71. unsigned int number_of_dimms)
  72. {
  73. int i;
  74. const unsigned int mclk_ps = get_memory_clk_period_ps();
  75. unsigned int lowest_good_caslat;
  76. unsigned int not_ok;
  77. unsigned int temp1, temp2;
  78. debug("using mclk_ps = %u\n", mclk_ps);
  79. if (mclk_ps > outpdimm->tckmax_ps) {
  80. printf("Warning: DDR clock (%u ps) is slower than DIMM(s) (tCKmax %u ps)\n",
  81. mclk_ps, outpdimm->tckmax_ps);
  82. }
  83. /*
  84. * Compute a CAS latency suitable for all DIMMs
  85. *
  86. * Strategy for SPD-defined latencies: compute only
  87. * CAS latency defined by all DIMMs.
  88. */
  89. /*
  90. * Step 1: find CAS latency common to all DIMMs using bitwise
  91. * operation.
  92. */
  93. temp1 = 0xFF;
  94. for (i = 0; i < number_of_dimms; i++) {
  95. if (dimm_params[i].n_ranks) {
  96. temp2 = 0;
  97. temp2 |= 1 << dimm_params[i].caslat_x;
  98. temp2 |= 1 << dimm_params[i].caslat_x_minus_1;
  99. temp2 |= 1 << dimm_params[i].caslat_x_minus_2;
  100. /*
  101. * If there was no entry for X-2 (X-1) in
  102. * the SPD, then caslat_x_minus_2
  103. * (caslat_x_minus_1) contains either 255 or
  104. * 0xFFFFFFFF because that's what the glorious
  105. * __ilog2 function returns for an input of 0.
  106. * On 32-bit PowerPC, left shift counts with bit
  107. * 26 set (that the value of 255 or 0xFFFFFFFF
  108. * will have), cause the destination register to
  109. * be 0. That is why this works.
  110. */
  111. temp1 &= temp2;
  112. }
  113. }
  114. /*
  115. * Step 2: check each common CAS latency against tCK of each
  116. * DIMM's SPD.
  117. */
  118. lowest_good_caslat = 0;
  119. temp2 = 0;
  120. while (temp1) {
  121. not_ok = 0;
  122. temp2 = __ilog2(temp1);
  123. debug("checking common caslat = %u\n", temp2);
  124. /* Check if this CAS latency will work on all DIMMs at tCK. */
  125. for (i = 0; i < number_of_dimms; i++) {
  126. if (!dimm_params[i].n_ranks)
  127. continue;
  128. if (dimm_params[i].caslat_x == temp2) {
  129. if (mclk_ps >= dimm_params[i].tckmin_x_ps) {
  130. debug("CL = %u ok on DIMM %u at tCK=%u ps with tCKmin_X_ps of %u\n",
  131. temp2, i, mclk_ps,
  132. dimm_params[i].tckmin_x_ps);
  133. continue;
  134. } else {
  135. not_ok++;
  136. }
  137. }
  138. if (dimm_params[i].caslat_x_minus_1 == temp2) {
  139. unsigned int tckmin_x_minus_1_ps
  140. = dimm_params[i].tckmin_x_minus_1_ps;
  141. if (mclk_ps >= tckmin_x_minus_1_ps) {
  142. debug("CL = %u ok on DIMM %u at tCK=%u ps with tckmin_x_minus_1_ps of %u\n",
  143. temp2, i, mclk_ps,
  144. tckmin_x_minus_1_ps);
  145. continue;
  146. } else {
  147. not_ok++;
  148. }
  149. }
  150. if (dimm_params[i].caslat_x_minus_2 == temp2) {
  151. unsigned int tckmin_x_minus_2_ps
  152. = dimm_params[i].tckmin_x_minus_2_ps;
  153. if (mclk_ps >= tckmin_x_minus_2_ps) {
  154. debug("CL = %u ok on DIMM %u at tCK=%u ps with tckmin_x_minus_2_ps of %u\n",
  155. temp2, i, mclk_ps,
  156. tckmin_x_minus_2_ps);
  157. continue;
  158. } else {
  159. not_ok++;
  160. }
  161. }
  162. }
  163. if (!not_ok)
  164. lowest_good_caslat = temp2;
  165. temp1 &= ~(1 << temp2);
  166. }
  167. debug("lowest common SPD-defined CAS latency = %u\n",
  168. lowest_good_caslat);
  169. outpdimm->lowest_common_spd_caslat = lowest_good_caslat;
  170. /*
  171. * Compute a common 'de-rated' CAS latency.
  172. *
  173. * The strategy here is to find the *highest* dereated cas latency
  174. * with the assumption that all of the DIMMs will support a dereated
  175. * CAS latency higher than or equal to their lowest dereated value.
  176. */
  177. temp1 = 0;
  178. for (i = 0; i < number_of_dimms; i++)
  179. temp1 = max(temp1, dimm_params[i].caslat_lowest_derated);
  180. outpdimm->highest_common_derated_caslat = temp1;
  181. debug("highest common dereated CAS latency = %u\n", temp1);
  182. return 0;
  183. }
  184. #endif
  185. /*
  186. * compute_lowest_common_dimm_parameters()
  187. *
  188. * Determine the worst-case DIMM timing parameters from the set of DIMMs
  189. * whose parameters have been computed into the array pointed to
  190. * by dimm_params.
  191. */
  192. unsigned int
  193. compute_lowest_common_dimm_parameters(const dimm_params_t *dimm_params,
  194. common_timing_params_t *outpdimm,
  195. const unsigned int number_of_dimms)
  196. {
  197. unsigned int i, j;
  198. unsigned int tckmin_x_ps = 0;
  199. unsigned int tckmax_ps = 0xFFFFFFFF;
  200. unsigned int trcd_ps = 0;
  201. unsigned int trp_ps = 0;
  202. unsigned int tras_ps = 0;
  203. #if defined(CONFIG_SYS_FSL_DDR3) || defined(CONFIG_SYS_FSL_DDR4)
  204. unsigned int taamin_ps = 0;
  205. #endif
  206. #ifdef CONFIG_SYS_FSL_DDR4
  207. unsigned int twr_ps = 15000;
  208. unsigned int trfc1_ps = 0;
  209. unsigned int trfc2_ps = 0;
  210. unsigned int trfc4_ps = 0;
  211. unsigned int trrds_ps = 0;
  212. unsigned int trrdl_ps = 0;
  213. unsigned int tccdl_ps = 0;
  214. #else
  215. unsigned int twr_ps = 0;
  216. unsigned int twtr_ps = 0;
  217. unsigned int trfc_ps = 0;
  218. unsigned int trrd_ps = 0;
  219. unsigned int trtp_ps = 0;
  220. #endif
  221. unsigned int trc_ps = 0;
  222. unsigned int refresh_rate_ps = 0;
  223. unsigned int extended_op_srt = 1;
  224. #if defined(CONFIG_SYS_FSL_DDR1) || defined(CONFIG_SYS_FSL_DDR2)
  225. unsigned int tis_ps = 0;
  226. unsigned int tih_ps = 0;
  227. unsigned int tds_ps = 0;
  228. unsigned int tdh_ps = 0;
  229. unsigned int tdqsq_max_ps = 0;
  230. unsigned int tqhs_ps = 0;
  231. #endif
  232. unsigned int temp1, temp2;
  233. unsigned int additive_latency = 0;
  234. temp1 = 0;
  235. for (i = 0; i < number_of_dimms; i++) {
  236. /*
  237. * If there are no ranks on this DIMM,
  238. * it probably doesn't exist, so skip it.
  239. */
  240. if (dimm_params[i].n_ranks == 0) {
  241. temp1++;
  242. continue;
  243. }
  244. if (dimm_params[i].n_ranks == 4 && i != 0) {
  245. printf("Found Quad-rank DIMM in wrong bank, ignored."
  246. " Software may not run as expected.\n");
  247. temp1++;
  248. continue;
  249. }
  250. /*
  251. * check if quad-rank DIMM is plugged if
  252. * CONFIG_CHIP_SELECT_QUAD_CAPABLE is not defined
  253. * Only the board with proper design is capable
  254. */
  255. #ifndef CONFIG_FSL_DDR_FIRST_SLOT_QUAD_CAPABLE
  256. if (dimm_params[i].n_ranks == 4 && \
  257. CONFIG_CHIP_SELECTS_PER_CTRL/CONFIG_DIMM_SLOTS_PER_CTLR < 4) {
  258. printf("Found Quad-rank DIMM, not able to support.");
  259. temp1++;
  260. continue;
  261. }
  262. #endif
  263. /*
  264. * Find minimum tckmax_ps to find fastest slow speed,
  265. * i.e., this is the slowest the whole system can go.
  266. */
  267. tckmax_ps = min(tckmax_ps,
  268. (unsigned int)dimm_params[i].tckmax_ps);
  269. #if defined(CONFIG_SYS_FSL_DDR3) || defined(CONFIG_SYS_FSL_DDR4)
  270. taamin_ps = max(taamin_ps,
  271. (unsigned int)dimm_params[i].taa_ps);
  272. #endif
  273. tckmin_x_ps = max(tckmin_x_ps,
  274. (unsigned int)dimm_params[i].tckmin_x_ps);
  275. trcd_ps = max(trcd_ps, (unsigned int)dimm_params[i].trcd_ps);
  276. trp_ps = max(trp_ps, (unsigned int)dimm_params[i].trp_ps);
  277. tras_ps = max(tras_ps, (unsigned int)dimm_params[i].tras_ps);
  278. #ifdef CONFIG_SYS_FSL_DDR4
  279. trfc1_ps = max(trfc1_ps,
  280. (unsigned int)dimm_params[i].trfc1_ps);
  281. trfc2_ps = max(trfc2_ps,
  282. (unsigned int)dimm_params[i].trfc2_ps);
  283. trfc4_ps = max(trfc4_ps,
  284. (unsigned int)dimm_params[i].trfc4_ps);
  285. trrds_ps = max(trrds_ps,
  286. (unsigned int)dimm_params[i].trrds_ps);
  287. trrdl_ps = max(trrdl_ps,
  288. (unsigned int)dimm_params[i].trrdl_ps);
  289. tccdl_ps = max(tccdl_ps,
  290. (unsigned int)dimm_params[i].tccdl_ps);
  291. #else
  292. twr_ps = max(twr_ps, (unsigned int)dimm_params[i].twr_ps);
  293. twtr_ps = max(twtr_ps, (unsigned int)dimm_params[i].twtr_ps);
  294. trfc_ps = max(trfc_ps, (unsigned int)dimm_params[i].trfc_ps);
  295. trrd_ps = max(trrd_ps, (unsigned int)dimm_params[i].trrd_ps);
  296. trtp_ps = max(trtp_ps, (unsigned int)dimm_params[i].trtp_ps);
  297. #endif
  298. trc_ps = max(trc_ps, (unsigned int)dimm_params[i].trc_ps);
  299. #if defined(CONFIG_SYS_FSL_DDR1) || defined(CONFIG_SYS_FSL_DDR2)
  300. tis_ps = max(tis_ps, (unsigned int)dimm_params[i].tis_ps);
  301. tih_ps = max(tih_ps, (unsigned int)dimm_params[i].tih_ps);
  302. tds_ps = max(tds_ps, (unsigned int)dimm_params[i].tds_ps);
  303. tdh_ps = max(tdh_ps, (unsigned int)dimm_params[i].tdh_ps);
  304. tqhs_ps = max(tqhs_ps, (unsigned int)dimm_params[i].tqhs_ps);
  305. /*
  306. * Find maximum tdqsq_max_ps to find slowest.
  307. *
  308. * FIXME: is finding the slowest value the correct
  309. * strategy for this parameter?
  310. */
  311. tdqsq_max_ps = max(tdqsq_max_ps,
  312. (unsigned int)dimm_params[i].tdqsq_max_ps);
  313. #endif
  314. refresh_rate_ps = max(refresh_rate_ps,
  315. (unsigned int)dimm_params[i].refresh_rate_ps);
  316. /* extended_op_srt is either 0 or 1, 0 having priority */
  317. extended_op_srt = min(extended_op_srt,
  318. (unsigned int)dimm_params[i].extended_op_srt);
  319. }
  320. outpdimm->ndimms_present = number_of_dimms - temp1;
  321. if (temp1 == number_of_dimms) {
  322. debug("no dimms this memory controller\n");
  323. return 0;
  324. }
  325. outpdimm->tckmin_x_ps = tckmin_x_ps;
  326. outpdimm->tckmax_ps = tckmax_ps;
  327. #if defined(CONFIG_SYS_FSL_DDR3) || defined(CONFIG_SYS_FSL_DDR4)
  328. outpdimm->taamin_ps = taamin_ps;
  329. #endif
  330. outpdimm->trcd_ps = trcd_ps;
  331. outpdimm->trp_ps = trp_ps;
  332. outpdimm->tras_ps = tras_ps;
  333. #ifdef CONFIG_SYS_FSL_DDR4
  334. outpdimm->trfc1_ps = trfc1_ps;
  335. outpdimm->trfc2_ps = trfc2_ps;
  336. outpdimm->trfc4_ps = trfc4_ps;
  337. outpdimm->trrds_ps = trrds_ps;
  338. outpdimm->trrdl_ps = trrdl_ps;
  339. outpdimm->tccdl_ps = tccdl_ps;
  340. #else
  341. outpdimm->twtr_ps = twtr_ps;
  342. outpdimm->trfc_ps = trfc_ps;
  343. outpdimm->trrd_ps = trrd_ps;
  344. outpdimm->trtp_ps = trtp_ps;
  345. #endif
  346. outpdimm->twr_ps = twr_ps;
  347. outpdimm->trc_ps = trc_ps;
  348. outpdimm->refresh_rate_ps = refresh_rate_ps;
  349. outpdimm->extended_op_srt = extended_op_srt;
  350. #if defined(CONFIG_SYS_FSL_DDR1) || defined(CONFIG_SYS_FSL_DDR2)
  351. outpdimm->tis_ps = tis_ps;
  352. outpdimm->tih_ps = tih_ps;
  353. outpdimm->tds_ps = tds_ps;
  354. outpdimm->tdh_ps = tdh_ps;
  355. outpdimm->tdqsq_max_ps = tdqsq_max_ps;
  356. outpdimm->tqhs_ps = tqhs_ps;
  357. #endif
  358. /* Determine common burst length for all DIMMs. */
  359. temp1 = 0xff;
  360. for (i = 0; i < number_of_dimms; i++) {
  361. if (dimm_params[i].n_ranks) {
  362. temp1 &= dimm_params[i].burst_lengths_bitmask;
  363. }
  364. }
  365. outpdimm->all_dimms_burst_lengths_bitmask = temp1;
  366. /* Determine if all DIMMs registered buffered. */
  367. temp1 = temp2 = 0;
  368. for (i = 0; i < number_of_dimms; i++) {
  369. if (dimm_params[i].n_ranks) {
  370. if (dimm_params[i].registered_dimm) {
  371. temp1 = 1;
  372. #ifndef CONFIG_SPL_BUILD
  373. printf("Detected RDIMM %s\n",
  374. dimm_params[i].mpart);
  375. #endif
  376. } else {
  377. temp2 = 1;
  378. #ifndef CONFIG_SPL_BUILD
  379. printf("Detected UDIMM %s\n",
  380. dimm_params[i].mpart);
  381. #endif
  382. }
  383. }
  384. }
  385. outpdimm->all_dimms_registered = 0;
  386. outpdimm->all_dimms_unbuffered = 0;
  387. if (temp1 && !temp2) {
  388. outpdimm->all_dimms_registered = 1;
  389. } else if (!temp1 && temp2) {
  390. outpdimm->all_dimms_unbuffered = 1;
  391. } else {
  392. printf("ERROR: Mix of registered buffered and unbuffered "
  393. "DIMMs detected!\n");
  394. }
  395. temp1 = 0;
  396. if (outpdimm->all_dimms_registered)
  397. for (j = 0; j < 16; j++) {
  398. outpdimm->rcw[j] = dimm_params[0].rcw[j];
  399. for (i = 1; i < number_of_dimms; i++) {
  400. if (!dimm_params[i].n_ranks)
  401. continue;
  402. if (dimm_params[i].rcw[j] != dimm_params[0].rcw[j]) {
  403. temp1 = 1;
  404. break;
  405. }
  406. }
  407. }
  408. if (temp1 != 0)
  409. printf("ERROR: Mix different RDIMM detected!\n");
  410. /* calculate cas latency for all DDR types */
  411. if (compute_cas_latency(dimm_params, outpdimm, number_of_dimms))
  412. return 1;
  413. /* Determine if all DIMMs ECC capable. */
  414. temp1 = 1;
  415. for (i = 0; i < number_of_dimms; i++) {
  416. if (dimm_params[i].n_ranks &&
  417. !(dimm_params[i].edc_config & EDC_ECC)) {
  418. temp1 = 0;
  419. break;
  420. }
  421. }
  422. if (temp1) {
  423. debug("all DIMMs ECC capable\n");
  424. } else {
  425. debug("Warning: not all DIMMs ECC capable, cant enable ECC\n");
  426. }
  427. outpdimm->all_dimms_ecc_capable = temp1;
  428. /*
  429. * Compute additive latency.
  430. *
  431. * For DDR1, additive latency should be 0.
  432. *
  433. * For DDR2, with ODT enabled, use "a value" less than ACTTORW,
  434. * which comes from Trcd, and also note that:
  435. * add_lat + caslat must be >= 4
  436. *
  437. * For DDR3, we use the AL=0
  438. *
  439. * When to use additive latency for DDR2:
  440. *
  441. * I. Because you are using CL=3 and need to do ODT on writes and
  442. * want functionality.
  443. * 1. Are you going to use ODT? (Does your board not have
  444. * additional termination circuitry for DQ, DQS, DQS_,
  445. * DM, RDQS, RDQS_ for x4/x8 configs?)
  446. * 2. If so, is your lowest supported CL going to be 3?
  447. * 3. If so, then you must set AL=1 because
  448. *
  449. * WL >= 3 for ODT on writes
  450. * RL = AL + CL
  451. * WL = RL - 1
  452. * ->
  453. * WL = AL + CL - 1
  454. * AL + CL - 1 >= 3
  455. * AL + CL >= 4
  456. * QED
  457. *
  458. * RL >= 3 for ODT on reads
  459. * RL = AL + CL
  460. *
  461. * Since CL aren't usually less than 2, AL=0 is a minimum,
  462. * so the WL-derived AL should be the -- FIXME?
  463. *
  464. * II. Because you are using auto-precharge globally and want to
  465. * use additive latency (posted CAS) to get more bandwidth.
  466. * 1. Are you going to use auto-precharge mode globally?
  467. *
  468. * Use addtivie latency and compute AL to be 1 cycle less than
  469. * tRCD, i.e. the READ or WRITE command is in the cycle
  470. * immediately following the ACTIVATE command..
  471. *
  472. * III. Because you feel like it or want to do some sort of
  473. * degraded-performance experiment.
  474. * 1. Do you just want to use additive latency because you feel
  475. * like it?
  476. *
  477. * Validation: AL is less than tRCD, and within the other
  478. * read-to-precharge constraints.
  479. */
  480. additive_latency = 0;
  481. #if defined(CONFIG_SYS_FSL_DDR2)
  482. if ((outpdimm->lowest_common_spd_caslat < 4) &&
  483. (picos_to_mclk(trcd_ps) > outpdimm->lowest_common_spd_caslat)) {
  484. additive_latency = picos_to_mclk(trcd_ps) -
  485. outpdimm->lowest_common_spd_caslat;
  486. if (mclk_to_picos(additive_latency) > trcd_ps) {
  487. additive_latency = picos_to_mclk(trcd_ps);
  488. debug("setting additive_latency to %u because it was "
  489. " greater than tRCD_ps\n", additive_latency);
  490. }
  491. }
  492. #endif
  493. /*
  494. * Validate additive latency
  495. *
  496. * AL <= tRCD(min)
  497. */
  498. if (mclk_to_picos(additive_latency) > trcd_ps) {
  499. printf("Error: invalid additive latency exceeds tRCD(min).\n");
  500. return 1;
  501. }
  502. /*
  503. * RL = CL + AL; RL >= 3 for ODT_RD_CFG to be enabled
  504. * WL = RL - 1; WL >= 3 for ODT_WL_CFG to be enabled
  505. * ADD_LAT (the register) must be set to a value less
  506. * than ACTTORW if WL = 1, then AL must be set to 1
  507. * RD_TO_PRE (the register) must be set to a minimum
  508. * tRTP + AL if AL is nonzero
  509. */
  510. /*
  511. * Additive latency will be applied only if the memctl option to
  512. * use it.
  513. */
  514. outpdimm->additive_latency = additive_latency;
  515. debug("tCKmin_ps = %u\n", outpdimm->tckmin_x_ps);
  516. debug("trcd_ps = %u\n", outpdimm->trcd_ps);
  517. debug("trp_ps = %u\n", outpdimm->trp_ps);
  518. debug("tras_ps = %u\n", outpdimm->tras_ps);
  519. #ifdef CONFIG_SYS_FSL_DDR4
  520. debug("trfc1_ps = %u\n", trfc1_ps);
  521. debug("trfc2_ps = %u\n", trfc2_ps);
  522. debug("trfc4_ps = %u\n", trfc4_ps);
  523. debug("trrds_ps = %u\n", trrds_ps);
  524. debug("trrdl_ps = %u\n", trrdl_ps);
  525. debug("tccdl_ps = %u\n", tccdl_ps);
  526. #else
  527. debug("twtr_ps = %u\n", outpdimm->twtr_ps);
  528. debug("trfc_ps = %u\n", outpdimm->trfc_ps);
  529. debug("trrd_ps = %u\n", outpdimm->trrd_ps);
  530. #endif
  531. debug("twr_ps = %u\n", outpdimm->twr_ps);
  532. debug("trc_ps = %u\n", outpdimm->trc_ps);
  533. return 0;
  534. }