From 905684a945bef15af93fa2c8c1e75fc481d9e082 Mon Sep 17 00:00:00 2001 From: Jarried Lin Date: Mon, 20 Jan 2025 19:21:04 +0800 Subject: [PATCH] soc/mediatek/mt8196: Fix issue with incomplete modem disable If the modem is not completely disabled, it will cause issues with suspend to RAM. Update the condition check in MD1_PWR_STA and increased the MAX_RETRY_COUNT from 200 to 4000 to make sure that the modem has sufficient time to completely disable before proceeding. TEST=Measure the power and ensure that the DRAM enters self-refresh mode. BUG=b:377628718 Change-Id: I6e915d26e5b3caee36f4726bc2fc1c53cfc17bfc Signed-off-by: Jarried Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/86069 Tested-by: build bot (Jenkins) Reviewed-by: Yidi Lin Reviewed-by: Yu-Ping Wu --- src/soc/mediatek/mt8196/modem_power_ctrl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/soc/mediatek/mt8196/modem_power_ctrl.c b/src/soc/mediatek/mt8196/modem_power_ctrl.c index 0fc46534ae..f849efdd41 100644 --- a/src/soc/mediatek/mt8196/modem_power_ctrl.c +++ b/src/soc/mediatek/mt8196/modem_power_ctrl.c @@ -10,7 +10,7 @@ #include #define SPMI_SLAVE_4_750MV 0x78 -#define MAX_RETRY_COUNT 200 +#define MAX_RETRY_COUNT 4000 #define VSRAM_VOSEL 0x24d #define VMODEM_VOSEL 0x24e #define MD1_PWR_STA_MASK BIT(0) @@ -74,7 +74,7 @@ static void spm_mtcmos_ctrl_md1_disable(void) clrbits32(&mtk_spm->md1_pwr_con, PWR_ON); if (!retry(MAX_RETRY_COUNT, - read32(&mtk_spm->pwr_status) & MD1_PWR_STA_MASK)) { + (read32(&mtk_spm->pwr_status) & MD1_PWR_STA_MASK) == 0)) { printk(BIOS_ERR, "Check MD1_PWR_STA failed\n"); }