Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2016 Google Inc. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | */ |
| 15 | |
| 16 | #include <soc/romstage.h> |
| 17 | #include <string.h> |
| 18 | |
| 19 | #include <fsp/soc_binding.h> |
| 20 | |
| 21 | #include "spd/spd.h" |
| 22 | |
| 23 | void mainboard_memory_init_params(FSPM_UPD *mupd) |
| 24 | { |
| 25 | FSP_M_CONFIG *mem_cfg = &mupd->FspmConfig; |
| 26 | /* DQ byte map */ |
| 27 | const u8 dq_map[2][12] = { |
Rizwan Qureshi | b4a1597 | 2017-01-13 12:45:19 +0530 | [diff] [blame] | 28 | { 0x0F, 0xF0, 0x00, 0xF0, 0x0F, 0xF0, |
Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 29 | 0x0F, 0x00, 0xFF, 0x00, 0xFF, 0x00 }, |
Rizwan Qureshi | b4a1597 | 2017-01-13 12:45:19 +0530 | [diff] [blame] | 30 | { 0xCC, 0x33, 0x00, 0x33, 0xCC, 0x33, |
Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 31 | 0xCC, 0x00, 0xFF, 0x00, 0xFF, 0x00 } |
| 32 | }; |
| 33 | /* DQS CPU<>DRAM map */ |
| 34 | const u8 dqs_map[2][8] = { |
Rizwan Qureshi | b4a1597 | 2017-01-13 12:45:19 +0530 | [diff] [blame] | 35 | { 2, 3, 1, 0, 4, 7, 6, 5 }, |
Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 36 | { 5, 6, 0, 3, 4, 7, 2, 1 }, |
| 37 | }; |
| 38 | /* Rcomp resistor */ |
| 39 | const u16 rcomp_resistor[] = { 200, 81, 162 }; |
| 40 | /* Rcomp target */ |
| 41 | const u16 rcomp_target[] = { 100, 40, 40, 23, 40 }; |
| 42 | |
| 43 | memcpy(&mem_cfg->DqByteMapCh0, dq_map, sizeof(dq_map)); |
| 44 | memcpy(&mem_cfg->DqsMapCpu2DramCh0, dqs_map, sizeof(dqs_map)); |
| 45 | memcpy(&mem_cfg->RcompResistor, rcomp_resistor, sizeof(rcomp_resistor)); |
| 46 | memcpy(&mem_cfg->RcompTarget, rcomp_target, sizeof(rcomp_target)); |
| 47 | |
| 48 | mem_cfg->MemorySpdPtr00 = mainboard_get_spd_data(); |
| 49 | mem_cfg->MemorySpdPtr10 = mem_cfg->MemorySpdPtr00; |
| 50 | mem_cfg->MemorySpdDataLen = SPD_LEN; |
| 51 | } |