Skip to content

Commit 3192d28

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: ufs: core: Introduce ufshcd_post_device_init()
Prepare for inlining one ufshcd_device_init() call by introducing the new function ufshcd_post_device_init(). No functionality has been changed. Reviewed-by: Avri Altman <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Bao D. Nguyen <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 17a9739 commit 3192d28

File tree

1 file changed

+35
-27
lines changed

1 file changed

+35
-27
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8686,6 +8686,40 @@ static void ufshcd_config_mcq(struct ufs_hba *hba)
86868686
hba->nutrs);
86878687
}
86888688

8689+
static int ufshcd_post_device_init(struct ufs_hba *hba)
8690+
{
8691+
int ret;
8692+
8693+
ufshcd_tune_unipro_params(hba);
8694+
8695+
/* UFS device is also active now */
8696+
ufshcd_set_ufs_dev_active(hba);
8697+
ufshcd_force_reset_auto_bkops(hba);
8698+
8699+
ufshcd_set_timestamp_attr(hba);
8700+
schedule_delayed_work(&hba->ufs_rtc_update_work,
8701+
msecs_to_jiffies(UFS_RTC_UPDATE_INTERVAL_MS));
8702+
8703+
if (!hba->max_pwr_info.is_valid)
8704+
return 0;
8705+
8706+
/*
8707+
* Set the right value to bRefClkFreq before attempting to
8708+
* switch to HS gears.
8709+
*/
8710+
if (hba->dev_ref_clk_freq != REF_CLK_FREQ_INVAL)
8711+
ufshcd_set_dev_ref_clk(hba);
8712+
/* Gear up to HS gear. */
8713+
ret = ufshcd_config_pwr_mode(hba, &hba->max_pwr_info.info);
8714+
if (ret) {
8715+
dev_err(hba->dev, "%s: Failed setting power mode, err = %d\n",
8716+
__func__, ret);
8717+
return ret;
8718+
}
8719+
8720+
return 0;
8721+
}
8722+
86898723
static int ufshcd_device_init(struct ufs_hba *hba, bool init_dev_params)
86908724
{
86918725
int ret;
@@ -8755,33 +8789,7 @@ static int ufshcd_device_init(struct ufs_hba *hba, bool init_dev_params)
87558789
}
87568790
}
87578791

8758-
ufshcd_tune_unipro_params(hba);
8759-
8760-
/* UFS device is also active now */
8761-
ufshcd_set_ufs_dev_active(hba);
8762-
ufshcd_force_reset_auto_bkops(hba);
8763-
8764-
ufshcd_set_timestamp_attr(hba);
8765-
schedule_delayed_work(&hba->ufs_rtc_update_work,
8766-
msecs_to_jiffies(UFS_RTC_UPDATE_INTERVAL_MS));
8767-
8768-
/* Gear up to HS gear if supported */
8769-
if (hba->max_pwr_info.is_valid) {
8770-
/*
8771-
* Set the right value to bRefClkFreq before attempting to
8772-
* switch to HS gears.
8773-
*/
8774-
if (hba->dev_ref_clk_freq != REF_CLK_FREQ_INVAL)
8775-
ufshcd_set_dev_ref_clk(hba);
8776-
ret = ufshcd_config_pwr_mode(hba, &hba->max_pwr_info.info);
8777-
if (ret) {
8778-
dev_err(hba->dev, "%s: Failed setting power mode, err = %d\n",
8779-
__func__, ret);
8780-
return ret;
8781-
}
8782-
}
8783-
8784-
return 0;
8792+
return ufshcd_post_device_init(hba);
87858793
}
87868794

87878795
/**

0 commit comments

Comments
 (0)