[PATCH] ufs: rockchip: propagate controller reset errors
From: Pengpeng Hou
Date: Sun Aug 30 2026 - 09:27:45 EST
The Rockchip UFS reset helper discards reset-controller errors before
probe, HCE enable, and runtime resume continue as if the controller were
reset.
Return reset errors from the helper and unwind the resume clock on failure.
Fixes: d3cbe455d6eb ("scsi: ufs: rockchip: Initial support for UFS")
Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
---
drivers/ufs/host/ufs-rockchip.c | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/drivers/ufs/host/ufs-rockchip.c b/drivers/ufs/host/ufs-rockchip.c
index bac68f238e1c4..3b9661befe6ae 100644
--- a/drivers/ufs/host/ufs-rockchip.c
+++ b/drivers/ufs/host/ufs-rockchip.c
@@ -20,11 +20,16 @@
#include "ufshcd-pltfrm.h"
#include "ufs-rockchip.h"
-static void ufs_rockchip_controller_reset(struct ufs_rockchip_host *host)
+static int ufs_rockchip_controller_reset(struct ufs_rockchip_host *host)
{
- reset_control_assert(host->rst);
+ int ret;
+
+ ret = reset_control_assert(host->rst);
+ if (ret)
+ return ret;
udelay(1);
- reset_control_deassert(host->rst);
+
+ return reset_control_deassert(host->rst);
}
static int ufs_rockchip_hce_enable_notify(struct ufs_hba *hba,
@@ -46,9 +51,7 @@ static int ufs_rockchip_hce_enable_notify(struct ufs_hba *hba,
}
/* PRE_CHANGE */
- ufs_rockchip_controller_reset(host);
-
- return 0;
+ return ufs_rockchip_controller_reset(host);
}
static void ufs_rockchip_set_pm_lvl(struct ufs_hba *hba)
@@ -167,7 +170,9 @@ static int ufs_rockchip_common_init(struct ufs_hba *hba)
return dev_err_probe(dev, PTR_ERR(host->rst),
"failed to get reset control\n");
- ufs_rockchip_controller_reset(host);
+ err = ufs_rockchip_controller_reset(host);
+ if (err)
+ return dev_err_probe(dev, err, "failed to reset controller\n");
host->ref_out_clk = devm_clk_get_enabled(dev, "ref_out");
if (IS_ERR(host->ref_out_clk))
@@ -291,7 +296,11 @@ static int ufs_rockchip_runtime_resume(struct device *dev)
return err;
}
- ufs_rockchip_controller_reset(host);
+ err = ufs_rockchip_controller_reset(host);
+ if (err) {
+ clk_disable_unprepare(host->ref_out_clk);
+ return err;
+ }
return ufshcd_runtime_resume(dev);
}
base-commit: 08dbfad3f5040f5bdb6c529da20d6d4e81fefd72
--
2.50.1