From 83dbc34b20734b4e1a9c48b336d621af53610627 Mon Sep 17 00:00:00 2001 From: Shawn Lin Date: Mon, 15 Apr 2024 09:27:29 +0800 Subject: [PATCH] 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 --- drivers/ufs/host/ufs-rockchip.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/ufs/host/ufs-rockchip.c b/drivers/ufs/host/ufs-rockchip.c index bef0ab45013b..b37bc14a23d0 100644 --- a/drivers/ufs/host/ufs-rockchip.c +++ b/drivers/ufs/host/ufs-rockchip.c @@ -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);