[PATCH v1 03/10] ufs: host: mediatek: Add debug information for Auto-Hibern8

peter.wang at mediatek.com peter.wang at mediatek.com
Mon Aug 11 06:11:19 PDT 2025


From: Peter Wang <peter.wang at mediatek.com>

This patch enhances the clock gating logic by adding debug
information for the Auto-Hibern8 (AHIT) register.
This additional logging aids in troubleshooting by providing
insights into the AHIT configuration when the clock is not
turned off as expected.

Signed-off-by: Peter Wang <peter.wang at mediatek.com>
---
 drivers/ufs/host/ufs-mediatek.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
index 3e661494fbb6..3d50cd3a01b3 100644
--- a/drivers/ufs/host/ufs-mediatek.c
+++ b/drivers/ufs/host/ufs-mediatek.c
@@ -798,8 +798,14 @@ static int ufs_mtk_setup_clocks(struct ufs_hba *hba, bool on,
 				clk_pwr_off = true;
 		}
 
-		if (clk_pwr_off)
+		if (clk_pwr_off) {
 			ufs_mtk_pwr_ctrl(hba, false);
+		} else {
+			dev_warn(hba->dev, "Clock is not turned off, hba->ahit = 0x%x, AHIT = 0x%x\n",
+				hba->ahit,
+				ufshcd_readl(hba,
+					REG_AUTO_HIBERNATE_IDLE_TIMER));
+		}
 		ufs_mtk_mcq_disable_irq(hba);
 	} else if (on && status == POST_CHANGE) {
 		ufs_mtk_pwr_ctrl(hba, true);
-- 
2.45.2




More information about the Linux-mediatek mailing list