blob: 2b35fc2017d0451cd5999f7b49809c5a9671600a [file] [log] [blame]
Angel Pons53e528a2020-04-03 01:23:03 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Youness Alaoui047475c2017-05-08 16:50:23 -04002
Youness Alaoui0e977fc2017-05-25 14:48:18 -05003#include <assert.h>
Youness Alaoui047475c2017-05-08 16:50:23 -04004#include <soc/romstage.h>
Youness Alaoui0e977fc2017-05-25 14:48:18 -05005#include <spd_bin.h>
Angel Pons42aa2cb2020-10-09 23:24:31 +02006#include <stdint.h>
Nico Huber0ebdf2a2019-05-04 17:06:06 +02007#include <string.h>
8
Matt DeVillierfb1cd092017-06-22 15:54:07 -04009void mainboard_memory_init_params(FSPM_UPD *mupd)
Youness Alaoui047475c2017-05-08 16:50:23 -040010{
Angel Pons42aa2cb2020-10-09 23:24:31 +020011 const u16 rcomp_resistors[3] = { 121, 81, 100 };
12
13 const u16 rcomp_targets[5] = { 100, 40, 20, 20, 26 };
14
15 FSP_M_CONFIG *mem_cfg = &mupd->FspmConfig;
16
Youness Alaoui0e977fc2017-05-25 14:48:18 -050017 struct spd_block blk = {
Nico Huber5f9c6732017-06-28 16:42:51 +020018 .addr_map = { 0x50 },
Youness Alaoui0e977fc2017-05-25 14:48:18 -050019 };
20
Angel Pons42aa2cb2020-10-09 23:24:31 +020021 assert(sizeof(mem_cfg->RcompResistor) == sizeof(rcomp_resistors));
22 assert(sizeof(mem_cfg->RcompTarget) == sizeof(rcomp_targets));
Matt DeVillierfb1cd092017-06-22 15:54:07 -040023
Youness Alaoui0e977fc2017-05-25 14:48:18 -050024 get_spd_smbus(&blk);
25 dump_spd_info(&blk);
Youness Alaoui0e977fc2017-05-25 14:48:18 -050026 assert(blk.spd_array[0][0] != 0);
Youness Alaoui3d607182017-06-15 16:50:47 -040027
Angel Pons42aa2cb2020-10-09 23:24:31 +020028 memcpy(mem_cfg->RcompResistor, rcomp_resistors, sizeof(mem_cfg->RcompResistor));
29 memcpy(mem_cfg->RcompTarget, rcomp_targets, sizeof(mem_cfg->RcompTarget));
Youness Alaoui0e977fc2017-05-25 14:48:18 -050030
Matt DeVillierfb1cd092017-06-22 15:54:07 -040031 mem_cfg->DqPinsInterleaved = TRUE;
Angel Ponse1269a72021-08-30 11:07:05 +020032 mem_cfg->CaVrefConfig = 2;
Matt DeVillierfb1cd092017-06-22 15:54:07 -040033 mem_cfg->MemorySpdDataLen = blk.len;
Elyes Haouas486240f2022-11-18 15:21:03 +010034 mem_cfg->MemorySpdPtr00 = (uintptr_t)blk.spd_array[0];
Matt DeVillierb5eae282020-09-23 17:11:19 -050035
36 /* Enable and set SATA HSIO adjustments for ports 0 and 2 */
37 mem_cfg->PchSataHsioRxGen3EqBoostMagEnable[0] = 1;
38 mem_cfg->PchSataHsioRxGen3EqBoostMagEnable[2] = 1;
39 mem_cfg->PchSataHsioRxGen3EqBoostMag[0] = 1;
40 mem_cfg->PchSataHsioRxGen3EqBoostMag[2] = 1;
Youness Alaoui0e977fc2017-05-25 14:48:18 -050041}