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

Commit f546de6b 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"

parents 06a7c1db 8586ea70
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1166,6 +1166,12 @@ static int ufs_qcom_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
			err = ufs_qcom_unvote_qos_all(hba);
	}

#if defined(CONFIG_SCSI_UFSHCD_QTI)
	/* reset the connected UFS device during power down */
	if (!err && ufs_qcom_is_link_off(hba) && host->device_reset)
		gpiod_set_value_cansleep(host->device_reset, 1);
#endif

	return err;
}

+28 −3
Original line number Diff line number Diff line
@@ -8791,10 +8791,9 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
	ret = ufshcd_link_state_transition(hba, req_link_state, 1);
	if (ret)
		goto set_dev_active;
#if defined(CONFIG_SCSI_UFSHCD_QTI)
	if (!hba->auto_bkops_enabled)
#endif
#if !defined(CONFIG_SCSI_UFSHCD_QTI)
		ufshcd_vreg_set_lpm(hba);
#endif

disable_clks:
	/*
@@ -8825,6 +8824,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 defined(CONFIG_SCSI_UFSHCD_QTI)
	if (!hba->auto_bkops_enabled)
		ufshcd_vreg_set_lpm(hba);
#endif
	goto out;

set_link_active:
@@ -8879,17 +8882,29 @@ 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);
#if defined(CONFIG_SCSI_UFSHCD_QTI)
	ret = ufshcd_vreg_set_hpm(hba);
	if (ret)
		goto out;
#endif

	/* Make sure clocks are enabled before accessing controller */
	ret = ufshcd_setup_clocks(hba, true);
	if (ret)
#if defined(CONFIG_SCSI_UFSHCD_QTI)
		goto disable_vreg;
#else
		goto out;
#endif

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

#if !defined(CONFIG_SCSI_UFSHCD_QTI)
	ret = ufshcd_vreg_set_hpm(hba);
	if (ret)
		goto disable_irq_and_vops_clks;
#endif

	/*
	 * Call vendor specific resume callback. As these callbacks may access
@@ -8898,7 +8913,11 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
	 */
	ret = ufshcd_vops_resume(hba, pm_op);
	if (ret)
#if defined(CONFIG_SCSI_UFSHCD_QTI)
		goto disable_irq_and_vops_clks;
#else
		goto disable_vreg;
#endif

	if (ufshcd_is_link_hibern8(hba)) {
		ret = ufshcd_uic_hibern8_exit(hba);
@@ -8967,8 +8986,10 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
	ufshcd_link_state_transition(hba, old_link_state, 0);
vendor_suspend:
	ufshcd_vops_suspend(hba, pm_op);
#if !defined(CONFIG_SCSI_UFSHCD_QTI)
disable_vreg:
	ufshcd_vreg_set_lpm(hba);
#endif
disable_irq_and_vops_clks:
	ufshcd_disable_irq(hba);
	if (hba->clk_scaling.is_allowed)
@@ -8979,6 +9000,10 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
		trace_ufshcd_clk_gating(dev_name(hba->dev),
					hba->clk_gating.state);
	}
#if defined(CONFIG_SCSI_UFSHCD_QTI)
disable_vreg:
	ufshcd_vreg_set_lpm(hba);
#endif
out:
	hba->pm_op_in_progress = 0;
	if (ret)