scsi: ufs: rockchip: Fix stability issues and add WB support

Disable UFS related clock in runtime is proved to be incorrect and
mismatch state between host and device should be recovered by reset the
controller to make sure each part is in the beginning status.

Meanwhile, we have verified WB works fine by test, so add WB support
as well.

Change-Id: I5af675576ef2b43ebe5061af204ba1fff5f3f233
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
This commit is contained in:
Shawn Lin
2024-04-15 09:27:29 +08:00
committed by Tao Huang
parent 197e998c07
commit 83dbc34b20

View File

@@ -433,14 +433,14 @@ static int ufs_rockchip_rk3576_init(struct ufs_hba *hba)
/* Enable runtime autosuspend */
hba->caps |= UFSHCD_CAP_RPM_AUTOSUSPEND;
/* Enable clock-gating */
hba->caps |= UFSHCD_CAP_CLK_GATING;
/* Enable BKOPS when suspend */
hba->caps |= UFSHCD_CAP_AUTO_BKOPS_SUSPEND;
/* Enable putting device into deep sleep */
hba->caps |= UFSHCD_CAP_DEEPSLEEP;
/* Enable devfreq of UFS */
hba->caps |= UFSHCD_CAP_CLK_SCALING;
/* Enable WriteBooster */
hba->caps |= UFSHCD_CAP_WB_EN;
ret = ufs_rockchip_common_init(hba);
if (ret) {
@@ -585,6 +585,10 @@ static int ufs_rockchip_runtime_resume(struct device *dev)
return err;
}
reset_control_assert(host->rst);
udelay(1);
reset_control_deassert(host->rst);
ufs_rockchip_restore_link(hba, false);
return ufshcd_runtime_resume(dev);