soc/mediatek: Add assert for regulator VRF12
Add assert for MT6366_VRF12, define a constant macro for 1200000.
BUG=none
TEST=build board starmie with mt8186.
Change-Id: I6d6a969ae993afcda0596a19928e8f98f343d589
Signed-off-by: Cong Yang <yangcong5@huaqin.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/74394
Reviewed-by: Yidi Lin <yidilin@google.com>
Reviewed-by: Ruihai Zhou <zhouruihai@huaqin.corp-partner.google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
diff --git a/src/soc/mediatek/mt8186/mt6366.c b/src/soc/mediatek/mt8186/mt6366.c
index 7874c08..9dbf483 100644
--- a/src/soc/mediatek/mt8186/mt6366.c
+++ b/src/soc/mediatek/mt8186/mt6366.c
@@ -725,14 +725,17 @@
pwrap_write_field(PMIC_LDO_VMC_CON0, 1, 0xFF, 0);
}
+#define VRF12_VOLTAGE_UV 1200000
+
static u32 pmic_get_vrf12_vol(void)
{
return (pwrap_read_field(PMIC_LDO_VRF12_CON0, 0x3, 0) &
- pwrap_read_field(PMIC_LDO_VRF12_OP_EN, 0x3, 0)) ? 1200000 : 0;
+ pwrap_read_field(PMIC_LDO_VRF12_OP_EN, 0x3, 0)) ? VRF12_VOLTAGE_UV : 0;
}
-static void pmic_enable_vrf12(void)
+static void pmic_set_vrf12_vol(u32 vrf12_uv)
{
+ assert(vrf12_uv == VRF12_VOLTAGE_UV);
pwrap_write_field(PMIC_LDO_VRF12_CON0, 1, 0x3, 0);
pwrap_write_field(PMIC_LDO_VRF12_OP_EN, 1, 0x3, 0);
}
@@ -921,8 +924,7 @@
pmic_set_vsram_proc12_vol(voltage_uv);
break;
case MT6366_VRF12:
- /* VRF12 only provides 1.2V, so we just need to enable it */
- pmic_enable_vrf12();
+ pmic_set_vrf12_vol(voltage_uv);
break;
case MT6366_VCN33:
pmic_set_vcn33_vol(voltage_uv);