Skip to content

Commit b0ee72d

Browse files
shawn1221martinkpetersen
authored andcommitted
scsi: ufs: rockchip: Reset controller on PRE_CHANGE of hce enable notify
This fixes the dme-reset failed when doing recovery. Because device reset is not enough, we could occasionally see the error below: 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 Fix this by resetting the controller on PRE_CHANGE stage of hce enable notify. Fixes: d3cbe45 ("scsi: ufs: rockchip: Initial support for UFS") Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Link: https://patch.msgid.link/1763009575-237552-1-git-send-email-shawn.lin@rock-chips.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 31e6e7e commit b0ee72d

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

drivers/ufs/host/ufs-rockchip.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,17 @@
2020
#include "ufshcd-pltfrm.h"
2121
#include "ufs-rockchip.h"
2222

23+
static void ufs_rockchip_controller_reset(struct ufs_rockchip_host *host)
24+
{
25+
reset_control_assert(host->rst);
26+
udelay(1);
27+
reset_control_deassert(host->rst);
28+
}
29+
2330
static int ufs_rockchip_hce_enable_notify(struct ufs_hba *hba,
2431
enum ufs_notify_change_status status)
2532
{
33+
struct ufs_rockchip_host *host = ufshcd_get_variant(hba);
2634
int err = 0;
2735

2836
if (status == POST_CHANGE) {
@@ -37,6 +45,9 @@ static int ufs_rockchip_hce_enable_notify(struct ufs_hba *hba,
3745
return ufshcd_vops_phy_initialization(hba);
3846
}
3947

48+
/* PRE_CHANGE */
49+
ufs_rockchip_controller_reset(host);
50+
4051
return 0;
4152
}
4253

@@ -156,9 +167,7 @@ static int ufs_rockchip_common_init(struct ufs_hba *hba)
156167
return dev_err_probe(dev, PTR_ERR(host->rst),
157168
"failed to get reset control\n");
158169

159-
reset_control_assert(host->rst);
160-
udelay(1);
161-
reset_control_deassert(host->rst);
170+
ufs_rockchip_controller_reset(host);
162171

163172
host->ref_out_clk = devm_clk_get_enabled(dev, "ref_out");
164173
if (IS_ERR(host->ref_out_clk))
@@ -282,9 +291,7 @@ static int ufs_rockchip_runtime_resume(struct device *dev)
282291
return err;
283292
}
284293

285-
reset_control_assert(host->rst);
286-
udelay(1);
287-
reset_control_deassert(host->rst);
294+
ufs_rockchip_controller_reset(host);
288295

289296
return ufshcd_runtime_resume(dev);
290297
}

0 commit comments

Comments
 (0)