From c074f61d8fb0fbad1ec7a19e32cb7d1524ad97f0 Mon Sep 17 00:00:00 2001 From: Yu-Ping Wu Date: Mon, 12 Apr 2021 11:03:57 +0800 Subject: [PATCH] soc/mediatek: Include sdram_info in ddr_base_info Sync dramc_param.h with private repo mtk-dramk (CL:*3751861). BUG=none TEST=emerge-asurada coreboot TEST=Hayato boots with fast calibration BRANCH=asurada Change-Id: I79541f66ce68a75147c22b83a456e6268ca1485e Signed-off-by: Yu-Ping Wu Reviewed-on: https://review.coreboot.org/c/coreboot/+/52257 Tested-by: build bot (Jenkins) Reviewed-by: Hung-Te Lin --- src/soc/mediatek/common/dram_init.c | 8 ++-- .../mediatek/common/include/soc/dramc_param.h | 43 +++++++++---------- src/soc/mediatek/common/memory.c | 4 +- 3 files changed, 27 insertions(+), 28 deletions(-) diff --git a/src/soc/mediatek/common/dram_init.c b/src/soc/mediatek/common/dram_init.c index accc7ac5e7..252ff8c802 100644 --- a/src/soc/mediatek/common/dram_init.c +++ b/src/soc/mediatek/common/dram_init.c @@ -19,15 +19,15 @@ bool is_dvfs_enabled(void) u32 get_ddr_geometry(void) { dramc_info("dram_init: ddr_geometry: %d\n", - dramc_params->dramc_datas.ddr_info.ddr_geometry); - return dramc_params->dramc_datas.ddr_info.ddr_geometry; + dramc_params->dramc_datas.ddr_info.sdram.ddr_geometry); + return dramc_params->dramc_datas.ddr_info.sdram.ddr_geometry; } u32 get_ddr_type(void) { dramc_info("dram_init: ddr_type: %d\n", - dramc_params->dramc_datas.ddr_info.ddr_type); - return dramc_params->dramc_datas.ddr_info.ddr_type; + dramc_params->dramc_datas.ddr_info.sdram.ddr_type); + return dramc_params->dramc_datas.ddr_info.sdram.ddr_type; } void init_dram_by_params(struct dramc_param *dparam) diff --git a/src/soc/mediatek/common/include/soc/dramc_param.h b/src/soc/mediatek/common/include/soc/dramc_param.h index e809379261..00bf7c0431 100644 --- a/src/soc/mediatek/common/include/soc/dramc_param.h +++ b/src/soc/mediatek/common/include/soc/dramc_param.h @@ -4,8 +4,8 @@ #define __SOC_MEDIATEK_DRAMC_PARAM_H__ /* - * This file is shared between coreboot and dram blob. Any change in this file - * should be synced to the other repository. + * NOTE: This file is shared between coreboot and dram blob. Any change in this + * file should be synced to the other repository. */ #include @@ -27,21 +27,21 @@ enum DRAMC_PARAM_STATUS_CODES { DRAMC_ERR_FAST_CALIBRATION, }; -enum DRAMC_PARAM_DVFS_FLAG { - DRAMC_DISABLE_DVFS, - DRAMC_ENABLE_DVFS, -}; - enum DRAMC_PARAM_FLAGS { DRAMC_FLAG_HAS_SAVED_DATA = 0x0001, }; -enum DRAMC_PARAM_DDR_TYPE { +enum SDRAM_DVFS_FLAG { + DRAMC_DISABLE_DVFS, + DRAMC_ENABLE_DVFS, +}; + +enum SDRAM_DDR_TYPE { DDR_TYPE_DISCRETE, DDR_TYPE_EMCP, }; -enum DRAMC_PARAM_GEOMETRY_TYPE { +enum SDRAM_DDR_GEOMETRY_TYPE { DDR_TYPE_2CH_2RK_4GB_2_2, DDR_TYPE_2CH_2RK_6GB_3_3, DDR_TYPE_2CH_2RK_8GB_4_4_BYTE, @@ -50,10 +50,10 @@ enum DRAMC_PARAM_GEOMETRY_TYPE { DDR_TYPE_2CH_2RK_8GB_4_4, }; -enum DRAM_PARAM_VOLTAGE_TYPE { - DRAM_VOLTAGE_NVCORE_NVDRAM, - DRAM_VOLTAGE_HVCORE_HVDRAM, - DRAM_VOLTAGE_LVCORE_LVDRAM, +enum SDRAM_VOLTAGE_TYPE { + SDRAM_VOLTAGE_NVCORE_NVDRAM, + SDRAM_VOLTAGE_HVCORE_HVDRAM, + SDRAM_VOLTAGE_LVCORE_LVDRAM, }; struct dramc_param_header { @@ -63,6 +63,11 @@ struct dramc_param_header { u16 flags; /* DRAMC_PARAM_FLAGS, update in the dram blob */ }; +struct sdram_info { + u32 ddr_type; /* SDRAM_DDR_TYPE */ + u32 ddr_geometry; /* SDRAM_DDR_GEOMETRY_TYPE */ +}; + struct sdram_params { u32 rank_num; u16 num_dlycell_perT; @@ -118,10 +123,9 @@ struct emi_mdl { }; struct ddr_base_info { - u32 config_dvfs; /* DRAMC_PARAM_DVFS_FLAG */ - u32 ddr_type; /* DRAMC_PARAM_DDR_TYPE */ - u32 ddr_geometry; /* DRAMC_PARAM_GEOMETRY_TYPE */ - u32 voltage_type; /* DRAM_PARAM_VOLTAGE_TYPE */ + u32 config_dvfs; /* SDRAM_DVFS_FLAG */ + struct sdram_info sdram; + u32 voltage_type; /* SDRAM_VOLTAGE_TYPE */ u32 support_ranks; u64 rank_size[RANK_MAX]; struct emi_mdl emi_config; @@ -139,11 +143,6 @@ struct dramc_param { struct dramc_data dramc_datas; }; -struct sdram_info { - u32 ddr_geometry; /* DRAMC_PARAM_GEOMETRY_TYPE */ - u32 ddr_type; /* DRAMC_PARAM_DDR_TYPE */ -}; - const struct sdram_info *get_sdram_config(void); struct dramc_param *get_dramc_param_from_blob(void *blob); void dump_param_header(const void *blob); diff --git a/src/soc/mediatek/common/memory.c b/src/soc/mediatek/common/memory.c index 016863503a..e1641d82f9 100644 --- a/src/soc/mediatek/common/memory.c +++ b/src/soc/mediatek/common/memory.c @@ -156,12 +156,12 @@ static void mem_init_set_default_config(struct dramc_param *dparam, type = dram_info->ddr_type; geometry = dram_info->ddr_geometry; - dparam->dramc_datas.ddr_info.ddr_type = type; + dparam->dramc_datas.ddr_info.sdram.ddr_type = type; if (CONFIG(MEDIATEK_DRAM_DVFS)) dparam->dramc_datas.ddr_info.config_dvfs = DRAMC_ENABLE_DVFS; - dparam->dramc_datas.ddr_info.ddr_geometry = geometry; + dparam->dramc_datas.ddr_info.sdram.ddr_geometry = geometry; printk(BIOS_INFO, "DRAM-K: ddr_type: %s, config_dvfs: %d, ddr_geometry: %s\n", get_dram_type_str(type),