options.c 27 KB

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