lc_common_dimm_params.c 17 KB

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