scsi: ufs: fix ufs power mode and link power state
authorhgchu <hg.chu@samsung.com>
Fri, 12 Jan 2018 03:51:40 +0000 (12:51 +0900)
committerJaeHun Jung <jh0801.jung@samsung.com>
Tue, 8 May 2018 08:20:22 +0000 (17:20 +0900)
Change-Id: Id9e4677e5e8c71aa060a922b75eba8a84f42d00d
Signed-off-by: hgchu <hg.chu@samsung.com>
drivers/scsi/ufs/ufshcd.c

index 71556a9b3481c599d568d855c8c1a4eef432aa0b..2b6ac1148e5a7002718472407a759ae7c84e5854 100644 (file)
@@ -5352,11 +5352,6 @@ skip_pending_xfer_clear:
                                        __func__);
                        hba->ufshcd_state = UFSHCD_STATE_ERROR;
                }
-               /*
-                * Inform scsi mid-layer that we did reset and allow to handle
-                * Unit Attention properly.
-                */
-               scsi_report_bus_reset(hba->host, 0);
                hba->saved_err = 0;
                hba->saved_uic_err = 0;
        }
@@ -7629,9 +7624,17 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
 {
        int ret;
        enum uic_link_state old_link_state;
+       enum ufs_pm_level pm_lvl;
        bool gating_allowed = !ufshcd_can_fake_clkgating(hba);
 
        hba->pm_op_in_progress = 1;
+       if (ufshcd_is_system_pm(pm_op))
+               pm_lvl = hba->spm_lvl;
+       else
+               pm_lvl = hba->rpm_lvl;
+
+       if (ufs_get_pm_lvl_to_link_pwr_state(pm_lvl) == UIC_LINK_OFF_STATE)
+               hba->uic_link_state = UIC_LINK_OFF_STATE;
        old_link_state = hba->uic_link_state;
 
        ufshcd_hba_vreg_set_hpm(hba);