blob: ae47167ec1c2371e3b0968e784be45b1027aa9e5 [file] [log] [blame]
Eric Lai50886822020-11-26 12:10:39 +08001/* SPDX-License-Identifier: GPL-2.0-or-later */
2
Eric Lai56868b82020-12-08 14:08:12 +08003#include <baseboard/gpio.h>
4#include <baseboard/variants.h>
Eric Lai50886822020-11-26 12:10:39 +08005#include <fsp/api.h>
Eric Lai56868b82020-12-08 14:08:12 +08006#include <gpio.h>
Eric Lai50886822020-11-26 12:10:39 +08007#include <soc/romstage.h>
David Wu126162c2021-07-23 11:36:33 +08008#include <string.h>
Eric Lai50886822020-11-26 12:10:39 +08009
Zhuohao Lee09f3b6c2022-01-20 21:30:12 +080010void mainboard_memory_init_params(FSPM_UPD *memupd)
Eric Lai50886822020-11-26 12:10:39 +080011{
Zhuohao Lee09f3b6c2022-01-20 21:30:12 +080012 FSP_M_CONFIG *m_cfg = &memupd->FspmConfig;
Eric Lai56868b82020-12-08 14:08:12 +080013 const struct mb_cfg *mem_config = variant_memory_params();
14 bool half_populated = variant_is_half_populated();
David Wu126162c2021-07-23 11:36:33 +080015 struct mem_spd spd_info;
16
17 memset(&spd_info, 0, sizeof(spd_info));
18 variant_get_spd_info(&spd_info);
19
Tim Wawrzynczakf55e82c2021-09-09 16:12:51 -060020 const struct pad_config *pads;
21 size_t pads_num;
Eric Lai56868b82020-12-08 14:08:12 +080022
Subrata Banik0007fa92021-06-23 15:27:43 +053023 memcfg_init(m_cfg, mem_config, &spd_info, half_populated);
Tim Wawrzynczakf55e82c2021-09-09 16:12:51 -060024
25 pads = variant_romstage_gpio_table(&pads_num);
26 gpio_configure_pads(pads, pads_num);
Eric Lai50886822020-11-26 12:10:39 +080027}