Yidi Lin has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/80687?usp=email )
Change subject: soc/mediatek: Move `get_sdram_config` to common code ......................................................................
soc/mediatek: Move `get_sdram_config` to common code
Starting from MT8195, MediaTek platform supports "dram adaptive" feature. So we can just pass a placeholder param blob in `get_sdram_config` by default. The platform which does not support "dram adaptive" can override `get_sdram_config` and implement it in the mainboard folder.
TEST=emerge-geralt coreboot
Change-Id: I05a01b1ab13fbf19b2a908c48a540a5c2e1ccbdc Signed-off-by: Yidi Lin yidilin@chromium.org --- M src/mainboard/google/cherry/Makefile.mk D src/mainboard/google/cherry/sdram_configs.c M src/mainboard/google/corsola/Makefile.mk D src/mainboard/google/corsola/sdram_configs.c M src/mainboard/google/geralt/Makefile.mk D src/mainboard/google/geralt/sdram_configs.c M src/soc/mediatek/common/include/soc/dramc_param_common.h M src/soc/mediatek/common/memory.c M src/soc/mediatek/mt8186/include/soc/dramc_param.h M src/soc/mediatek/mt8188/include/soc/dramc_param.h M src/soc/mediatek/mt8192/include/soc/dramc_param.h M src/soc/mediatek/mt8195/include/soc/dramc_param.h 12 files changed, 14 insertions(+), 52 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/80687/1
diff --git a/src/mainboard/google/cherry/Makefile.mk b/src/mainboard/google/cherry/Makefile.mk index 5fe1339..41ec839 100644 --- a/src/mainboard/google/cherry/Makefile.mk +++ b/src/mainboard/google/cherry/Makefile.mk @@ -14,7 +14,6 @@ romstage-y += regulator.c romstage-y += reset.c romstage-y += romstage.c -romstage-y += sdram_configs.c
ramstage-y += memlayout.ld ramstage-y += boardid.c diff --git a/src/mainboard/google/cherry/sdram_configs.c b/src/mainboard/google/cherry/sdram_configs.c deleted file mode 100644 index de6bdd1..0000000 --- a/src/mainboard/google/cherry/sdram_configs.c +++ /dev/null @@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -#include <soc/dramc_param.h> - -const struct sdram_info *get_sdram_config(void) -{ - /* - * The MT8195 platform supports "dram adaptive" feature to - * automatically detect dram information, including channel, rank, die size..., - * and can automatically configure EMI settings. - * So we will be passing a placeholder param blob. - */ - static struct sdram_info params; - return ¶ms; -} diff --git a/src/mainboard/google/corsola/Makefile.mk b/src/mainboard/google/corsola/Makefile.mk index 5483167..1442f33 100644 --- a/src/mainboard/google/corsola/Makefile.mk +++ b/src/mainboard/google/corsola/Makefile.mk @@ -14,7 +14,6 @@ romstage-y += regulator.c romstage-y += reset.c romstage-y += romstage.c -romstage-y += sdram_configs.c
ramstage-y += memlayout.ld ramstage-y += boardid.c diff --git a/src/mainboard/google/corsola/sdram_configs.c b/src/mainboard/google/corsola/sdram_configs.c deleted file mode 100644 index f565f53..0000000 --- a/src/mainboard/google/corsola/sdram_configs.c +++ /dev/null @@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -#include <soc/dramc_param.h> - -const struct sdram_info *get_sdram_config(void) -{ - /* - * The MT8186 platform supports "dram adaptive" feature to - * automatically detect dram information, including channel, rank, die size..., - * and can automatically configure EMI settings. - * So we will be passing a placeholder param blob. - */ - static struct sdram_info params; - return ¶ms; -} diff --git a/src/mainboard/google/geralt/Makefile.mk b/src/mainboard/google/geralt/Makefile.mk index b1af289..0975c5c 100644 --- a/src/mainboard/google/geralt/Makefile.mk +++ b/src/mainboard/google/geralt/Makefile.mk @@ -15,7 +15,6 @@ romstage-y += regulator.c romstage-y += reset.c romstage-y += romstage.c -romstage-y += sdram_configs.c
ramstage-y += memlayout.ld ramstage-y += boardid.c diff --git a/src/mainboard/google/geralt/sdram_configs.c b/src/mainboard/google/geralt/sdram_configs.c deleted file mode 100644 index c4766be..0000000 --- a/src/mainboard/google/geralt/sdram_configs.c +++ /dev/null @@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -#include <soc/dramc_param.h> - -const struct sdram_info *get_sdram_config(void) -{ - /* - * The MT8188 platform supports "dram adaptive" feature to automatically - * detect dram information, including channel, rank, die size..., and - * can automatically configure EMI settings. Therefore, we will be - * passing a placeholder param blob. - */ - static struct sdram_info params; - return ¶ms; -} 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 429f3c6..7dd8bba 100644 --- a/src/soc/mediatek/common/include/soc/dramc_param_common.h +++ b/src/soc/mediatek/common/include/soc/dramc_param_common.h @@ -101,4 +101,6 @@ u32 data_rate; };
+const struct sdram_info *get_sdram_config(void); + #endif diff --git a/src/soc/mediatek/common/memory.c b/src/soc/mediatek/common/memory.c index be72023..dce6bcd 100644 --- a/src/soc/mediatek/common/memory.c +++ b/src/soc/mediatek/common/memory.c @@ -311,6 +311,18 @@ } }
+__weak const struct sdram_info *get_sdram_config(void) +{ + /* + * Starting from MT8195, MediaTek platform supports "dram adaptive" + * feature to automatically detect dram information, including channel, + * rank, die size..., and can automatically configure EMI settings. + * So we will be passing a placeholder param blob. + */ + static struct sdram_info params; + return ¶ms; +} + void mt_mem_init(struct dramc_param *dparam) { const struct sdram_info *sdram_param = get_sdram_config(); diff --git a/src/soc/mediatek/mt8186/include/soc/dramc_param.h b/src/soc/mediatek/mt8186/include/soc/dramc_param.h index 2d6212b..29380c2 100644 --- a/src/soc/mediatek/mt8186/include/soc/dramc_param.h +++ b/src/soc/mediatek/mt8186/include/soc/dramc_param.h @@ -78,7 +78,6 @@ struct dramc_data dramc_datas; };
-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); int initialize_dramc_param(void *blob); diff --git a/src/soc/mediatek/mt8188/include/soc/dramc_param.h b/src/soc/mediatek/mt8188/include/soc/dramc_param.h index 88e2a90..740e27b 100644 --- a/src/soc/mediatek/mt8188/include/soc/dramc_param.h +++ b/src/soc/mediatek/mt8188/include/soc/dramc_param.h @@ -98,7 +98,6 @@ struct dramc_data dramc_datas; };
-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); int validate_dramc_param(const void *blob); diff --git a/src/soc/mediatek/mt8192/include/soc/dramc_param.h b/src/soc/mediatek/mt8192/include/soc/dramc_param.h index c4f1293..fca82be 100644 --- a/src/soc/mediatek/mt8192/include/soc/dramc_param.h +++ b/src/soc/mediatek/mt8192/include/soc/dramc_param.h @@ -73,7 +73,6 @@ struct dramc_data dramc_datas; };
-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); int validate_dramc_param(const void *blob); diff --git a/src/soc/mediatek/mt8195/include/soc/dramc_param.h b/src/soc/mediatek/mt8195/include/soc/dramc_param.h index 7c66b70..0885ee0 100644 --- a/src/soc/mediatek/mt8195/include/soc/dramc_param.h +++ b/src/soc/mediatek/mt8195/include/soc/dramc_param.h @@ -73,7 +73,6 @@ struct dramc_data dramc_datas; };
-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); int validate_dramc_param(const void *blob);