blob: debfaa2f2aa38ad42360da7064dcd7ebce42b7c6 [file] [log] [blame]
Angel Pons6e5aabd2020-03-23 23:44:42 +01001/* SPDX-License-Identifier: GPL-2.0-only */
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +01002
3#ifndef RAMINIT_COMMON_H
4#define RAMINIT_COMMON_H
5
Felix Held380c6b22020-01-26 05:06:38 +01006#include <stdint.h>
7
Angel Pons7c49cb82020-03-16 23:17:32 +01008#define BASEFREQ 133
9#define tDLLK 512
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +010010
Angel Pons7c49cb82020-03-16 23:17:32 +010011#define IS_SANDY_CPU(x) ((x & 0xffff0) == 0x206a0)
12#define IS_SANDY_CPU_C(x) ((x & 0xf) == 4)
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +010013#define IS_SANDY_CPU_D0(x) ((x & 0xf) == 5)
14#define IS_SANDY_CPU_D1(x) ((x & 0xf) == 6)
15#define IS_SANDY_CPU_D2(x) ((x & 0xf) == 7)
16
Angel Pons7c49cb82020-03-16 23:17:32 +010017#define IS_IVY_CPU(x) ((x & 0xffff0) == 0x306a0)
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +010018#define IS_IVY_CPU_C(x) ((x & 0xf) == 4)
19#define IS_IVY_CPU_K(x) ((x & 0xf) == 5)
20#define IS_IVY_CPU_D(x) ((x & 0xf) == 6)
21#define IS_IVY_CPU_E(x) ((x & 0xf) >= 8)
22
Angel Pons7c49cb82020-03-16 23:17:32 +010023#define NUM_CHANNELS 2
24#define NUM_SLOTRANKS 4
25#define NUM_SLOTS 2
Patrick Rudolphdd662872017-10-28 18:20:11 +020026#define NUM_LANES 9
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +010027
Angel Pons3abd2062020-05-03 00:25:02 +020028/* IOSAV_n_SP_CMD_CTRL DRAM commands */
Angel Pons6aa7cca2020-05-02 19:38:34 +020029#define IOSAV_MRS (0xf000)
30#define IOSAV_PRE (0xf002)
31#define IOSAV_ZQCS (0xf003)
32#define IOSAV_ACT (0xf006)
33#define IOSAV_RD (0xf105)
34#define IOSAV_NOP_ALT (0xf107)
35#define IOSAV_WR (0xf201)
36#define IOSAV_NOP (0xf207)
Angel Pons69e17142020-03-23 12:26:29 +010037
Angel Pons3abd2062020-05-03 00:25:02 +020038/* IOSAV_n_SUBSEQ_CTRL data direction */
39#define SSQ_NA 0 /* Non-data */
40#define SSQ_RD 1 /* Read */
41#define SSQ_WR 2 /* Write */
42#define SSQ_RW 3 /* Read and write */
43
Angel Ponsd5b780c2020-05-02 21:48:46 +020044struct iosav_ssq {
45 /* IOSAV_n_SP_CMD_CTRL */
46 union {
47 struct {
Angel Pons19c5cd22020-08-10 14:27:23 +020048 u32 command : 16; /* [15.. 0] */
49 u32 ranksel_ap : 2; /* [17..16] */
Angel Ponsd5b780c2020-05-02 21:48:46 +020050 u32 : 14;
51 };
52 u32 raw;
53 } sp_cmd_ctrl;
54
55 /* IOSAV_n_SUBSEQ_CTRL */
56 union {
57 struct {
Angel Pons19c5cd22020-08-10 14:27:23 +020058 u32 cmd_executions : 9; /* [ 8.. 0] */
Angel Ponsd5b780c2020-05-02 21:48:46 +020059 u32 : 1;
Angel Pons19c5cd22020-08-10 14:27:23 +020060 u32 cmd_delay_gap : 5; /* [14..10] */
Angel Ponsd5b780c2020-05-02 21:48:46 +020061 u32 : 1;
Angel Pons19c5cd22020-08-10 14:27:23 +020062 u32 post_ssq_wait : 9; /* [24..16] */
Angel Ponsd5b780c2020-05-02 21:48:46 +020063 u32 : 1;
Angel Pons19c5cd22020-08-10 14:27:23 +020064 u32 data_direction : 2; /* [27..26] */
Angel Ponsd5b780c2020-05-02 21:48:46 +020065 u32 : 4;
66 };
67 u32 raw;
68 } subseq_ctrl;
69
70 /* IOSAV_n_SP_CMD_ADDR */
71 union {
72 struct {
Angel Pons19c5cd22020-08-10 14:27:23 +020073 u32 address : 16; /* [15.. 0] */
74 u32 rowbits : 3; /* [18..16] */
Angel Ponsd5b780c2020-05-02 21:48:46 +020075 u32 : 1;
Angel Pons19c5cd22020-08-10 14:27:23 +020076 u32 bank : 3; /* [22..20] */
Angel Ponsd5b780c2020-05-02 21:48:46 +020077 u32 : 1;
Angel Pons19c5cd22020-08-10 14:27:23 +020078 u32 rank : 2; /* [25..24] */
Angel Ponsd5b780c2020-05-02 21:48:46 +020079 u32 : 6;
80 };
81 u32 raw;
82 } sp_cmd_addr;
83
84 /* IOSAV_n_ADDR_UPDATE */
85 union {
86 struct {
Angel Pons19c5cd22020-08-10 14:27:23 +020087 u32 inc_addr_1 : 1; /* [ 0.. 0] */
88 u32 inc_addr_8 : 1; /* [ 1.. 1] */
89 u32 inc_bank : 1; /* [ 2.. 2] */
90 u32 inc_rank : 2; /* [ 4.. 3] */
91 u32 addr_wrap : 5; /* [ 9.. 5] */
92 u32 lfsr_upd : 2; /* [11..10] */
93 u32 upd_rate : 4; /* [15..12] */
94 u32 lfsr_xors : 2; /* [17..16] */
Angel Ponsd5b780c2020-05-02 21:48:46 +020095 u32 : 14;
96 };
97 u32 raw;
98 } addr_update;
99};
100
Angel Pons737f1112020-11-13 14:07:30 +0100101union gdcr_cmd_pi_coding_reg {
102 struct {
103 u32 cmd_pi_code : 6; /* [ 5.. 0] */
104 u32 ctl_pi_code_d0 : 6; /* [11.. 6] */
105 u32 cmd_logic_delay : 1; /* [12..12] */
106 u32 cmd_phase_delay : 1; /* [13..13] */
107 u32 cmd_xover_enable : 1; /* [14..14] */
108 u32 ctl_logic_delay_d0 : 1; /* [15..15] */
109 u32 ctl_phase_delay_d0 : 1; /* [16..16] */
110 u32 ctl_xover_enable_d0 : 1; /* [17..17] */
111 u32 ctl_pi_code_d1 : 6; /* [23..18] */
112 u32 ctl_logic_delay_d1 : 1; /* [24..24] */
113 u32 ctl_phase_delay_d1 : 1; /* [25..25] */
114 u32 ctl_xover_enable_d1 : 1; /* [26..26] */
115 u32 : 5;
116 };
117 u32 raw;
118};
119
Angel Pons58b609b2020-11-13 14:35:29 +0100120union gdcr_training_mod_reg {
121 struct {
122 u32 receive_enable_mode : 1; /* [ 0.. 0] */
123 u32 write_leveling_mode : 1; /* [ 1.. 1] */
124 u32 training_rank_sel : 2; /* [ 3.. 2] */
125 u32 enable_dqs_wl : 4; /* [ 7.. 4] */
126 u32 dqs_logic_delay_wl : 1; /* [ 8.. 8] */
127 u32 dq_dqs_training_res : 1; /* [ 9.. 9] */
128 u32 : 4;
129 u32 delay_dq : 1; /* [14..14] */
130 u32 odt_always_on : 1; /* [15..15] */
131 u32 : 4;
132 u32 force_drive_enable : 1; /* [20..20] */
133 u32 dft_tx_pi_clk_view : 1; /* [21..21] */
134 u32 dft_tx_pi_clk_swap : 1; /* [22..22] */
135 u32 early_odt_en : 1; /* [23..23] */
136 u32 vref_gen_ctl : 6; /* [29..24] */
137 u32 ext_vref_sel : 1; /* [30..30] */
138 u32 tx_fifo_always_on : 1; /* [31..31] */
139 };
140 u32 raw;
141};
142
Angel Pons4f86d632020-11-19 17:18:46 +0100143union comp_ofst_1_reg {
144 struct {
145 u32 dq_odt_down : 3; /* [ 2.. 0] */
146 u32 dq_odt_up : 3; /* [ 5.. 3] */
147 u32 clk_odt_down : 3; /* [ 8.. 6] */
148 u32 clk_odt_up : 3; /* [11.. 9] */
149 u32 dq_drv_down : 3; /* [14..12] */
150 u32 dq_drv_up : 3; /* [17..15] */
151 u32 clk_drv_down : 3; /* [20..18] */
152 u32 clk_drv_up : 3; /* [23..21] */
153 u32 ctl_drv_down : 3; /* [26..24] */
154 u32 ctl_drv_up : 3; /* [29..27] */
155 u32 : 2;
156 };
157 u32 raw;
158};
159
Angel Pons7a612742020-11-12 13:34:03 +0100160union tc_dbp_reg {
161 struct {
162 u32 tRCD : 4; /* [ 3.. 0] */
163 u32 tRP : 4; /* [ 7.. 4] */
164 u32 tAA : 4; /* [11.. 8] */
165 u32 tCWL : 4; /* [15..12] */
166 u32 tRAS : 8; /* [23..16] */
167 u32 : 8;
168 };
169 u32 raw;
170};
171
172union tc_rap_reg {
173 struct {
174 u32 tRRD : 4; /* [ 3.. 0] */
175 u32 tRTP : 4; /* [ 7.. 4] */
176 u32 tCKE : 4; /* [11.. 8] */
177 u32 tWTR : 4; /* [15..12] */
178 u32 tFAW : 8; /* [23..16] */
179 u32 tWR : 5; /* [28..24] */
180 u32 dis_3st : 1; /* [29..29] */
181 u32 tCMD : 2; /* [31..30] */
182 };
183 u32 raw;
184};
185
186union tc_rwp_reg {
187 struct {
188 u32 tRRDR : 3; /* [ 2.. 0] */
189 u32 : 1;
190 u32 tRRDD : 3; /* [ 6.. 4] */
191 u32 : 1;
192 u32 tWWDR : 3; /* [10.. 8] */
193 u32 : 1;
194 u32 tWWDD : 3; /* [14..12] */
195 u32 : 1;
196 u32 tRWDRDD : 3; /* [18..16] */
197 u32 : 1;
198 u32 tWRDRDD : 3; /* [22..20] */
199 u32 : 1;
200 u32 tRWSR : 3; /* [26..24] */
201 u32 dec_wrd : 1; /* [27..27] */
202 u32 : 4;
203 };
204 u32 raw;
205};
206
207union tc_othp_reg {
208 struct {
209 u32 tXPDLL : 5; /* [ 4.. 0] */
210 u32 tXP : 3; /* [ 7.. 5] */
211 u32 tAONPD : 4; /* [11.. 8] */
212 u32 tCPDED : 2; /* [13..12] */
213 u32 tPRPDEN : 2; /* [15..14] */
214 u32 odt_delay_d0 : 2; /* [17..16] */
215 u32 odt_delay_d1 : 2; /* [19..18] */
216 u32 : 12;
217 };
218 u32 raw;
219};
220
221union tc_dtp_reg {
222 struct {
223 u32 : 12;
224 u32 overclock_tXP : 1; /* [12..12] */
225 u32 overclock_tXPDLL : 1; /* [13..13] */
226 u32 : 18;
227 };
228 u32 raw;
229};
230
231union tc_rfp_reg {
232 struct {
233 u32 oref_ri : 8; /* [ 7.. 0] */
234 u32 refresh_high_wm : 4; /* [11.. 8] */
235 u32 refresh_panic_wm : 4; /* [15..12] */
236 u32 refresh_2x_control : 2; /* [17..16] */
237 u32 : 14;
238 };
239 u32 raw;
240};
241
242union tc_rftp_reg {
243 struct {
244 u32 tREFI : 16; /* [15.. 0] */
245 u32 tRFC : 9; /* [24..16] */
246 u32 tREFIx9 : 7; /* [31..25] */
247 };
248 u32 raw;
249};
250
251union tc_srftp_reg {
252 struct {
253 u32 tXSDLL : 12; /* [11.. 0] */
254 u32 tXS_offset : 4; /* [15..12] */
255 u32 tZQOPER : 10; /* [25..16] */
256 u32 : 2;
257 u32 tMOD : 4; /* [31..28] */
258 };
259 u32 raw;
260};
261
Angel Ponsffd50152020-11-12 11:03:10 +0100262typedef struct ramctr_timing_st ramctr_timing;
263
Angel Pons8f0757e2020-11-11 23:03:36 +0100264void iosav_write_sequence(const int ch, const struct iosav_ssq *seq, const unsigned int length);
Angel Pons1c505f82020-11-11 20:55:35 +0100265void iosav_run_queue(const int ch, const u8 loops, const u8 as_timer);
266void iosav_run_once(const int ch);
267void wait_for_iosav(int channel);
268
Angel Ponsffd50152020-11-12 11:03:10 +0100269void iosav_write_zqcs_sequence(int channel, int slotrank, u32 gap, u32 post, u32 wrap);
270void iosav_write_prea_sequence(int channel, int slotrank, u32 post, u32 wrap);
271void iosav_write_read_mpr_sequence(
272 int channel, int slotrank, u32 tMOD, u32 loops, u32 gap, u32 loops2, u32 post2);
Angel Pons801a5cb2020-11-15 15:48:29 +0100273void iosav_write_prea_act_read_sequence(ramctr_timing *ctrl, int channel, int slotrank);
Angel Pons94267212020-11-14 16:49:29 +0100274void iosav_write_jedec_write_leveling_sequence(
275 ramctr_timing *ctrl, int channel, int slotrank, int bank, u32 mr1reg);
Angel Ponsffd50152020-11-12 11:03:10 +0100276void iosav_write_misc_write_sequence(ramctr_timing *ctrl, int channel, int slotrank,
277 u32 gap0, u32 loops0, u32 gap1, u32 loops2, u32 wrap2);
278void iosav_write_command_training_sequence(
279 ramctr_timing *ctrl, int channel, int slotrank, unsigned int address);
280void iosav_write_data_write_sequence(ramctr_timing *ctrl, int channel, int slotrank);
281void iosav_write_aggressive_write_read_sequence(ramctr_timing *ctrl, int channel, int slotrank);
282void iosav_write_memory_test_sequence(ramctr_timing *ctrl, int channel, int slotrank);
283
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100284/* FIXME: Vendor BIOS uses 64 but our algorithms are less
285 performant and even 1 seems to be enough in practice. */
Angel Pons7c49cb82020-03-16 23:17:32 +0100286#define NUM_PATTERNS 4
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100287
Angel Pons5c1baf52020-03-22 12:23:35 +0100288/*
289 * WARNING: Do not forget to increase MRC_CACHE_VERSION when the saved data is changed!
290 */
Patrick Rudolphdd662872017-10-28 18:20:11 +0200291#define MRC_CACHE_VERSION 5
Angel Pons5c1baf52020-03-22 12:23:35 +0100292
Angel Pons09fc4b92020-11-19 12:02:07 +0100293enum pdwm_mode {
294 PDM_NONE = 0,
295 PDM_APD = 1,
296 PDM_PPD = 2,
297 PDM_APD_PPD = 3,
298 PDM_DLL_OFF = 6,
299 PDM_APD_DLL_OFF = 7,
300};
301
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100302typedef struct odtmap_st {
303 u16 rttwr;
304 u16 rttnom;
305} odtmap;
306
Angel Pons5c1baf52020-03-22 12:23:35 +0100307/* WARNING: Do not forget to increase MRC_CACHE_VERSION when this struct is changed! */
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100308typedef struct dimm_info_st {
309 dimm_attr dimm[NUM_CHANNELS][NUM_SLOTS];
310} dimm_info;
311
Angel Pons5c1baf52020-03-22 12:23:35 +0100312/* WARNING: Do not forget to increase MRC_CACHE_VERSION when this struct is changed! */
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100313struct ram_rank_timings {
Angel Pons7c49cb82020-03-16 23:17:32 +0100314 /* ROUNDT_LAT register: One byte per slotrank */
Angel Pons88521882020-01-05 20:21:20 +0100315 u8 roundtrip_latency;
316
Angel Pons7c49cb82020-03-16 23:17:32 +0100317 /* IO_LATENCY register: One nibble per slotrank */
Felix Heldef4fe3e2019-12-31 14:15:05 +0100318 u8 io_latency;
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100319
Angel Pons7c49cb82020-03-16 23:17:32 +0100320 /* Phase interpolator coding for command and control */
Angel Pons88521882020-01-05 20:21:20 +0100321 int pi_coding;
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100322
323 struct ram_lane_timings {
Angel Pons7c49cb82020-03-16 23:17:32 +0100324 /* Lane register offset 0x10 */
325 u16 timA; /* bits 0 - 5, bits 16 - 18 */
326 u8 rising; /* bits 8 - 14 */
327 u8 falling; /* bits 20 - 26 */
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100328
Angel Pons7c49cb82020-03-16 23:17:32 +0100329 /* Lane register offset 0x20 */
330 int timC; /* bits 0 - 5, 19 */
331 u16 timB; /* bits 8 - 13, 15 - 17 */
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100332 } lanes[NUM_LANES];
333};
334
Angel Pons5c1baf52020-03-22 12:23:35 +0100335/* WARNING: Do not forget to increase MRC_CACHE_VERSION when this struct is changed! */
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100336typedef struct ramctr_timing_st {
337 u16 spd_crc[NUM_CHANNELS][NUM_SLOTS];
Angel Pons80037f72020-03-21 13:12:37 +0100338
339 /* CPUID value */
340 u32 cpu;
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100341
Patrick Rudolph77eaba32016-11-11 18:55:54 +0100342 /* DDR base_freq = 100 Mhz / 133 Mhz */
343 u8 base_freq;
344
Angel Pons48409b82020-03-23 22:19:29 +0100345 /* Frequency index */
346 u32 FRQ;
347
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100348 u16 cas_supported;
Angel Pons7c49cb82020-03-16 23:17:32 +0100349 /* Latencies are in units of ns, scaled by x256 */
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100350 u32 tCK;
351 u32 tAA;
352 u32 tWR;
353 u32 tRCD;
354 u32 tRRD;
355 u32 tRP;
356 u32 tRAS;
357 u32 tRFC;
358 u32 tWTR;
359 u32 tRTP;
360 u32 tFAW;
Dan Elkoubydabebc32018-04-13 18:47:10 +0300361 u32 tCWL;
362 u32 tCMD;
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100363 /* Latencies in terms of clock cycles
Angel Pons7c49cb82020-03-16 23:17:32 +0100364 They are saved separately as they are needed for DRAM MRS commands */
365 u8 CAS; /* CAS read latency */
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100366 u8 CWL; /* CAS write latency */
367
368 u32 tREFI;
369 u32 tMOD;
370 u32 tXSOffset;
371 u32 tWLO;
372 u32 tCKE;
373 u32 tXPDLL;
374 u32 tXP;
375 u32 tAONPD;
376
Angel Pons7c49cb82020-03-16 23:17:32 +0100377 /* Bits [0..11] of PM_DLL_CONFIG: Master DLL wakeup delay timer */
Angel Pons88521882020-01-05 20:21:20 +0100378 u16 mdll_wake_delay;
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100379
380 u8 rankmap[NUM_CHANNELS];
381 int ref_card_offset[NUM_CHANNELS];
382 u32 mad_dimm[NUM_CHANNELS];
383 int channel_size_mb[NUM_CHANNELS];
384 u32 cmd_stretch[NUM_CHANNELS];
385
Angel Pons88521882020-01-05 20:21:20 +0100386 int pi_code_offset;
387 int pi_coding_threshold;
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100388
Patrick Rudolph05d4bf7e2017-10-28 16:36:09 +0200389 bool ecc_supported;
390 bool ecc_forced;
Patrick Rudolphdd662872017-10-28 18:20:11 +0200391 bool ecc_enabled;
392 int lanes; /* active lanes: 8 or 9 */
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100393 int edge_offset[3];
394 int timC_offset[3];
395
396 int extended_temperature_range;
397 int auto_self_refresh;
398
399 int rank_mirror[NUM_CHANNELS][NUM_SLOTRANKS];
400
401 struct ram_rank_timings timings[NUM_CHANNELS][NUM_SLOTRANKS];
402
403 dimm_info info;
404} ramctr_timing;
405
Felix Held87ddea22020-01-26 04:55:27 +0100406#define SOUTHBRIDGE PCI_DEV(0, 0x1f, 0)
407
Patrick Rudolphdd662872017-10-28 18:20:11 +0200408#define FOR_ALL_LANES for (lane = 0; lane < ctrl->lanes; lane++)
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100409#define FOR_ALL_CHANNELS for (channel = 0; channel < NUM_CHANNELS; channel++)
410#define FOR_ALL_POPULATED_RANKS for (slotrank = 0; slotrank < NUM_SLOTRANKS; slotrank++) if (ctrl->rankmap[channel] & (1 << slotrank))
411#define FOR_ALL_POPULATED_CHANNELS for (channel = 0; channel < NUM_CHANNELS; channel++) if (ctrl->rankmap[channel])
412#define MAX_EDGE_TIMING 71
413#define MAX_TIMC 127
414#define MAX_TIMB 511
415#define MAX_TIMA 127
416#define MAX_CAS 18
417#define MIN_CAS 4
418
Angel Pons7c49cb82020-03-16 23:17:32 +0100419#define MAKE_ERR ((channel << 16) | (slotrank << 8) | 1)
420#define GET_ERR_CHANNEL(x) (x >> 16)
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100421
Angel Pons88521882020-01-05 20:21:20 +0100422void dram_mrscommands(ramctr_timing *ctrl);
423void program_timings(ramctr_timing *ctrl, int channel);
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100424void dram_find_common_params(ramctr_timing *ctrl);
Angel Pons88521882020-01-05 20:21:20 +0100425void dram_xover(ramctr_timing *ctrl);
426void dram_timing_regs(ramctr_timing *ctrl);
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100427void dram_dimm_mapping(ramctr_timing *ctrl);
Patrick Rudolphdd662872017-10-28 18:20:11 +0200428void dram_dimm_set_mapping(ramctr_timing *ctrl, int training);
Angel Pons88521882020-01-05 20:21:20 +0100429void dram_zones(ramctr_timing *ctrl, int training);
Angel Pons88521882020-01-05 20:21:20 +0100430void dram_memorymap(ramctr_timing *ctrl, int me_uma_size);
431void dram_jedecreset(ramctr_timing *ctrl);
Angel Pons7f5a97c2020-11-13 16:58:46 +0100432int receive_enable_calibration(ramctr_timing *ctrl);
Angel Pons88521882020-01-05 20:21:20 +0100433int write_training(ramctr_timing *ctrl);
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100434int command_training(ramctr_timing *ctrl);
Angel Pons4c79f932020-11-14 01:26:52 +0100435int read_mpr_training(ramctr_timing *ctrl);
Angel Pons08f749d2020-11-17 16:50:56 +0100436int aggressive_read_training(ramctr_timing *ctrl);
Angel Pons2a7d7522020-11-19 12:49:07 +0100437int aggressive_write_training(ramctr_timing *ctrl);
Angel Pons88521882020-01-05 20:21:20 +0100438void normalize_training(ramctr_timing *ctrl);
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100439int channel_test(ramctr_timing *ctrl);
Angel Pons88521882020-01-05 20:21:20 +0100440void set_scrambling_seed(ramctr_timing *ctrl);
Angel Pons89ae6b82020-03-21 13:23:32 +0100441void set_wmm_behavior(const u32 cpu);
Angel Pons88521882020-01-05 20:21:20 +0100442void prepare_training(ramctr_timing *ctrl);
Angel Pons7c49cb82020-03-16 23:17:32 +0100443void set_read_write_timings(ramctr_timing *ctrl);
Angel Pons88521882020-01-05 20:21:20 +0100444void set_normal_operation(ramctr_timing *ctrl);
445void final_registers(ramctr_timing *ctrl);
446void restore_timings(ramctr_timing *ctrl);
Angel Ponsefbed262020-03-23 23:18:03 +0100447int try_init_dram_ddr3(ramctr_timing *ctrl, int fast_boot, int s3resume, int me_uma_size);
Patrick Rudolphfd5fa2a2016-11-11 18:22:33 +0100448
Patrick Rudolphdd662872017-10-28 18:20:11 +0200449void channel_scrub(ramctr_timing *ctrl);
Patrick Rudolph05d4bf7e2017-10-28 16:36:09 +0200450bool get_host_ecc_cap(void);
451bool get_host_ecc_forced(void);
452
Patrick Rudolph305035c2016-11-11 18:38:50 +0100453#endif