soc/mediatek: Add MEDIATEK_DRAM_ADAPTIVE
config to support dram adaptive
Starting from MT8195, MediaTek platform supports "dram adaptive" to automatically detect dram information, including channel, rank, die size..., and can automatically configure EMI settings. So we can just pass a placeholder param blob to `mt_mem_init_run` by enabling this option. Platforms (MT8173, MT8183, MT8192) which do not support "dram adaptive" need to implement `get_sdram_config` to get onboard DRAM configuration info. TEST=emerge-geralt coreboot && emerge-asurada coreboot TEST=CONFIG_MEDIATEK_DRAM_ADAPTIVE is set to y on geralt TEST=CONFIG_MEDIATEK_DRAM_ADAPTIVE is no set on asurada Change-Id: I05a01b1ab13fbf19b2a908c48a540a5c2e1ccbdc Signed-off-by: Yidi Lin <yidilin@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/80687 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
This commit is contained in:
@@ -14,7 +14,6 @@ romstage-y += chromeos.c
|
|||||||
romstage-y += regulator.c
|
romstage-y += regulator.c
|
||||||
romstage-y += reset.c
|
romstage-y += reset.c
|
||||||
romstage-y += romstage.c
|
romstage-y += romstage.c
|
||||||
romstage-y += sdram_configs.c
|
|
||||||
|
|
||||||
ramstage-y += memlayout.ld
|
ramstage-y += memlayout.ld
|
||||||
ramstage-y += boardid.c
|
ramstage-y += boardid.c
|
||||||
|
@@ -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;
|
|
||||||
}
|
|
@@ -14,7 +14,6 @@ romstage-y += chromeos.c
|
|||||||
romstage-y += regulator.c
|
romstage-y += regulator.c
|
||||||
romstage-y += reset.c
|
romstage-y += reset.c
|
||||||
romstage-y += romstage.c
|
romstage-y += romstage.c
|
||||||
romstage-y += sdram_configs.c
|
|
||||||
|
|
||||||
ramstage-y += memlayout.ld
|
ramstage-y += memlayout.ld
|
||||||
ramstage-y += boardid.c
|
ramstage-y += boardid.c
|
||||||
|
@@ -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;
|
|
||||||
}
|
|
@@ -15,7 +15,6 @@ romstage-y += chromeos.c
|
|||||||
romstage-y += regulator.c
|
romstage-y += regulator.c
|
||||||
romstage-y += reset.c
|
romstage-y += reset.c
|
||||||
romstage-y += romstage.c
|
romstage-y += romstage.c
|
||||||
romstage-y += sdram_configs.c
|
|
||||||
|
|
||||||
ramstage-y += memlayout.ld
|
ramstage-y += memlayout.ld
|
||||||
ramstage-y += boardid.c
|
ramstage-y += boardid.c
|
||||||
|
@@ -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;
|
|
||||||
}
|
|
@@ -8,6 +8,21 @@ config SOC_MEDIATEK_COMMON
|
|||||||
|
|
||||||
if SOC_MEDIATEK_COMMON
|
if SOC_MEDIATEK_COMMON
|
||||||
|
|
||||||
|
config MEDIATEK_DRAM_ADAPTIVE
|
||||||
|
bool
|
||||||
|
default n if SOC_MEDIATEK_MT8173
|
||||||
|
default n if SOC_MEDIATEK_MT8183
|
||||||
|
default n if SOC_MEDIATEK_MT8192
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Starting from MT8195, MediaTek platform supports "dram adaptive" to
|
||||||
|
automatically detect dram information, including channel, rank, die
|
||||||
|
size..., and can automatically configure EMI settings. So we can just
|
||||||
|
pass a placeholder param blob to `mt_mem_init_run` by enabling this
|
||||||
|
option.
|
||||||
|
Platforms (MT8173, MT8183, MT8192) which do not support "dram adaptive"
|
||||||
|
need to implement `get_sdram_config` to get the DRAM configuration info.
|
||||||
|
|
||||||
config MEDIATEK_DRAM_DVFS
|
config MEDIATEK_DRAM_DVFS
|
||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
|
@@ -101,4 +101,6 @@ struct ddr_base_info {
|
|||||||
u32 data_rate;
|
u32 data_rate;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const struct sdram_info *get_sdram_config(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -313,7 +313,13 @@ static void mt_mem_init_run(struct dramc_param *dparam,
|
|||||||
|
|
||||||
void mt_mem_init(struct dramc_param *dparam)
|
void mt_mem_init(struct dramc_param *dparam)
|
||||||
{
|
{
|
||||||
const struct sdram_info *sdram_param = get_sdram_config();
|
const struct sdram_info *sdram_param = NULL;
|
||||||
|
static struct sdram_info fake_sdram_param;
|
||||||
|
|
||||||
|
if (CONFIG(MEDIATEK_DRAM_ADAPTIVE))
|
||||||
|
sdram_param = &fake_sdram_param;
|
||||||
|
else
|
||||||
|
sdram_param = get_sdram_config();
|
||||||
|
|
||||||
mt_mem_init_run(dparam, sdram_param);
|
mt_mem_init_run(dparam, sdram_param);
|
||||||
}
|
}
|
||||||
|
@@ -78,7 +78,6 @@ struct dramc_param {
|
|||||||
struct dramc_data dramc_datas;
|
struct dramc_data dramc_datas;
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct sdram_info *get_sdram_config(void);
|
|
||||||
struct dramc_param *get_dramc_param_from_blob(void *blob);
|
struct dramc_param *get_dramc_param_from_blob(void *blob);
|
||||||
void dump_param_header(const void *blob);
|
void dump_param_header(const void *blob);
|
||||||
int initialize_dramc_param(void *blob);
|
int initialize_dramc_param(void *blob);
|
||||||
|
@@ -98,7 +98,6 @@ struct dramc_param {
|
|||||||
struct dramc_data dramc_datas;
|
struct dramc_data dramc_datas;
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct sdram_info *get_sdram_config(void);
|
|
||||||
struct dramc_param *get_dramc_param_from_blob(void *blob);
|
struct dramc_param *get_dramc_param_from_blob(void *blob);
|
||||||
void dump_param_header(const void *blob);
|
void dump_param_header(const void *blob);
|
||||||
int validate_dramc_param(const void *blob);
|
int validate_dramc_param(const void *blob);
|
||||||
|
@@ -73,7 +73,6 @@ struct dramc_param {
|
|||||||
struct dramc_data dramc_datas;
|
struct dramc_data dramc_datas;
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct sdram_info *get_sdram_config(void);
|
|
||||||
struct dramc_param *get_dramc_param_from_blob(void *blob);
|
struct dramc_param *get_dramc_param_from_blob(void *blob);
|
||||||
void dump_param_header(const void *blob);
|
void dump_param_header(const void *blob);
|
||||||
int validate_dramc_param(const void *blob);
|
int validate_dramc_param(const void *blob);
|
||||||
|
@@ -73,7 +73,6 @@ struct dramc_param {
|
|||||||
struct dramc_data dramc_datas;
|
struct dramc_data dramc_datas;
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct sdram_info *get_sdram_config(void);
|
|
||||||
struct dramc_param *get_dramc_param_from_blob(void *blob);
|
struct dramc_param *get_dramc_param_from_blob(void *blob);
|
||||||
void dump_param_header(const void *blob);
|
void dump_param_header(const void *blob);
|
||||||
int validate_dramc_param(const void *blob);
|
int validate_dramc_param(const void *blob);
|
||||||
|
Reference in New Issue
Block a user