From: hgchu Date: Fri, 12 Jan 2018 10:26:38 +0000 (+0900) Subject: [COMMON] scsi: ufs: Fix problems in clock enable fail and hibern8 fail cases X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4b7fcf7e4b1fcfe6f9a1f4a5d8457a80780b277d;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] scsi: ufs: Fix problems in clock enable fail and hibern8 fail cases Change-Id: I33d16b03022baa441cfe101f81364295f3d9f476 Signed-off-by: hgchu --- diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 4900522746a6..ccf07d8b4cf3 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4506,7 +4506,7 @@ link_startup: * but we can't be sure if the link is up until link startup * succeeds. So reset the local Uni-Pro and try again. */ - if (ret && ufshcd_hba_enable(hba)) + if ((ret && !retries) || (ret && ufshcd_hba_enable(hba))) goto out; } while (ret && retries--); @@ -7530,6 +7530,7 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on, if (on && !clki->enabled) { ret = clk_prepare_enable(clki->clk); if (ret) { + hba->clk_gating.state = CLKS_DISABLE; dev_err(hba->dev, "%s: %s prepare enable failed, %d\n", __func__, clki->name, ret); goto out; diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index c46de5e4a0ff..9b80eb1605cb 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -353,6 +353,7 @@ enum clk_gating_state { REQ_CLKS_OFF, REQ_CLKS_ON, __CLKS_ON, + CLKS_DISABLE = 0x99, }; /**