]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
scsi: ufs: Move ufshcd_get_max_pwr_mode() to ufshcd_device_params_init()
authorBean Huo <beanhuo@micron.com>
Mon, 20 Jan 2020 13:08:16 +0000 (14:08 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 21 Jan 2020 00:16:10 +0000 (19:16 -0500)
ufshcd_get_max_pwr_mode() only need to be called once while booting, take
it out from ufshcd_probe_hba() and inline into ufshcd_device_params_init().

Link: https://lore.kernel.org/r/20200120130820.1737-5-huobean@gmail.com
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd.c

index f839f4ba2ce7d6b19889e90e533eaf53fd87c879..d27762c1170a3eb1cb2e1ac8670293171eb620da 100644 (file)
@@ -6962,6 +6962,11 @@ static int ufshcd_device_params_init(struct ufs_hba *hba)
                        QUERY_FLAG_IDN_PWR_ON_WPE, &flag))
                hba->dev_info.f_power_on_wp_en = flag;
 
+       /* Probe maximum power mode co-supported by both UFS host and device */
+       if (ufshcd_get_max_pwr_mode(hba))
+               dev_err(hba->dev,
+                       "%s: Failed getting max supported power mode\n",
+                       __func__);
 out:
        return ret;
 }
@@ -7060,11 +7065,8 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool async)
        ufshcd_force_reset_auto_bkops(hba);
        hba->wlun_dev_clr_ua = true;
 
-       if (ufshcd_get_max_pwr_mode(hba)) {
-               dev_err(hba->dev,
-                       "%s: Failed getting max supported power mode\n",
-                       __func__);
-       } else {
+       /* Gear up to HS gear if supported */
+       if (hba->max_pwr_info.is_valid) {
                /*
                 * Set the right value to bRefClkFreq before attempting to
                 * switch to HS gears.