1 /*******************************************************************************
2 Copyright (C) Marvell International Ltd. and its affiliates
4 This software file (the "File") is owned and distributed by Marvell
5 International Ltd. and/or its affiliates ("Marvell") under the following
6 alternative licensing terms. Once you have made an election to distribute the
7 File under one of the following license alternatives, please (i) delete this
8 introductory statement regarding license alternatives, (ii) delete the two
9 license alternatives that you have not elected to use and (iii) preserve the
10 Marvell copyright notice above.
12 ********************************************************************************
13 Marvell Commercial License Option
15 If you received this File from Marvell and you have entered into a commercial
16 license agreement (a "Commercial License") with Marvell, the File is licensed
17 to you under the terms of the applicable Commercial License.
19 ********************************************************************************
20 Marvell GPL License Option
22 If you received this File from Marvell, you may opt to use, redistribute and/or
23 modify this File in accordance with the terms and conditions of the General
24 Public License Version 2, June 1991 (the "GPL License"), a copy of which is
25 available along with the File in the license.txt file or by writing to the Free
26 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or
27 on the worldwide web at http://www.gnu.org/licenses/gpl.txt.
29 THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED
30 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY
31 DISCLAIMED. The GPL License provides additional details about this warranty
33 ********************************************************************************
34 Marvell BSD License Option
36 If you received this File from Marvell, you may opt to use, redistribute and/or
37 modify this File under the following licensing terms.
38 Redistribution and use in source and binary forms, with or without modification,
39 are permitted provided that the following conditions are met:
41 * Redistributions of source code must retain the above copyright notice,
42 this list of conditions and the following disclaimer.
44 * Redistributions in binary form must reproduce the above copyright
45 notice, this list of conditions and the following disclaimer in the
46 documentation and/or other materials provided with the distribution.
48 * Neither the name of Marvell nor the names of its contributors may be
49 used to endorse or promote products derived from this software without
50 specific prior written permission.
52 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
53 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
54 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
55 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
56 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
57 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
58 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
59 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
60 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
61 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63 *******************************************************************************/
65 #include "ddr1_2/mvDram.h"
66 #include "boardEnv/mvBoardEnvLib.h"
75 static MV_VOID
cpyDimm2BankInfo(MV_DIMM_INFO
*pDimmInfo
,
76 MV_DRAM_BANK_INFO
*pBankInfo
);
77 static MV_U32
cas2ps(MV_U8 spd_byte
);
78 /*******************************************************************************
79 * mvDramBankGet - Get the DRAM bank paramters.
82 * This function retrieves DRAM bank parameters as described in
83 * DRAM_BANK_INFO struct to the controller DRAM unit. In case the board
84 * has its DRAM on DIMMs it will use its EEPROM to extract SPD data
85 * from it. Otherwise, if the DRAM is soldered on board, the function
86 * should insert its bank information into MV_DRAM_BANK_INFO struct.
89 * bankNum - Board DRAM bank number.
92 * pBankInfo - DRAM bank information struct.
95 * MV_FAIL - Bank parameters could not be read.
97 *******************************************************************************/
98 MV_STATUS
mvDramBankInfoGet(MV_U32 bankNum
, MV_DRAM_BANK_INFO
*pBankInfo
)
100 MV_DIMM_INFO dimmInfo
;
102 DB(mvOsPrintf("Dram: mvDramBankInfoGet bank %d\n", bankNum
));
103 /* zero pBankInfo structure */
104 memset(pBankInfo
, 0, sizeof(*pBankInfo
));
106 if((NULL
== pBankInfo
) || (bankNum
>= MV_DRAM_MAX_CS
))
108 DB(mvOsPrintf("Dram: mvDramBankInfoGet bad params \n"));
111 if( MV_OK
!= dimmSpdGet((MV_U32
)(bankNum
/2), &dimmInfo
))
113 DB(mvOsPrintf("Dram: ERR dimmSpdGet failed to get dimm info \n"));
116 if((dimmInfo
.numOfModuleBanks
== 1) && ((bankNum
% 2) == 1))
118 DB(mvOsPrintf("Dram: ERR dimmSpdGet. Can't find DIMM bank 2 \n"));
122 /* convert Dimm info to Bank info */
123 cpyDimm2BankInfo(&dimmInfo
, pBankInfo
);
128 /*******************************************************************************
129 * cpyDimm2BankInfo - Convert a Dimm info struct into a bank info struct.
132 * Convert a Dimm info struct into a bank info struct.
135 * pDimmInfo - DIMM information structure.
138 * pBankInfo - DRAM bank information struct.
143 *******************************************************************************/
144 static MV_VOID
cpyDimm2BankInfo(MV_DIMM_INFO
*pDimmInfo
,
145 MV_DRAM_BANK_INFO
*pBankInfo
)
147 pBankInfo
->memoryType
= pDimmInfo
->memoryType
;
149 /* DIMM dimensions */
150 pBankInfo
->numOfRowAddr
= pDimmInfo
->numOfRowAddr
;
151 pBankInfo
->numOfColAddr
= pDimmInfo
->numOfColAddr
;
152 pBankInfo
->dataWidth
= pDimmInfo
->dataWidth
;
153 pBankInfo
->errorCheckType
= pDimmInfo
->errorCheckType
;
154 pBankInfo
->sdramWidth
= pDimmInfo
->sdramWidth
;
155 pBankInfo
->errorCheckDataWidth
= pDimmInfo
->errorCheckDataWidth
;
156 pBankInfo
->numOfBanksOnEachDevice
= pDimmInfo
->numOfBanksOnEachDevice
;
157 pBankInfo
->suportedCasLatencies
= pDimmInfo
->suportedCasLatencies
;
158 pBankInfo
->refreshInterval
= pDimmInfo
->refreshInterval
;
160 /* DIMM timing parameters */
161 pBankInfo
->minCycleTimeAtMaxCasLatPs
= pDimmInfo
->minCycleTimeAtMaxCasLatPs
;
162 pBankInfo
->minCycleTimeAtMaxCasLatMinus1Ps
=
163 pDimmInfo
->minCycleTimeAtMaxCasLatMinus1Ps
;
164 pBankInfo
->minCycleTimeAtMaxCasLatMinus2Ps
=
165 pDimmInfo
->minCycleTimeAtMaxCasLatMinus2Ps
;
167 pBankInfo
->minRowPrechargeTime
= pDimmInfo
->minRowPrechargeTime
;
168 pBankInfo
->minRowActiveToRowActive
= pDimmInfo
->minRowActiveToRowActive
;
169 pBankInfo
->minRasToCasDelay
= pDimmInfo
->minRasToCasDelay
;
170 pBankInfo
->minRasPulseWidth
= pDimmInfo
->minRasPulseWidth
;
171 pBankInfo
->minWriteRecoveryTime
= pDimmInfo
->minWriteRecoveryTime
;
172 pBankInfo
->minWriteToReadCmdDelay
= pDimmInfo
->minWriteToReadCmdDelay
;
173 pBankInfo
->minReadToPrechCmdDelay
= pDimmInfo
->minReadToPrechCmdDelay
;
174 pBankInfo
->minRefreshToActiveCmd
= pDimmInfo
->minRefreshToActiveCmd
;
176 /* Parameters calculated from the extracted DIMM information */
177 pBankInfo
->size
= pDimmInfo
->size
/pDimmInfo
->numOfModuleBanks
;
178 pBankInfo
->deviceDensity
= pDimmInfo
->deviceDensity
;
179 pBankInfo
->numberOfDevices
= pDimmInfo
->numberOfDevices
/
180 pDimmInfo
->numOfModuleBanks
;
182 /* DIMM attributes (MV_TRUE for yes) */
184 if ((pDimmInfo
->memoryType
== MEM_TYPE_SDRAM
) ||
185 (pDimmInfo
->memoryType
== MEM_TYPE_DDR1
) )
187 if (pDimmInfo
->dimmAttributes
& BIT1
)
188 pBankInfo
->registeredAddrAndControlInputs
= MV_TRUE
;
190 pBankInfo
->registeredAddrAndControlInputs
= MV_FALSE
;
192 else /* pDimmInfo->memoryType == MEM_TYPE_DDR2 */
194 if (pDimmInfo
->dimmTypeInfo
& (BIT0
| BIT4
))
195 pBankInfo
->registeredAddrAndControlInputs
= MV_TRUE
;
197 pBankInfo
->registeredAddrAndControlInputs
= MV_FALSE
;
203 /*******************************************************************************
204 * dimmSpdCpy - Cpy SPD parameters from dimm 0 to dimm 1.
207 * Read the DIMM SPD parameters from dimm 0 into dimm 1 SPD.
216 * MV_TRUE if function could read DIMM parameters, MV_FALSE otherwise.
218 *******************************************************************************/
219 MV_STATUS
dimmSpdCpy(MV_VOID
)
224 MV_TWSI_SLAVE twsiSlave
;
225 MV_U8 data
[SPD_SIZE
];
227 /* zero dimmInfo structure */
228 memset(data
, 0, SPD_SIZE
);
230 /* read the dimm eeprom */
231 DB(mvOsPrintf("DRAM: Read Dimm eeprom\n"));
232 twsiSlave
.slaveAddr
.address
= MV_BOARD_DIMM0_I2C_ADDR
;
233 twsiSlave
.slaveAddr
.type
= ADDR7_BIT
;
234 twsiSlave
.validOffset
= MV_TRUE
;
235 twsiSlave
.offset
= 0;
236 twsiSlave
.moreThen256
= MV_FALSE
;
238 if( MV_OK
!= mvTwsiRead (MV_BOARD_DIMM_I2C_CHANNEL
,
239 &twsiSlave
, data
, SPD_SIZE
) )
241 DB(mvOsPrintf("DRAM: ERR. no DIMM in dimmNum 0\n"));
244 DB(puts("DRAM: Reading dimm info succeded.\n"));
246 /* calculate SPD checksum */
249 for(i
= 0 ; i
<= 62 ; i
++)
251 spdChecksum
+= data
[i
];
254 if ((spdChecksum
& 0xff) != data
[63])
256 DB(mvOsPrintf("DRAM: Warning. Wrong SPD Checksum %2x, expValue=%2x\n",
257 (MV_U32
)(spdChecksum
& 0xff), data
[63]));
261 DB(mvOsPrintf("DRAM: SPD Checksum ok!\n"));
264 /* copy the SPD content 1:1 into the DIMM 1 SPD */
265 twsiSlave
.slaveAddr
.address
= MV_BOARD_DIMM1_I2C_ADDR
;
266 twsiSlave
.slaveAddr
.type
= ADDR7_BIT
;
267 twsiSlave
.validOffset
= MV_TRUE
;
268 twsiSlave
.offset
= 0;
269 twsiSlave
.moreThen256
= MV_FALSE
;
271 for(i
= 0 ; i
< SPD_SIZE
; i
++)
273 twsiSlave
.offset
= i
;
274 if( MV_OK
!= mvTwsiWrite (MV_BOARD_DIMM_I2C_CHANNEL
,
275 &twsiSlave
, &data
[i
], 1) )
277 mvOsPrintf("DRAM: ERR. no DIMM in dimmNum 1 byte %d \n",i
);
283 DB(puts("DRAM: Reading dimm info succeded.\n"));
287 /*******************************************************************************
288 * dimmSpdGet - Get the SPD parameters.
291 * Read the DIMM SPD parameters into given struct parameter.
294 * dimmNum - DIMM number. See MV_BOARD_DIMM_NUM enumerator.
297 * pDimmInfo - DIMM information structure.
300 * MV_TRUE if function could read DIMM parameters, MV_FALSE otherwise.
302 *******************************************************************************/
303 MV_STATUS
dimmSpdGet(MV_U32 dimmNum
, MV_DIMM_INFO
*pDimmInfo
)
309 MV_TWSI_SLAVE twsiSlave
;
310 MV_U8 data
[SPD_SIZE
];
312 if((NULL
== pDimmInfo
)|| (dimmNum
>= MAX_DIMM_NUM
))
314 DB(mvOsPrintf("Dram: mvDramBankInfoGet bad params \n"));
318 /* zero dimmInfo structure */
319 memset(data
, 0, SPD_SIZE
);
321 /* read the dimm eeprom */
322 DB(mvOsPrintf("DRAM: Read Dimm eeprom\n"));
323 twsiSlave
.slaveAddr
.address
= (dimmNum
== 0) ?
324 MV_BOARD_DIMM0_I2C_ADDR
: MV_BOARD_DIMM1_I2C_ADDR
;
325 twsiSlave
.slaveAddr
.type
= ADDR7_BIT
;
326 twsiSlave
.validOffset
= MV_TRUE
;
327 twsiSlave
.offset
= 0;
328 twsiSlave
.moreThen256
= MV_FALSE
;
330 if( MV_OK
!= mvTwsiRead (MV_BOARD_DIMM_I2C_CHANNEL
,
331 &twsiSlave
, data
, SPD_SIZE
) )
333 DB(mvOsPrintf("DRAM: ERR. no DIMM in dimmNum %d \n", dimmNum
));
336 DB(puts("DRAM: Reading dimm info succeded.\n"));
338 /* calculate SPD checksum */
341 for(i
= 0 ; i
<= 62 ; i
++)
343 spdChecksum
+= data
[i
];
346 if ((spdChecksum
& 0xff) != data
[63])
348 DB(mvOsPrintf("DRAM: Warning. Wrong SPD Checksum %2x, expValue=%2x\n",
349 (MV_U32
)(spdChecksum
& 0xff), data
[63]));
353 DB(mvOsPrintf("DRAM: SPD Checksum ok!\n"));
356 /* copy the SPD content 1:1 into the dimmInfo structure*/
357 for(i
= 0 ; i
< SPD_SIZE
; i
++)
359 pDimmInfo
->spdRawData
[i
] = data
[i
];
360 DB(mvOsPrintf("SPD-EEPROM Byte %3d = %3x (%3d)\n",i
, data
[i
], data
[i
]));
363 DB(mvOsPrintf("DRAM SPD Information:\n"));
365 /* Memory type (DDR / SDRAM) */
366 switch (data
[DIMM_MEM_TYPE
])
368 case (DIMM_MEM_TYPE_SDRAM
):
369 pDimmInfo
->memoryType
= MEM_TYPE_SDRAM
;
370 DB(mvOsPrintf("DRAM Memeory type SDRAM\n"));
372 case (DIMM_MEM_TYPE_DDR1
):
373 pDimmInfo
->memoryType
= MEM_TYPE_DDR1
;
374 DB(mvOsPrintf("DRAM Memeory type DDR1\n"));
376 case (DIMM_MEM_TYPE_DDR2
):
377 pDimmInfo
->memoryType
= MEM_TYPE_DDR2
;
378 DB(mvOsPrintf("DRAM Memeory type DDR2\n"));
381 mvOsPrintf("ERROR: Undefined memory type!\n");
386 /* Number Of Row Addresses */
387 pDimmInfo
->numOfRowAddr
= data
[DIMM_ROW_NUM
];
388 DB(mvOsPrintf("DRAM numOfRowAddr[3] %d\n",pDimmInfo
->numOfRowAddr
));
390 /* Number Of Column Addresses */
391 pDimmInfo
->numOfColAddr
= data
[DIMM_COL_NUM
];
392 DB(mvOsPrintf("DRAM numOfColAddr[4] %d\n",pDimmInfo
->numOfColAddr
));
394 /* Number Of Module Banks */
395 pDimmInfo
->numOfModuleBanks
= data
[DIMM_MODULE_BANK_NUM
];
396 DB(mvOsPrintf("DRAM numOfModuleBanks[5] 0x%x\n",
397 pDimmInfo
->numOfModuleBanks
));
399 /* Number of module banks encoded differently for DDR2 */
400 if (pDimmInfo
->memoryType
== MEM_TYPE_DDR2
)
401 pDimmInfo
->numOfModuleBanks
= (pDimmInfo
->numOfModuleBanks
& 0x7)+1;
404 pDimmInfo
->dataWidth
= data
[DIMM_DATA_WIDTH
];
405 DB(mvOsPrintf("DRAM dataWidth[6] 0x%x\n", pDimmInfo
->dataWidth
));
407 /* Minimum Cycle Time At Max CasLatancy */
408 pDimmInfo
->minCycleTimeAtMaxCasLatPs
= cas2ps(data
[DIMM_MIN_CC_AT_MAX_CAS
]);
410 /* Error Check Type */
411 pDimmInfo
->errorCheckType
= data
[DIMM_ERR_CHECK_TYPE
];
412 DB(mvOsPrintf("DRAM errorCheckType[11] 0x%x\n",
413 pDimmInfo
->errorCheckType
));
415 /* Refresh Interval */
416 pDimmInfo
->refreshInterval
= data
[DIMM_REFRESH_INTERVAL
];
417 DB(mvOsPrintf("DRAM refreshInterval[12] 0x%x\n",
418 pDimmInfo
->refreshInterval
));
421 pDimmInfo
->sdramWidth
= data
[DIMM_SDRAM_WIDTH
];
422 DB(mvOsPrintf("DRAM sdramWidth[13] 0x%x\n",pDimmInfo
->sdramWidth
));
424 /* Error Check Data Width */
425 pDimmInfo
->errorCheckDataWidth
= data
[DIMM_ERR_CHECK_DATA_WIDTH
];
426 DB(mvOsPrintf("DRAM errorCheckDataWidth[14] 0x%x\n",
427 pDimmInfo
->errorCheckDataWidth
));
429 /* Burst Length Supported */
431 *******-******-******-******-******-******-******-*******
432 * bit7 | bit6 | bit5 | bit4 | bit3 | bit2 | bit1 | bit0 *
433 *******-******-******-******-******-******-******-*******
434 burst length = * Page | TBD | TBD | TBD | 8 | 4 | 2 | 1 *
435 *********************************************************/
437 *******-******-******-******-******-******-******-*******
438 * bit7 | bit6 | bit5 | bit4 | bit3 | bit2 | bit1 | bit0 *
439 *******-******-******-******-******-******-******-*******
440 burst length = * Page | TBD | TBD | TBD | 8 | 4 | TBD | TBD *
441 *********************************************************/
443 pDimmInfo
->burstLengthSupported
= data
[DIMM_BURST_LEN_SUP
];
444 DB(mvOsPrintf("DRAM burstLengthSupported[16] 0x%x\n",
445 pDimmInfo
->burstLengthSupported
));
447 /* Number Of Banks On Each Device */
448 pDimmInfo
->numOfBanksOnEachDevice
= data
[DIMM_DEV_BANK_NUM
];
449 DB(mvOsPrintf("DRAM numOfBanksOnEachDevice[17] 0x%x\n",
450 pDimmInfo
->numOfBanksOnEachDevice
));
452 /* Suported Cas Latencies */
455 *******-******-******-******-******-******-******-*******
456 * bit7 | bit6 | bit5 | bit4 | bit3 | bit2 | bit1 | bit0 *
457 *******-******-******-******-******-******-******-*******
458 CAS = * TBD | 7 | 6 | 5 | 4 | 3 | 2 | 1 *
459 ********************************************************/
462 *******-******-******-******-******-******-******-*******
463 * bit7 | bit6 | bit5 | bit4 | bit3 | bit2 | bit1 | bit0 *
464 *******-******-******-******-******-******-******-*******
465 CAS = * TBD | 4 | 3.5 | 3 | 2.5 | 2 | 1.5 | 1 *
466 *********************************************************/
469 *******-******-******-******-******-******-******-*******
470 * bit7 | bit6 | bit5 | bit4 | bit3 | bit2 | bit1 | bit0 *
471 *******-******-******-******-******-******-******-*******
472 CAS = * TBD | TBD | 5 | 4 | 3 | 2 | TBD | TBD *
473 *********************************************************/
475 pDimmInfo
->suportedCasLatencies
= data
[DIMM_SUP_CAL
];
476 DB(mvOsPrintf("DRAM suportedCasLatencies[18] 0x%x\n",
477 pDimmInfo
->suportedCasLatencies
));
479 /* For DDR2 only, get the DIMM type information */
480 if (pDimmInfo
->memoryType
== MEM_TYPE_DDR2
)
482 pDimmInfo
->dimmTypeInfo
= data
[DIMM_DDR2_TYPE_INFORMATION
];
483 DB(mvOsPrintf("DRAM dimmTypeInfo[20] (DDR2) 0x%x\n",
484 pDimmInfo
->dimmTypeInfo
));
487 /* SDRAM Modules Attributes */
488 pDimmInfo
->dimmAttributes
= data
[DIMM_BUF_ADDR_CONT_IN
];
489 DB(mvOsPrintf("DRAM dimmAttributes[21] 0x%x\n",
490 pDimmInfo
->dimmAttributes
));
492 /* Minimum Cycle Time At Max CasLatancy Minus 1*/
493 pDimmInfo
->minCycleTimeAtMaxCasLatMinus1Ps
=
494 cas2ps(data
[DIMM_MIN_CC_AT_MAX_CAS_MINUS1
]);
496 /* Minimum Cycle Time At Max CasLatancy Minus 2*/
497 pDimmInfo
->minCycleTimeAtMaxCasLatMinus2Ps
=
498 cas2ps(data
[DIMM_MIN_CC_AT_MAX_CAS_MINUS2
]);
500 pDimmInfo
->minRowPrechargeTime
= data
[DIMM_MIN_ROW_PRECHARGE_TIME
];
501 DB(mvOsPrintf("DRAM minRowPrechargeTime[27] 0x%x\n",
502 pDimmInfo
->minRowPrechargeTime
));
503 pDimmInfo
->minRowActiveToRowActive
= data
[DIMM_MIN_ROW_ACTIVE_TO_ROW_ACTIVE
];
504 DB(mvOsPrintf("DRAM minRowActiveToRowActive[28] 0x%x\n",
505 pDimmInfo
->minRowActiveToRowActive
));
506 pDimmInfo
->minRasToCasDelay
= data
[DIMM_MIN_RAS_TO_CAS_DELAY
];
507 DB(mvOsPrintf("DRAM minRasToCasDelay[29] 0x%x\n",
508 pDimmInfo
->minRasToCasDelay
));
509 pDimmInfo
->minRasPulseWidth
= data
[DIMM_MIN_RAS_PULSE_WIDTH
];
510 DB(mvOsPrintf("DRAM minRasPulseWidth[30] 0x%x\n",
511 pDimmInfo
->minRasPulseWidth
));
513 /* DIMM Bank Density */
514 pDimmInfo
->dimmBankDensity
= data
[DIMM_BANK_DENSITY
];
515 DB(mvOsPrintf("DRAM dimmBankDensity[31] 0x%x\n",
516 pDimmInfo
->dimmBankDensity
));
518 /* Only DDR2 includes Write Recovery Time field. Other SDRAM ignore */
519 pDimmInfo
->minWriteRecoveryTime
= data
[DIMM_MIN_WRITE_RECOVERY_TIME
];
520 DB(mvOsPrintf("DRAM minWriteRecoveryTime[36] 0x%x\n",
521 pDimmInfo
->minWriteRecoveryTime
));
523 /* Only DDR2 includes Internal Write To Read Command Delay field. */
524 pDimmInfo
->minWriteToReadCmdDelay
= data
[DIMM_MIN_WRITE_TO_READ_CMD_DELAY
];
525 DB(mvOsPrintf("DRAM minWriteToReadCmdDelay[37] 0x%x\n",
526 pDimmInfo
->minWriteToReadCmdDelay
));
528 /* Only DDR2 includes Internal Read To Precharge Command Delay field. */
529 pDimmInfo
->minReadToPrechCmdDelay
= data
[DIMM_MIN_READ_TO_PRECH_CMD_DELAY
];
530 DB(mvOsPrintf("DRAM minReadToPrechCmdDelay[38] 0x%x\n",
531 pDimmInfo
->minReadToPrechCmdDelay
));
533 /* Only DDR2 includes Minimum Refresh to Activate/Refresh Command field */
534 pDimmInfo
->minRefreshToActiveCmd
= data
[DIMM_MIN_REFRESH_TO_ACTIVATE_CMD
];
535 DB(mvOsPrintf("DRAM minRefreshToActiveCmd[42] 0x%x\n",
536 pDimmInfo
->minRefreshToActiveCmd
));
538 /* calculating the sdram density. Representing device density from */
539 /* bit 20 to allow representation of 4GB and above. */
540 /* For example, if density is 512Mbit 0x20000000, will be represent in */
541 /* deviceDensity by 0x20000000 >> 16 --> 0x00000200. Another example */
542 /* is density 8GB 0x200000000 >> 16 --> 0x00002000. */
543 density
= (1 << ((pDimmInfo
->numOfRowAddr
+ pDimmInfo
->numOfColAddr
) - 20));
544 pDimmInfo
->deviceDensity
= density
*
545 pDimmInfo
->numOfBanksOnEachDevice
*
546 pDimmInfo
->sdramWidth
;
547 DB(mvOsPrintf("DRAM deviceDensity %d\n",pDimmInfo
->deviceDensity
));
549 /* Number of devices includeing Error correction */
550 pDimmInfo
->numberOfDevices
= (pDimmInfo
->dataWidth
/pDimmInfo
->sdramWidth
) *
551 pDimmInfo
->numOfModuleBanks
;
552 DB(mvOsPrintf("DRAM numberOfDevices %d\n",
553 pDimmInfo
->numberOfDevices
));
557 /* Note that pDimmInfo->size is in MB units */
558 if (pDimmInfo
->memoryType
== MEM_TYPE_SDRAM
)
560 if (pDimmInfo
->dimmBankDensity
& BIT0
)
561 pDimmInfo
->size
+= 1024; /* Equal to 1GB */
562 else if (pDimmInfo
->dimmBankDensity
& BIT1
)
563 pDimmInfo
->size
+= 8; /* Equal to 8MB */
564 else if (pDimmInfo
->dimmBankDensity
& BIT2
)
565 pDimmInfo
->size
+= 16; /* Equal to 16MB */
566 else if (pDimmInfo
->dimmBankDensity
& BIT3
)
567 pDimmInfo
->size
+= 32; /* Equal to 32MB */
568 else if (pDimmInfo
->dimmBankDensity
& BIT4
)
569 pDimmInfo
->size
+= 64; /* Equal to 64MB */
570 else if (pDimmInfo
->dimmBankDensity
& BIT5
)
571 pDimmInfo
->size
+= 128; /* Equal to 128MB */
572 else if (pDimmInfo
->dimmBankDensity
& BIT6
)
573 pDimmInfo
->size
+= 256; /* Equal to 256MB */
574 else if (pDimmInfo
->dimmBankDensity
& BIT7
)
575 pDimmInfo
->size
+= 512; /* Equal to 512MB */
577 else if (pDimmInfo
->memoryType
== MEM_TYPE_DDR1
)
579 if (pDimmInfo
->dimmBankDensity
& BIT0
)
580 pDimmInfo
->size
+= 1024; /* Equal to 1GB */
581 else if (pDimmInfo
->dimmBankDensity
& BIT1
)
582 pDimmInfo
->size
+= 2048; /* Equal to 2GB */
583 else if (pDimmInfo
->dimmBankDensity
& BIT2
)
584 pDimmInfo
->size
+= 16; /* Equal to 16MB */
585 else if (pDimmInfo
->dimmBankDensity
& BIT3
)
586 pDimmInfo
->size
+= 32; /* Equal to 32MB */
587 else if (pDimmInfo
->dimmBankDensity
& BIT4
)
588 pDimmInfo
->size
+= 64; /* Equal to 64MB */
589 else if (pDimmInfo
->dimmBankDensity
& BIT5
)
590 pDimmInfo
->size
+= 128; /* Equal to 128MB */
591 else if (pDimmInfo
->dimmBankDensity
& BIT6
)
592 pDimmInfo
->size
+= 256; /* Equal to 256MB */
593 else if (pDimmInfo
->dimmBankDensity
& BIT7
)
594 pDimmInfo
->size
+= 512; /* Equal to 512MB */
596 else /* if (dimmInfo.memoryType == MEM_TYPE_DDR2) */
598 if (pDimmInfo
->dimmBankDensity
& BIT0
)
599 pDimmInfo
->size
+= 1024; /* Equal to 1GB */
600 else if (pDimmInfo
->dimmBankDensity
& BIT1
)
601 pDimmInfo
->size
+= 2048; /* Equal to 2GB */
602 else if (pDimmInfo
->dimmBankDensity
& BIT2
)
603 pDimmInfo
->size
+= 4096; /* Equal to 4GB */
604 else if (pDimmInfo
->dimmBankDensity
& BIT3
)
605 pDimmInfo
->size
+= 8192; /* Equal to 8GB */
606 else if (pDimmInfo
->dimmBankDensity
& BIT4
)
607 pDimmInfo
->size
+= 16384; /* Equal to 16GB */
608 else if (pDimmInfo
->dimmBankDensity
& BIT5
)
609 pDimmInfo
->size
+= 128; /* Equal to 128MB */
610 else if (pDimmInfo
->dimmBankDensity
& BIT6
)
611 pDimmInfo
->size
+= 256; /* Equal to 256MB */
612 else if (pDimmInfo
->dimmBankDensity
& BIT7
)
613 pDimmInfo
->size
+= 512; /* Equal to 512MB */
616 pDimmInfo
->size
*= pDimmInfo
->numOfModuleBanks
;
618 DB(mvOsPrintf("Dram: dimm size %dMB \n",pDimmInfo
->size
));
623 /*******************************************************************************
624 * dimmSpdPrint - Print the SPD parameters.
627 * Print the Dimm SPD parameters.
630 * pDimmInfo - DIMM information structure.
638 *******************************************************************************/
639 MV_VOID
dimmSpdPrint(MV_U32 dimmNum
)
641 MV_DIMM_INFO dimmInfo
;
643 MV_U32 k
, maskLeftOfPoint
= 0, maskRightOfPoint
= 0;
644 MV_U32 rightOfPoint
= 0,leftOfPoint
= 0, div
, time_tmp
, shift
;
646 MV_U8 trp_clocks
=0, trcd_clocks
, tras_clocks
, trrd_clocks
,
647 temp_buf
[40], *spdRawData
;
649 busClkPs
= 1000000000 / (mvBoardSysClkGet() / 100); /* in 10 ps units */
651 spdRawData
= dimmInfo
.spdRawData
;
653 if(MV_OK
!= dimmSpdGet(dimmNum
, &dimmInfo
))
655 mvOsOutput("ERROR: Could not read SPD information!\n");
659 /* find Manufactura of Dimm Module */
660 mvOsOutput("\nManufacturer's JEDEC ID Code: ");
661 for(i
= 0 ; i
< DIMM_MODULE_MANU_SIZE
; i
++)
663 mvOsOutput("%x",spdRawData
[DIMM_MODULE_MANU_OFFS
+ i
]);
667 /* Manufacturer's Specific Data */
668 for(i
= 0 ; i
< DIMM_MODULE_ID_SIZE
; i
++)
670 temp_buf
[i
] = spdRawData
[DIMM_MODULE_ID_OFFS
+ i
];
672 mvOsOutput("Manufacturer's Specific Data: %s\n", temp_buf
);
674 /* Module Part Number */
675 for(i
= 0 ; i
< DIMM_MODULE_VEN_SIZE
; i
++)
677 temp_buf
[i
] = spdRawData
[DIMM_MODULE_VEN_OFFS
+ i
];
679 mvOsOutput("Module Part Number: %s\n", temp_buf
);
681 /* Module Serial Number */
682 for(i
= 0; i
< sizeof(MV_U32
); i
++)
684 temp
|= spdRawData
[95+i
] << 8*i
;
686 mvOsOutput("DIMM Serial No. %ld (%lx)\n", (long)temp
,
689 /* find Manufac-Data of Dimm Module */
690 mvOsOutput("Manufactoring Date: Year 20%d%d/ ww %d%d\n",
691 ((spdRawData
[93] & 0xf0) >> 4), (spdRawData
[93] & 0xf),
692 ((spdRawData
[94] & 0xf0) >> 4), (spdRawData
[94] & 0xf));
693 /* find modul_revision of Dimm Module */
694 mvOsOutput("Module Revision: %d.%d\n",
695 spdRawData
[91], spdRawData
[92]);
697 /* find manufac_place of Dimm Module */
698 mvOsOutput("manufac_place: %d\n", spdRawData
[72]);
700 /* go over the first 35 I2C data bytes */
701 for(i
= 2 ; i
<= 35 ; i
++)
704 case 2: /* Memory type (DDR1/2 / SDRAM) */
705 if (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
)
706 mvOsOutput("Dram Type is: SDRAM\n");
707 else if (dimmInfo
.memoryType
== MEM_TYPE_DDR1
)
708 mvOsOutput("Dram Type is: SDRAM DDR1\n");
709 else if (dimmInfo
.memoryType
== MEM_TYPE_DDR2
)
710 mvOsOutput("Dram Type is: SDRAM DDR2\n");
712 mvOsOutput("Dram Type unknown\n");
714 /*----------------------------------------------------------------------------*/
716 case 3: /* Number Of Row Addresses */
717 mvOsOutput("Module Number of row addresses: %d\n",
718 dimmInfo
.numOfRowAddr
);
720 /*----------------------------------------------------------------------------*/
722 case 4: /* Number Of Column Addresses */
723 mvOsOutput("Module Number of col addresses: %d\n",
724 dimmInfo
.numOfColAddr
);
726 /*----------------------------------------------------------------------------*/
728 case 5: /* Number Of Module Banks */
729 mvOsOutput("Number of Banks on Mod.: %d\n",
730 dimmInfo
.numOfModuleBanks
);
732 /*----------------------------------------------------------------------------*/
734 case 6: /* Data Width */
735 mvOsOutput("Module Data Width: %d bit\n",
738 /*----------------------------------------------------------------------------*/
740 case 8: /* Voltage Interface */
741 switch(spdRawData
[i
])
744 mvOsOutput("Module is TTL_5V_TOLERANT\n");
747 mvOsOutput("Module is LVTTL\n");
750 mvOsOutput("Module is HSTL_1_5V\n");
753 mvOsOutput("Module is SSTL_3_3V\n");
756 mvOsOutput("Module is SSTL_2_5V\n");
759 if (dimmInfo
.memoryType
!= MEM_TYPE_SDRAM
)
761 mvOsOutput("Module is SSTL_1_8V\n");
765 mvOsOutput("Module is VOLTAGE_UNKNOWN\n");
769 /*----------------------------------------------------------------------------*/
771 case 9: /* Minimum Cycle Time At Max CasLatancy */
772 leftOfPoint
= (spdRawData
[i
] & 0xf0) >> 4;
773 rightOfPoint
= (spdRawData
[i
] & 0x0f) * 10;
775 /* DDR2 addition of right of point */
776 if ((spdRawData
[i
] & 0x0f) == 0xA)
780 if ((spdRawData
[i
] & 0x0f) == 0xB)
784 if ((spdRawData
[i
] & 0x0f) == 0xC)
788 if ((spdRawData
[i
] & 0x0f) == 0xD)
792 mvOsOutput("Minimum Cycle Time At Max CL: %d.%d [ns]\n",
793 leftOfPoint
, rightOfPoint
);
795 /*----------------------------------------------------------------------------*/
797 case 10: /* Clock To Data Out */
798 div
= (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
)? 10:100;
799 time_tmp
= (((spdRawData
[i
] & 0xf0) >> 4)*10) +
800 ((spdRawData
[i
] & 0x0f));
801 leftOfPoint
= time_tmp
/ div
;
802 rightOfPoint
= time_tmp
% div
;
803 mvOsOutput("Clock To Data Out: %d.%d [ns]\n",
804 leftOfPoint
, rightOfPoint
);
806 /*----------------------------------------------------------------------------*/
808 case 11: /* Error Check Type */
809 mvOsOutput("Error Check Type (0=NONE): %d\n",
810 dimmInfo
.errorCheckType
);
812 /*----------------------------------------------------------------------------*/
814 case 12: /* Refresh Interval */
815 mvOsOutput("Refresh Rate: %x\n",
816 dimmInfo
.refreshInterval
);
818 /*----------------------------------------------------------------------------*/
820 case 13: /* Sdram Width */
821 mvOsOutput("Sdram Width: %d bits\n",
822 dimmInfo
.sdramWidth
);
824 /*----------------------------------------------------------------------------*/
826 case 14: /* Error Check Data Width */
827 mvOsOutput("Error Check Data Width: %d bits\n",
828 dimmInfo
.errorCheckDataWidth
);
830 /*----------------------------------------------------------------------------*/
832 case 15: /* Minimum Clock Delay is unsupported */
833 if ((dimmInfo
.memoryType
== MEM_TYPE_SDRAM
) ||
834 (dimmInfo
.memoryType
== MEM_TYPE_DDR1
))
836 mvOsOutput("Minimum Clk Delay back to back: %d\n",
840 /*----------------------------------------------------------------------------*/
842 case 16: /* Burst Length Supported */
844 *******-******-******-******-******-******-******-*******
845 * bit7 | bit6 | bit5 | bit4 | bit3 | bit2 | bit1 | bit0 *
846 *******-******-******-******-******-******-******-*******
847 burst length = * Page | TBD | TBD | TBD | 8 | 4 | 2 | 1 *
848 *********************************************************/
850 *******-******-******-******-******-******-******-*******
851 * bit7 | bit6 | bit5 | bit4 | bit3 | bit2 | bit1 | bit0 *
852 *******-******-******-******-******-******-******-*******
853 burst length = * Page | TBD | TBD | TBD | 8 | 4 | TBD | TBD *
854 *********************************************************/
855 mvOsOutput("Burst Length Supported: ");
856 if ((dimmInfo
.memoryType
== MEM_TYPE_SDRAM
) ||
857 (dimmInfo
.memoryType
== MEM_TYPE_DDR1
))
859 if (dimmInfo
.burstLengthSupported
& BIT0
)
861 if (dimmInfo
.burstLengthSupported
& BIT1
)
864 if (dimmInfo
.burstLengthSupported
& BIT2
)
866 if (dimmInfo
.burstLengthSupported
& BIT3
)
869 mvOsOutput(" Bit \n");
871 /*----------------------------------------------------------------------------*/
873 case 17: /* Number Of Banks On Each Device */
874 mvOsOutput("Number Of Banks On Each Chip: %d\n",
875 dimmInfo
.numOfBanksOnEachDevice
);
877 /*----------------------------------------------------------------------------*/
879 case 18: /* Suported Cas Latencies */
882 *******-******-******-******-******-******-******-*******
883 * bit7 | bit6 | bit5 | bit4 | bit3 | bit2 | bit1 | bit0 *
884 *******-******-******-******-******-******-******-*******
885 CAS = * TBD | 7 | 6 | 5 | 4 | 3 | 2 | 1 *
886 ********************************************************/
889 *******-******-******-******-******-******-******-*******
890 * bit7 | bit6 | bit5 | bit4 | bit3 | bit2 | bit1 | bit0 *
891 *******-******-******-******-******-******-******-*******
892 CAS = * TBD | 4 | 3.5 | 3 | 2.5 | 2 | 1.5 | 1 *
893 *********************************************************/
896 *******-******-******-******-******-******-******-*******
897 * bit7 | bit6 | bit5 | bit4 | bit3 | bit2 | bit1 | bit0 *
898 *******-******-******-******-******-******-******-*******
899 CAS = * TBD | TBD | 5 | 4 | 3 | 2 | TBD | TBD *
900 *********************************************************/
902 mvOsOutput("Suported Cas Latencies: (CL) ");
903 if (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
)
905 for (k
= 0; k
<=7; k
++)
907 if (dimmInfo
.suportedCasLatencies
& (1 << k
))
908 mvOsOutput("%d, ", k
+1);
911 else if (dimmInfo
.memoryType
== MEM_TYPE_DDR1
)
913 if (dimmInfo
.suportedCasLatencies
& BIT0
)
915 if (dimmInfo
.suportedCasLatencies
& BIT1
)
917 if (dimmInfo
.suportedCasLatencies
& BIT2
)
919 if (dimmInfo
.suportedCasLatencies
& BIT3
)
921 if (dimmInfo
.suportedCasLatencies
& BIT4
)
923 if (dimmInfo
.suportedCasLatencies
& BIT5
)
926 else if (dimmInfo
.memoryType
== MEM_TYPE_DDR2
)
928 if (dimmInfo
.suportedCasLatencies
& BIT2
)
930 if (dimmInfo
.suportedCasLatencies
& BIT3
)
932 if (dimmInfo
.suportedCasLatencies
& BIT4
)
934 if (dimmInfo
.suportedCasLatencies
& BIT5
)
941 /*----------------------------------------------------------------------------*/
943 case 20: /* DDR2 DIMM type info */
944 if (dimmInfo
.memoryType
== MEM_TYPE_DDR2
)
946 if (dimmInfo
.dimmTypeInfo
& (BIT0
| BIT4
))
947 mvOsOutput("Registered DIMM (RDIMM)\n");
948 else if (dimmInfo
.dimmTypeInfo
& (BIT1
| BIT5
))
949 mvOsOutput("Unbuffered DIMM (UDIMM)\n");
951 mvOsOutput("Unknown DIMM type.\n");
955 /*----------------------------------------------------------------------------*/
957 case 21: /* SDRAM Modules Attributes */
958 mvOsOutput("\nModule Attributes (SPD Byte 21): \n");
960 if (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
)
962 if (dimmInfo
.dimmAttributes
& BIT0
)
963 mvOsOutput(" Buffered Addr/Control Input: Yes\n");
965 mvOsOutput(" Buffered Addr/Control Input: No\n");
967 if (dimmInfo
.dimmAttributes
& BIT1
)
968 mvOsOutput(" Registered Addr/Control Input: Yes\n");
970 mvOsOutput(" Registered Addr/Control Input: No\n");
972 if (dimmInfo
.dimmAttributes
& BIT2
)
973 mvOsOutput(" On-Card PLL (clock): Yes \n");
975 mvOsOutput(" On-Card PLL (clock): No \n");
977 if (dimmInfo
.dimmAttributes
& BIT3
)
978 mvOsOutput(" Bufferd DQMB Input: Yes \n");
980 mvOsOutput(" Bufferd DQMB Inputs: No \n");
982 if (dimmInfo
.dimmAttributes
& BIT4
)
983 mvOsOutput(" Registered DQMB Inputs: Yes \n");
985 mvOsOutput(" Registered DQMB Inputs: No \n");
987 if (dimmInfo
.dimmAttributes
& BIT5
)
988 mvOsOutput(" Differential Clock Input: Yes \n");
990 mvOsOutput(" Differential Clock Input: No \n");
992 if (dimmInfo
.dimmAttributes
& BIT6
)
993 mvOsOutput(" redundant Row Addressing: Yes \n");
995 mvOsOutput(" redundant Row Addressing: No \n");
997 else if (dimmInfo
.memoryType
== MEM_TYPE_DDR1
)
999 if (dimmInfo
.dimmAttributes
& BIT0
)
1000 mvOsOutput(" Buffered Addr/Control Input: Yes\n");
1002 mvOsOutput(" Buffered Addr/Control Input: No\n");
1004 if (dimmInfo
.dimmAttributes
& BIT1
)
1005 mvOsOutput(" Registered Addr/Control Input: Yes\n");
1007 mvOsOutput(" Registered Addr/Control Input: No\n");
1009 if (dimmInfo
.dimmAttributes
& BIT2
)
1010 mvOsOutput(" On-Card PLL (clock): Yes \n");
1012 mvOsOutput(" On-Card PLL (clock): No \n");
1014 if (dimmInfo
.dimmAttributes
& BIT3
)
1015 mvOsOutput(" FET Switch On-Card Enabled: Yes \n");
1017 mvOsOutput(" FET Switch On-Card Enabled: No \n");
1019 if (dimmInfo
.dimmAttributes
& BIT4
)
1020 mvOsOutput(" FET Switch External Enabled: Yes \n");
1022 mvOsOutput(" FET Switch External Enabled: No \n");
1024 if (dimmInfo
.dimmAttributes
& BIT5
)
1025 mvOsOutput(" Differential Clock Input: Yes \n");
1027 mvOsOutput(" Differential Clock Input: No \n");
1029 else /* if (dimmInfo.memoryType == MEM_TYPE_DDR2) */
1031 mvOsOutput(" Number of Active Registers on the DIMM: %d\n",
1032 (dimmInfo
.dimmAttributes
& 0x3) + 1);
1034 mvOsOutput(" Number of PLLs on the DIMM: %d\n",
1035 ((dimmInfo
.dimmAttributes
) >> 2) & 0x3);
1037 if (dimmInfo
.dimmAttributes
& BIT4
)
1038 mvOsOutput(" FET Switch External Enabled: Yes \n");
1040 mvOsOutput(" FET Switch External Enabled: No \n");
1042 if (dimmInfo
.dimmAttributes
& BIT6
)
1043 mvOsOutput(" Analysis probe installed: Yes \n");
1045 mvOsOutput(" Analysis probe installed: No \n");
1049 /*----------------------------------------------------------------------------*/
1051 case 22: /* Suported AutoPreCharge */
1052 mvOsOutput("\nModul Attributes (SPD Byte 22): \n");
1053 if (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
)
1055 if ( spdRawData
[i
] & BIT0
)
1056 mvOsOutput(" Early Ras Precharge: Yes \n");
1058 mvOsOutput(" Early Ras Precharge: No \n");
1060 if ( spdRawData
[i
] & BIT1
)
1061 mvOsOutput(" AutoPreCharge: Yes \n");
1063 mvOsOutput(" AutoPreCharge: No \n");
1065 if ( spdRawData
[i
] & BIT2
)
1066 mvOsOutput(" Precharge All: Yes \n");
1068 mvOsOutput(" Precharge All: No \n");
1070 if ( spdRawData
[i
] & BIT3
)
1071 mvOsOutput(" Write 1/ReadBurst: Yes \n");
1073 mvOsOutput(" Write 1/ReadBurst: No \n");
1075 if ( spdRawData
[i
] & BIT4
)
1076 mvOsOutput(" lower VCC tolerance: 5%%\n");
1078 mvOsOutput(" lower VCC tolerance: 10%%\n");
1080 if ( spdRawData
[i
] & BIT5
)
1081 mvOsOutput(" upper VCC tolerance: 5%%\n");
1083 mvOsOutput(" upper VCC tolerance: 10%%\n");
1085 else if (dimmInfo
.memoryType
== MEM_TYPE_DDR1
)
1087 if ( spdRawData
[i
] & BIT0
)
1088 mvOsOutput(" Supports Weak Driver: Yes \n");
1090 mvOsOutput(" Supports Weak Driver: No \n");
1092 if ( !(spdRawData
[i
] & BIT4
) )
1093 mvOsOutput(" lower VCC tolerance: 0.2V\n");
1095 if ( !(spdRawData
[i
] & BIT5
) )
1096 mvOsOutput(" upper VCC tolerance: 0.2V\n");
1098 if ( spdRawData
[i
] & BIT6
)
1099 mvOsOutput(" Concurrent Auto Preharge: Yes \n");
1101 mvOsOutput(" Concurrent Auto Preharge: No \n");
1103 if ( spdRawData
[i
] & BIT7
)
1104 mvOsOutput(" Supports Fast AP: Yes \n");
1106 mvOsOutput(" Supports Fast AP: No \n");
1108 else if (dimmInfo
.memoryType
== MEM_TYPE_DDR2
)
1110 if ( spdRawData
[i
] & BIT0
)
1111 mvOsOutput(" Supports Weak Driver: Yes \n");
1113 mvOsOutput(" Supports Weak Driver: No \n");
1116 /*----------------------------------------------------------------------------*/
1119 /* Minimum Cycle Time At Maximum Cas Latancy Minus 1 (2nd highest CL) */
1120 leftOfPoint
= (spdRawData
[i
] & 0xf0) >> 4;
1121 rightOfPoint
= (spdRawData
[i
] & 0x0f) * 10;
1123 /* DDR2 addition of right of point */
1124 if ((spdRawData
[i
] & 0x0f) == 0xA)
1128 if ((spdRawData
[i
] & 0x0f) == 0xB)
1132 if ((spdRawData
[i
] & 0x0f) == 0xC)
1136 if ((spdRawData
[i
] & 0x0f) == 0xD)
1141 mvOsOutput("Minimum Cycle Time At 2nd highest CasLatancy"
1142 "(0 = Not supported): %d.%d [ns]\n",
1143 leftOfPoint
, rightOfPoint
);
1145 /*----------------------------------------------------------------------------*/
1147 case 24: /* Clock To Data Out 2nd highest Cas Latency Value*/
1148 div
= (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
) ? 10:100;
1149 time_tmp
= (((spdRawData
[i
] & 0xf0) >> 4)*10) +
1150 ((spdRawData
[i
] & 0x0f));
1151 leftOfPoint
= time_tmp
/ div
;
1152 rightOfPoint
= time_tmp
% div
;
1153 mvOsOutput("Clock To Data Out (2nd CL value): %d.%d [ns]\n",
1154 leftOfPoint
, rightOfPoint
);
1156 /*----------------------------------------------------------------------------*/
1159 /* Minimum Cycle Time At Maximum Cas Latancy Minus 2 (3rd highest CL) */
1160 if (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
)
1162 leftOfPoint
= (spdRawData
[i
] & 0xfc) >> 2;
1163 rightOfPoint
= (spdRawData
[i
] & 0x3) * 25;
1165 else /* DDR1 or DDR2 */
1167 leftOfPoint
= (spdRawData
[i
] & 0xf0) >> 4;
1168 rightOfPoint
= (spdRawData
[i
] & 0x0f) * 10;
1170 /* DDR2 addition of right of point */
1171 if ((spdRawData
[i
] & 0x0f) == 0xA)
1175 if ((spdRawData
[i
] & 0x0f) == 0xB)
1179 if ((spdRawData
[i
] & 0x0f) == 0xC)
1183 if ((spdRawData
[i
] & 0x0f) == 0xD)
1188 mvOsOutput("Minimum Cycle Time At 3rd highest CasLatancy"
1189 "(0 = Not supported): %d.%d [ns]\n",
1190 leftOfPoint
, rightOfPoint
);
1192 /*----------------------------------------------------------------------------*/
1194 case 26: /* Clock To Data Out 3rd highest Cas Latency Value*/
1195 if (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
)
1197 leftOfPoint
= (spdRawData
[i
] & 0xfc) >> 2;
1198 rightOfPoint
= (spdRawData
[i
] & 0x3) * 25;
1200 else /* DDR1 or DDR2 */
1202 time_tmp
= (((spdRawData
[i
] & 0xf0) >> 4)*10) +
1203 ((spdRawData
[i
] & 0x0f));
1205 rightOfPoint
= time_tmp
;
1207 mvOsOutput("Clock To Data Out (3rd CL value): %d.%2d[ns]\n",
1208 leftOfPoint
, rightOfPoint
);
1210 /*----------------------------------------------------------------------------*/
1212 case 27: /* Minimum Row Precharge Time */
1213 shift
= (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
)? 0:2;
1214 maskLeftOfPoint
= (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
) ?
1216 maskRightOfPoint
= (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
) ?
1218 leftOfPoint
= ((spdRawData
[i
] & maskLeftOfPoint
) >> shift
);
1219 rightOfPoint
= (spdRawData
[i
] & maskRightOfPoint
)*25;
1220 temp
= ((leftOfPoint
*100) + rightOfPoint
);/* in 10ps Intervals*/
1221 trp_clocks
= (temp
+ (busClkPs
-1)) / busClkPs
;
1222 mvOsOutput("Minimum Row Precharge Time [ns]: %d.%d = "
1223 "in Clk cycles %d\n",
1224 leftOfPoint
, rightOfPoint
, trp_clocks
);
1226 /*----------------------------------------------------------------------------*/
1228 case 28: /* Minimum Row Active to Row Active Time */
1229 shift
= (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
)? 0:2;
1230 maskLeftOfPoint
= (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
) ?
1232 maskRightOfPoint
= (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
) ?
1234 leftOfPoint
= ((spdRawData
[i
] & maskLeftOfPoint
) >> shift
);
1235 rightOfPoint
= (spdRawData
[i
] & maskRightOfPoint
)*25;
1236 temp
= ((leftOfPoint
*100) + rightOfPoint
);/* in 100ns Interval*/
1237 trrd_clocks
= (temp
+ (busClkPs
-1)) / busClkPs
;
1238 mvOsOutput("Minimum Row Active -To- Row Active Delay [ns]: "
1239 "%d.%d = in Clk cycles %d\n",
1240 leftOfPoint
, rightOfPoint
, trp_clocks
);
1242 /*----------------------------------------------------------------------------*/
1244 case 29: /* Minimum Ras-To-Cas Delay */
1245 shift
= (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
)? 0:2;
1246 maskLeftOfPoint
= (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
) ?
1248 maskRightOfPoint
= (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
) ?
1250 leftOfPoint
= ((spdRawData
[i
] & maskLeftOfPoint
) >> shift
);
1251 rightOfPoint
= (spdRawData
[i
] & maskRightOfPoint
)*25;
1252 temp
= ((leftOfPoint
*100) + rightOfPoint
);/* in 100ns Interval*/
1253 trcd_clocks
= (temp
+ (busClkPs
-1) )/ busClkPs
;
1254 mvOsOutput("Minimum Ras-To-Cas Delay [ns]: %d.%d = "
1255 "in Clk cycles %d\n",
1256 leftOfPoint
, rightOfPoint
, trp_clocks
);
1258 /*----------------------------------------------------------------------------*/
1260 case 30: /* Minimum Ras Pulse Width */
1261 tras_clocks
= (cas2ps(spdRawData
[i
])+(busClkPs
-1)) / busClkPs
;
1262 mvOsOutput("Minimum Ras Pulse Width [ns]: %d = "
1263 "in Clk cycles %d\n", spdRawData
[i
], tras_clocks
);
1265 /*----------------------------------------------------------------------------*/
1267 case 31: /* Module Bank Density */
1268 mvOsOutput("Module Bank Density (more than 1= Multisize-Module):");
1270 if (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
)
1272 if (dimmInfo
.dimmBankDensity
& BIT0
)
1273 mvOsOutput("1GB, ");
1274 if (dimmInfo
.dimmBankDensity
& BIT1
)
1275 mvOsOutput("8MB, ");
1276 if (dimmInfo
.dimmBankDensity
& BIT2
)
1277 mvOsOutput("16MB, ");
1278 if (dimmInfo
.dimmBankDensity
& BIT3
)
1279 mvOsOutput("32MB, ");
1280 if (dimmInfo
.dimmBankDensity
& BIT4
)
1281 mvOsOutput("64MB, ");
1282 if (dimmInfo
.dimmBankDensity
& BIT5
)
1283 mvOsOutput("128MB, ");
1284 if (dimmInfo
.dimmBankDensity
& BIT6
)
1285 mvOsOutput("256MB, ");
1286 if (dimmInfo
.dimmBankDensity
& BIT7
)
1287 mvOsOutput("512MB, ");
1289 else if (dimmInfo
.memoryType
== MEM_TYPE_DDR1
)
1291 if (dimmInfo
.dimmBankDensity
& BIT0
)
1292 mvOsOutput("1GB, ");
1293 if (dimmInfo
.dimmBankDensity
& BIT1
)
1294 mvOsOutput("2GB, ");
1295 if (dimmInfo
.dimmBankDensity
& BIT2
)
1296 mvOsOutput("16MB, ");
1297 if (dimmInfo
.dimmBankDensity
& BIT3
)
1298 mvOsOutput("32MB, ");
1299 if (dimmInfo
.dimmBankDensity
& BIT4
)
1300 mvOsOutput("64MB, ");
1301 if (dimmInfo
.dimmBankDensity
& BIT5
)
1302 mvOsOutput("128MB, ");
1303 if (dimmInfo
.dimmBankDensity
& BIT6
)
1304 mvOsOutput("256MB, ");
1305 if (dimmInfo
.dimmBankDensity
& BIT7
)
1306 mvOsOutput("512MB, ");
1308 else /* if (dimmInfo.memoryType == MEM_TYPE_DDR2) */
1310 if (dimmInfo
.dimmBankDensity
& BIT0
)
1311 mvOsOutput("1GB, ");
1312 if (dimmInfo
.dimmBankDensity
& BIT1
)
1313 mvOsOutput("2GB, ");
1314 if (dimmInfo
.dimmBankDensity
& BIT2
)
1315 mvOsOutput("4GB, ");
1316 if (dimmInfo
.dimmBankDensity
& BIT3
)
1317 mvOsOutput("8GB, ");
1318 if (dimmInfo
.dimmBankDensity
& BIT4
)
1319 mvOsOutput("16GB, ");
1320 if (dimmInfo
.dimmBankDensity
& BIT5
)
1321 mvOsOutput("128MB, ");
1322 if (dimmInfo
.dimmBankDensity
& BIT6
)
1323 mvOsOutput("256MB, ");
1324 if (dimmInfo
.dimmBankDensity
& BIT7
)
1325 mvOsOutput("512MB, ");
1329 /*----------------------------------------------------------------------------*/
1331 case 32: /* Address And Command Setup Time (measured in ns/1000) */
1332 if (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
)
1334 rightOfPoint
= (spdRawData
[i
] & 0x0f);
1335 leftOfPoint
= (spdRawData
[i
] & 0xf0) >> 4;
1341 else /* DDR1 or DDR2 */
1343 time_tmp
= (((spdRawData
[i
] & 0xf0) >> 4)*10) +
1344 ((spdRawData
[i
] & 0x0f));
1345 leftOfPoint
= time_tmp
/ 100;
1346 rightOfPoint
= time_tmp
% 100;
1348 mvOsOutput("Address And Command Setup Time [ns]: %d.%d\n",
1349 leftOfPoint
, rightOfPoint
);
1351 /*----------------------------------------------------------------------------*/
1353 case 33: /* Address And Command Hold Time */
1354 if (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
)
1356 rightOfPoint
= (spdRawData
[i
] & 0x0f);
1357 leftOfPoint
= (spdRawData
[i
] & 0xf0) >> 4;
1363 else /* DDR1 or DDR2 */
1365 time_tmp
= (((spdRawData
[i
] & 0xf0) >> 4)*10) +
1366 ((spdRawData
[i
] & 0x0f));
1367 leftOfPoint
= time_tmp
/ 100;
1368 rightOfPoint
= time_tmp
% 100;
1370 mvOsOutput("Address And Command Hold Time [ns]: %d.%d\n",
1371 leftOfPoint
, rightOfPoint
);
1373 /*----------------------------------------------------------------------------*/
1375 case 34: /* Data Input Setup Time */
1376 if (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
)
1378 rightOfPoint
= (spdRawData
[i
] & 0x0f);
1379 leftOfPoint
= (spdRawData
[i
] & 0xf0) >> 4;
1385 else /* DDR1 or DDR2 */
1387 time_tmp
= (((spdRawData
[i
] & 0xf0) >> 4)*10) +
1388 ((spdRawData
[i
] & 0x0f));
1389 leftOfPoint
= time_tmp
/ 100;
1390 rightOfPoint
= time_tmp
% 100;
1392 mvOsOutput("Data Input Setup Time [ns]: %d.%d\n",
1393 leftOfPoint
, rightOfPoint
);
1395 /*----------------------------------------------------------------------------*/
1397 case 35: /* Data Input Hold Time */
1398 if (dimmInfo
.memoryType
== MEM_TYPE_SDRAM
)
1400 rightOfPoint
= (spdRawData
[i
] & 0x0f);
1401 leftOfPoint
= (spdRawData
[i
] & 0xf0) >> 4;
1407 else /* DDR1 or DDR2 */
1409 time_tmp
= (((spdRawData
[i
] & 0xf0) >> 4)*10) +
1410 ((spdRawData
[i
] & 0x0f));
1411 leftOfPoint
= time_tmp
/ 100;
1412 rightOfPoint
= time_tmp
% 100;
1414 mvOsOutput("Data Input Hold Time [ns]: %d.%d\n\n",
1415 leftOfPoint
, rightOfPoint
);
1417 /*----------------------------------------------------------------------------*/
1419 case 36: /* Relevant for DDR2 only: Write Recovery Time */
1420 leftOfPoint
= ((spdRawData
[i
] & maskLeftOfPoint
) >> 2);
1421 rightOfPoint
= (spdRawData
[i
] & maskRightOfPoint
) * 25;
1422 mvOsOutput("Write Recovery Time [ns]: %d.%d\n",
1423 leftOfPoint
, rightOfPoint
);
1425 /*----------------------------------------------------------------------------*/
1432 * translate ns.ns/10 coding of SPD timing values
1433 * into ps unit values
1435 /*******************************************************************************
1436 * cas2ps - Translate x.y ns parameter to pico-seconds values
1439 * This function translates x.y nano seconds to its value in pico seconds.
1440 * For example 3.75ns will return 3750.
1443 * spd_byte - DIMM SPD byte.
1449 * value in pico seconds.
1451 *******************************************************************************/
1452 static MV_U32
cas2ps(MV_U8 spd_byte
)
1456 /* isolate upper nibble */
1457 ns
= (spd_byte
>> 4) & 0x0F;
1458 /* isolate lower nibble */
1459 ns10
= (spd_byte
& 0x0F);
1464 else if( ns10
== 10 )
1466 else if( ns10
== 11 )
1468 else if( ns10
== 12 )
1470 else if( ns10
== 13 )
1474 mvOsOutput("cas2ps Err. unsupported cycle time.\n");
1477 return (ns
*1000 + ns10
*10);