From: hgchu Date: Fri, 12 Jan 2018 02:34:29 +0000 (+0900) Subject: scsi: ufs: recover link state after entering hibernation fails X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=66a356658f35461dc2f679d6a0807c0c31cbffb3;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git scsi: ufs: recover link state after entering hibernation fails Change-Id: I9dccb778410033510e6e38ee399c93ce721a4a36 Signed-off-by: hgchu --- diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 04c0e869f920..1e06f3d25c76 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1430,7 +1430,9 @@ static void ufshcd_ungate_work(struct work_struct *work) if (gating_allowed) { ufshcd_setup_clocks(hba, true); } else { + spin_lock_irqsave(hba->host->host_lock, flags); hba->clk_gating.state = CLKS_ON; + spin_unlock_irqrestore(hba->host->host_lock, flags); } /* Exit from hibern8 */ @@ -1574,7 +1576,13 @@ static void ufshcd_gate_work(struct work_struct *work) if (ufshcd_can_hibern8_during_gating(hba)) { ufshcd_set_link_trans_hibern8(hba); if (ufshcd_link_hibern8_ctrl(hba, true)) { + spin_lock_irqsave(hba->host->host_lock, flags); + hba->clk_gating.state = __CLKS_ON; + spin_unlock_irqrestore(hba->host->host_lock, flags); + hba->clk_gating.is_suspended = true; + ufshcd_reset_and_restore(hba); hba->clk_gating.state = CLKS_ON; + hba->clk_gating.is_suspended = false; trace_ufshcd_clk_gating(dev_name(hba->dev), hba->clk_gating.state); goto out; @@ -7305,6 +7313,7 @@ static int ufshcd_link_state_transition(struct ufs_hba *hba, if (!ret) ufshcd_set_link_hibern8(hba); else { + ufshcd_host_reset_and_restore(hba); goto out; } /*