mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-05-06 13:16:12 +02:00
drivers: ufs: handle return values of ufs_hba_ops callbacks
The return values of ufshcd_ops_link_startup_notify(), ufshcd_ops_hce_enable_notify(), ufshcd_ops_init(), and ufshcd_device_reset() are currently ignored. Check and propagate these return values properly and emit appropriate error messages on error. While at it, remove the ufshcd_device_reset() wrapper, which just call ufshcd_device_reset(). Signed-off-by: Julien Stephan <jstephan@baylibre.com> Reviewed-by: Macpaul Lin <macpaul.lin@mediatek.com> Link: https://patch.msgid.link/20260305-ufs-ufs_hba_ops-cleanup-v3-1-e153ffab98f5@baylibre.com Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
This commit is contained in:
parent
c0ca147ac6
commit
0bb1d511e4
@ -127,11 +127,6 @@ static void ufshcd_print_pwr_info(struct ufs_hba *hba)
|
||||
hba->pwr_info.hs_rate);
|
||||
}
|
||||
|
||||
static void ufshcd_device_reset(struct ufs_hba *hba)
|
||||
{
|
||||
ufshcd_vops_device_reset(hba);
|
||||
}
|
||||
|
||||
/**
|
||||
* ufshcd_ready_for_uic_cmd - Check if controller is ready
|
||||
* to accept UIC commands
|
||||
@ -512,7 +507,9 @@ static int ufshcd_link_startup(struct ufs_hba *hba)
|
||||
int retries = DME_LINKSTARTUP_RETRIES;
|
||||
|
||||
do {
|
||||
ufshcd_ops_link_startup_notify(hba, PRE_CHANGE);
|
||||
ret = ufshcd_ops_link_startup_notify(hba, PRE_CHANGE);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
ret = ufshcd_dme_link_startup(hba);
|
||||
|
||||
@ -598,12 +595,18 @@ static inline void ufshcd_hba_start(struct ufs_hba *hba)
|
||||
static int ufshcd_hba_enable(struct ufs_hba *hba)
|
||||
{
|
||||
int retry;
|
||||
int ret;
|
||||
|
||||
if (!ufshcd_is_hba_active(hba))
|
||||
/* change controller state to "reset state" */
|
||||
ufshcd_hba_stop(hba);
|
||||
|
||||
ufshcd_ops_hce_enable_notify(hba, PRE_CHANGE);
|
||||
ret = ufshcd_ops_hce_enable_notify(hba, PRE_CHANGE);
|
||||
if (ret) {
|
||||
dev_err(hba->dev, "Controller enable notify PRE_CHANGE failed: %i\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* start controller initialization sequence */
|
||||
ufshcd_hba_start(hba);
|
||||
@ -635,7 +638,12 @@ static int ufshcd_hba_enable(struct ufs_hba *hba)
|
||||
/* enable UIC related interrupts */
|
||||
ufshcd_enable_intr(hba, UFSHCD_UIC_MASK);
|
||||
|
||||
ufshcd_ops_hce_enable_notify(hba, POST_CHANGE);
|
||||
ret = ufshcd_ops_hce_enable_notify(hba, POST_CHANGE);
|
||||
if (ret) {
|
||||
dev_err(hba->dev, "Controller enable notify POST_CHANGE failed: %i\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2182,7 +2190,11 @@ int ufshcd_probe(struct udevice *ufs_dev, struct ufs_hba_ops *hba_ops)
|
||||
/* Set descriptor lengths to specification defaults */
|
||||
ufshcd_def_desc_sizes(hba);
|
||||
|
||||
ufshcd_ops_init(hba);
|
||||
err = ufshcd_ops_init(hba);
|
||||
if (err) {
|
||||
dev_err(hba->dev, "Host controller init failed: %i\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Read capabilities registers */
|
||||
hba->capabilities = ufshcd_readl(hba, REG_CONTROLLER_CAPABILITIES);
|
||||
@ -2226,7 +2238,11 @@ int ufshcd_probe(struct udevice *ufs_dev, struct ufs_hba_ops *hba_ops)
|
||||
mb(); /* flush previous writes */
|
||||
|
||||
/* Reset the attached device */
|
||||
ufshcd_device_reset(hba);
|
||||
err = ufshcd_vops_device_reset(hba);
|
||||
if (err) {
|
||||
dev_err(hba->dev, "Failed to reset attached device: %i\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = ufshcd_hba_enable(hba);
|
||||
if (err) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user