Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 648ade52 authored by Veerabhadrarao Badiganti's avatar Veerabhadrarao Badiganti Committed by Pranav Vashi
Browse files

scsi: ufs: Disable irq before turning off clocks in suspend path



In ufs suspend path we are turning off the clocks first and then
disabling the irq. But in few scenarios link remains in active state
(say rpm_lvl=2) and there is a chance that link can trigger error
interrupts. If interrupt gets triggered after disabling clocks and
before disabling irq, ISR gets invoked and tries to read registers
which can lead to un-clocked access.

To avoid this scenario, disable irq before disabling clocks.

Change-Id: Ia9df61ac11d1e27f4d373df42d79b6fa7a11c28f
Signed-off-by: default avatarVeerabhadrarao Badiganti <vbadigan@codeaurora.org>
[dereference23: Apply to msm-4.14]
Signed-off-by: default avatarAlexander Winkowski <dereference23@outlook.com>
Signed-off-by: default avatarPranav Vashi <neobuddy89@gmail.com>
parent 51f5cf9b
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -10326,6 +10326,12 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
	if (ret)
		goto set_link_active;

	/*
	 * Disable the host irq as host controller as there won't be any
	 * host controller transaction expected till resume.
	 */
	ufshcd_disable_irq(hba);

	/* reset the connected UFS device during power down */
	if (ufshcd_is_link_off(hba)) {
		ret = ufshcd_assert_device_reset(hba);
@@ -10349,11 +10355,6 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
		trace_ufshcd_clk_gating(dev_name(hba->dev),
					hba->clk_gating.state);
	}
	/*
	 * Disable the host irq as host controller as there won't be any
	 * host controller transaction expected till resume.
	 */
	ufshcd_disable_irq(hba);

	if (!hba->auto_bkops_enabled ||
		!(req_dev_pwr_mode == UFS_ACTIVE_PWR_MODE &&
@@ -10365,6 +10366,7 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
	goto out;

set_link_active:
	ufshcd_enable_irq(hba);
	if (hba->clk_scaling.is_allowed)
		ufshcd_resume_clkscaling(hba);
	ufshcd_vreg_set_hpm(hba);