From 2b9310ad9cfa2c6a0cd0572b070133dd4a571cac Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Sun, 22 Mar 2020 16:27:12 -0700 Subject: [PATCH] scsi: ufs: set autohibern8 timer regardless of hibern8_on_idle This fixes disabling autohibern8 by the previous commit. Bug: 151321015 Bug: 152116476 Fixes: 5a57ae46dd6 ("scsi: ufs: disable hibern8_on_idle") Signed-off-by: Jaegeuk Kim Signed-off-by: Alexander Winkowski Change-Id: If71f3212081f62d9c92b8f611aadb4f547ced1e0 --- drivers/scsi/ufs/ufshcd.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 8a4642a04b6d..203a10ac74b1 100755 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -3062,6 +3062,9 @@ static void ufshcd_exit_clk_gating(struct ufs_hba *hba) static void ufshcd_set_auto_hibern8_timer(struct ufs_hba *hba, u32 delay) { + if (!ufshcd_is_auto_hibern8_supported(hba)) + return; + ufshcd_rmwl(hba, AUTO_HIBERN8_TIMER_SCALE_MASK | AUTO_HIBERN8_IDLE_TIMER_MASK, AUTO_HIBERN8_TIMER_SCALE_1_MS | delay, @@ -3415,7 +3418,8 @@ static void ufshcd_init_hibern8_on_idle(struct ufs_hba *hba) /* initialize the state variable here */ hba->hibern8_on_idle.state = HIBERN8_EXITED; - if (!ufshcd_is_hibern8_on_idle_allowed(hba)) + if (!ufshcd_is_hibern8_on_idle_allowed(hba) && + !ufshcd_is_auto_hibern8_supported(hba)) return; if (ufshcd_is_auto_hibern8_supported(hba)) { @@ -3426,6 +3430,7 @@ static void ufshcd_init_hibern8_on_idle(struct ufs_hba *hba) * auto hibern8 is supported */ hba->caps &= ~UFSHCD_CAP_HIBERN8_ENTER_ON_IDLE; + return; } else { hba->hibern8_on_idle.delay_ms = 10; INIT_DELAYED_WORK(&hba->hibern8_on_idle.enter_work, @@ -10198,10 +10203,7 @@ retry: * Enable auto hibern8 if supported, after full host and * device initialization. */ - if (ufshcd_is_auto_hibern8_supported(hba) && - hba->hibern8_on_idle.is_enabled) - ufshcd_set_auto_hibern8_timer(hba, - hba->hibern8_on_idle.delay_ms); + ufshcd_set_auto_hibern8_timer(hba, hba->hibern8_on_idle.delay_ms); out: if (ret && link_retry_count++ < UFS_LINK_SETUP_RETRIES) { dev_err(hba->dev, "%s: error with %d, and will be reset.(%d)\n",