diff options
-rw-r--r-- | src/soc/mediatek/common/dram_init.c | 8 | ||||
-rw-r--r-- | src/soc/mediatek/common/include/soc/dramc_param.h | 43 | ||||
-rw-r--r-- | 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 <stdint.h> @@ -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), |