Hung-Te Lin has submitted this change. ( https://review.coreboot.org/c/coreboot/+/61390 )
Change subject: soc/mediatek/mt8186: Add register protect control for MT6366 ......................................................................
soc/mediatek/mt8186: Add register protect control for MT6366
Some registers of PMIC init settings are protected, so we failed to set the correct value for init_setting. We disable protection before setting PMIC init setting and enable it afterward.
BUG=b:216263707 TEST=PMIC setting value is set correctly.
Signed-off-by: Rex-BC Chen rex-bc.chen@mediatek.com Change-Id: I94d73d9c8a137444988e65c3709d29a3a4c03c5b Reviewed-on: https://review.coreboot.org/c/coreboot/+/61390 Reviewed-by: Yu-Ping Wu yupingso@google.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/soc/mediatek/mt8186/mt6366.c 1 file changed, 12 insertions(+), 5 deletions(-)
Approvals: build bot (Jenkins): Verified Yu-Ping Wu: Looks good to me, approved Rex-BC Chen: Looks good to me, but someone else must approve
diff --git a/src/soc/mediatek/mt8186/mt6366.c b/src/soc/mediatek/mt8186/mt6366.c index 9ca7c05..90ff328 100644 --- a/src/soc/mediatek/mt8186/mt6366.c +++ b/src/soc/mediatek/mt8186/mt6366.c @@ -420,6 +420,12 @@ 80000, 70000, 60000, 50000, 40000, 30000, 20000, 10000, };
+static void mt6366_protect_control(bool en_protect) +{ + /* Write a magic number 0x9CA7 to disable protection */ + pwrap_write_field(PMIC_TOP_TMA_KEY, en_protect ? 0 : 0x9CA7, 0xFFFF, 0); +} + static u32 pmic_read_efuse(int i) { u32 efuse_data = 0; @@ -591,9 +597,9 @@ assert(cali_trim < ARRAY_SIZE(vddq_votrim)); }
- pwrap_write_field(PMIC_TOP_TMA_KEY, 0x9CA7, 0xFFFF, 0); + mt6366_protect_control(false); pwrap_write_field(PMIC_VDDQ_ELR_0, cali_trim, 0xF, 0); - pwrap_write_field(PMIC_TOP_TMA_KEY, 0, 0xFFFF, 0); + mt6366_protect_control(true); udelay(1); }
@@ -779,10 +785,12 @@
static void mt6366_init_setting(void) { + mt6366_protect_control(false); for (size_t i = 0; i < ARRAY_SIZE(init_setting); i++) pwrap_write_field( init_setting[i].addr, init_setting[i].val, init_setting[i].mask, init_setting[i].shift); + mt6366_protect_control(true); }
static void wk_sleep_voltage_by_ddr(void) @@ -793,11 +801,10 @@
static void wk_power_down_seq(void) { - /* Write TMA KEY with magic number */ - pwrap_write_field(PMIC_TOP_TMA_KEY, 0x9CA7, 0xFFFF, 0); + mt6366_protect_control(false); /* Set VPROC12 sequence to VA12 */ pwrap_write_field(PMIC_CPSDSA4, 0xA, 0x1F, 0); - pwrap_write_field(PMIC_TOP_TMA_KEY, 0x0, 0xFFFF, 0); + mt6366_protect_control(true); }
static void mt6366_lp_setting(void)
2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one.