@@ -8686,6 +8686,40 @@ static void ufshcd_config_mcq(struct ufs_hba *hba)
8686
8686
hba -> nutrs );
8687
8687
}
8688
8688
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
+
8689
8723
static int ufshcd_device_init (struct ufs_hba * hba , bool init_dev_params )
8690
8724
{
8691
8725
int ret ;
@@ -8755,33 +8789,7 @@ static int ufshcd_device_init(struct ufs_hba *hba, bool init_dev_params)
8755
8789
}
8756
8790
}
8757
8791
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 );
8785
8793
}
8786
8794
8787
8795
/**
0 commit comments