options.c 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147
  1. /*
  2. * Copyright 2008, 2010-2012 Freescale Semiconductor, Inc.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <hwconfig.h>
  8. #include <asm/fsl_ddr_sdram.h>
  9. #include "ddr.h"
  10. /*
  11. * Use our own stack based buffer before relocation to allow accessing longer
  12. * hwconfig strings that might be in the environment before we've relocated.
  13. * This is pretty fragile on both the use of stack and if the buffer is big
  14. * enough. However we will get a warning from getenv_f for the later.
  15. */
  16. /* Board-specific functions defined in each board's ddr.c */
  17. extern void fsl_ddr_board_options(memctl_options_t *popts,
  18. dimm_params_t *pdimm,
  19. unsigned int ctrl_num);
  20. struct dynamic_odt {
  21. unsigned int odt_rd_cfg;
  22. unsigned int odt_wr_cfg;
  23. unsigned int odt_rtt_norm;
  24. unsigned int odt_rtt_wr;
  25. };
  26. #ifdef CONFIG_FSL_DDR3
  27. static const struct dynamic_odt single_Q[4] = {
  28. { /* cs0 */
  29. FSL_DDR_ODT_NEVER,
  30. FSL_DDR_ODT_CS_AND_OTHER_DIMM,
  31. DDR3_RTT_20_OHM,
  32. DDR3_RTT_120_OHM
  33. },
  34. { /* cs1 */
  35. FSL_DDR_ODT_NEVER,
  36. FSL_DDR_ODT_NEVER, /* tied high */
  37. DDR3_RTT_OFF,
  38. DDR3_RTT_120_OHM
  39. },
  40. { /* cs2 */
  41. FSL_DDR_ODT_NEVER,
  42. FSL_DDR_ODT_CS_AND_OTHER_DIMM,
  43. DDR3_RTT_20_OHM,
  44. DDR3_RTT_120_OHM
  45. },
  46. { /* cs3 */
  47. FSL_DDR_ODT_NEVER,
  48. FSL_DDR_ODT_NEVER, /* tied high */
  49. DDR3_RTT_OFF,
  50. DDR3_RTT_120_OHM
  51. }
  52. };
  53. static const struct dynamic_odt single_D[4] = {
  54. { /* cs0 */
  55. FSL_DDR_ODT_NEVER,
  56. FSL_DDR_ODT_ALL,
  57. DDR3_RTT_40_OHM,
  58. DDR3_RTT_OFF
  59. },
  60. { /* cs1 */
  61. FSL_DDR_ODT_NEVER,
  62. FSL_DDR_ODT_NEVER,
  63. DDR3_RTT_OFF,
  64. DDR3_RTT_OFF
  65. },
  66. {0, 0, 0, 0},
  67. {0, 0, 0, 0}
  68. };
  69. static const struct dynamic_odt single_S[4] = {
  70. { /* cs0 */
  71. FSL_DDR_ODT_NEVER,
  72. FSL_DDR_ODT_ALL,
  73. DDR3_RTT_40_OHM,
  74. DDR3_RTT_OFF
  75. },
  76. {0, 0, 0, 0},
  77. {0, 0, 0, 0},
  78. {0, 0, 0, 0},
  79. };
  80. static const struct dynamic_odt dual_DD[4] = {
  81. { /* cs0 */
  82. FSL_DDR_ODT_NEVER,
  83. FSL_DDR_ODT_SAME_DIMM,
  84. DDR3_RTT_120_OHM,
  85. DDR3_RTT_OFF
  86. },
  87. { /* cs1 */
  88. FSL_DDR_ODT_OTHER_DIMM,
  89. FSL_DDR_ODT_OTHER_DIMM,
  90. DDR3_RTT_30_OHM,
  91. DDR3_RTT_OFF
  92. },
  93. { /* cs2 */
  94. FSL_DDR_ODT_NEVER,
  95. FSL_DDR_ODT_SAME_DIMM,
  96. DDR3_RTT_120_OHM,
  97. DDR3_RTT_OFF
  98. },
  99. { /* cs3 */
  100. FSL_DDR_ODT_OTHER_DIMM,
  101. FSL_DDR_ODT_OTHER_DIMM,
  102. DDR3_RTT_30_OHM,
  103. DDR3_RTT_OFF
  104. }
  105. };
  106. static const struct dynamic_odt dual_DS[4] = {
  107. { /* cs0 */
  108. FSL_DDR_ODT_NEVER,
  109. FSL_DDR_ODT_SAME_DIMM,
  110. DDR3_RTT_120_OHM,
  111. DDR3_RTT_OFF
  112. },
  113. { /* cs1 */
  114. FSL_DDR_ODT_OTHER_DIMM,
  115. FSL_DDR_ODT_OTHER_DIMM,
  116. DDR3_RTT_30_OHM,
  117. DDR3_RTT_OFF
  118. },
  119. { /* cs2 */
  120. FSL_DDR_ODT_OTHER_DIMM,
  121. FSL_DDR_ODT_ALL,
  122. DDR3_RTT_20_OHM,
  123. DDR3_RTT_120_OHM
  124. },
  125. {0, 0, 0, 0}
  126. };
  127. static const struct dynamic_odt dual_SD[4] = {
  128. { /* cs0 */
  129. FSL_DDR_ODT_OTHER_DIMM,
  130. FSL_DDR_ODT_ALL,
  131. DDR3_RTT_20_OHM,
  132. DDR3_RTT_120_OHM
  133. },
  134. {0, 0, 0, 0},
  135. { /* cs2 */
  136. FSL_DDR_ODT_NEVER,
  137. FSL_DDR_ODT_SAME_DIMM,
  138. DDR3_RTT_120_OHM,
  139. DDR3_RTT_OFF
  140. },
  141. { /* cs3 */
  142. FSL_DDR_ODT_OTHER_DIMM,
  143. FSL_DDR_ODT_OTHER_DIMM,
  144. DDR3_RTT_20_OHM,
  145. DDR3_RTT_OFF
  146. }
  147. };
  148. static const struct dynamic_odt dual_SS[4] = {
  149. { /* cs0 */
  150. FSL_DDR_ODT_OTHER_DIMM,
  151. FSL_DDR_ODT_ALL,
  152. DDR3_RTT_30_OHM,
  153. DDR3_RTT_120_OHM
  154. },
  155. {0, 0, 0, 0},
  156. { /* cs2 */
  157. FSL_DDR_ODT_OTHER_DIMM,
  158. FSL_DDR_ODT_ALL,
  159. DDR3_RTT_30_OHM,
  160. DDR3_RTT_120_OHM
  161. },
  162. {0, 0, 0, 0}
  163. };
  164. static const struct dynamic_odt dual_D0[4] = {
  165. { /* cs0 */
  166. FSL_DDR_ODT_NEVER,
  167. FSL_DDR_ODT_SAME_DIMM,
  168. DDR3_RTT_40_OHM,
  169. DDR3_RTT_OFF
  170. },
  171. { /* cs1 */
  172. FSL_DDR_ODT_NEVER,
  173. FSL_DDR_ODT_NEVER,
  174. DDR3_RTT_OFF,
  175. DDR3_RTT_OFF
  176. },
  177. {0, 0, 0, 0},
  178. {0, 0, 0, 0}
  179. };
  180. static const struct dynamic_odt dual_0D[4] = {
  181. {0, 0, 0, 0},
  182. {0, 0, 0, 0},
  183. { /* cs2 */
  184. FSL_DDR_ODT_NEVER,
  185. FSL_DDR_ODT_SAME_DIMM,
  186. DDR3_RTT_40_OHM,
  187. DDR3_RTT_OFF
  188. },
  189. { /* cs3 */
  190. FSL_DDR_ODT_NEVER,
  191. FSL_DDR_ODT_NEVER,
  192. DDR3_RTT_OFF,
  193. DDR3_RTT_OFF
  194. }
  195. };
  196. static const struct dynamic_odt dual_S0[4] = {
  197. { /* cs0 */
  198. FSL_DDR_ODT_NEVER,
  199. FSL_DDR_ODT_CS,
  200. DDR3_RTT_40_OHM,
  201. DDR3_RTT_OFF
  202. },
  203. {0, 0, 0, 0},
  204. {0, 0, 0, 0},
  205. {0, 0, 0, 0}
  206. };
  207. static const struct dynamic_odt dual_0S[4] = {
  208. {0, 0, 0, 0},
  209. {0, 0, 0, 0},
  210. { /* cs2 */
  211. FSL_DDR_ODT_NEVER,
  212. FSL_DDR_ODT_CS,
  213. DDR3_RTT_40_OHM,
  214. DDR3_RTT_OFF
  215. },
  216. {0, 0, 0, 0}
  217. };
  218. static const struct dynamic_odt odt_unknown[4] = {
  219. { /* cs0 */
  220. FSL_DDR_ODT_NEVER,
  221. FSL_DDR_ODT_CS,
  222. DDR3_RTT_120_OHM,
  223. DDR3_RTT_OFF
  224. },
  225. { /* cs1 */
  226. FSL_DDR_ODT_NEVER,
  227. FSL_DDR_ODT_CS,
  228. DDR3_RTT_120_OHM,
  229. DDR3_RTT_OFF
  230. },
  231. { /* cs2 */
  232. FSL_DDR_ODT_NEVER,
  233. FSL_DDR_ODT_CS,
  234. DDR3_RTT_120_OHM,
  235. DDR3_RTT_OFF
  236. },
  237. { /* cs3 */
  238. FSL_DDR_ODT_NEVER,
  239. FSL_DDR_ODT_CS,
  240. DDR3_RTT_120_OHM,
  241. DDR3_RTT_OFF
  242. }
  243. };
  244. #else /* CONFIG_FSL_DDR3 */
  245. static const struct dynamic_odt single_Q[4] = {
  246. {0, 0, 0, 0},
  247. {0, 0, 0, 0},
  248. {0, 0, 0, 0},
  249. {0, 0, 0, 0}
  250. };
  251. static const struct dynamic_odt single_D[4] = {
  252. { /* cs0 */
  253. FSL_DDR_ODT_NEVER,
  254. FSL_DDR_ODT_ALL,
  255. DDR2_RTT_150_OHM,
  256. DDR2_RTT_OFF
  257. },
  258. { /* cs1 */
  259. FSL_DDR_ODT_NEVER,
  260. FSL_DDR_ODT_NEVER,
  261. DDR2_RTT_OFF,
  262. DDR2_RTT_OFF
  263. },
  264. {0, 0, 0, 0},
  265. {0, 0, 0, 0}
  266. };
  267. static const struct dynamic_odt single_S[4] = {
  268. { /* cs0 */
  269. FSL_DDR_ODT_NEVER,
  270. FSL_DDR_ODT_ALL,
  271. DDR2_RTT_150_OHM,
  272. DDR2_RTT_OFF
  273. },
  274. {0, 0, 0, 0},
  275. {0, 0, 0, 0},
  276. {0, 0, 0, 0},
  277. };
  278. static const struct dynamic_odt dual_DD[4] = {
  279. { /* cs0 */
  280. FSL_DDR_ODT_OTHER_DIMM,
  281. FSL_DDR_ODT_OTHER_DIMM,
  282. DDR2_RTT_75_OHM,
  283. DDR2_RTT_OFF
  284. },
  285. { /* cs1 */
  286. FSL_DDR_ODT_NEVER,
  287. FSL_DDR_ODT_NEVER,
  288. DDR2_RTT_OFF,
  289. DDR2_RTT_OFF
  290. },
  291. { /* cs2 */
  292. FSL_DDR_ODT_OTHER_DIMM,
  293. FSL_DDR_ODT_OTHER_DIMM,
  294. DDR2_RTT_75_OHM,
  295. DDR2_RTT_OFF
  296. },
  297. { /* cs3 */
  298. FSL_DDR_ODT_NEVER,
  299. FSL_DDR_ODT_NEVER,
  300. DDR2_RTT_OFF,
  301. DDR2_RTT_OFF
  302. }
  303. };
  304. static const struct dynamic_odt dual_DS[4] = {
  305. { /* cs0 */
  306. FSL_DDR_ODT_OTHER_DIMM,
  307. FSL_DDR_ODT_OTHER_DIMM,
  308. DDR2_RTT_75_OHM,
  309. DDR2_RTT_OFF
  310. },
  311. { /* cs1 */
  312. FSL_DDR_ODT_NEVER,
  313. FSL_DDR_ODT_NEVER,
  314. DDR2_RTT_OFF,
  315. DDR2_RTT_OFF
  316. },
  317. { /* cs2 */
  318. FSL_DDR_ODT_OTHER_DIMM,
  319. FSL_DDR_ODT_OTHER_DIMM,
  320. DDR2_RTT_75_OHM,
  321. DDR2_RTT_OFF
  322. },
  323. {0, 0, 0, 0}
  324. };
  325. static const struct dynamic_odt dual_SD[4] = {
  326. { /* cs0 */
  327. FSL_DDR_ODT_OTHER_DIMM,
  328. FSL_DDR_ODT_OTHER_DIMM,
  329. DDR2_RTT_75_OHM,
  330. DDR2_RTT_OFF
  331. },
  332. {0, 0, 0, 0},
  333. { /* cs2 */
  334. FSL_DDR_ODT_OTHER_DIMM,
  335. FSL_DDR_ODT_OTHER_DIMM,
  336. DDR2_RTT_75_OHM,
  337. DDR2_RTT_OFF
  338. },
  339. { /* cs3 */
  340. FSL_DDR_ODT_NEVER,
  341. FSL_DDR_ODT_NEVER,
  342. DDR2_RTT_OFF,
  343. DDR2_RTT_OFF
  344. }
  345. };
  346. static const struct dynamic_odt dual_SS[4] = {
  347. { /* cs0 */
  348. FSL_DDR_ODT_OTHER_DIMM,
  349. FSL_DDR_ODT_OTHER_DIMM,
  350. DDR2_RTT_75_OHM,
  351. DDR2_RTT_OFF
  352. },
  353. {0, 0, 0, 0},
  354. { /* cs2 */
  355. FSL_DDR_ODT_OTHER_DIMM,
  356. FSL_DDR_ODT_OTHER_DIMM,
  357. DDR2_RTT_75_OHM,
  358. DDR2_RTT_OFF
  359. },
  360. {0, 0, 0, 0}
  361. };
  362. static const struct dynamic_odt dual_D0[4] = {
  363. { /* cs0 */
  364. FSL_DDR_ODT_NEVER,
  365. FSL_DDR_ODT_ALL,
  366. DDR2_RTT_150_OHM,
  367. DDR2_RTT_OFF
  368. },
  369. { /* cs1 */
  370. FSL_DDR_ODT_NEVER,
  371. FSL_DDR_ODT_NEVER,
  372. DDR2_RTT_OFF,
  373. DDR2_RTT_OFF
  374. },
  375. {0, 0, 0, 0},
  376. {0, 0, 0, 0}
  377. };
  378. static const struct dynamic_odt dual_0D[4] = {
  379. {0, 0, 0, 0},
  380. {0, 0, 0, 0},
  381. { /* cs2 */
  382. FSL_DDR_ODT_NEVER,
  383. FSL_DDR_ODT_ALL,
  384. DDR2_RTT_150_OHM,
  385. DDR2_RTT_OFF
  386. },
  387. { /* cs3 */
  388. FSL_DDR_ODT_NEVER,
  389. FSL_DDR_ODT_NEVER,
  390. DDR2_RTT_OFF,
  391. DDR2_RTT_OFF
  392. }
  393. };
  394. static const struct dynamic_odt dual_S0[4] = {
  395. { /* cs0 */
  396. FSL_DDR_ODT_NEVER,
  397. FSL_DDR_ODT_CS,
  398. DDR2_RTT_150_OHM,
  399. DDR2_RTT_OFF
  400. },
  401. {0, 0, 0, 0},
  402. {0, 0, 0, 0},
  403. {0, 0, 0, 0}
  404. };
  405. static const struct dynamic_odt dual_0S[4] = {
  406. {0, 0, 0, 0},
  407. {0, 0, 0, 0},
  408. { /* cs2 */
  409. FSL_DDR_ODT_NEVER,
  410. FSL_DDR_ODT_CS,
  411. DDR2_RTT_150_OHM,
  412. DDR2_RTT_OFF
  413. },
  414. {0, 0, 0, 0}
  415. };
  416. static const struct dynamic_odt odt_unknown[4] = {
  417. { /* cs0 */
  418. FSL_DDR_ODT_NEVER,
  419. FSL_DDR_ODT_CS,
  420. DDR2_RTT_75_OHM,
  421. DDR2_RTT_OFF
  422. },
  423. { /* cs1 */
  424. FSL_DDR_ODT_NEVER,
  425. FSL_DDR_ODT_NEVER,
  426. DDR2_RTT_OFF,
  427. DDR2_RTT_OFF
  428. },
  429. { /* cs2 */
  430. FSL_DDR_ODT_NEVER,
  431. FSL_DDR_ODT_CS,
  432. DDR2_RTT_75_OHM,
  433. DDR2_RTT_OFF
  434. },
  435. { /* cs3 */
  436. FSL_DDR_ODT_NEVER,
  437. FSL_DDR_ODT_NEVER,
  438. DDR2_RTT_OFF,
  439. DDR2_RTT_OFF
  440. }
  441. };
  442. #endif
  443. /*
  444. * Automatically seleect bank interleaving mode based on DIMMs
  445. * in this order: cs0_cs1_cs2_cs3, cs0_cs1, null.
  446. * This function only deal with one or two slots per controller.
  447. */
  448. static inline unsigned int auto_bank_intlv(dimm_params_t *pdimm)
  449. {
  450. #if (CONFIG_DIMM_SLOTS_PER_CTLR == 1)
  451. if (pdimm[0].n_ranks == 4)
  452. return FSL_DDR_CS0_CS1_CS2_CS3;
  453. else if (pdimm[0].n_ranks == 2)
  454. return FSL_DDR_CS0_CS1;
  455. #elif (CONFIG_DIMM_SLOTS_PER_CTLR == 2)
  456. #ifdef CONFIG_FSL_DDR_FIRST_SLOT_QUAD_CAPABLE
  457. if (pdimm[0].n_ranks == 4)
  458. return FSL_DDR_CS0_CS1_CS2_CS3;
  459. #endif
  460. if (pdimm[0].n_ranks == 2) {
  461. if (pdimm[1].n_ranks == 2)
  462. return FSL_DDR_CS0_CS1_CS2_CS3;
  463. else
  464. return FSL_DDR_CS0_CS1;
  465. }
  466. #endif
  467. return 0;
  468. }
  469. unsigned int populate_memctl_options(int all_dimms_registered,
  470. memctl_options_t *popts,
  471. dimm_params_t *pdimm,
  472. unsigned int ctrl_num)
  473. {
  474. unsigned int i;
  475. char buffer[HWCONFIG_BUFFER_SIZE];
  476. char *buf = NULL;
  477. #if defined(CONFIG_FSL_DDR3) || defined(CONFIG_FSL_DDR2)
  478. const struct dynamic_odt *pdodt = odt_unknown;
  479. #endif
  480. ulong ddr_freq;
  481. /*
  482. * Extract hwconfig from environment since we have not properly setup
  483. * the environment but need it for ddr config params
  484. */
  485. if (getenv_f("hwconfig", buffer, sizeof(buffer)) > 0)
  486. buf = buffer;
  487. #if defined(CONFIG_FSL_DDR3) || defined(CONFIG_FSL_DDR2)
  488. /* Chip select options. */
  489. if (CONFIG_DIMM_SLOTS_PER_CTLR == 1) {
  490. switch (pdimm[0].n_ranks) {
  491. case 1:
  492. pdodt = single_S;
  493. break;
  494. case 2:
  495. pdodt = single_D;
  496. break;
  497. case 4:
  498. pdodt = single_Q;
  499. break;
  500. }
  501. } else if (CONFIG_DIMM_SLOTS_PER_CTLR == 2) {
  502. switch (pdimm[0].n_ranks) {
  503. #ifdef CONFIG_FSL_DDR_FIRST_SLOT_QUAD_CAPABLE
  504. case 4:
  505. pdodt = single_Q;
  506. if (pdimm[1].n_ranks)
  507. printf("Error: Quad- and Dual-rank DIMMs "
  508. "cannot be used together\n");
  509. break;
  510. #endif
  511. case 2:
  512. switch (pdimm[1].n_ranks) {
  513. case 2:
  514. pdodt = dual_DD;
  515. break;
  516. case 1:
  517. pdodt = dual_DS;
  518. break;
  519. case 0:
  520. pdodt = dual_D0;
  521. break;
  522. }
  523. break;
  524. case 1:
  525. switch (pdimm[1].n_ranks) {
  526. case 2:
  527. pdodt = dual_SD;
  528. break;
  529. case 1:
  530. pdodt = dual_SS;
  531. break;
  532. case 0:
  533. pdodt = dual_S0;
  534. break;
  535. }
  536. break;
  537. case 0:
  538. switch (pdimm[1].n_ranks) {
  539. case 2:
  540. pdodt = dual_0D;
  541. break;
  542. case 1:
  543. pdodt = dual_0S;
  544. break;
  545. }
  546. break;
  547. }
  548. }
  549. #endif
  550. /* Pick chip-select local options. */
  551. for (i = 0; i < CONFIG_CHIP_SELECTS_PER_CTRL; i++) {
  552. #if defined(CONFIG_FSL_DDR3) || defined(CONFIG_FSL_DDR2)
  553. popts->cs_local_opts[i].odt_rd_cfg = pdodt[i].odt_rd_cfg;
  554. popts->cs_local_opts[i].odt_wr_cfg = pdodt[i].odt_wr_cfg;
  555. popts->cs_local_opts[i].odt_rtt_norm = pdodt[i].odt_rtt_norm;
  556. popts->cs_local_opts[i].odt_rtt_wr = pdodt[i].odt_rtt_wr;
  557. #else
  558. popts->cs_local_opts[i].odt_rd_cfg = FSL_DDR_ODT_NEVER;
  559. popts->cs_local_opts[i].odt_wr_cfg = FSL_DDR_ODT_CS;
  560. #endif
  561. popts->cs_local_opts[i].auto_precharge = 0;
  562. }
  563. /* Pick interleaving mode. */
  564. /*
  565. * 0 = no interleaving
  566. * 1 = interleaving between 2 controllers
  567. */
  568. popts->memctl_interleaving = 0;
  569. /*
  570. * 0 = cacheline
  571. * 1 = page
  572. * 2 = (logical) bank
  573. * 3 = superbank (only if CS interleaving is enabled)
  574. */
  575. popts->memctl_interleaving_mode = 0;
  576. /*
  577. * 0: cacheline: bit 30 of the 36-bit physical addr selects the memctl
  578. * 1: page: bit to the left of the column bits selects the memctl
  579. * 2: bank: bit to the left of the bank bits selects the memctl
  580. * 3: superbank: bit to the left of the chip select selects the memctl
  581. *
  582. * NOTE: ba_intlv (rank interleaving) is independent of memory
  583. * controller interleaving; it is only within a memory controller.
  584. * Must use superbank interleaving if rank interleaving is used and
  585. * memory controller interleaving is enabled.
  586. */
  587. /*
  588. * 0 = no
  589. * 0x40 = CS0,CS1
  590. * 0x20 = CS2,CS3
  591. * 0x60 = CS0,CS1 + CS2,CS3
  592. * 0x04 = CS0,CS1,CS2,CS3
  593. */
  594. popts->ba_intlv_ctl = 0;
  595. /* Memory Organization Parameters */
  596. popts->registered_dimm_en = all_dimms_registered;
  597. /* Operational Mode Paramters */
  598. /* Pick ECC modes */
  599. popts->ecc_mode = 0; /* 0 = disabled, 1 = enabled */
  600. #ifdef CONFIG_DDR_ECC
  601. if (hwconfig_sub_f("fsl_ddr", "ecc", buf)) {
  602. if (hwconfig_subarg_cmp_f("fsl_ddr", "ecc", "on", buf))
  603. popts->ecc_mode = 1;
  604. } else
  605. popts->ecc_mode = 1;
  606. #endif
  607. popts->ecc_init_using_memctl = 1; /* 0 = use DMA, 1 = use memctl */
  608. /*
  609. * Choose DQS config
  610. * 0 for DDR1
  611. * 1 for DDR2
  612. */
  613. #if defined(CONFIG_FSL_DDR1)
  614. popts->dqs_config = 0;
  615. #elif defined(CONFIG_FSL_DDR2) || defined(CONFIG_FSL_DDR3)
  616. popts->dqs_config = 1;
  617. #endif
  618. /* Choose self-refresh during sleep. */
  619. popts->self_refresh_in_sleep = 1;
  620. /* Choose dynamic power management mode. */
  621. popts->dynamic_power = 0;
  622. /*
  623. * check first dimm for primary sdram width
  624. * presuming all dimms are similar
  625. * 0 = 64-bit, 1 = 32-bit, 2 = 16-bit
  626. */
  627. #if defined(CONFIG_FSL_DDR1) || defined(CONFIG_FSL_DDR2)
  628. if (pdimm[0].n_ranks != 0) {
  629. if ((pdimm[0].data_width >= 64) && \
  630. (pdimm[0].data_width <= 72))
  631. popts->data_bus_width = 0;
  632. else if ((pdimm[0].data_width >= 32) || \
  633. (pdimm[0].data_width <= 40))
  634. popts->data_bus_width = 1;
  635. else {
  636. panic("Error: data width %u is invalid!\n",
  637. pdimm[0].data_width);
  638. }
  639. }
  640. #else
  641. if (pdimm[0].n_ranks != 0) {
  642. if (pdimm[0].primary_sdram_width == 64)
  643. popts->data_bus_width = 0;
  644. else if (pdimm[0].primary_sdram_width == 32)
  645. popts->data_bus_width = 1;
  646. else if (pdimm[0].primary_sdram_width == 16)
  647. popts->data_bus_width = 2;
  648. else {
  649. panic("Error: primary sdram width %u is invalid!\n",
  650. pdimm[0].primary_sdram_width);
  651. }
  652. }
  653. #endif
  654. popts->x4_en = (pdimm[0].device_width == 4) ? 1 : 0;
  655. /* Choose burst length. */
  656. #if defined(CONFIG_FSL_DDR3)
  657. #if defined(CONFIG_E500MC)
  658. popts->otf_burst_chop_en = 0; /* on-the-fly burst chop disable */
  659. popts->burst_length = DDR_BL8; /* Fixed 8-beat burst len */
  660. #else
  661. if ((popts->data_bus_width == 1) || (popts->data_bus_width == 2)) {
  662. /* 32-bit or 16-bit bus */
  663. popts->otf_burst_chop_en = 0;
  664. popts->burst_length = DDR_BL8;
  665. } else {
  666. popts->otf_burst_chop_en = 1; /* on-the-fly burst chop */
  667. popts->burst_length = DDR_OTF; /* on-the-fly BC4 and BL8 */
  668. }
  669. #endif
  670. #else
  671. popts->burst_length = DDR_BL4; /* has to be 4 for DDR2 */
  672. #endif
  673. /* Choose ddr controller address mirror mode */
  674. #if defined(CONFIG_FSL_DDR3)
  675. popts->mirrored_dimm = pdimm[0].mirrored_dimm;
  676. #endif
  677. /* Global Timing Parameters. */
  678. debug("mclk_ps = %u ps\n", get_memory_clk_period_ps());
  679. /* Pick a caslat override. */
  680. popts->cas_latency_override = 0;
  681. popts->cas_latency_override_value = 3;
  682. if (popts->cas_latency_override) {
  683. debug("using caslat override value = %u\n",
  684. popts->cas_latency_override_value);
  685. }
  686. /* Decide whether to use the computed derated latency */
  687. popts->use_derated_caslat = 0;
  688. /* Choose an additive latency. */
  689. popts->additive_latency_override = 0;
  690. popts->additive_latency_override_value = 3;
  691. if (popts->additive_latency_override) {
  692. debug("using additive latency override value = %u\n",
  693. popts->additive_latency_override_value);
  694. }
  695. /*
  696. * 2T_EN setting
  697. *
  698. * Factors to consider for 2T_EN:
  699. * - number of DIMMs installed
  700. * - number of components, number of active ranks
  701. * - how much time you want to spend playing around
  702. */
  703. popts->twot_en = 0;
  704. popts->threet_en = 0;
  705. /* for RDIMM, address parity enable */
  706. popts->ap_en = 1;
  707. /*
  708. * BSTTOPRE precharge interval
  709. *
  710. * Set this to 0 for global auto precharge
  711. *
  712. * FIXME: Should this be configured in picoseconds?
  713. * Why it should be in ps: better understanding of this
  714. * relative to actual DRAM timing parameters such as tRAS.
  715. * e.g. tRAS(min) = 40 ns
  716. */
  717. popts->bstopre = 0x100;
  718. /* Minimum CKE pulse width -- tCKE(MIN) */
  719. popts->tcke_clock_pulse_width_ps
  720. = mclk_to_picos(FSL_DDR_MIN_TCKE_PULSE_WIDTH_DDR);
  721. /*
  722. * Window for four activates -- tFAW
  723. *
  724. * FIXME: UM: applies only to DDR2/DDR3 with eight logical banks only
  725. * FIXME: varies depending upon number of column addresses or data
  726. * FIXME: width, was considering looking at pdimm->primary_sdram_width
  727. */
  728. #if defined(CONFIG_FSL_DDR1)
  729. popts->tfaw_window_four_activates_ps = mclk_to_picos(1);
  730. #elif defined(CONFIG_FSL_DDR2)
  731. /*
  732. * x4/x8; some datasheets have 35000
  733. * x16 wide columns only? Use 50000?
  734. */
  735. popts->tfaw_window_four_activates_ps = 37500;
  736. #elif defined(CONFIG_FSL_DDR3)
  737. popts->tfaw_window_four_activates_ps = pdimm[0].tfaw_ps;
  738. #endif
  739. popts->zq_en = 0;
  740. popts->wrlvl_en = 0;
  741. #if defined(CONFIG_FSL_DDR3)
  742. /*
  743. * due to ddr3 dimm is fly-by topology
  744. * we suggest to enable write leveling to
  745. * meet the tQDSS under different loading.
  746. */
  747. popts->wrlvl_en = 1;
  748. popts->zq_en = 1;
  749. popts->wrlvl_override = 0;
  750. #endif
  751. /*
  752. * Check interleaving configuration from environment.
  753. * Please refer to doc/README.fsl-ddr for the detail.
  754. *
  755. * If memory controller interleaving is enabled, then the data
  756. * bus widths must be programmed identically for all memory controllers.
  757. *
  758. * XXX: Attempt to set all controllers to the same chip select
  759. * interleaving mode. It will do a best effort to get the
  760. * requested ranks interleaved together such that the result
  761. * should be a subset of the requested configuration.
  762. */
  763. #if (CONFIG_NUM_DDR_CONTROLLERS > 1)
  764. if (!hwconfig_sub_f("fsl_ddr", "ctlr_intlv", buf))
  765. goto done;
  766. if (pdimm[0].n_ranks == 0) {
  767. printf("There is no rank on CS0 for controller %d.\n", ctrl_num);
  768. popts->memctl_interleaving = 0;
  769. goto done;
  770. }
  771. popts->memctl_interleaving = 1;
  772. /*
  773. * test null first. if CONFIG_HWCONFIG is not defined
  774. * hwconfig_arg_cmp returns non-zero
  775. */
  776. if (hwconfig_subarg_cmp_f("fsl_ddr", "ctlr_intlv",
  777. "null", buf)) {
  778. popts->memctl_interleaving = 0;
  779. debug("memory controller interleaving disabled.\n");
  780. } else if (hwconfig_subarg_cmp_f("fsl_ddr",
  781. "ctlr_intlv",
  782. "cacheline", buf)) {
  783. popts->memctl_interleaving_mode =
  784. ((CONFIG_NUM_DDR_CONTROLLERS == 3) && ctrl_num == 2) ?
  785. 0 : FSL_DDR_CACHE_LINE_INTERLEAVING;
  786. popts->memctl_interleaving =
  787. ((CONFIG_NUM_DDR_CONTROLLERS == 3) && ctrl_num == 2) ?
  788. 0 : 1;
  789. } else if (hwconfig_subarg_cmp_f("fsl_ddr",
  790. "ctlr_intlv",
  791. "page", buf)) {
  792. popts->memctl_interleaving_mode =
  793. ((CONFIG_NUM_DDR_CONTROLLERS == 3) && ctrl_num == 2) ?
  794. 0 : FSL_DDR_PAGE_INTERLEAVING;
  795. popts->memctl_interleaving =
  796. ((CONFIG_NUM_DDR_CONTROLLERS == 3) && ctrl_num == 2) ?
  797. 0 : 1;
  798. } else if (hwconfig_subarg_cmp_f("fsl_ddr",
  799. "ctlr_intlv",
  800. "bank", buf)) {
  801. popts->memctl_interleaving_mode =
  802. ((CONFIG_NUM_DDR_CONTROLLERS == 3) && ctrl_num == 2) ?
  803. 0 : FSL_DDR_BANK_INTERLEAVING;
  804. popts->memctl_interleaving =
  805. ((CONFIG_NUM_DDR_CONTROLLERS == 3) && ctrl_num == 2) ?
  806. 0 : 1;
  807. } else if (hwconfig_subarg_cmp_f("fsl_ddr",
  808. "ctlr_intlv",
  809. "superbank", buf)) {
  810. popts->memctl_interleaving_mode =
  811. ((CONFIG_NUM_DDR_CONTROLLERS == 3) && ctrl_num == 2) ?
  812. 0 : FSL_DDR_SUPERBANK_INTERLEAVING;
  813. popts->memctl_interleaving =
  814. ((CONFIG_NUM_DDR_CONTROLLERS == 3) && ctrl_num == 2) ?
  815. 0 : 1;
  816. #if (CONFIG_NUM_DDR_CONTROLLERS == 3)
  817. } else if (hwconfig_subarg_cmp_f("fsl_ddr",
  818. "ctlr_intlv",
  819. "3way_1KB", buf)) {
  820. popts->memctl_interleaving_mode =
  821. FSL_DDR_3WAY_1KB_INTERLEAVING;
  822. } else if (hwconfig_subarg_cmp_f("fsl_ddr",
  823. "ctlr_intlv",
  824. "3way_4KB", buf)) {
  825. popts->memctl_interleaving_mode =
  826. FSL_DDR_3WAY_4KB_INTERLEAVING;
  827. } else if (hwconfig_subarg_cmp_f("fsl_ddr",
  828. "ctlr_intlv",
  829. "3way_8KB", buf)) {
  830. popts->memctl_interleaving_mode =
  831. FSL_DDR_3WAY_8KB_INTERLEAVING;
  832. #elif (CONFIG_NUM_DDR_CONTROLLERS == 4)
  833. } else if (hwconfig_subarg_cmp_f("fsl_ddr",
  834. "ctlr_intlv",
  835. "4way_1KB", buf)) {
  836. popts->memctl_interleaving_mode =
  837. FSL_DDR_4WAY_1KB_INTERLEAVING;
  838. } else if (hwconfig_subarg_cmp_f("fsl_ddr",
  839. "ctlr_intlv",
  840. "4way_4KB", buf)) {
  841. popts->memctl_interleaving_mode =
  842. FSL_DDR_4WAY_4KB_INTERLEAVING;
  843. } else if (hwconfig_subarg_cmp_f("fsl_ddr",
  844. "ctlr_intlv",
  845. "4way_8KB", buf)) {
  846. popts->memctl_interleaving_mode =
  847. FSL_DDR_4WAY_8KB_INTERLEAVING;
  848. #endif
  849. } else {
  850. popts->memctl_interleaving = 0;
  851. printf("hwconfig has unrecognized parameter for ctlr_intlv.\n");
  852. }
  853. done:
  854. #endif
  855. if ((hwconfig_sub_f("fsl_ddr", "bank_intlv", buf)) &&
  856. (CONFIG_CHIP_SELECTS_PER_CTRL > 1)) {
  857. /* test null first. if CONFIG_HWCONFIG is not defined,
  858. * hwconfig_subarg_cmp_f returns non-zero */
  859. if (hwconfig_subarg_cmp_f("fsl_ddr", "bank_intlv",
  860. "null", buf))
  861. debug("bank interleaving disabled.\n");
  862. else if (hwconfig_subarg_cmp_f("fsl_ddr", "bank_intlv",
  863. "cs0_cs1", buf))
  864. popts->ba_intlv_ctl = FSL_DDR_CS0_CS1;
  865. else if (hwconfig_subarg_cmp_f("fsl_ddr", "bank_intlv",
  866. "cs2_cs3", buf))
  867. popts->ba_intlv_ctl = FSL_DDR_CS2_CS3;
  868. else if (hwconfig_subarg_cmp_f("fsl_ddr", "bank_intlv",
  869. "cs0_cs1_and_cs2_cs3", buf))
  870. popts->ba_intlv_ctl = FSL_DDR_CS0_CS1_AND_CS2_CS3;
  871. else if (hwconfig_subarg_cmp_f("fsl_ddr", "bank_intlv",
  872. "cs0_cs1_cs2_cs3", buf))
  873. popts->ba_intlv_ctl = FSL_DDR_CS0_CS1_CS2_CS3;
  874. else if (hwconfig_subarg_cmp_f("fsl_ddr", "bank_intlv",
  875. "auto", buf))
  876. popts->ba_intlv_ctl = auto_bank_intlv(pdimm);
  877. else
  878. printf("hwconfig has unrecognized parameter for bank_intlv.\n");
  879. switch (popts->ba_intlv_ctl & FSL_DDR_CS0_CS1_CS2_CS3) {
  880. case FSL_DDR_CS0_CS1_CS2_CS3:
  881. #if (CONFIG_DIMM_SLOTS_PER_CTLR == 1)
  882. if (pdimm[0].n_ranks < 4) {
  883. popts->ba_intlv_ctl = 0;
  884. printf("Not enough bank(chip-select) for "
  885. "CS0+CS1+CS2+CS3 on controller %d, "
  886. "interleaving disabled!\n", ctrl_num);
  887. }
  888. #elif (CONFIG_DIMM_SLOTS_PER_CTLR == 2)
  889. #ifdef CONFIG_FSL_DDR_FIRST_SLOT_QUAD_CAPABLE
  890. if (pdimm[0].n_ranks == 4)
  891. break;
  892. #endif
  893. if ((pdimm[0].n_ranks < 2) && (pdimm[1].n_ranks < 2)) {
  894. popts->ba_intlv_ctl = 0;
  895. printf("Not enough bank(chip-select) for "
  896. "CS0+CS1+CS2+CS3 on controller %d, "
  897. "interleaving disabled!\n", ctrl_num);
  898. }
  899. if (pdimm[0].capacity != pdimm[1].capacity) {
  900. popts->ba_intlv_ctl = 0;
  901. printf("Not identical DIMM size for "
  902. "CS0+CS1+CS2+CS3 on controller %d, "
  903. "interleaving disabled!\n", ctrl_num);
  904. }
  905. #endif
  906. break;
  907. case FSL_DDR_CS0_CS1:
  908. if (pdimm[0].n_ranks < 2) {
  909. popts->ba_intlv_ctl = 0;
  910. printf("Not enough bank(chip-select) for "
  911. "CS0+CS1 on controller %d, "
  912. "interleaving disabled!\n", ctrl_num);
  913. }
  914. break;
  915. case FSL_DDR_CS2_CS3:
  916. #if (CONFIG_DIMM_SLOTS_PER_CTLR == 1)
  917. if (pdimm[0].n_ranks < 4) {
  918. popts->ba_intlv_ctl = 0;
  919. printf("Not enough bank(chip-select) for CS2+CS3 "
  920. "on controller %d, interleaving disabled!\n", ctrl_num);
  921. }
  922. #elif (CONFIG_DIMM_SLOTS_PER_CTLR == 2)
  923. if (pdimm[1].n_ranks < 2) {
  924. popts->ba_intlv_ctl = 0;
  925. printf("Not enough bank(chip-select) for CS2+CS3 "
  926. "on controller %d, interleaving disabled!\n", ctrl_num);
  927. }
  928. #endif
  929. break;
  930. case FSL_DDR_CS0_CS1_AND_CS2_CS3:
  931. #if (CONFIG_DIMM_SLOTS_PER_CTLR == 1)
  932. if (pdimm[0].n_ranks < 4) {
  933. popts->ba_intlv_ctl = 0;
  934. printf("Not enough bank(CS) for CS0+CS1 and "
  935. "CS2+CS3 on controller %d, "
  936. "interleaving disabled!\n", ctrl_num);
  937. }
  938. #elif (CONFIG_DIMM_SLOTS_PER_CTLR == 2)
  939. if ((pdimm[0].n_ranks < 2) || (pdimm[1].n_ranks < 2)) {
  940. popts->ba_intlv_ctl = 0;
  941. printf("Not enough bank(CS) for CS0+CS1 and "
  942. "CS2+CS3 on controller %d, "
  943. "interleaving disabled!\n", ctrl_num);
  944. }
  945. #endif
  946. break;
  947. default:
  948. popts->ba_intlv_ctl = 0;
  949. break;
  950. }
  951. }
  952. if (hwconfig_sub_f("fsl_ddr", "addr_hash", buf)) {
  953. if (hwconfig_subarg_cmp_f("fsl_ddr", "addr_hash", "null", buf))
  954. popts->addr_hash = 0;
  955. else if (hwconfig_subarg_cmp_f("fsl_ddr", "addr_hash",
  956. "true", buf))
  957. popts->addr_hash = 1;
  958. }
  959. if (pdimm[0].n_ranks == 4)
  960. popts->quad_rank_present = 1;
  961. ddr_freq = get_ddr_freq(0) / 1000000;
  962. if (popts->registered_dimm_en) {
  963. popts->rcw_override = 1;
  964. popts->rcw_1 = 0x000a5a00;
  965. if (ddr_freq <= 800)
  966. popts->rcw_2 = 0x00000000;
  967. else if (ddr_freq <= 1066)
  968. popts->rcw_2 = 0x00100000;
  969. else if (ddr_freq <= 1333)
  970. popts->rcw_2 = 0x00200000;
  971. else
  972. popts->rcw_2 = 0x00300000;
  973. }
  974. fsl_ddr_board_options(popts, pdimm, ctrl_num);
  975. return 0;
  976. }
  977. void check_interleaving_options(fsl_ddr_info_t *pinfo)
  978. {
  979. int i, j, k, check_n_ranks, intlv_invalid = 0;
  980. unsigned int check_intlv, check_n_row_addr, check_n_col_addr;
  981. unsigned long long check_rank_density;
  982. struct dimm_params_s *dimm;
  983. /*
  984. * Check if all controllers are configured for memory
  985. * controller interleaving. Identical dimms are recommended. At least
  986. * the size, row and col address should be checked.
  987. */
  988. j = 0;
  989. check_n_ranks = pinfo->dimm_params[0][0].n_ranks;
  990. check_rank_density = pinfo->dimm_params[0][0].rank_density;
  991. check_n_row_addr = pinfo->dimm_params[0][0].n_row_addr;
  992. check_n_col_addr = pinfo->dimm_params[0][0].n_col_addr;
  993. check_intlv = pinfo->memctl_opts[0].memctl_interleaving_mode;
  994. for (i = 0; i < CONFIG_NUM_DDR_CONTROLLERS; i++) {
  995. dimm = &pinfo->dimm_params[i][0];
  996. if (!pinfo->memctl_opts[i].memctl_interleaving) {
  997. continue;
  998. } else if (((check_rank_density != dimm->rank_density) ||
  999. (check_n_ranks != dimm->n_ranks) ||
  1000. (check_n_row_addr != dimm->n_row_addr) ||
  1001. (check_n_col_addr != dimm->n_col_addr) ||
  1002. (check_intlv !=
  1003. pinfo->memctl_opts[i].memctl_interleaving_mode))){
  1004. intlv_invalid = 1;
  1005. break;
  1006. } else {
  1007. j++;
  1008. }
  1009. }
  1010. if (intlv_invalid) {
  1011. for (i = 0; i < CONFIG_NUM_DDR_CONTROLLERS; i++)
  1012. pinfo->memctl_opts[i].memctl_interleaving = 0;
  1013. printf("Not all DIMMs are identical. "
  1014. "Memory controller interleaving disabled.\n");
  1015. } else {
  1016. switch (check_intlv) {
  1017. case FSL_DDR_CACHE_LINE_INTERLEAVING:
  1018. case FSL_DDR_PAGE_INTERLEAVING:
  1019. case FSL_DDR_BANK_INTERLEAVING:
  1020. case FSL_DDR_SUPERBANK_INTERLEAVING:
  1021. if (3 == CONFIG_NUM_DDR_CONTROLLERS)
  1022. k = 2;
  1023. else
  1024. k = CONFIG_NUM_DDR_CONTROLLERS;
  1025. break;
  1026. case FSL_DDR_3WAY_1KB_INTERLEAVING:
  1027. case FSL_DDR_3WAY_4KB_INTERLEAVING:
  1028. case FSL_DDR_3WAY_8KB_INTERLEAVING:
  1029. case FSL_DDR_4WAY_1KB_INTERLEAVING:
  1030. case FSL_DDR_4WAY_4KB_INTERLEAVING:
  1031. case FSL_DDR_4WAY_8KB_INTERLEAVING:
  1032. default:
  1033. k = CONFIG_NUM_DDR_CONTROLLERS;
  1034. break;
  1035. }
  1036. debug("%d of %d controllers are interleaving.\n", j, k);
  1037. if (j && (j != k)) {
  1038. for (i = 0; i < CONFIG_NUM_DDR_CONTROLLERS; i++)
  1039. pinfo->memctl_opts[i].memctl_interleaving = 0;
  1040. printf("Not all controllers have compatible "
  1041. "interleaving mode. All disabled.\n");
  1042. }
  1043. }
  1044. debug("Checking interleaving options completed\n");
  1045. }
  1046. int fsl_use_spd(void)
  1047. {
  1048. int use_spd = 0;
  1049. #ifdef CONFIG_DDR_SPD
  1050. char buffer[HWCONFIG_BUFFER_SIZE];
  1051. char *buf = NULL;
  1052. /*
  1053. * Extract hwconfig from environment since we have not properly setup
  1054. * the environment but need it for ddr config params
  1055. */
  1056. if (getenv_f("hwconfig", buffer, sizeof(buffer)) > 0)
  1057. buf = buffer;
  1058. /* if hwconfig is not enabled, or "sdram" is not defined, use spd */
  1059. if (hwconfig_sub_f("fsl_ddr", "sdram", buf)) {
  1060. if (hwconfig_subarg_cmp_f("fsl_ddr", "sdram", "spd", buf))
  1061. use_spd = 1;
  1062. else if (hwconfig_subarg_cmp_f("fsl_ddr", "sdram",
  1063. "fixed", buf))
  1064. use_spd = 0;
  1065. else
  1066. use_spd = 1;
  1067. } else
  1068. use_spd = 1;
  1069. #endif
  1070. return use_spd;
  1071. }