Angel Pons | 60ec365 | 2020-04-03 01:22:13 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Angel Pons | 60ec365 | 2020-04-03 01:22:13 +0200 | [diff] [blame] | 2 | |
Ronak Kanabar | ba5062d | 2020-02-27 19:40:32 +0530 | [diff] [blame] | 3 | #include <baseboard/variants.h> |
Aamir Bohra | a23e0c9 | 2020-03-25 15:31:12 +0530 | [diff] [blame] | 4 | #include <soc/meminit.h> |
Aamir Bohra | 630aa4b | 2019-12-06 19:19:19 +0530 | [diff] [blame] | 5 | #include <soc/romstage.h> |
Ronak Kanabar | ba5062d | 2020-02-27 19:40:32 +0530 | [diff] [blame] | 6 | #include "board_id.h" |
Aamir Bohra | 630aa4b | 2019-12-06 19:19:19 +0530 | [diff] [blame] | 7 | |
Ronak Kanabar | ba5062d | 2020-02-27 19:40:32 +0530 | [diff] [blame] | 8 | void mainboard_memory_init_params(FSPM_UPD *memupd) |
Aamir Bohra | 630aa4b | 2019-12-06 19:19:19 +0530 | [diff] [blame] | 9 | { |
Ronak Kanabar | ba5062d | 2020-02-27 19:40:32 +0530 | [diff] [blame] | 10 | static struct spd_info jslrvp_spd_info; |
| 11 | uint8_t board_id = get_board_id(); |
| 12 | const struct mb_cfg *board_cfg = variant_memcfg_config(board_id); |
| 13 | |
| 14 | /* TODO: Read the resistor strap to get number of memory segments */ |
| 15 | bool half_populated = false; |
| 16 | |
| 17 | /* Check board id and fill correct parameters to upd */ |
| 18 | if (board_id == jsl_ddr4) { |
| 19 | /* Initialize spd information for DDR4 board */ |
| 20 | jslrvp_spd_info.read_type = READ_SMBUS; |
| 21 | jslrvp_spd_info.spd_spec.spd_smbus_address[0] = 0xA0; |
| 22 | jslrvp_spd_info.spd_spec.spd_smbus_address[1] = 0xA2; |
| 23 | jslrvp_spd_info.spd_spec.spd_smbus_address[2] = 0xA4; |
| 24 | jslrvp_spd_info.spd_spec.spd_smbus_address[3] = 0xA6; |
| 25 | |
| 26 | } else if (board_id == jsl_lpddr4) { |
| 27 | /* Initialize spd information for LPDDR4 board */ |
| 28 | jslrvp_spd_info.read_type = READ_SPD_CBFS; |
| 29 | jslrvp_spd_info.spd_spec.spd_index = 0x00; |
| 30 | } |
| 31 | |
| 32 | /* Initialize variant specific configurations */ |
| 33 | memcfg_init(&memupd->FspmConfig, board_cfg, &jslrvp_spd_info, half_populated); |
Aamir Bohra | 630aa4b | 2019-12-06 19:19:19 +0530 | [diff] [blame] | 34 | } |