ddrphy_phyinit_struct.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786
  1. /*
  2. * Copyright (C) 2021-2024, STMicroelectronics - All Rights Reserved
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef DDRPHY_PHYINIT_STRUCT_H
  7. #define DDRPHY_PHYINIT_STRUCT_H
  8. /* This file defines the internal data structures used in PhyInit to store user configuration */
  9. /* DIMM Type definitions */
  10. #define DDR_DIMMTYPE_NODIMM 4U /* No DIMM (Soldered-on) */
  11. /*
  12. * Structure for basic user inputs
  13. *
  14. * The following basic data structure must be set and completed correctly so
  15. * that the PhyInit software package can accurate program PHY registers.
  16. */
  17. struct user_input_basic {
  18. uint32_t dramtype; /*
  19. * DRAM module type.
  20. *
  21. * Value | Description
  22. * ----- | ------
  23. * 0x0 | DDR4
  24. * 0x1 | DDR3
  25. * 0x2 | LPDDR4
  26. */
  27. uint32_t dimmtype; /*
  28. * DIMM type.
  29. *
  30. * Value | Description
  31. * ----- | ------
  32. * 0x4 | No DIMM (Soldered-on) (DDR_DIMMTYPE_NODIMM)
  33. */
  34. uint32_t lp4xmode; /*
  35. * LPDDR4X mode support.
  36. * Only used for LPDDR4, but not valid here.
  37. *
  38. * Value | Description
  39. * ----- | ------
  40. * 0x0 | LPDDR4 mode, when dramtype is LPDDR4
  41. */
  42. uint32_t numdbyte; /* Number of dbytes physically instantiated */
  43. uint32_t numactivedbytedfi0; /* Number of active dbytes to be controlled by dfi0 */
  44. uint32_t numactivedbytedfi1; /*
  45. * Number of active dbytes to be controlled by dfi1.
  46. * Only used for LPDDR4.
  47. */
  48. uint32_t numanib; /* Number of ANIBs physically instantiated */
  49. uint32_t numrank_dfi0; /* Number of ranks in DFI0 channel */
  50. uint32_t numrank_dfi1; /* Number of ranks in DFI1 channel (if DFI1 exists) */
  51. uint32_t dramdatawidth; /*
  52. * Width of the DRAM device.
  53. *
  54. * Enter 4,8,16 or 32 depending on protocol and dram type
  55. * according below table.
  56. *
  57. * Protocol | Valid Options | Default
  58. * -------- | ------------- | ---
  59. * DDR3 | 4,8,16 | 8
  60. * DDR4 | 4,8,16 | 8
  61. * LPDDR4 | 8,16 | 16
  62. *
  63. * For mixed x8 and x16 width devices, set variable to x8.
  64. */
  65. uint32_t numpstates; /* Number of p-states used. Must be set to 1 */
  66. uint32_t frequency; /*
  67. * Memclk frequency for each PState.
  68. * Memclk frequency in MHz round up to next highest integer.
  69. * Enter 334 for 333.333, etc.
  70. */
  71. uint32_t pllbypass; /*
  72. * Indicates if PLL should be in Bypass mode.
  73. * If DDR datarate < 333, PLL must be in Bypass Mode.
  74. *
  75. * Value | Description
  76. * ----- | ------
  77. * 0x1 | Enabled
  78. * 0x0 | Disabled
  79. */
  80. uint32_t dfifreqratio; /*
  81. * Selected Dfi Frequency ratio.
  82. * Used to program the dfifreqratio register. This register
  83. * controls how dfi_freq_ratio input pin should be driven
  84. * inaccordance with DFI Spec.
  85. *
  86. * Binary Value | Description
  87. * ----- | ------
  88. * 2'b01 | 1:2 DFI Frequency Ratio (default)
  89. */
  90. uint32_t dfi1exists; /* Indicates if the PHY configuration has Dfi1 channel */
  91. uint32_t train2d; /* Obsolete. Not used. */
  92. uint32_t hardmacrover; /*
  93. * Hard Macro Family version in use.
  94. *
  95. * Value | Description
  96. * ----- | ------
  97. * 3 | hardmacro family D
  98. */
  99. uint32_t readdbienable; /* Obsolete. Not Used. */
  100. uint32_t dfimode; /* Obsolete. Not Used. */
  101. };
  102. /*
  103. * Structure for advanced user inputs
  104. */
  105. struct user_input_advanced {
  106. uint32_t lp4rxpreamblemode; /*
  107. * Selects between DRAM read static vs toggle preamble.
  108. * Determine desired DRAM Read Preamble Mode based on SI
  109. * Analysis and DRAM Part in use.
  110. * The PHY training firmware will program DRAM mr1-OP[3]
  111. * after training based on setting.
  112. *
  113. * Value | Description
  114. * ----- | ------
  115. * 0x1 | toggling preamble
  116. * 0x0 | static preamble
  117. */
  118. uint32_t lp4postambleext; /*
  119. * Extend write postamble in LPDDR4.
  120. * Only used for LPDDR4.
  121. * This variable is used to calculate LPDDR4 mr3-OP[1] set
  122. * in the messageBlock.
  123. * The training firmware will set DRAM MR according to MR
  124. * value in the messageBlock at the end of training.
  125. * Set value according to your SI analysis and DRAM
  126. * requirement.
  127. *
  128. * Value | Description
  129. * ----- | ------
  130. * 0x0 | half Memclk postamble
  131. * 0x1 | 1.5 Memclk postabmle (default)
  132. */
  133. uint32_t d4rxpreamblelength; /*
  134. * Length of read preamble in DDR4 mode.
  135. * Only used for DDR4.
  136. * This variable is used to calculate DDR4 mr4-OP[11] set
  137. * in the messageBlock.
  138. * The training firmware will set DRAM MR according to MR
  139. * value in the messageBlock at the end of training.
  140. * Set value according to your SI analysis and DRAM
  141. * requirement.
  142. *
  143. * Value | Description
  144. * ----- | ------
  145. * 0x0 | 1 Tck
  146. * 0x1 | 2 Tck (default)
  147. */
  148. uint32_t d4txpreamblelength; /*
  149. * Length of write preamble in DDR4 mode.
  150. * Only used for DDR4.
  151. * This variable is used to calculate DDR4 mr4-OP[12] set
  152. * in the messageBlock.
  153. * The training firmware will set DRAM MR according to MR
  154. * value in the messageBlock at the end of training.
  155. * Set value according to your SI analysis and DRAM
  156. * requirement.
  157. *
  158. * Value | Description
  159. * ----- | ------
  160. * 0x0 | 1 Tck (default)
  161. * 0x1 | 2 Tck
  162. */
  163. uint32_t extcalresval; /*
  164. * External Impedance calibration pull-down resistor value
  165. * select.
  166. * Indicates value of impedance calibration pull-down
  167. * resistor connected to BP_ZN pin of the PHY.
  168. * Value | Description
  169. * ----- | ------
  170. * 0x0 | 240 ohm (default)
  171. */
  172. uint32_t is2ttiming; /*
  173. * Set to 1 to use 2T timing for address/command, otherwise
  174. * 1T timing will be used.
  175. * Determine 1T or 2T Timing operation mode based on SI
  176. * Analysis and DRAM Timing.
  177. * - In 1T mode, CK, CS, CA all have the same nominal
  178. * timing, ie. ATxDly[6:0] will have same value for all
  179. * ANIBs.
  180. * - In 2T mode, CK, CS,have the same nominal timing
  181. * (e.g. AtxDly[6:0]=0x00), while CA is delayed by 1UI
  182. * (e.g. ATxDly[6:0]=0x40)
  183. * Used to program phycfg setting in messageBlock.
  184. *
  185. * Value | Description
  186. * ----- | ------
  187. * 0x0 | 1T Timing (default)
  188. * 0x1 | 2T Timing
  189. */
  190. uint32_t odtimpedance; /*
  191. * ODT impedance in ohm.
  192. * Used for programming TxOdtDrvStren registers.
  193. * Enter 0 for open/high-impedance.
  194. * Default value: 60
  195. */
  196. uint32_t tximpedance; /*
  197. * Tx Drive Impedance for DQ/DQS in ohm.
  198. * Used for programming TxImpedanceCtrl1 registers.
  199. * Enter 0 for open/high-impedance.
  200. * Default value: 60
  201. */
  202. uint32_t atximpedance; /*
  203. * Tx Drive Impedance for AC in ohm.
  204. * Used for programming ATxImpedance register.
  205. * Enter 0 for open/high-impedance
  206. * Default value: 20 (HMA,HMB,HMC,HMD), 40 (HME)
  207. */
  208. uint32_t memalerten; /*
  209. * Enables BP_ALERT programming of PHY registers.
  210. * Only used for DDR3 and DDR4.
  211. * Used for programming MemAlertControl and MemAlertControl2
  212. * registers.
  213. * Program if you require using BP_ALERT pin (to receive or
  214. * terminate signal) of the PHY otherwise leave at default
  215. * value to save power.
  216. *
  217. * Value | Description
  218. * ----- | ------
  219. * 0x0 | Disable BP_ALERT (default)
  220. */
  221. uint32_t memalertpuimp; /*
  222. * Specify MemAlert Pull-up Termination Impedance.
  223. * Programs the pull-up termination on BP_ALERT.
  224. * Not valid here (fixed 0 value).
  225. */
  226. uint32_t memalertvreflevel; /*
  227. * Specify the Vref level for BP_ALERT(MemAlert) Receiver.
  228. * Not valid here (fixed 0 value).
  229. */
  230. uint32_t memalertsyncbypass; /*
  231. * When set, this bit bypasses the DfiClk synchronizer on
  232. * dfi_alert_n.
  233. * Not valid here (fixed 0 value).
  234. */
  235. uint32_t disdynadrtri; /*
  236. * Disable Dynamic Per-MEMCLK Address Tristate feature.
  237. * Program this variable if you require to disable this
  238. * feature.
  239. * - In DDR3/2T and DDR4/2T/2N modes, the dynamic tristate
  240. * feature should be disabled if the controller cannot
  241. * follow the 2T PHY tristate protocol.
  242. * - In LPDDR4 mode, the dynamic tristate feature should
  243. * be disabled.
  244. *
  245. * Value | Description
  246. * ----- | ------
  247. * 0x1 | Disable Dynamic Tristate
  248. */
  249. uint32_t phymstrtraininterval; /*
  250. * Specifies the how frequent dfi_phymstr_req is issued by
  251. * PHY.
  252. * Only required in LPDDR4.
  253. * Based on SI analysis determine how frequent DRAM drift
  254. * compensation and re-training is required.
  255. * Determine if Memory controller supports DFI PHY Master
  256. * Interface.
  257. * Program based on desired setting for
  258. * PPTTrainSetup.PhyMstrTrainInterval register.
  259. * Default value: 0xa
  260. *
  261. * Example:
  262. * Value | Description
  263. * ----- | ------
  264. * 0xa | PPT Train Interval = 268435456 MEMCLKs (default)
  265. */
  266. uint32_t phymstrmaxreqtoack; /*
  267. * Max time from dfi_phymstr_req asserted to dfi_phymstr_ack
  268. * asserted.
  269. * Only required in LPDDR4.
  270. * Based on your Memory controller's(MC) specification
  271. * determine how long the PHY should wait for the assertion
  272. * of dfi_phymstr_ack once dfi_phymstr_req has been issued
  273. * by the PHY. If the MC does not ack the PHY's request, PHY
  274. * may issue dfi_error.
  275. * This value will be used to program
  276. * PPTTrainSetup.PhyMstrMaxReqToAck register.
  277. * Default value: 0x5
  278. *
  279. * Example:
  280. * Value | Description
  281. * ----- | ------
  282. * 0x5 | PPT Max. Req to Ack. = 8192 MEMCLKs (default)
  283. */
  284. uint32_t wdqsext; /*
  285. * Enable Write DQS Extension feature of PHY.
  286. *
  287. * Value | Description
  288. * ----- | ------
  289. * 0x0 | Disable Write DQS Extension feature. (default)
  290. * 0x1 | Enable Write DQS Extension feature.
  291. */
  292. uint32_t calinterval; /*
  293. * Specifies the interval between successive calibrations,
  294. * in mS.
  295. * Program variable based on desired setting for
  296. * CalRate.CalInterval register.
  297. * - Fixed 0x9 value (20mS interval)
  298. */
  299. uint32_t calonce; /*
  300. * This setting changes the behaviour of CalRun register.
  301. * If you desire to manually trigger impedance calibration
  302. * in mission mode set this variable to 1, and toggle CalRun
  303. * in mission mode.
  304. *
  305. * Value | Description
  306. * ----- | ------
  307. * 0x0 | Calibration will proceed at the rate determined
  308. * | by CalInterval. This field should only be changed
  309. * | while the calibrator is idle. ie before csr
  310. * | CalRun is set.
  311. */
  312. uint32_t lp4rl; /*
  313. * LPDDR4 Dram Read Latency.
  314. * Applicable only if dramtype == LPDDR4.
  315. * This variable is used to calculate LPDDR4 mr2-OP[2:0]
  316. * set in the messageBlock.
  317. * The training firmware will set DRAM MR according to MR
  318. * value in the messageBlock at the end of training.
  319. * Please refer to JEDEC JESD209-4A (LPDDR4) Spec for
  320. * definition of MR.
  321. * Determine values based on your DRAM part's supported
  322. * speed and latency bin.
  323. * Default: calculated based on user_input_basic.frequency
  324. * and "JEDEC JESD209-4A (LPDDR4)" Table 28 "Read and Write
  325. * Latencies".
  326. * Lowest latency selected when more than one latency can be
  327. * used. For example given configuration for LPDDR4, x16,
  328. * NoDbi and DDR533, RL=10 is selected rather than 14.
  329. */
  330. uint32_t lp4wl; /*
  331. * LPDDR4 Dram Write Latency.
  332. * Applicable only if dramtype == LPDDR4.
  333. * This variable is used to calculate LPDDR4 mr2-OP[5:3]
  334. * set in the messageBlock.
  335. * The training firmware will set DRAM MR according to MR
  336. * value in the messageBlock at the end of training.
  337. * Please refer to JEDEC JESD209-4A (LPDDR4) Spec for
  338. * definition of MR.
  339. * Determine values based on your DRAM part's supported
  340. * speed and latency bin.
  341. * Default: calculated based on user_input_basic.frequency
  342. * and "JEDEC JESD209-4A (LPDDR4)" Table 28 "Read and Write
  343. * Latencies".
  344. * Lowest latency selected when more than one latency can be
  345. * used.
  346. */
  347. uint32_t lp4wls; /*
  348. * LPDDR4 Dram WL Set.
  349. * Applicable only if dramtype == LPDDR4.
  350. * This variable is used to calculate LPDDR4 mr2-OP[6] set
  351. * in the messageBlock.
  352. * The training firmware will set DRAM MR according to MR
  353. * value in the messageBlock at the end of training.
  354. * Please refer to JEDEC JESD209-4A (LPDDR4) Spec for
  355. * definition of MR.
  356. * Determine value based on Memory controllers requirement
  357. * of DRAM State after PHY training.
  358. *
  359. * Value | Description
  360. * --- | ---
  361. * 0x0 | WL Set "A" (default)
  362. */
  363. uint32_t lp4dbird; /*
  364. * LPDDR4 Dram DBI-Read Enable.
  365. * Applicable only if dramtype == LPDDR4.
  366. * Determine if you require to using DBI for the given
  367. * PState.
  368. * If Read DBI is not used PHY receivers are turned off to
  369. * save power.
  370. * This variable is used to calculate LPDDR4 mr3-OP[6] set
  371. * in the messageBlock.
  372. * The training firmware will set DRAM MR according to MR
  373. * value in the messageBlock at the end of training.
  374. * PHY register DMIPinPresent is programmed based on this
  375. * parameter.
  376. * Please refer to JEDEC JESD209-4A (LPDDR4) Spec for
  377. * definition of MR.
  378. *
  379. * Value | Description
  380. * --- | ---
  381. * 0x0 | Disabled (default)
  382. * 0x1 | Enabled
  383. */
  384. uint32_t lp4dbiwr; /*
  385. * LPDDR4 Dram DBI-Write Enable.
  386. * Applicable only if dramtype == LPDDR4.
  387. * This variable is used to calculate LPDDR4 mr3-OP[7] set
  388. * in the messageBlock.
  389. * The training firmware will set DRAM MR according to MR
  390. * value in the messageBlock at the end of training.
  391. * Please refer to JEDEC JESD209-4A (LPDDR4) Spec for
  392. * definition of MR.
  393. *
  394. * Value | Description
  395. * --- | ---
  396. * 0x0 | Disabled (default)
  397. * 0x1 | Enabled
  398. */
  399. uint32_t lp4nwr; /*
  400. * LPDDR4 Write-Recovery for Auto- Pre-charge commands.
  401. * Applicable only if dramtype == LPDDR4.
  402. * This variable is used to calculate LPDDR4 mr1-OP[6:4] set
  403. * in the messageBlock.
  404. * The training firmware will set DRAM MR according to MR
  405. * value in the messageBlock at the end of training.
  406. * Please refer to JEDEC JESD209-4A (LPDDR4) Spec for
  407. * definition of MR.
  408. * Determine values based on your DRAM part's supported
  409. * speed and latency bin.
  410. * Default: calculated based on user_input_basic.frequency
  411. * and "JEDEC JESD209-4A (LPDDR4)" Table 28 "Read and Write
  412. * Latencies".
  413. * Lowest latency selected when more than one latency can be
  414. * used.
  415. *
  416. * Binary Value | Description
  417. * --- | ---
  418. * 000 | nWR = 6 (default)
  419. * 001 | nWR = 10
  420. * 010 | nWR = 16
  421. * 011 | nWR = 20
  422. * 100 | nWR = 24
  423. * 101 | nWR = 30
  424. * 110 | nWR = 34
  425. * 111 | nWR = 40
  426. */
  427. uint32_t lp4lowpowerdrv; /*
  428. * Configure output Driver in Low power mode.
  429. * Feature only supported for Hard Macro Family E (HME).
  430. * Use NMOS Pull-up for Low-Power IO.
  431. * Not valid here
  432. */
  433. uint32_t drambyteswap; /*
  434. * DRAM Oscillator count source mapping for skip_training.
  435. * The PHY supports swapping of DRAM oscillator count values
  436. * between paired DBytes for the purpose of tDQSDQ DRAM
  437. * Drift Compensation(DDC).
  438. * Each DByte has a register bit to control the source of
  439. * the oscillator count value used to perform tDQSDQ Drift
  440. * compensation.
  441. * On silicon the training firmware will determine the DByte
  442. * swap and program PptCtlStatic register to select
  443. * oscillator count source. When skip_train is used,
  444. * training firmware is skipped thus manual programming may
  445. * be required depending on configuration.
  446. * The default hardware configuration is for odd Dbyte
  447. * instance n to use oscillator count values from its paired
  448. * Dbyte instance n-1. So Dbyte1 will use the oscillator
  449. * count values from Dbyte0, Dbyte3 will use Dbyte2 and so
  450. * on. This is required for DRAM Data width =16.
  451. * Each bit of this field corresponds to a DBYTE:
  452. * - bit-0 = setting for DBYTE0
  453. * - bit-1 = setting for DBYTE1
  454. * - bit-2 = setting for DBYTE2
  455. * - . . .
  456. * - bit-n = setting for DBYTEn
  457. * By setting the associated bit for each DByte to 1, PHY
  458. * will use non-default source for count value.
  459. * - for even Dbytes, non-default source is to use the odd
  460. * pair count value.
  461. * - for odd Dbytes, no-default source to use data
  462. * received directly from the DRAM.
  463. * Byte swapping must be the same across different ranks.
  464. * Default value: 0x0
  465. * If Byte mode devices are indicated via the x8mode
  466. * messageBlock parameter, this variable is ignored as PHY
  467. * only supports a limited configuration set based on Byte
  468. * mode configuration.
  469. *
  470. * Example:
  471. * DramByteSwap = 0x03 - Dbyte0: use count values from
  472. * Dbyte1, Dbyte1 uses count values received directly
  473. * received from DRAM.
  474. * Rest of Dbytes have default source for DRAM oscilator
  475. * count.
  476. */
  477. uint32_t rxenbackoff; /*
  478. * Determines the Placement of PHY Read Gate signal.
  479. * Only used in LPDDR4 when lp4rxpreamblemode==0 (static
  480. * preamble) for skip_train==true.
  481. * For other dramtypes or LPDDR4-toggling-preamble no
  482. * options are available and PhyInit will set position as
  483. * required. See source code in
  484. * ddrphy_phyinit_c_initphyconfig() to see how the
  485. * RxEnBackOff register is set.
  486. * For skip_train==false, FW will set the position based on
  487. * Preamble.
  488. * We recommend keeping this setting at default value.
  489. * SI analysis is required to determine if default value
  490. * needs to be changed.
  491. *
  492. * Value | Description
  493. * ----- | ---
  494. * 0x1 | Position read gate 1UI from the first valid edge
  495. * | of DQS_t (LPDDR4 Static preamble only) (default)
  496. */
  497. uint32_t trainsequencectrl; /*
  498. * Firmware Training Sequence Control.
  499. * This input is used to program sequencectrl in
  500. * messageBlock.
  501. * It controls the training stages executed by firmware.
  502. * For production silicon we recommend to use default value
  503. * programmed by PhyInit.
  504. */
  505. uint32_t snpsumctlopt; /*
  506. * Enable Fast Frequency Change (FFC) Optimizations
  507. * specific to UMCTL2 (DDRCTRL).
  508. * Not valid for dimmtype=NODIMM.
  509. * Consult DDRCTRL documentation in Reference Manual to
  510. * ensure when optimizations can be enabled.
  511. *
  512. * Value | Description
  513. * ----- | ---
  514. * 0 | Disable FFC MRW optimization (default)
  515. */
  516. uint32_t snpsumctlf0rc5x; /*
  517. * F0RX5x RCD Control Word when using Fast Frequency
  518. * Change(FFC) optimizations specific to UMCTL2
  519. * Not valid for dimmtype=NODIMM.
  520. * Only valid for when SnpsUmctlOpt=1.
  521. * When UMCTL2 optimizations are enabled PHY will perform
  522. * RCD MRW during fast frequency change request.
  523. * The correct RCD control word value for each PState must
  524. * be programmed in this field.
  525. * Consult the RCD spec and UMCTL documentation to
  526. * determine the correct value based on DRAM configuration
  527. * and operating speed.
  528. */
  529. uint32_t txslewrisedq; /*
  530. * Pull-up slew rate control for DBYTE Tx.
  531. * Value specified here will be written to register
  532. * TxSlewRate.TxPreP by PhyInit.
  533. * See register description for more information.
  534. */
  535. uint32_t txslewfalldq; /*
  536. * Pull-down slew rate control for DBYTE Tx.
  537. * Value specified here will be written to
  538. * TxSlewRate.TxPreN by PhyInit.
  539. * See register description for more information.
  540. */
  541. uint32_t txslewriseac; /*
  542. * Pull-up slew rate control for ANIB Tx.
  543. * Value specified here will be written to
  544. * ATxSlewRate.ATxPreP.
  545. * See register description for more information.
  546. */
  547. uint32_t txslewfallac; /*
  548. * Pull-down slew rate control for ANIB Tx.
  549. * Value specified here will be written to
  550. * ATxSlewRate.ATxPreN.
  551. * See register description for more information.
  552. */
  553. uint32_t disableretraining; /*
  554. * Disable PHY DRAM Drift compensation re-training.
  555. * Only applied to LPDDR4. No retraining is required in
  556. * DDR4/3.
  557. * Disable PHY re-training during DFI frequency change
  558. * requests in LPDDR4.
  559. * The purpose of retraining is to compensate for drift in
  560. * the DRAM.
  561. * Determine based on SI analysis and DRAM datasheet if
  562. * retraining can be disabled.
  563. *
  564. * Value | Description
  565. * ----- | ---
  566. * 0x1 | Disable retraining
  567. * 0x0 | Enable retraining
  568. */
  569. uint32_t disablephyupdate; /*
  570. * Disable DFI PHY Update feature.
  571. * Only effects LPDDR4.
  572. * Disable DFI PHY Update feature. When set PHY will not
  573. * assert dfi0/1_phyupd_req.
  574. *
  575. * Value | Description
  576. * ----- | ---
  577. * 0x1 | Disable DFI PHY Update
  578. * 0x0 | Enable DFI PHY Update
  579. */
  580. uint32_t enablehighclkskewfix; /*
  581. * Enable alternative PIE program.
  582. * If enabled the PIE reinitializes the FIFO pointers a
  583. * second time due for designs with large skew between
  584. * chiplet DfiClk branches. If enabled PIE latencies in all
  585. * protocols are increased by 60 DfiClks.
  586. *
  587. * Value | Description
  588. * ----- | ---
  589. * 0x0 | Disable (default)
  590. */
  591. uint32_t disableunusedaddrlns; /*
  592. * Turn off or tristate Address Lanes when possible.
  593. *
  594. * When enabled, PHY will tristate unused address lanes to
  595. * save power when possible by using Acx4AnibDis and
  596. * AForceTriCont registers.
  597. * This feature is only implemented for the default PHY
  598. * Address bump mapping and Ranks must be populated in
  599. * order. ie Rank1 cannot be used if Rank0 is unpopulated.
  600. * For alternative bump mapping follow the following
  601. * guideline to achieve maximum power savings:
  602. * - For each unused BP_A bump program AForceTriCont[4:0]
  603. * bits based on register description.
  604. * - if all lanes of an Anib are unused _AND_ ANIB is not
  605. * the first or last instance set bit associated with
  606. * the instance in Acs4AnibDis registers. see register
  607. * description for details.
  608. *
  609. * Value | Description
  610. * ----- | ---
  611. * 0x1 | Enable
  612. */
  613. uint32_t phyinitsequencenum; /*
  614. * Switches between supported phyinit training sequences.
  615. *
  616. * Value | Description
  617. * ----- | ---
  618. * 0x0 | Minimizes number of Imem/Dmem loads (default)
  619. */
  620. uint32_t enabledficspolarityfix;/*
  621. * Enable alternative PIE program.
  622. * Set to 1 if PUB_VERSION <2.43a, otherwise set to 0. If
  623. * enabled the PIE programs Dfi{Rd,Wr}DataCsDestMap CSR's
  624. * to default values 0x00E4 before running PPT.
  625. * Before exiting PPT, PIE will restore
  626. * Dfi{Rd,Wr}DataCsDestMap CSR's to 0x00E1.
  627. *
  628. * Value | Description
  629. * ----- | ---
  630. * 0x0 | Disable (default)
  631. */
  632. uint32_t phyvref; /*
  633. * Must be programmed with the Vref level to be used by the
  634. * PHY during reads.
  635. * The units of this field are a percentage of VDDQ
  636. * according to the following equation:
  637. * Receiver Vref = VDDQ*phyvref[6:0]/128
  638. * For example to set Vref at 0.75*VDDQ, set this field to
  639. * 0x60.
  640. * For digital simulation, any legal value can be used. For
  641. * silicon, the users must calculate the analytical Vref by
  642. * using the impedances, terminations, and series resistance
  643. * present in the system.
  644. */
  645. uint32_t sequencectrl; /*
  646. * Controls the training steps to be run. Each bit
  647. * corresponds to a training step.
  648. * If the bit is set to 1, the training step will run.
  649. * If the bit is set to 0, the training step will be
  650. * skipped.
  651. * Training step to bit mapping:
  652. * sequencectrl[0] = Run DevInit - Device/phy
  653. * initialization. Should always be set.
  654. * sequencectrl[1] = Run WrLvl - Write leveling
  655. * sequencectrl[2] = Run RxEn - Read gate training
  656. * sequencectrl[3] = Run RdDQS1D - 1d read dqs training
  657. * sequencectrl[4] = Run WrDQ1D - 1d write dq training
  658. * sequencectrl[5] = RFU, must be zero
  659. * sequencectrl[6] = RFU, must be zero
  660. * sequencectrl[7] = RFU, must be zero
  661. * sequencectrl[8] = Run RdDeskew - Per lane read dq deskew
  662. * training
  663. * sequencectrl[9] = Run MxRdLat - Max read latency training
  664. * sequencectrl[10] = RFU, must be zero
  665. * sequencectrl[11] = RFU, must be zero
  666. * sequencectrl[12] = RFU, must be zero
  667. * sequencectrl[13] = RFU, must be zero
  668. * sequencectrl[15-14] = RFU, must be zero
  669. */
  670. };
  671. /*
  672. * Structure for mode register user inputs
  673. *
  674. * The following data structure must be set and completed correctly so that the PhyInit software
  675. * package can accurate fill message block structure.
  676. * Only some mrx are used per DDR type, on related width:
  677. * - DDR3: mr0..2 are used (16-bits values)
  678. * - DDR4: mr0..6 are used (16-bits values)
  679. * - LPDDR4: mr1..4 and mr11..22 are used (8-bits values)
  680. */
  681. struct user_input_mode_register {
  682. uint32_t mr0;
  683. uint32_t mr1;
  684. uint32_t mr2;
  685. uint32_t mr3;
  686. uint32_t mr4;
  687. uint32_t mr5;
  688. uint32_t mr6;
  689. uint32_t mr11;
  690. uint32_t mr12;
  691. uint32_t mr13;
  692. uint32_t mr14;
  693. uint32_t mr22;
  694. };
  695. /*
  696. * Structure for swizzle user inputs
  697. *
  698. * The following data structure must be set and completed correctly sothat the PhyInit software
  699. * package can accurate set swizzle (IO muxing) config.
  700. * Only some swizzles are used per DDR type:
  701. * - DDR3/DDR4: swizzle 0..32 are used
  702. * - 26 for hwtswizzle
  703. * - 7 for acswizzle
  704. * - LPDDR4: swizzle 0..43 are used
  705. * - 8 per byte for dqlnsel (total 32)
  706. * - 6 for mapcaatodfi
  707. * - 6 for mapcabtodfi
  708. */
  709. #define NB_HWT_SWIZZLE 26U
  710. #define NB_AC_SWIZZLE 7U
  711. #define NB_DQLNSEL_SWIZZLE_PER_BYTE 8U
  712. #define NB_MAPCAATODFI_SWIZZLE 6U
  713. #define NB_MAPCABTODFI_SWIZZLE 6U
  714. #define NB_SWIZZLE 44
  715. struct user_input_swizzle {
  716. uint32_t swizzle[NB_SWIZZLE];
  717. };
  718. #endif /* DDRPHY_PHYINIT_STRUCT_H */