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

Commit e550e539 authored by Veerabhadrarao Badiganti's avatar Veerabhadrarao Badiganti
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>
parent 01dafb76
Loading
Loading
Loading
Loading
+8 −5
Original line number Original line Diff line number Diff line
@@ -10469,6 +10469,12 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
	if (ret)
	if (ret)
		goto set_link_active;
		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);

	if (!ufshcd_is_link_active(hba))
	if (!ufshcd_is_link_active(hba))
		ret = ufshcd_disable_clocks(hba, false);
		ret = ufshcd_disable_clocks(hba, false);
	else
	else
@@ -10485,16 +10491,13 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
		trace_ufshcd_clk_gating(dev_name(hba->dev),
		trace_ufshcd_clk_gating(dev_name(hba->dev),
					hba->clk_gating.state);
					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);
	/* Put the host controller in low power mode if possible */
	/* Put the host controller in low power mode if possible */
	ufshcd_hba_vreg_set_lpm(hba);
	ufshcd_hba_vreg_set_lpm(hba);
	goto out;
	goto out;


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