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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Chun-Hung Wu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent a84a9ba commit 16b30c7

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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)