blob: 15e66c934c96bf2aaa949421ba16d1f3617eceb7 [file] [log] [blame]
Zheng Baoeb75f652010-04-23 17:32:48 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2010 Advanced Micro Devices, Inc.
Timothy Pearsonb8a355d2015-09-05 17:55:58 -05005 * Copyright (C) 2015 Timothy Pearson <tpearson@raptorengineeringinc.com>, Raptor Engineering
Zheng Baoeb75f652010-04-23 17:32:48 +00006 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Zheng Baoeb75f652010-04-23 17:32:48 +000015 */
16
17u8 mct_checkNumberOfDqsRcvEn_1Pass(u8 pass)
18{
19 u8 ret = 1;
Timothy Pearson730a0432015-10-16 13:51:51 -050020
21 if (is_fam15h()) {
22 /* Fam15h needs two passes */
23 ret = 1;
24 } else {
25 if (pass == SecondPass)
26 ret = 0;
27 }
Zheng Baoeb75f652010-04-23 17:32:48 +000028
29 return ret;
30}
31
32u32 SetupDqsPattern_1PassA(u8 pass)
33{
34 return (u32) TestPattern1_D;
35}
36
37u32 SetupDqsPattern_1PassB(u8 pass)
38{
39 return (u32) TestPattern0_D;
40}
41
Timothy Pearsonb8a355d2015-09-05 17:55:58 -050042static u16 mct_Average_RcvrEnDly_1Pass(struct DCTStatStruc *pDCTstat, u8 Channel, u8 Receiver,
Zheng Baoeb75f652010-04-23 17:32:48 +000043 u8 Pass)
44{
Timothy Pearsonb8a355d2015-09-05 17:55:58 -050045 u16 i, MaxValue;
46 u16 *p;
47 u16 val;
Zheng Baoeb75f652010-04-23 17:32:48 +000048
49 MaxValue = 0;
50 p = pDCTstat->CH_D_B_RCVRDLY[Channel][Receiver >> 1];
51
52 for(i=0; i < 8; i++) {
53 /* get left value from DCTStatStruc.CHA_D0_B0_RCVRDLY*/
54 val = p[i];
55 /* get right value from DCTStatStruc.CHA_D0_B0_RCVRDLY_1*/
56 val += Pass1MemClkDly;
57 /* write back the value to stack */
58 if (val > MaxValue)
59 MaxValue = val;
60
61 p[i] = val;
62 }
63 /* pDCTstat->DimmTrainFail &= ~(1<<Receiver+Channel); */
64
65 return MaxValue;
66}
67
68u8 mct_SaveRcvEnDly_D_1Pass(struct DCTStatStruc *pDCTstat, u8 pass)
69{
70 u8 ret;
71 ret = 0;
72 if((pDCTstat->DqsRcvEn_Pass == 0xff) && (pass== FirstPass))
73 ret = 2;
74 return ret;
75}
76
Timothy Pearsonb8a355d2015-09-05 17:55:58 -050077u16 mct_Average_RcvrEnDly_Pass(struct DCTStatStruc *pDCTstat,
78 u16 RcvrEnDly, u16 RcvrEnDlyLimit,
Zheng Baoeb75f652010-04-23 17:32:48 +000079 u8 Channel, u8 Receiver, u8 Pass)
80
81{
82 return mct_Average_RcvrEnDly_1Pass(pDCTstat, Channel, Receiver, Pass);
83}