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

Commit a8bc450a authored by Nitin Rawat's avatar Nitin Rawat Committed by Gerrit - the friendly Code Review server
Browse files

scsi: ufs: fix ufs power down specs violation in shutdown path



As per specs, while powering off the ufs device, RST_N signal
and REF_CLK signal should be deasserted between VSS(Ground)
and VCCQ.

As per current implementation during power down, we follow
below sequence of events:

1. Turn-off VCCQ
2. Turn-off VCC
3. Turn-off REF_CLK

It is observed that during powering down of ufs device,
REF_CLK is taking longer than usual to ramp down which
keeps REF_CLK signal to be above VCCQ and hence causing
specs violation during power down.

Similarly since RST_N is not asserted as part of power down,
RST_N signal is not falling between VSS and VCCQ and hence
causing specs violation for RST_N as well.

To guarantee that, we should follow below sequence of
events during power down in shutdown path:

1. Turn-off REF_CLK
2. Assert RST_N low
3. Turn-off VCCQ
4. Turn-off VCC.

Change-Id: I69dcec71a136cc3d1673c523dc73575cbbbcac4e
Signed-off-by: default avatarNitin Rawat <nitirawa@codeaurora.org>
parent e33f4a08
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -10370,7 +10370,7 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)

	/* UFS device & link must be active before we enter in this function */
	if (!ufshcd_is_ufs_dev_active(hba) || !ufshcd_is_link_active(hba))
		goto set_vreg_lpm;
		goto disable_clks;

	if (ufshcd_is_runtime_pm(pm_op)) {
		if (ufshcd_can_autobkops_during_suspend(hba)) {
@@ -10412,9 +10412,6 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
	    ufshcd_is_hibern8_on_idle_allowed(hba))
		hba->hibern8_on_idle.state = HIBERN8_ENTERED;

set_vreg_lpm:
	if (!hba->auto_bkops_enabled)
		ufshcd_vreg_set_lpm(hba);
disable_clks:
	/*
	 * Call vendor specific suspend callback. As these callbacks may access
@@ -10431,6 +10428,13 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
	 */
	ufshcd_disable_irq(hba);

	/* reset the connected UFS device during shutdown */
	if (ufshcd_is_shutdown_pm(pm_op)) {
		ret = ufshcd_assert_device_reset(hba);
		if (ret)
			goto set_link_active;
	}

	if (!ufshcd_is_link_active(hba))
		ret = ufshcd_disable_clocks(hba, false);
	else
@@ -10450,6 +10454,10 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)

	/* Put the host controller in low power mode if possible */
	ufshcd_hba_vreg_set_lpm(hba);
	if (!hba->auto_bkops_enabled ||
		!(req_dev_pwr_mode == UFS_ACTIVE_PWR_MODE &&
		req_link_state == UIC_LINK_ACTIVE_STATE))
		ufshcd_vreg_set_lpm(hba);
	goto out;

set_link_active: