Skip to content

Commit 16b30c7

Browse files
ptr324martinkpetersen
authored andcommitted
scsi: ufs: host: mediatek: Change ref-clk timeout policy
Update the timeout policy for ref-clk control. - If a clock-on operation times out, it is assumed that the clock is off. The system will notify TFA to perform clock-off settings. - If a clock-off operation times out, it is assumed that the clock will eventually turn off. The 'ref_clk_enabled' flag is set directly. Signed-off-by: Peter Wang <peter.wang@mediatek.com> Link: https://lore.kernel.org/r/20250722030841.1998783-4-peter.wang@mediatek.com Reviewed-by: Chun-Hung Wu <chun-hung.wu@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent a84a9ba commit 16b30c7

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

drivers/ufs/host/ufs-mediatek.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,16 @@ static int ufs_mtk_setup_ref_clk(struct ufs_hba *hba, bool on)
351351

352352
dev_err(hba->dev, "missing ack of refclk req, reg: 0x%x\n", value);
353353

354-
ufs_mtk_ref_clk_notify(host->ref_clk_enabled, POST_CHANGE, res);
354+
/*
355+
* If clock on timeout, assume clock is off, notify tfa do clock
356+
* off setting.(keep DIFN disable, release resource)
357+
* If clock off timeout, assume clock will off finally,
358+
* set ref_clk_enabled directly.(keep DIFN disable, keep resource)
359+
*/
360+
if (on)
361+
ufs_mtk_ref_clk_notify(false, POST_CHANGE, res);
362+
else
363+
host->ref_clk_enabled = false;
355364

356365
return -ETIMEDOUT;
357366

0 commit comments

Comments
 (0)