summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/hwp/dram_training/mss_termination_control.H
blob: 5156b0991ac4161ea490351e908b46e035ee1810 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/hwpf/hwp/dram_training/mss_termination_control.H $    */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2012,2014              */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
// $Id: mss_termination_control.H,v 1.12 2014/01/22 15:39:22 mjjones Exp $
/* File is created by SARAVANAN SETHURAMAN on Thur Sept 28 2011. */

//------------------------------------------------------------------------------
// *! (C) Copyright International Business Machines Corp. 2007
// *! All Rights Reserved -- Property of IBM
// *! *** IBM Confidential ***
//------------------------------------------------------------------------------
// *! TITLE :mss_draminit_training_advanced.H
// *! DESCRIPTION : Tools for centaur procedures
// *! OWNER NAME :  Saravanan sethuraman    Email ID: saravanans@in.ibm.com
// *! BACKUP NAME : Menlo Wuu               Email ID: menlowuu@us.ibm.com
// #! ADDITIONAL COMMENTS :
//
// General purpose funcs

//------------------------------------------------------------------------------
// Don't forget to create CVS comments when you check in your changes!
//------------------------------------------------------------------------------
// CHANGE HISTORY:
//------------------------------------------------------------------------------
// Version:|  Author:  |  Date:   | Comment:
//---------|---------- |--------- |---------------------------------------------
//  1.12   | 22-Jan-14 | mjjones  | Removed FW header
//  1.11   | 21-Jan-14 | abhijsau | mike and menlo fixed ras review comments
//  1.10   | 14-Dec-12 | sasethur | Updated for fw review comments
//  1.9    | 07-Dec-12 | sasethur | Updated for fw review comments
//  1.8	   | 16-Nov-12 | mwuu	  | Added typedef for external call of
//                                  mss_slew_cal F
//  1.7	   | 14-Nov-12 | mwuu	  | Changed "l_" variables to "i_" in 
//  								config_slew_rate FN
//  1.6	   | 14-Nov-12 | mwuu	  | Fixed revision numbering in comments
//  1.5    | 14-Nov-12 | mwuu     | Added additional slew rates, and new const
//  1.4    | 26-Oct-12 | mwuu     | Added additional slew types enums, need to
//  								change MAX_NUM_SLEW_TYPES when attributes
//  								updated.
//  1.3    | 26-Oct-12 | sasethur | Updated FW review comments fapi::,
//  								const fapi::Target
//  1.2	   | 17-Oct-12 | mwuu	  | updates to enum and consts
//  1.1    | 28-Sep-12 | sasethur | First draft


#ifndef MSS_TERMINATION_CONTROL_H
#define MSS_TERMINATION_CONTROL_H
//----------------------------------------------------------------------
//  Includes
//----------------------------------------------------------------------
#include <fapi.H>

enum {
	SLEW_TYPE_DATA = 0,
	SLEW_TYPE_ADR_ADDR = 1,
	SLEW_TYPE_ADR_CNTL = 2,
	SLEW_TYPE_ADR_CLK = 3,
	SLEW_TYPE_ADR_SPCKE = 4,

	OHM15 = 15,
	OHM20 = 20,
	OHM24 = 24,
	OHM30 = 30,
	OHM34 = 34,
	OHM40 = 40,

	SLEW_3V_NS = 3,
	SLEW_4V_NS = 4,
	SLEW_5V_NS = 5,
	SLEW_6V_NS = 6,
	SLEW_MAXV_NS = 7,
};

const uint8_t MAX_NUM_PORTS = 2;		// max number of ports
const uint8_t MAX_NUM_SLEW_TYPES = 5;	// data(dq/dqs), adr_cmd, adr_cntl, clk, spcke, used by slew_cal FN only
const uint8_t MAX_NUM_IMP = 4;		// number of impedances valid per slew type

//Address shmoo is not done as a part of Training advanced, so the order matches
//attribute enum
const uint8_t adr_imp_array[] = {
	15,
	20,
	30,
	40,
};

// bypass slew (MAX slew rate) not included since it is not calibrated.
const uint8_t MAX_NUM_CAL_SLEW_RATES = 4 ;	// 3V/ns, 4V/ns, 5V/ns, 6V/n
const uint8_t MAX_NUM_SLEW_RATES = 4;	// 3V/ns, 4V/ns, 5V/ns, 6V/n, MAX?
const uint8_t slew_rate_array[] = {
	6,
	5,
	4,
    3,
};

const uint8_t MAX_SLEW_VALUE = 15;		// 4 bit value
const uint8_t MAX_WR_VREF = 32;

const uint32_t wr_vref_array[] = {
	420,
	425,
	430,
	435,
	440,
	445,
	450,
	455,
	460,
	465,
	470,
	475,
	480,
	485,
	490,
	495,
	500,
	505,
	510,
	515,
	520,
	525,
	530,
	535,
	540,
	545,
	550,
	555,
	560,
	565,
	570,
	575
	};


//The Array is re-arranged inorder to find the best Eye margin based on the
//Fitness level - 500 is the best value
const uint32_t wr_vref_array_fitness[] = {
	420,
	425,
	575,
	430,
	570,
	435,
	565,
	440,
	560,
	445,
	555,
	450,
	550,
	455,
	545,
	460,
	540,
	465,
	535,
	470,
	530,
	475,
	525,
	480,
	520,
	485,
	515,
	490,
	510,
	495,
	505,
	500
	};

const uint8_t MAX_RD_VREF = 16;
const uint32_t rd_cen_vref_array[] = {
	40375,
	41750,
	43125,
	44500,
	45875,
	47250,
	48625,
	50000,
	51375,
	52750,
	54125,
	55500,
	56875,
	58250,
	59625,
	61000
	};

//The Array is re-arranged inorder to find the best Eye margin based on the
//Fitness level - 50000 is the best value
const uint32_t rd_cen_vref_array_fitness[] = {
	61000,
	59625,
	40375,
	58250,
	41750,
	56875,
	43125,
	55500,
	44500,
	54125,
	45875,
	52750,
	47250,
	51375,
	48625,
	50000
	};

//The Array is re-arranged inorder to find the best Eye margin based on the
//Fitness level - 24 is the best value
const uint8_t MAX_DRV_IMP = 4;
const uint8_t drv_imp_array[] = {
	40,
	34,
	30,
	24
	};

//The Array is re-arranged inorder to find the best Eye margin based on the
//Fitness level - 15 is the best value
const uint8_t MAX_RCV_IMP = 9;
const uint8_t rcv_imp_array[] = {
	120,
    80,
    60,
    48,
    40,
    34,
    30,
    20,
    15
    };

extern "C"
{
/**
 * @brief configures PC_VREF_DRV_CONTROL registers to vary the DRAM VREF
 *
 * @param[in] i_target_mba   Reference to centaur.mba target
 * @param[in] i_port         MBA Port
 * @param[in] i_wr_dram_vref DRAM VREF to set
 *
 * @return ReturnCode
 */
fapi::ReturnCode config_wr_dram_vref(const fapi::Target & i_target_mba,
                                     uint8_t i_port,
                                     uint32_t i_wr_dram_vref);

/**
 * @brief configures read vref registers to vary the CEN VREF
 *
 * @param[in] i_target_mba   Reference to centaur.mba target
 * @param[in] i_port         MBA Port
 * @param[in] i_rd_cen_vref  CEN VREF to set
 *
 * @return ReturnCode
 */
fapi::ReturnCode config_rd_cen_vref(const fapi::Target & i_target_mba,
                                    uint8_t i_port,
                                    uint32_t i_rd_cen_vref);

/**
 * @brief configures the Driver impedance values to the registers
 *
 * @param[in] i_target_mba     Reference to centaur.mba target
 * @param[in] i_port           MBA Port
 * @param[in] i_drv_imp_dq_dqs Driver impedance values
 *
 * @return ReturnCode
 */
fapi::ReturnCode config_drv_imp(const fapi::Target & i_target_mba,
                                uint8_t i_port,
                                uint8_t i_drv_imp_dq_dqs);

/**
 * @brief configures the Receiver impedance values to the registers
 *
 * @param[in] i_target_mba     Reference to centaur.mba target
 * @param[in] i_port           MBA Port
 * @param[in] i_rcv_imp_dq_dqs Receiver impedance values
 *
 * @return ReturnCode
 */
fapi::ReturnCode config_rcv_imp(const fapi::Target & i_target_mba,
                                uint8_t i_port,
                                uint8_t i_rcv_imp_dq_dqs);

/**
 * @brief configures the Slew rate values to the registers
 *
 * @param[in] i_target_mba Reference to centaur.mba target
 * @param[in] i_port       MBA Port
 * @param[in] i_slew_type  Slew Type
 * @param[in] i_slew_imp   Slew Impedance
 * @param[in] i_slew_rate  Slew Rate
 *
 * @return ReturnCode
 */
fapi::ReturnCode config_slew_rate(const fapi::Target & i_target_mba,
	                              const uint8_t i_port,
	                              const uint8_t i_slew_type,
	                              const uint8_t i_slew_imp,
	                              const uint8_t i_slew_rate);

/**
 * @brief runs the slew calibration engine
 *
 * Configures MSS_SLEW_DATA/ADR attributes and calls config_slew_rate to set
 * the slew rate in the registers.
 *
 * @param[in] i_target_mba     Reference to centaur.mba target
 *
 * @return ReturnCode
 */
fapi::ReturnCode mss_slew_cal(const fapi::Target & i_target_mba);

} // extern C
#endif
OpenPOWER on IntegriCloud