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

Commit 1b789dd7 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "scsi: ufs: Fix ufs power down/on specs violation in suspend/resume path"

parents 1208fd92 85411b7c
Loading
Loading
Loading
Loading
+21 −9
Original line number Diff line number Diff line
@@ -10436,8 +10436,8 @@ 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)) {
	/* reset the connected UFS device during power down */
	if (ufshcd_is_link_off(hba)) {
		ret = ufshcd_assert_device_reset(hba);
		if (ret)
			goto set_link_active;
@@ -10477,6 +10477,7 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
		ufshcd_set_link_active(hba);
	} else if (ufshcd_is_link_off(hba)) {
		ufshcd_update_error_stats(hba, UFS_ERR_VOPS_SUSPEND);
		ufshcd_deassert_device_reset(hba);
		ufshcd_host_reset_and_restore(hba);
	}
set_dev_active:
@@ -10519,17 +10520,25 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
	old_pwr_mode = hba->curr_dev_pwr_mode;

	ufshcd_hba_vreg_set_hpm(hba);

	ret = ufshcd_vreg_set_hpm(hba);
	if (ret)
		goto out;

	/* Make sure clocks are enabled before accessing controller */
	ret = ufshcd_enable_clocks(hba);
	if (ret)
		goto out;
		goto disable_vreg;

	/* enable the host irq as host controller would be active soon */
	ufshcd_enable_irq(hba);

	ret = ufshcd_vreg_set_hpm(hba);
	/* Pull up RST_n before device reset */
	if (ufshcd_is_link_off(hba)) {
		ret = ufshcd_deassert_device_reset(hba);
		if (ret)
			goto disable_irq_and_vops_clks;
	}

	/*
	 * Call vendor specific resume callback. As these callbacks may access
@@ -10538,7 +10547,7 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
	 */
	ret = ufshcd_vops_resume(hba, pm_op);
	if (ret)
		goto disable_vreg;
		goto assert_device_reset;

	if (ufshcd_is_link_hibern8(hba)) {
		ret = ufshcd_uic_hibern8_exit(hba);
@@ -10629,8 +10638,9 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
		hba->hibern8_on_idle.state = HIBERN8_ENTERED;
vendor_suspend:
	ufshcd_vops_suspend(hba, pm_op);
disable_vreg:
	ufshcd_vreg_set_lpm(hba);
assert_device_reset:
	if (ufshcd_is_link_off(hba))
		ufshcd_assert_device_reset(hba);
disable_irq_and_vops_clks:
	ufshcd_disable_irq(hba);
	if (hba->clk_scaling.is_allowed)
@@ -10638,6 +10648,8 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
	ufshcd_disable_clocks(hba, false);
	if (ufshcd_is_clkgating_allowed(hba))
		hba->clk_gating.state = CLKS_OFF;
disable_vreg:
	ufshcd_vreg_set_lpm(hba);
out:
	hba->pm_op_in_progress = 0;