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>
This commit is contained in:
Peter Wang 2023-12-21 19:04:14 +08:00 committed by Martin K. Petersen
parent 0652205b4c
commit 29b3a373e2

View File

@ -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 {