scsi: ufs: rockchip: fix dme-reset failed issue

Resetting the device without resetting the controller during
exception handling will result in a dme command error.

log:
ufshcd-rockchip 2a2d0000.ufs: uic cmd 0x14 with arg3 0x0 completion timeout
ufshcd-rockchip 2a2d0000.ufs: dme-reset: error code -110
ufshcd-rockchip 2a2d0000.ufs: DME_RESET failed
ufshcd-rockchip 2a2d0000.ufs: ufshcd_host_reset_and_restore: Host init failed -110

Change-Id: Ia83e80aea0f6b916bf7131d0b2240023f32a1a21
Signed-off-by: Yifeng Zhao <yifeng.zhao@rock-chips.com>
This commit is contained in:
Yifeng Zhao
2024-10-30 11:00:51 +08:00
committed by Tao Huang
parent 971dce993d
commit 70e0b8e214

View File

@@ -182,14 +182,25 @@ static int ufshcd_dme_link_startup(struct ufs_hba *hba)
return ret;
}
static void ufs_rockchip_controller_reset(struct ufs_rockchip_host *host)
{
reset_control_assert(host->rst);
udelay(1);
reset_control_deassert(host->rst);
}
static int ufs_rockchip_hce_enable_notify(struct ufs_hba *hba,
enum ufs_notify_change_status status)
{
struct ufs_rockchip_host *host = ufshcd_get_variant(hba);
int err = 0;
if (status == PRE_CHANGE) {
int retry_outer = 3;
int retry_inner;
ufs_rockchip_controller_reset(host);
start:
if (ufshcd_is_hba_active(hba))
/* change controller state to "reset state" */
@@ -374,9 +385,7 @@ static int ufs_rockchip_common_init(struct ufs_hba *hba)
return PTR_ERR(host->rst);
}
reset_control_assert(host->rst);
udelay(1);
reset_control_deassert(host->rst);
ufs_rockchip_controller_reset(host);
host->ref_out_clk = devm_clk_get(dev, "ref_out");
if (IS_ERR(host->ref_out_clk)) {