diff options
author | Peter Wang <peter.wang@mediatek.com> | 2023-12-21 19:04:14 +0800 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2024-01-23 21:06:05 -0500 |
commit | 29b3a373e2df30b1f8bb9ef8a0d480cce3d0e295 (patch) | |
tree | a0aa7a4d46b169a1f3ef8259a943f543e3c159af /drivers/ufs | |
parent | 0652205b4ce2c954a08f9cbba432aadda79c6484 (diff) |
scsi: ufs: ufs-mediatek: Check link status after exiting hibern8
To prevent SSU(Active) error, check link status after exiting hibern8. If
link is not VS_LINK_UP, return error and do ufshcd_link_recovery.
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Link: https://lore.kernel.org/r/20231221110416.16176-2-peter.wang@mediatek.com
Reviewed-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/ufs')
-rw-r--r-- | drivers/ufs/host/ufs-mediatek.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c index f43eb945e011..dcccb63f74b9 100644 --- a/drivers/ufs/host/ufs-mediatek.c +++ b/drivers/ufs/host/ufs-mediatek.c @@ -1189,11 +1189,18 @@ static int ufs_mtk_link_set_hpm(struct ufs_hba *hba) return err; err = ufshcd_uic_hibern8_exit(hba); - if (!err) - ufshcd_set_link_active(hba); - else + if (err) return err; + /* Check link state to make sure exit h8 success */ + ufs_mtk_wait_idle_state(hba, 5); + err = ufs_mtk_wait_link_state(hba, VS_LINK_UP, 100); + if (err) { + dev_warn(hba->dev, "exit h8 state fail, err=%d\n", err); + return err; + } + ufshcd_set_link_active(hba); + if (!hba->mcq_enabled) { err = ufshcd_make_hba_operational(hba); } else { |