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: d3cbe455d6 ("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>
This commit is contained in:
committed by
Martin K. Petersen
parent
31e6e7e54b
commit
b0ee72db91
@@ -20,9 +20,17 @@
|
|||||||
#include "ufshcd-pltfrm.h"
|
#include "ufshcd-pltfrm.h"
|
||||||
#include "ufs-rockchip.h"
|
#include "ufs-rockchip.h"
|
||||||
|
|
||||||
|
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,
|
static int ufs_rockchip_hce_enable_notify(struct ufs_hba *hba,
|
||||||
enum ufs_notify_change_status status)
|
enum ufs_notify_change_status status)
|
||||||
{
|
{
|
||||||
|
struct ufs_rockchip_host *host = ufshcd_get_variant(hba);
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (status == POST_CHANGE) {
|
if (status == POST_CHANGE) {
|
||||||
@@ -37,6 +45,9 @@ static int ufs_rockchip_hce_enable_notify(struct ufs_hba *hba,
|
|||||||
return ufshcd_vops_phy_initialization(hba);
|
return ufshcd_vops_phy_initialization(hba);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* PRE_CHANGE */
|
||||||
|
ufs_rockchip_controller_reset(host);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,9 +167,7 @@ static int ufs_rockchip_common_init(struct ufs_hba *hba)
|
|||||||
return dev_err_probe(dev, PTR_ERR(host->rst),
|
return dev_err_probe(dev, PTR_ERR(host->rst),
|
||||||
"failed to get reset control\n");
|
"failed to get reset control\n");
|
||||||
|
|
||||||
reset_control_assert(host->rst);
|
ufs_rockchip_controller_reset(host);
|
||||||
udelay(1);
|
|
||||||
reset_control_deassert(host->rst);
|
|
||||||
|
|
||||||
host->ref_out_clk = devm_clk_get_enabled(dev, "ref_out");
|
host->ref_out_clk = devm_clk_get_enabled(dev, "ref_out");
|
||||||
if (IS_ERR(host->ref_out_clk))
|
if (IS_ERR(host->ref_out_clk))
|
||||||
@@ -282,9 +291,7 @@ static int ufs_rockchip_runtime_resume(struct device *dev)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
reset_control_assert(host->rst);
|
ufs_rockchip_controller_reset(host);
|
||||||
udelay(1);
|
|
||||||
reset_control_deassert(host->rst);
|
|
||||||
|
|
||||||
return ufshcd_runtime_resume(dev);
|
return ufshcd_runtime_resume(dev);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user