Yidi Lin has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46406 )
Change subject: mb/google/asurada: Implement regulator control for vdd2, vddq and vmddr ......................................................................
mb/google/asurada: Implement regulator control for vdd2, vddq and vmddr
These three requlators are controlled via EC.
BUG=b:147789962 BRANCH=none TEST=verified with DRAM driver
Signed-off-by: Yidi Lin yidi.lin@mediatek.com Change-Id: Id06a8196ca4badc51b06759afb07b5664278d13b --- M src/mainboard/google/asurada/Makefile.inc A src/mainboard/google/asurada/regulator.c 2 files changed, 70 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/06/46406/1
diff --git a/src/mainboard/google/asurada/Makefile.inc b/src/mainboard/google/asurada/Makefile.inc index 02fb830..d3f8ce6 100644 --- a/src/mainboard/google/asurada/Makefile.inc +++ b/src/mainboard/google/asurada/Makefile.inc @@ -13,6 +13,7 @@ romstage-y += chromeos.c romstage-y += romstage.c romstage-y += sdram_configs.c +romstage-y += regulator.c
ramstage-y += memlayout.ld ramstage-y += boardid.c diff --git a/src/mainboard/google/asurada/regulator.c b/src/mainboard/google/asurada/regulator.c new file mode 100644 index 0000000..514c423 --- /dev/null +++ b/src/mainboard/google/asurada/regulator.c @@ -0,0 +1,69 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <ec/google/chromeec/ec.h> +#include <soc/regulator.h> + +enum mt6360_regulator_id { + MT6360_LDO3, + MT6360_LDO5, + MT6360_LDO6, + MT6360_LDO7, + MT6360_BUCK1, + MT6360_BUCK2, + + MT6360_REGULATOR_COUNT, +}; + +void mainboard_set_vdd2_vol(uint32_t voltage_uv) +{ + uint32_t voltage_mv = voltage_uv / 1000; + + google_chromeec_regulator_set_voltage(MT6360_BUCK1, + voltage_mv, + voltage_mv); +} + +void mainboard_set_vddq_vol(uint32_t voltage_uv) +{ + uint32_t voltage_mv = voltage_uv / 1000; + + google_chromeec_regulator_set_voltage(MT6360_LDO7, + voltage_mv, + voltage_mv); +} + +void mainboard_set_vmddr_vol(uint32_t voltage_uv) +{ + uint32_t voltage_mv = voltage_uv / 1000; + + google_chromeec_regulator_set_voltage(MT6360_LDO6, + voltage_mv, + voltage_mv); +} + +uint32_t mainboard_get_vdd2_vol(void) +{ + uint32_t voltage_mv = 0; + + google_chromeec_regulator_get_voltage(MT6360_BUCK1, &voltage_mv); + + return voltage_mv * 1000; +} + +uint32_t mainboard_get_vddq_vol(void) +{ + uint32_t voltage_mv = 0; + + google_chromeec_regulator_get_voltage(MT6360_LDO7, &voltage_mv); + + return voltage_mv * 1000; +} + +uint32_t mainboard_get_vmddr_vol(void) +{ + uint32_t voltage_mv = 0; + + google_chromeec_regulator_get_voltage(MT6360_LDO6, &voltage_mv); + + return voltage_mv * 1000; +}