diff --git a/src/soc/mediatek/common/Kconfig b/src/soc/mediatek/common/Kconfig index 2fdeda9abc..1ca0b9867c 100644 --- a/src/soc/mediatek/common/Kconfig +++ b/src/soc/mediatek/common/Kconfig @@ -30,6 +30,13 @@ config MEDIATEK_DRAM_BLOB_FAST_INIT This option allows performing fast calibration through different open-source policy. +config MEDIATEK_DRAM_SCRAMBLE + bool + default y + help + This option enables DRAM data scramble, which can prevent DRAM data from + being hacked. + config MEMORY_TEST bool default y diff --git a/src/soc/mediatek/common/include/soc/dramc_param_common.h b/src/soc/mediatek/common/include/soc/dramc_param_common.h index 09b89cbe62..429f3c64a9 100644 --- a/src/soc/mediatek/common/include/soc/dramc_param_common.h +++ b/src/soc/mediatek/common/include/soc/dramc_param_common.h @@ -31,6 +31,8 @@ enum DRAMC_PARAM_CONFIG { DRAMC_CONFIG_EMCP = 0x0001, DRAMC_CONFIG_DVFS = 0x0002, DRAMC_CONFIG_FAST_K = 0x0004, + /* Security configs */ + DRAMC_CONFIG_SCRAMBLE = 0x0100, }; struct dramc_param_header { diff --git a/src/soc/mediatek/common/memory.c b/src/soc/mediatek/common/memory.c index fc559e2c17..b6f7dde02b 100644 --- a/src/soc/mediatek/common/memory.c +++ b/src/soc/mediatek/common/memory.c @@ -244,6 +244,8 @@ static void mem_init_set_default_config(struct dramc_param *dparam, if (CONFIG(MEDIATEK_DRAM_DVFS)) dparam->dramc_datas.ddr_info.config_dvfs = DRAMC_ENABLE_DVFS; + if (CONFIG(MEDIATEK_DRAM_SCRAMBLE)) + dparam->header.config |= DRAMC_CONFIG_SCRAMBLE; dparam->dramc_datas.ddr_info.sdram.ddr_geometry = geometry;