Michał Kopeć | cce6dfb | 2023-09-23 14:48:25 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <assert.h> |
| 4 | #include <soc/romstage.h> |
| 5 | #include <spd_bin.h> |
| 6 | #include <stdint.h> |
| 7 | #include <string.h> |
| 8 | |
| 9 | void mainboard_memory_init_params(FSPM_UPD *mupd) |
| 10 | { |
| 11 | const u16 rcomp_resistors[3] = { 121, 75, 100 }; |
| 12 | |
| 13 | const u16 rcomp_targets[5] = { 50, 26, 20, 20, 26 }; |
| 14 | |
| 15 | FSP_M_CONFIG *const mem_cfg = &mupd->FspmConfig; |
| 16 | |
| 17 | struct spd_block blk = { |
| 18 | .addr_map = { 0x50, 0x52 }, |
| 19 | }; |
| 20 | |
| 21 | assert(sizeof(mem_cfg->RcompResistor) == sizeof(rcomp_resistors)); |
| 22 | assert(sizeof(mem_cfg->RcompTarget) == sizeof(rcomp_targets)); |
| 23 | |
| 24 | mem_cfg->DqPinsInterleaved = 1; |
| 25 | mem_cfg->CaVrefConfig = 2; |
| 26 | get_spd_smbus(&blk); |
| 27 | mem_cfg->MemorySpdDataLen = blk.len; |
| 28 | mem_cfg->MemorySpdPtr00 = (uintptr_t)blk.spd_array[0]; |
| 29 | mem_cfg->MemorySpdPtr10 = (uintptr_t)blk.spd_array[1]; |
| 30 | dump_spd_info(&blk); |
| 31 | |
| 32 | memcpy(mem_cfg->RcompResistor, rcomp_resistors, sizeof(mem_cfg->RcompResistor)); |
| 33 | memcpy(mem_cfg->RcompTarget, rcomp_targets, sizeof(mem_cfg->RcompTarget)); |
| 34 | |
| 35 | /* use virtual channel 1 for the dmi interface of the PCH */ |
| 36 | mupd->FspmTestConfig.DmiVc1 = 1; |
| 37 | } |