diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index 01ab9c65a20c..3101eca79823 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -1720,6 +1720,13 @@ static int ufs_qcom_init(struct ufs_hba *hba) host->hba = hba; ufshcd_set_variant(hba, host); + /* + * voting/devoting device ref_clk source is time consuming hence + * skip devoting it during aggressive clock gating. This clock + * will still be gated off during runtime suspend. + */ + hba->no_ref_clk_gating = true; + err = ufs_qcom_ice_get_dev(host); if (err == -EPROBE_DEFER) { /* diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 7b4955db1225..d1ffa9406baa 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1270,7 +1270,7 @@ static void ufshcd_gate_work(struct work_struct *work) ufshcd_suspend_clkscaling(hba); - if (!ufshcd_is_link_active(hba)) + if (!ufshcd_is_link_active(hba) && !hba->no_ref_clk_gating) ufshcd_setup_clocks(hba, false); else /* If link is active, device ref_clk can't be switched off */ diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index eb2c1f3bdcb5..8e2c2f509039 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -841,6 +841,9 @@ struct ufs_hba { bool is_urgent_bkops_lvl_checked; struct rw_semaphore clk_scaling_lock; + + /* If set, don't gate device ref_clk during clock gating */ + bool no_ref_clk_gating; }; /* Returns true if clocks can be gated. Otherwise false */