Zheng Bao | eb75f65 | 2010-04-23 17:32:48 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2010 Advanced Micro Devices, Inc. |
Timothy Pearson | b8a355d | 2015-09-05 17:55:58 -0500 | [diff] [blame] | 5 | * Copyright (C) 2015 Timothy Pearson <tpearson@raptorengineeringinc.com>, Raptor Engineering |
Zheng Bao | eb75f65 | 2010-04-23 17:32:48 +0000 | [diff] [blame] | 6 | * |
| 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 Bao | eb75f65 | 2010-04-23 17:32:48 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | u8 mct_checkNumberOfDqsRcvEn_1Pass(u8 pass) |
| 18 | { |
| 19 | u8 ret = 1; |
Timothy Pearson | 730a043 | 2015-10-16 13:51:51 -0500 | [diff] [blame^] | 20 | |
| 21 | if (is_fam15h()) { |
| 22 | /* Fam15h needs two passes */ |
| 23 | ret = 1; |
| 24 | } else { |
| 25 | if (pass == SecondPass) |
| 26 | ret = 0; |
| 27 | } |
Zheng Bao | eb75f65 | 2010-04-23 17:32:48 +0000 | [diff] [blame] | 28 | |
| 29 | return ret; |
| 30 | } |
| 31 | |
| 32 | u32 SetupDqsPattern_1PassA(u8 pass) |
| 33 | { |
| 34 | return (u32) TestPattern1_D; |
| 35 | } |
| 36 | |
| 37 | u32 SetupDqsPattern_1PassB(u8 pass) |
| 38 | { |
| 39 | return (u32) TestPattern0_D; |
| 40 | } |
| 41 | |
Timothy Pearson | b8a355d | 2015-09-05 17:55:58 -0500 | [diff] [blame] | 42 | static u16 mct_Average_RcvrEnDly_1Pass(struct DCTStatStruc *pDCTstat, u8 Channel, u8 Receiver, |
Zheng Bao | eb75f65 | 2010-04-23 17:32:48 +0000 | [diff] [blame] | 43 | u8 Pass) |
| 44 | { |
Timothy Pearson | b8a355d | 2015-09-05 17:55:58 -0500 | [diff] [blame] | 45 | u16 i, MaxValue; |
| 46 | u16 *p; |
| 47 | u16 val; |
Zheng Bao | eb75f65 | 2010-04-23 17:32:48 +0000 | [diff] [blame] | 48 | |
| 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 | |
| 68 | u8 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 Pearson | b8a355d | 2015-09-05 17:55:58 -0500 | [diff] [blame] | 77 | u16 mct_Average_RcvrEnDly_Pass(struct DCTStatStruc *pDCTstat, |
| 78 | u16 RcvrEnDly, u16 RcvrEnDlyLimit, |
Zheng Bao | eb75f65 | 2010-04-23 17:32:48 +0000 | [diff] [blame] | 79 | u8 Channel, u8 Receiver, u8 Pass) |
| 80 | |
| 81 | { |
| 82 | return mct_Average_RcvrEnDly_1Pass(pDCTstat, Channel, Receiver, Pass); |
| 83 | } |