ddr.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright 2017 NXP
  4. */
  5. #ifndef __ASM_ARCH_MX8M_DDR_H
  6. #define __ASM_ARCH_MX8M_DDR_H
  7. #define DDRC_DDR_SS_GPR0 0x3d000000
  8. #define DDRC_IPS_BASE_ADDR_0 0x3f400000
  9. #define IP2APB_DDRPHY_IPS_BASE_ADDR(X) (0x3c000000 + (X * 0x2000000))
  10. #define DDRPHY_MEM(X) (0x3c000000 + (X * 0x2000000) + 0x50000)
  11. struct ddrc_freq {
  12. u32 res0[8];
  13. u32 derateen;
  14. u32 derateint;
  15. u32 res1[10];
  16. u32 rfshctl0;
  17. u32 res2[4];
  18. u32 rfshtmg;
  19. u32 rfshtmg1;
  20. u32 res3[28];
  21. u32 init3;
  22. u32 init4;
  23. u32 res;
  24. u32 init6;
  25. u32 init7;
  26. u32 res4[4];
  27. u32 dramtmg0;
  28. u32 dramtmg1;
  29. u32 dramtmg2;
  30. u32 dramtmg3;
  31. u32 dramtmg4;
  32. u32 dramtmg5;
  33. u32 dramtmg6;
  34. u32 dramtmg7;
  35. u32 dramtmg8;
  36. u32 dramtmg9;
  37. u32 dramtmg10;
  38. u32 dramtmg11;
  39. u32 dramtmg12;
  40. u32 dramtmg13;
  41. u32 dramtmg14;
  42. u32 dramtmg15;
  43. u32 dramtmg16;
  44. u32 dramtmg17;
  45. u32 res5[10];
  46. u32 mramtmg0;
  47. u32 mramtmg1;
  48. u32 mramtmg4;
  49. u32 mramtmg9;
  50. u32 zqctl0;
  51. u32 res6[3];
  52. u32 dfitmg0;
  53. u32 dfitmg1;
  54. u32 res7[7];
  55. u32 dfitmg2;
  56. u32 dfitmg3;
  57. u32 res8[33];
  58. u32 odtcfg;
  59. };
  60. struct imx8m_ddrc_regs {
  61. u32 mstr;
  62. u32 stat;
  63. u32 mstr1;
  64. u32 res1;
  65. u32 mrctrl0;
  66. u32 mrctrl1;
  67. u32 mrstat;
  68. u32 mrctrl2;
  69. u32 derateen;
  70. u32 derateint;
  71. u32 mstr2;
  72. u32 res2;
  73. u32 pwrctl;
  74. u32 pwrtmg;
  75. u32 hwlpctl;
  76. u32 hwffcctl;
  77. u32 hwffcstat;
  78. u32 res3[3];
  79. u32 rfshctl0;
  80. u32 rfshctl1;
  81. u32 rfshctl2;
  82. u32 rfshctl4;
  83. u32 rfshctl3;
  84. u32 rfshtmg;
  85. u32 rfshtmg1;
  86. u32 res4;
  87. u32 ecccfg0;
  88. u32 ecccfg1;
  89. u32 eccstat;
  90. u32 eccclr;
  91. u32 eccerrcnt;
  92. u32 ecccaddr0;
  93. u32 ecccaddr1;
  94. u32 ecccsyn0;
  95. u32 ecccsyn1;
  96. u32 ecccsyn2;
  97. u32 eccbitmask0;
  98. u32 eccbitmask1;
  99. u32 eccbitmask2;
  100. u32 eccuaddr0;
  101. u32 eccuaddr1;
  102. u32 eccusyn0;
  103. u32 eccusyn1;
  104. u32 eccusyn2;
  105. u32 eccpoisonaddr0;
  106. u32 eccpoisonaddr1;
  107. u32 crcparctl0;
  108. u32 crcparctl1;
  109. u32 crcparctl2;
  110. u32 crcparstat;
  111. u32 init0;
  112. u32 init1;
  113. u32 init2;
  114. u32 init3;
  115. u32 init4;
  116. u32 init5;
  117. u32 init6;
  118. u32 init7;
  119. u32 dimmctl;
  120. u32 rankctl;
  121. u32 res5;
  122. u32 chctl;
  123. u32 dramtmg0;
  124. u32 dramtmg1;
  125. u32 dramtmg2;
  126. u32 dramtmg3;
  127. u32 dramtmg4;
  128. u32 dramtmg5;
  129. u32 dramtmg6;
  130. u32 dramtmg7;
  131. u32 dramtmg8;
  132. u32 dramtmg9;
  133. u32 dramtmg10;
  134. u32 dramtmg11;
  135. u32 dramtmg12;
  136. u32 dramtmg13;
  137. u32 dramtmg14;
  138. u32 dramtmg15;
  139. u32 dramtmg16;
  140. u32 dramtmg17;
  141. u32 res6[10];
  142. u32 mramtmg0;
  143. u32 mramtmg1;
  144. u32 mramtmg4;
  145. u32 mramtmg9;
  146. u32 zqctl0;
  147. u32 zqctl1;
  148. u32 zqctl2;
  149. u32 zqstat;
  150. u32 dfitmg0;
  151. u32 dfitmg1;
  152. u32 dfilpcfg0;
  153. u32 dfilpcfg1;
  154. u32 dfiupd0;
  155. u32 dfiupd1;
  156. u32 dfiupd2;
  157. u32 res7;
  158. u32 dfimisc;
  159. u32 dfitmg2;
  160. u32 dfitmg3;
  161. u32 dfistat;
  162. u32 dbictl;
  163. u32 dfiphymstr;
  164. u32 res8[14];
  165. u32 addrmap0;
  166. u32 addrmap1;
  167. u32 addrmap2;
  168. u32 addrmap3;
  169. u32 addrmap4;
  170. u32 addrmap5;
  171. u32 addrmap6;
  172. u32 addrmap7;
  173. u32 addrmap8;
  174. u32 addrmap9;
  175. u32 addrmap10;
  176. u32 addrmap11;
  177. u32 res9[4];
  178. u32 odtcfg;
  179. u32 odtmap;
  180. u32 res10[2];
  181. u32 sched;
  182. u32 sched1;
  183. u32 sched2;
  184. u32 perfhpr1;
  185. u32 res11;
  186. u32 perflpr1;
  187. u32 res12;
  188. u32 perfwr1;
  189. u32 res13[4];
  190. u32 dqmap0;
  191. u32 dqmap1;
  192. u32 dqmap2;
  193. u32 dqmap3;
  194. u32 dqmap4;
  195. u32 dqmap5;
  196. u32 res14[26];
  197. u32 dbg0;
  198. u32 dbg1;
  199. u32 dbgcam;
  200. u32 dbgcmd;
  201. u32 dbgstat;
  202. u32 res15[3];
  203. u32 swctl;
  204. u32 swstat;
  205. u32 res16[2];
  206. u32 ocparcfg0;
  207. u32 ocparcfg1;
  208. u32 ocparcfg2;
  209. u32 ocparcfg3;
  210. u32 ocparstat0;
  211. u32 ocparstat1;
  212. u32 ocparwlog0;
  213. u32 ocparwlog1;
  214. u32 ocparwlog2;
  215. u32 ocparawlog0;
  216. u32 ocparawlog1;
  217. u32 ocparrlog0;
  218. u32 ocparrlog1;
  219. u32 ocpararlog0;
  220. u32 ocpararlog1;
  221. u32 poisoncfg;
  222. u32 poisonstat;
  223. u32 adveccindex;
  224. union {
  225. u32 adveccstat;
  226. u32 eccapstat;
  227. };
  228. u32 eccpoisonpat0;
  229. u32 eccpoisonpat1;
  230. u32 eccpoisonpat2;
  231. u32 res17[6];
  232. u32 caparpoisonctl;
  233. u32 caparpoisonstat;
  234. u32 res18[2];
  235. u32 dynbsmstat;
  236. u32 res19[18];
  237. u32 pstat;
  238. u32 pccfg;
  239. struct {
  240. u32 pcfgr;
  241. u32 pcfgw;
  242. u32 pcfgc;
  243. struct {
  244. u32 pcfgidmaskch0;
  245. u32 pcfidvaluech0;
  246. } pcfgid[16];
  247. u32 pctrl;
  248. u32 pcfgqos0;
  249. u32 pcfgqos1;
  250. u32 pcfgwqos0;
  251. u32 pcfgwqos1;
  252. u32 res[4];
  253. } pcfg[16];
  254. struct {
  255. u32 sarbase;
  256. u32 sarsize;
  257. } sar[4];
  258. u32 sbrctl;
  259. u32 sbrstat;
  260. u32 sbrwdata0;
  261. u32 sbrwdata1;
  262. u32 pdch;
  263. u32 res20[755];
  264. /* umctl2_regs_dch1 */
  265. u32 ch1_stat;
  266. u32 res21[2];
  267. u32 ch1_mrctrl0;
  268. u32 ch1_mrctrl1;
  269. u32 ch1_mrstat;
  270. u32 ch1_mrctrl2;
  271. u32 res22[4];
  272. u32 ch1_pwrctl;
  273. u32 ch1_pwrtmg;
  274. u32 ch1_hwlpctl;
  275. u32 res23[15];
  276. u32 ch1_eccstat;
  277. u32 ch1_eccclr;
  278. u32 ch1_eccerrcnt;
  279. u32 ch1_ecccaddr0;
  280. u32 ch1_ecccaddr1;
  281. u32 ch1_ecccsyn0;
  282. u32 ch1_ecccsyn1;
  283. u32 ch1_ecccsyn2;
  284. u32 ch1_eccbitmask0;
  285. u32 ch1_eccbitmask1;
  286. u32 ch1_eccbitmask2;
  287. u32 ch1_eccuaddr0;
  288. u32 ch1_eccuaddr1;
  289. u32 ch1_eccusyn0;
  290. u32 ch1_eccusyn1;
  291. u32 ch1_eccusyn2;
  292. u32 res24[2];
  293. u32 ch1_crcparctl0;
  294. u32 res25[2];
  295. u32 ch1_crcparstat;
  296. u32 res26[46];
  297. u32 ch1_zqctl2;
  298. u32 ch1_zqstat;
  299. u32 res27[11];
  300. u32 ch1_dfistat;
  301. u32 res28[33];
  302. u32 ch1_odtmap;
  303. u32 res29[47];
  304. u32 ch1_dbg1;
  305. u32 ch1_dbgcam;
  306. u32 ch1_dbgcmd;
  307. u32 ch1_dbgstat;
  308. u32 res30[123];
  309. /* umctl2_regs_freq1 */
  310. struct ddrc_freq freq1;
  311. u32 res31[109];
  312. /* umctl2_regs_addrmap_alt */
  313. u32 addrmap0_alt;
  314. u32 addrmap1_alt;
  315. u32 addrmap2_alt;
  316. u32 addrmap3_alt;
  317. u32 addrmap4_alt;
  318. u32 addrmap5_alt;
  319. u32 addrmap6_alt;
  320. u32 addrmap7_alt;
  321. u32 addrmap8_alt;
  322. u32 addrmap9_alt;
  323. u32 addrmap10_alt;
  324. u32 addrmap11_alt;
  325. u32 res32[758];
  326. /* umctl2_regs_freq2 */
  327. struct ddrc_freq freq2;
  328. u32 res33[879];
  329. /* umctl2_regs_freq3 */
  330. struct ddrc_freq freq3;
  331. };
  332. struct imx8m_ddrphy_regs {
  333. u32 reg[0xf0000];
  334. };
  335. /* PHY State */
  336. enum pstate {
  337. PS0,
  338. PS1,
  339. PS2,
  340. PS3,
  341. };
  342. enum msg_response {
  343. TRAIN_SUCCESS = 0x7,
  344. TRAIN_STREAM_START = 0x8,
  345. TRAIN_FAIL = 0xff,
  346. };
  347. #endif