Xi Chen has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/48261 )
Change subject: src/mediatek/mt8192: pass regulator function pointer to dram blob ......................................................................
src/mediatek/mt8192: pass regulator function pointer to dram blob
For dram power HV or LV control, dram blob and coreboot have different api and implementations, coreboot will pass regulator get/set pointer to dram blob, blob can leverage coreboot regulator implementation.
Signed-off-by: Xi Chen xixi.chen@mediatek.com Change-Id: Id44fe4d6c7a7448b63b400744cbc331055e94024 --- M src/soc/mediatek/mt8192/include/soc/dramc_param.h M src/soc/mediatek/mt8192/memory.c 2 files changed, 16 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/61/48261/1
diff --git a/src/soc/mediatek/mt8192/include/soc/dramc_param.h b/src/soc/mediatek/mt8192/include/soc/dramc_param.h index 180311e..95a29d6 100644 --- a/src/soc/mediatek/mt8192/include/soc/dramc_param.h +++ b/src/soc/mediatek/mt8192/include/soc/dramc_param.h @@ -6,9 +6,10 @@ #include <stdint.h> #include <sys/types.h> #include <soc/dramc_common_mt8192.h> +#include <soc/regulator.h>
enum { - DRAMC_PARAM_HEADER_VERSION = 5, + DRAMC_PARAM_HEADER_VERSION = 6, };
enum DRAMC_PARAM_STATUS_CODES { @@ -53,6 +54,10 @@ DRAM_VOLTAGE_LVCORE_LVDRAM, };
+typedef uint32_t (*get_regulator_vol_ptr)(enum mtk_regulator regulator); +typedef void (*set_regulator_vol_ptr)(enum mtk_regulator regulator, + uint32_t voltage_uv); + struct dramc_param_header { u32 checksum; /* checksum of dramc_datas, update in the coreboot */ u16 version; /* DRAMC_PARAM_HEADER_VERSION, update in the coreboot */ @@ -131,10 +136,16 @@ struct sdram_params freq_params[DRAM_DFS_SHU_MAX]; };
+struct dram_power_control { + get_regulator_vol_ptr get_regulator_vol; + set_regulator_vol_ptr set_regulator_vol; +}; + struct dramc_param { struct dramc_param_header header; void (*do_putc)(unsigned char c); struct dramc_data dramc_datas; + struct dram_power_control dram_power_ctl; };
struct dramc_param_ops { diff --git a/src/soc/mediatek/mt8192/memory.c b/src/soc/mediatek/mt8192/memory.c index 97bcc22..666aa00 100644 --- a/src/soc/mediatek/mt8192/memory.c +++ b/src/soc/mediatek/mt8192/memory.c @@ -93,6 +93,10 @@
dparam->do_putc = do_putchar;
+ /* init dram power control pointer with regulator mainboard API */ + dparam->dram_power_ctl.get_regulator_vol = mainboard_get_regulator_vol; + dparam->dram_power_ctl.set_regulator_vol = mainboard_set_regulator_vol; + prog_set_entry(&dram, prog_entry(&dram), dparam); prog_run(&dram); if (dparam->header.status != DRAMC_SUCCESS) {