Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: d3cbe455d6eb ("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>

authored by

Shawn Lin and committed by
Martin K. Petersen
b0ee72db 31e6e7e5

+13 -6
+13 -6
drivers/ufs/host/ufs-rockchip.c
··· 20 20 #include "ufshcd-pltfrm.h" 21 21 #include "ufs-rockchip.h" 22 22 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 + 23 30 static int ufs_rockchip_hce_enable_notify(struct ufs_hba *hba, 24 31 enum ufs_notify_change_status status) 25 32 { 33 + struct ufs_rockchip_host *host = ufshcd_get_variant(hba); 26 34 int err = 0; 27 35 28 36 if (status == POST_CHANGE) { ··· 44 36 45 37 return ufshcd_vops_phy_initialization(hba); 46 38 } 39 + 40 + /* PRE_CHANGE */ 41 + ufs_rockchip_controller_reset(host); 47 42 48 43 return 0; 49 44 } ··· 167 156 return dev_err_probe(dev, PTR_ERR(host->rst), 168 157 "failed to get reset control\n"); 169 158 170 - reset_control_assert(host->rst); 171 - udelay(1); 172 - reset_control_deassert(host->rst); 159 + ufs_rockchip_controller_reset(host); 173 160 174 161 host->ref_out_clk = devm_clk_get_enabled(dev, "ref_out"); 175 162 if (IS_ERR(host->ref_out_clk)) ··· 291 282 return err; 292 283 } 293 284 294 - reset_control_assert(host->rst); 295 - udelay(1); 296 - reset_control_deassert(host->rst); 285 + ufs_rockchip_controller_reset(host); 297 286 298 287 return ufshcd_runtime_resume(dev); 299 288 }