summaryrefslogtreecommitdiff
path: root/arch/arm/include/asm/arch-mx8m/ddr.h
blob: b37382eab0eef11b54dd671092596f7ef8e75e2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
/*
 * Copyright 2017 NXP
 *
 * SPDX-License-Identifier:	GPL-2.0+
 */

#ifndef __ASM_ARCH_MX8M_DDR_H
#define __ASM_ARCH_MX8M_DDR_H

#define DDRC_DDR_SS_GPR0		0x3d000000
#define DDRC_IPS_BASE_ADDR_0		0x3f400000
#define IP2APB_DDRPHY_IPS_BASE_ADDR(X)	(0x3c000000 + (X * 0x2000000))
#define DDRPHY_MEM(X)			(0x3c000000 + (X * 0x2000000) + 0x50000)

struct ddrc_freq {
	u32 res0[8];
	u32 derateen;
	u32 derateint;
	u32 res1[10];
	u32 rfshctl0;
	u32 res2[4];
	u32 rfshtmg;
	u32 rfshtmg1;
	u32 res3[28];
	u32 init3;
	u32 init4;
	u32 res;
	u32 init6;
	u32 init7;
	u32 res4[4];
	u32 dramtmg0;
	u32 dramtmg1;
	u32 dramtmg2;
	u32 dramtmg3;
	u32 dramtmg4;
	u32 dramtmg5;
	u32 dramtmg6;
	u32 dramtmg7;
	u32 dramtmg8;
	u32 dramtmg9;
	u32 dramtmg10;
	u32 dramtmg11;
	u32 dramtmg12;
	u32 dramtmg13;
	u32 dramtmg14;
	u32 dramtmg15;
	u32 dramtmg16;
	u32 dramtmg17;
	u32 res5[10];
	u32 mramtmg0;
	u32 mramtmg1;
	u32 mramtmg4;
	u32 mramtmg9;
	u32 zqctl0;
	u32 res6[3];
	u32 dfitmg0;
	u32 dfitmg1;
	u32 res7[7];
	u32 dfitmg2;
	u32 dfitmg3;
	u32 res8[33];
	u32 odtcfg;
};

struct imx8m_ddrc_regs {
	u32 mstr;
	u32 stat;
	u32 mstr1;
	u32 res1;
	u32 mrctrl0;
	u32 mrctrl1;
	u32 mrstat;
	u32 mrctrl2;
	u32 derateen;
	u32 derateint;
	u32 mstr2;
	u32 res2;
	u32 pwrctl;
	u32 pwrtmg;
	u32 hwlpctl;
	u32 hwffcctl;
	u32 hwffcstat;
	u32 res3[3];
	u32 rfshctl0;
	u32 rfshctl1;
	u32 rfshctl2;
	u32 rfshctl4;
	u32 rfshctl3;
	u32 rfshtmg;
	u32 rfshtmg1;
	u32 res4;
	u32 ecccfg0;
	u32 ecccfg1;
	u32 eccstat;
	u32 eccclr;
	u32 eccerrcnt;
	u32 ecccaddr0;
	u32 ecccaddr1;
	u32 ecccsyn0;
	u32 ecccsyn1;
	u32 ecccsyn2;
	u32 eccbitmask0;
	u32 eccbitmask1;
	u32 eccbitmask2;
	u32 eccuaddr0;
	u32 eccuaddr1;
	u32 eccusyn0;
	u32 eccusyn1;
	u32 eccusyn2;
	u32 eccpoisonaddr0;
	u32 eccpoisonaddr1;
	u32 crcparctl0;
	u32 crcparctl1;
	u32 crcparctl2;
	u32 crcparstat;
	u32 init0;
	u32 init1;
	u32 init2;
	u32 init3;
	u32 init4;
	u32 init5;
	u32 init6;
	u32 init7;
	u32 dimmctl;
	u32 rankctl;
	u32 res5;
	u32 chctl;
	u32 dramtmg0;
	u32 dramtmg1;
	u32 dramtmg2;
	u32 dramtmg3;
	u32 dramtmg4;
	u32 dramtmg5;
	u32 dramtmg6;
	u32 dramtmg7;
	u32 dramtmg8;
	u32 dramtmg9;
	u32 dramtmg10;
	u32 dramtmg11;
	u32 dramtmg12;
	u32 dramtmg13;
	u32 dramtmg14;
	u32 dramtmg15;
	u32 dramtmg16;
	u32 dramtmg17;
	u32 res6[10];
	u32 mramtmg0;
	u32 mramtmg1;
	u32 mramtmg4;
	u32 mramtmg9;
	u32 zqctl0;
	u32 zqctl1;
	u32 zqctl2;
	u32 zqstat;
	u32 dfitmg0;
	u32 dfitmg1;
	u32 dfilpcfg0;
	u32 dfilpcfg1;
	u32 dfiupd0;
	u32 dfiupd1;
	u32 dfiupd2;
	u32 res7;
	u32 dfimisc;
	u32 dfitmg2;
	u32 dfitmg3;
	u32 dfistat;
	u32 dbictl;
	u32 dfiphymstr;
	u32 res8[14];
	u32 addrmap0;
	u32 addrmap1;
	u32 addrmap2;
	u32 addrmap3;
	u32 addrmap4;
	u32 addrmap5;
	u32 addrmap6;
	u32 addrmap7;
	u32 addrmap8;
	u32 addrmap9;
	u32 addrmap10;
	u32 addrmap11;
	u32 res9[4];
	u32 odtcfg;
	u32 odtmap;
	u32 res10[2];
	u32 sched;
	u32 sched1;
	u32 sched2;
	u32 perfhpr1;
	u32 res11;
	u32 perflpr1;
	u32 res12;
	u32 perfwr1;
	u32 res13[4];
	u32 dqmap0;
	u32 dqmap1;
	u32 dqmap2;
	u32 dqmap3;
	u32 dqmap4;
	u32 dqmap5;
	u32 res14[26];
	u32 dbg0;
	u32 dbg1;
	u32 dbgcam;
	u32 dbgcmd;
	u32 dbgstat;
	u32 res15[3];
	u32 swctl;
	u32 swstat;
	u32 res16[2];
	u32 ocparcfg0;
	u32 ocparcfg1;
	u32 ocparcfg2;
	u32 ocparcfg3;
	u32 ocparstat0;
	u32 ocparstat1;
	u32 ocparwlog0;
	u32 ocparwlog1;
	u32 ocparwlog2;
	u32 ocparawlog0;
	u32 ocparawlog1;
	u32 ocparrlog0;
	u32 ocparrlog1;
	u32 ocpararlog0;
	u32 ocpararlog1;
	u32 poisoncfg;
	u32 poisonstat;
	u32 adveccindex;
	union  {
		u32 adveccstat;
		u32 eccapstat;
	};
	u32 eccpoisonpat0;
	u32 eccpoisonpat1;
	u32 eccpoisonpat2;
	u32 res17[6];
	u32 caparpoisonctl;
	u32 caparpoisonstat;
	u32 res18[2];
	u32 dynbsmstat;
	u32 res19[18];
	u32 pstat;
	u32 pccfg;
	struct {
		u32 pcfgr;
		u32 pcfgw;
		u32 pcfgc;
		struct {
			u32 pcfgidmaskch0;
			u32 pcfidvaluech0;
		} pcfgid[16];
		u32 pctrl;
		u32 pcfgqos0;
		u32 pcfgqos1;
		u32 pcfgwqos0;
		u32 pcfgwqos1;
		u32 res[4];
	} pcfg[16];
	struct {
		u32 sarbase;
		u32 sarsize;
	} sar[4];
	u32 sbrctl;
	u32 sbrstat;
	u32 sbrwdata0;
	u32 sbrwdata1;
	u32 pdch;
	u32 res20[755];
	/* umctl2_regs_dch1 */
	u32 ch1_stat;
	u32 res21[2];
	u32 ch1_mrctrl0;
	u32 ch1_mrctrl1;
	u32 ch1_mrstat;
	u32 ch1_mrctrl2;
	u32 res22[4];
	u32 ch1_pwrctl;
	u32 ch1_pwrtmg;
	u32 ch1_hwlpctl;
	u32 res23[15];
	u32 ch1_eccstat;
	u32 ch1_eccclr;
	u32 ch1_eccerrcnt;
	u32 ch1_ecccaddr0;
	u32 ch1_ecccaddr1;
	u32 ch1_ecccsyn0;
	u32 ch1_ecccsyn1;
	u32 ch1_ecccsyn2;
	u32 ch1_eccbitmask0;
	u32 ch1_eccbitmask1;
	u32 ch1_eccbitmask2;
	u32 ch1_eccuaddr0;
	u32 ch1_eccuaddr1;
	u32 ch1_eccusyn0;
	u32 ch1_eccusyn1;
	u32 ch1_eccusyn2;
	u32 res24[2];
	u32 ch1_crcparctl0;
	u32 res25[2];
	u32 ch1_crcparstat;
	u32 res26[46];
	u32 ch1_zqctl2;
	u32 ch1_zqstat;
	u32 res27[11];
	u32 ch1_dfistat;
	u32 res28[33];
	u32 ch1_odtmap;
	u32 res29[47];
	u32 ch1_dbg1;
	u32 ch1_dbgcam;
	u32 ch1_dbgcmd;
	u32 ch1_dbgstat;
	u32 res30[123];
	/* umctl2_regs_freq1 */
	struct ddrc_freq freq1;
	u32 res31[109];
	/* umctl2_regs_addrmap_alt */
	u32 addrmap0_alt;
	u32 addrmap1_alt;
	u32 addrmap2_alt;
	u32 addrmap3_alt;
	u32 addrmap4_alt;
	u32 addrmap5_alt;
	u32 addrmap6_alt;
	u32 addrmap7_alt;
	u32 addrmap8_alt;
	u32 addrmap9_alt;
	u32 addrmap10_alt;
	u32 addrmap11_alt;
	u32 res32[758];
	/* umctl2_regs_freq2 */
	struct ddrc_freq freq2;
	u32 res33[879];
	/* umctl2_regs_freq3 */
	struct ddrc_freq freq3;
};

struct imx8m_ddrphy_regs {
	u32 reg[0xf0000];
};

/* PHY State */
enum pstate {
	PS0,
	PS1,
	PS2,
	PS3,
};

enum msg_response {
	TRAIN_SUCCESS = 0x7,
	TRAIN_STREAM_START = 0x8,
	TRAIN_FAIL = 0xff,
};

#endif