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

Commit 810bf9f3 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "scsi: ufs: splits vops and creates wrapper functions"

parents 65076ad2 6334ec60
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -1681,8 +1681,7 @@ void ufsdbg_add_debugfs(struct ufs_hba *hba)

	ufsdbg_setup_fault_injection(hba);

	if (hba->vops && hba->vops->add_debugfs)
		hba->vops->add_debugfs(hba, hba->debugfs_files.debugfs_root);
	ufshcd_vops_add_debugfs(hba, hba->debugfs_files.debugfs_root);

	return;

@@ -1695,8 +1694,7 @@ err_no_root:

void ufsdbg_remove_debugfs(struct ufs_hba *hba)
{
	if (hba->vops && hba->vops->remove_debugfs)
		hba->vops->remove_debugfs(hba);
	ufshcd_vops_remove_debugfs(hba);
	debugfs_remove_recursive(hba->debugfs_files.debugfs_root);
	kfree(hba->ufs_stats.tag_stats);

+50 −42
Original line number Diff line number Diff line
@@ -205,7 +205,7 @@ out:

static int ufs_qcom_link_startup_post_change(struct ufs_hba *hba)
{
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
	struct phy *phy = host->generic_phy;
	u32 tx_lanes;
	int err = 0;
@@ -282,7 +282,7 @@ static void ufs_qcom_select_unipro_mode(struct ufs_qcom_host *host)

static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)
{
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
	struct phy *phy = host->generic_phy;
	int ret = 0;
	bool is_rate_B = (UFS_QCOM_LIMIT_HS_RATE == PA_HS_MODE_B)
@@ -348,7 +348,7 @@ static void ufs_qcom_enable_hw_clk_gating(struct ufs_hba *hba)
static int ufs_qcom_hce_enable_notify(struct ufs_hba *hba,
				      enum ufs_notify_change_status status)
{
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
	int err = 0;

	switch (status) {
@@ -391,7 +391,7 @@ static int ufs_qcom_cfg_timers(struct ufs_hba *hba, u32 gear,
			       u32 hs, u32 rate, bool update_link_startup_timer)
{
	int ret = 0;
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
	struct ufs_clk_info *clki;
	u32 core_clk_period_in_ns;
	u32 tx_clk_cycles_per_us = 0;
@@ -535,7 +535,7 @@ static int ufs_qcom_link_startup_notify(struct ufs_hba *hba,
					enum ufs_notify_change_status status)
{
	int err = 0;
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
	struct phy *phy = host->generic_phy;

	switch (status) {
@@ -587,7 +587,7 @@ out:

static int ufs_qcom_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
{
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
	struct phy *phy = host->generic_phy;
	int ret = 0;

@@ -625,7 +625,7 @@ out:

static int ufs_qcom_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
{
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
	struct phy *phy = host->generic_phy;
	int err;

@@ -677,7 +677,7 @@ out:
static
int ufs_qcom_crytpo_engine_cfg(struct ufs_hba *hba, unsigned int task_tag)
{
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
	struct ufshcd_lrb *lrbp = &hba->lrb[task_tag];
	int err = 0;

@@ -693,7 +693,7 @@ out:
static
int ufs_qcom_crytpo_engine_reset(struct ufs_hba *hba)
{
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
	int err = 0;

	if (!host->ice.pdev)
@@ -706,7 +706,7 @@ out:

static int ufs_qcom_crypto_engine_eh(struct ufs_hba *hba)
{
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
	int ice_status = 0;
	int err = 0;

@@ -741,14 +741,14 @@ static int ufs_qcom_crypto_engine_eh(struct ufs_hba *hba)

static int ufs_qcom_crypto_engine_get_err(struct ufs_hba *hba)
{
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);

	return host->ice.crypto_engine_err;
}

static void ufs_qcom_crypto_engine_reset_err(struct ufs_hba *hba)
{
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);

	host->ice.crypto_engine_err = 0;
}
@@ -915,7 +915,7 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba,
				struct ufs_pa_layer_attr *dev_req_params)
{
	u32 val;
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
	struct phy *phy = host->generic_phy;
	struct ufs_qcom_dev_params ufs_qcom_cap;
	int ret = 0;
@@ -1013,7 +1013,7 @@ out:

static u32 ufs_qcom_get_ufs_hci_version(struct ufs_hba *hba)
{
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);

	if (host->hw_ver.major == 0x1)
		return UFSHCI_VERSION_11;
@@ -1032,7 +1032,7 @@ static u32 ufs_qcom_get_ufs_hci_version(struct ufs_hba *hba)
 */
static void ufs_qcom_advertise_quirks(struct ufs_hba *hba)
{
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);

	if (host->hw_ver.major == 0x1) {
		hba->quirks |= (UFSHCD_QUIRK_DELAY_BEFORE_DME_CMDS
@@ -1058,7 +1058,7 @@ static void ufs_qcom_advertise_quirks(struct ufs_hba *hba)

static void ufs_qcom_set_caps(struct ufs_hba *hba)
{
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);

	hba->caps |= UFSHCD_CAP_CLK_GATING | UFSHCD_CAP_CLK_SCALING;
	hba->caps |= UFSHCD_CAP_AUTO_BKOPS_SUSPEND;
@@ -1147,7 +1147,7 @@ static void ufs_qcom_get_speed_mode(struct ufs_pa_layer_attr *p, char *result)

static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on)
{
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
	int err;
	int vote = 0;

@@ -1203,7 +1203,7 @@ show_ufs_to_mem_max_bus_bw(struct device *dev, struct device_attribute *attr,
			char *buf)
{
	struct ufs_hba *hba = dev_get_drvdata(dev);
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);

	return snprintf(buf, PAGE_SIZE, "%u\n",
			host->bus_vote.is_max_bw_needed);
@@ -1214,7 +1214,7 @@ store_ufs_to_mem_max_bus_bw(struct device *dev, struct device_attribute *attr,
		const char *buf, size_t count)
{
	struct ufs_hba *hba = dev_get_drvdata(dev);
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
	uint32_t value;

	if (!kstrtou32(buf, 0, &value)) {
@@ -1309,8 +1309,9 @@ static int ufs_qcom_init(struct ufs_hba *hba)
		goto out;
	}

	/* Make a two way bind between the qcom host and the hba */
	host->hba = hba;
	hba->priv = (void *)host;
	ufshcd_bind_variant(hba, host);

	err = ufs_qcom_ice_get_dev(host);
	if (err == -EPROBE_DEFER) {
@@ -1417,14 +1418,14 @@ out_unregister_bus:
	msm_bus_scale_unregister_client(host->bus_vote.client_handle);
out_host_free:
	devm_kfree(dev, host);
	hba->priv = NULL;
	ufshcd_bind_variant(hba, NULL);
out:
	return err;
}

static void ufs_qcom_exit(struct ufs_hba *hba)
{
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);

	msm_bus_scale_unregister_client(host->bus_vote.client_handle);
	ufs_qcom_disable_lane_clks(host);
@@ -1467,7 +1468,7 @@ static int ufs_qcom_clk_scale_up_pre_change(struct ufs_hba *hba)

static int ufs_qcom_clk_scale_up_post_change(struct ufs_hba *hba)
{
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);

	if (!ufs_qcom_cap_qunipro(host))
		return 0;
@@ -1478,7 +1479,7 @@ static int ufs_qcom_clk_scale_up_post_change(struct ufs_hba *hba)

static int ufs_qcom_clk_scale_down_pre_change(struct ufs_hba *hba)
{
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
	int err;
	u32 core_clk_ctrl_reg;

@@ -1503,7 +1504,7 @@ static int ufs_qcom_clk_scale_down_pre_change(struct ufs_hba *hba)

static int ufs_qcom_clk_scale_down_post_change(struct ufs_hba *hba)
{
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);

	if (!ufs_qcom_cap_qunipro(host))
		return 0;
@@ -1515,7 +1516,7 @@ static int ufs_qcom_clk_scale_down_post_change(struct ufs_hba *hba)
static int ufs_qcom_clk_scale_notify(struct ufs_hba *hba,
				      bool scale_up, bool status)
{
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
	struct ufs_pa_layer_attr *dev_req_params = &host->dev_req_params;
	int err = 0;

@@ -1556,7 +1557,7 @@ out:
static int ufs_qcom_update_sec_cfg(struct ufs_hba *hba, bool restore_sec_cfg)
{
	int ret = 0, scm_ret = 0;
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);

	/* scm command buffer structrue */
	struct msm_scm_cmd_buf {
@@ -1626,7 +1627,7 @@ void ufs_qcom_print_hw_debug_reg_all(struct ufs_hba *hba, void *priv,
		return;
	}

	host = hba->priv;
	host = ufshcd_get_variant(hba);
	if (!(host->dbg_print_en & UFS_QCOM_DBG_PRINT_REGS_EN))
		return;

@@ -1792,7 +1793,7 @@ static void ufs_qcom_testbus_read(struct ufs_hba *hba)

static void ufs_qcom_dump_dbg_regs(struct ufs_hba *hba)
{
	struct ufs_qcom_host *host = hba->priv;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);

	ufs_qcom_dump_regs(hba, REG_UFS_SYS1CLK_1US, 16,
			"HCI Vendor Specific Registers ");
@@ -1808,8 +1809,7 @@ static void ufs_qcom_dump_dbg_regs(struct ufs_hba *hba)
 * The variant operations configure the necessary controller and PHY
 * handshake during initialization.
 */
const struct ufs_hba_variant_ops ufs_hba_qcom_vops = {
	.name                   = "qcom",
static struct ufs_hba_variant_ops ufs_hba_qcom_vops = {
	.init			= ufs_qcom_init,
	.exit			= ufs_qcom_exit,
	.get_ufs_hci_version	= ufs_qcom_get_ufs_hci_version,
@@ -1822,17 +1822,25 @@ const struct ufs_hba_variant_ops ufs_hba_qcom_vops = {
	.resume			= ufs_qcom_resume,
	.full_reset		= ufs_qcom_full_reset,
	.update_sec_cfg		= ufs_qcom_update_sec_cfg,
	.dbg_register_dump	= ufs_qcom_dump_dbg_regs,
#ifdef CONFIG_DEBUG_FS
	.add_debugfs		= ufs_qcom_dbg_add_debugfs,
#endif
};

static struct ufs_hba_crypto_variant_ops ufs_hba_crypto_variant_ops = {
	.crypto_engine_cfg	= ufs_qcom_crytpo_engine_cfg,
	.crypto_engine_reset	= ufs_qcom_crytpo_engine_reset,
	.crypto_engine_eh	= ufs_qcom_crypto_engine_eh,
	.crypto_engine_get_err	= ufs_qcom_crypto_engine_get_err,
	.crypto_engine_reset_err = ufs_qcom_crypto_engine_reset_err,
	.dbg_register_dump	= ufs_qcom_dump_dbg_regs,
#ifdef CONFIG_DEBUG_FS
	.add_debugfs		= ufs_qcom_dbg_add_debugfs,
#endif
};
EXPORT_SYMBOL(ufs_hba_qcom_vops);

static struct ufs_hba_variant ufs_hba_qcom_variant = {
	.name		= "qcom",
	.vops		= &ufs_hba_qcom_vops,
	.crypto_vops	= &ufs_hba_crypto_variant_ops,
};

/**
 * ufs_qcom_probe - probe routine of the driver
@@ -1842,7 +1850,7 @@ EXPORT_SYMBOL(ufs_hba_qcom_vops);
 */
static int ufs_qcom_probe(struct platform_device *pdev)
{
	dev_set_drvdata(&pdev->dev, (void *)&ufs_hba_qcom_vops);
	dev_set_drvdata(&pdev->dev, (void *)&ufs_hba_qcom_variant);
	return 0;
}

+1 −1
Original line number Diff line number Diff line
@@ -377,7 +377,7 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev)
				of_find_device_by_node(ufs_variant_node);

			if (ufs_variant_pdev)
				hba->vops = (struct ufs_hba_variant_ops *)
				hba->var = (struct ufs_hba_variant *)
				     dev_get_drvdata(&ufs_variant_pdev->dev);
		}
	}
+68 −105
Original line number Diff line number Diff line
@@ -528,8 +528,7 @@ static void ufshcd_print_host_regs(struct ufs_hba *hba)

	ufshcd_print_clk_freqs(hba);

	if (hba->vops && hba->vops->dbg_register_dump)
		hba->vops->dbg_register_dump(hba);
	ufshcd_vops_dbg_register_dump(hba);
}

static
@@ -709,8 +708,7 @@ static inline u32 ufshcd_get_intr_mask(struct ufs_hba *hba)
static inline u32 ufshcd_get_ufs_version(struct ufs_hba *hba)
{
	if (hba->quirks & UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION) {
		if (hba->vops && hba->vops->get_ufs_hci_version)
			return hba->vops->get_ufs_hci_version(hba);
		return ufshcd_vops_get_ufs_hci_version(hba);
	}

	return ufshcd_readl(hba, REG_UFS_VERSION);
@@ -1099,23 +1097,19 @@ static int ufshcd_scale_clks(struct ufs_hba *hba, bool scale_up)
{
	int ret = 0;

	if (hba->vops && hba->vops->clk_scale_notify) {
		ret = hba->vops->clk_scale_notify(hba, scale_up, PRE_CHANGE);
	ret = ufshcd_vops_clk_scale_notify(hba, scale_up, PRE_CHANGE);
	if (ret)
		return ret;
	}

	ret = ufshcd_set_clk_freq(hba, scale_up);
	if (ret)
		return ret;

	if (hba->vops && hba->vops->clk_scale_notify) {
		ret = hba->vops->clk_scale_notify(hba, scale_up, POST_CHANGE);
	ret = ufshcd_vops_clk_scale_notify(hba, scale_up, POST_CHANGE);
	if (ret) {
		ufshcd_set_clk_freq(hba, !scale_up);
		return ret;
	}
	}

	return ret;
}
@@ -1947,15 +1941,13 @@ int ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag)
{
	int ret = 0;

	if (hba->vops && hba->vops->crypto_engine_cfg) {
		ret = hba->vops->crypto_engine_cfg(hba, task_tag);
	ret = ufshcd_vops_crypto_engine_cfg(hba, task_tag);
	if (ret) {
		dev_err(hba->dev,
			"%s: failed to configure crypto engine %d\n",
			__func__, ret);
		return ret;
	}
	}

	hba->lrb[task_tag].issue_time_stamp = ktime_get();
	hba->lrb[task_tag].complete_time_stamp = ktime_set(0, 0);
@@ -3893,13 +3885,11 @@ static int ufshcd_link_recovery(struct ufs_hba *hba)
	ufshcd_set_eh_in_progress(hba);
	spin_unlock_irqrestore(hba->host->host_lock, flags);

	if (hba->vops && hba->vops->full_reset) {
		ret = hba->vops->full_reset(hba);
	ret = ufshcd_vops_full_reset(hba);
	if (ret)
		dev_warn(hba->dev,
			"full reset returned %d, trying to recover the link\n",
			ret);
	}

	ret = ufshcd_host_reset_and_restore(hba);

@@ -4133,9 +4123,8 @@ int ufshcd_change_power_mode(struct ufs_hba *hba,
		dev_err(hba->dev,
			"%s: power mode change failed %d\n", __func__, ret);
	} else {
		if (hba->vops && hba->vops->pwr_change_notify)
			hba->vops->pwr_change_notify(hba,
				POST_CHANGE, NULL, pwr_mode);
		ufshcd_vops_pwr_change_notify(hba, POST_CHANGE, NULL,
						pwr_mode);

		memcpy(&hba->pwr_info, pwr_mode,
			sizeof(struct ufs_pa_layer_attr));
@@ -4159,9 +4148,9 @@ static int ufshcd_config_pwr_mode(struct ufs_hba *hba,
	int ret;

	/* Get the connected lane count */
	if (hba->vops && hba->vops->pwr_change_notify)
		hba->vops->pwr_change_notify(hba,
		     PRE_CHANGE, desired_pwr_mode, &final_params);
	if (hba->var && hba->var->vops && hba->var->vops->pwr_change_notify)
		ufshcd_vops_pwr_change_notify(hba, PRE_CHANGE,
					desired_pwr_mode, &final_params);
	else
		memcpy(&final_params, desired_pwr_mode, sizeof(final_params));

@@ -4314,8 +4303,7 @@ static int ufshcd_hba_enable(struct ufs_hba *hba)
	/* UniPro link is disabled at this point */
	ufshcd_set_link_off(hba);

	if (hba->vops && hba->vops->hce_enable_notify)
		hba->vops->hce_enable_notify(hba, PRE_CHANGE);
	ufshcd_vops_hce_enable_notify(hba, PRE_CHANGE);

	/* start controller initialization sequence */
	ufshcd_hba_start(hba);
@@ -4348,8 +4336,7 @@ static int ufshcd_hba_enable(struct ufs_hba *hba)
	/* enable UIC related interrupts */
	ufshcd_enable_intr(hba, UFSHCD_UIC_MASK);

	if (hba->vops && hba->vops->hce_enable_notify)
		hba->vops->hce_enable_notify(hba, POST_CHANGE);
	ufshcd_vops_hce_enable_notify(hba, POST_CHANGE);

	return 0;
}
@@ -4407,8 +4394,7 @@ static int ufshcd_link_startup(struct ufs_hba *hba)
	int retries = DME_LINKSTARTUP_RETRIES;

	do {
		if (hba->vops && hba->vops->link_startup_notify)
			hba->vops->link_startup_notify(hba, PRE_CHANGE);
		ufshcd_vops_link_startup_notify(hba, PRE_CHANGE);

		ret = ufshcd_dme_link_startup(hba);
		if (ret)
@@ -4452,11 +4438,9 @@ static int ufshcd_link_startup(struct ufs_hba *hba)
	}

	/* Include any host controller configuration via UIC commands */
	if (hba->vops && hba->vops->link_startup_notify) {
		ret = hba->vops->link_startup_notify(hba, POST_CHANGE);
	ret = ufshcd_vops_link_startup_notify(hba, POST_CHANGE);
	if (ret)
		goto out;
	}

	ret = ufshcd_make_hba_operational(hba);
out:
@@ -5475,8 +5459,7 @@ static void ufshcd_err_handler(struct work_struct *work)
		}
	}

	if (hba->vops && hba->vops->crypto_engine_get_err)
		crypto_engine_err = hba->vops->crypto_engine_get_err(hba);
	crypto_engine_err = ufshcd_vops_crypto_engine_get_err(hba);

	if ((hba->saved_err & INT_FATAL_ERRORS) || crypto_engine_err ||
	    ((hba->saved_err & UIC_ERROR) &&
@@ -5563,8 +5546,7 @@ skip_pending_xfer_clear:
		scsi_report_bus_reset(hba->host, 0);
		hba->saved_err = 0;
		hba->saved_uic_err = 0;
		if (hba->vops && hba->vops->crypto_engine_reset_err)
			hba->vops->crypto_engine_reset_err(hba);
		ufshcd_vops_crypto_engine_reset_err(hba);
	}

skip_err_handling:
@@ -5662,8 +5644,7 @@ static void ufshcd_check_errors(struct ufs_hba *hba)
	bool queue_eh_work = false;
	int crypto_engine_err = 0;

	if (hba->vops && hba->vops->crypto_engine_get_err)
		crypto_engine_err = hba->vops->crypto_engine_get_err(hba);
	crypto_engine_err = ufshcd_vops_crypto_engine_get_err(hba);

	if (hba->errors & INT_FATAL_ERRORS || crypto_engine_err)
		queue_eh_work = true;
@@ -5725,8 +5706,7 @@ static void ufshcd_sl_intr(struct ufs_hba *hba, u32 intr_status)
	ufsdbg_error_inject_dispatcher(hba,
		ERR_INJECT_INTR, intr_status, &intr_status);

	if (hba->vops && hba->vops->crypto_engine_eh)
		crypto_engine_err = hba->vops->crypto_engine_eh(hba);
	ufshcd_vops_crypto_engine_eh(hba);

	hba->errors = UFSHCD_ERROR_MASK & intr_status;
	if (hba->errors || crypto_engine_err)
@@ -6160,8 +6140,8 @@ static int ufshcd_host_reset_and_restore(struct ufs_hba *hba)
		goto out;
	}

	if (!err && hba->vops && hba->vops->crypto_engine_reset) {
		err = hba->vops->crypto_engine_reset(hba);
	if (!err) {
		err = ufshcd_vops_crypto_engine_reset(hba);
		if (err) {
			dev_err(hba->dev,
				"%s: failed to reset crypto engine %d\n",
@@ -7178,8 +7158,8 @@ static int ufshcd_setup_hba_vreg(struct ufs_hba *hba, bool on)
	if (info->vdd_hba) {
		ret = ufshcd_toggle_vreg(hba->dev, info->vdd_hba, on);

		if (!ret && hba->vops && hba->vops->update_sec_cfg)
			hba->vops->update_sec_cfg(hba, on);
		if (!ret)
			ufshcd_vops_update_sec_cfg(hba, on);
	}

	return ret;
@@ -7282,8 +7262,8 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on,
	 * this standard driver hence call the vendor specific setup_clocks
	 * before disabling the clocks managed here.
	 */
	if (hba->vops && hba->vops->setup_clocks && !on) {
		ret = hba->vops->setup_clocks(hba, on);
	if (!on) {
		ret = ufshcd_vops_setup_clocks(hba, on);
		if (ret)
			return ret;
	}
@@ -7315,8 +7295,8 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on,
	 * this standard driver hence call the vendor specific setup_clocks
	 * after enabling the clocks managed here.
	 */
	if (hba->vops && hba->vops->setup_clocks && on)
		ret = hba->vops->setup_clocks(hba, on);
	if (on)
		ret = ufshcd_vops_setup_clocks(hba, on);

out:
	if (ret) {
@@ -7331,8 +7311,7 @@ out:
			hba->clk_gating.state);
		spin_unlock_irqrestore(hba->host->host_lock, flags);
		/* restore the secure configuration as clocks are enabled */
		if (hba->vops && hba->vops->update_sec_cfg)
			hba->vops->update_sec_cfg(hba, true);
		ufshcd_vops_update_sec_cfg(hba, true);
	}

	if (clk_state_changed)
@@ -7390,46 +7369,38 @@ static int ufshcd_variant_hba_init(struct ufs_hba *hba)
{
	int err = 0;

	if (!hba->vops)
	if (!hba->var || !hba->var->vops)
		goto out;

	if (hba->vops->init) {
		err = hba->vops->init(hba);
	err = ufshcd_vops_init(hba);
	if (err)
		goto out;
	}

	if (hba->vops->setup_regulators) {
		err = hba->vops->setup_regulators(hba, true);
	err = ufshcd_vops_setup_regulators(hba, true);
	if (err)
		goto out_exit;
	}

	goto out;

out_exit:
	if (hba->vops->exit)
		hba->vops->exit(hba);
	ufshcd_vops_exit(hba);
out:
	if (err)
		dev_err(hba->dev, "%s: variant %s init failed err %d\n",
			__func__, hba->vops ? hba->vops->name : "", err);
			__func__, ufshcd_get_var_name(hba), err);
	return err;
}

static void ufshcd_variant_hba_exit(struct ufs_hba *hba)
{
	if (!hba->vops)
	if (!hba->var || !hba->var->vops)
		return;

	if (hba->vops->setup_clocks)
		hba->vops->setup_clocks(hba, false);
	ufshcd_vops_setup_clocks(hba, false);

	if (hba->vops->setup_regulators)
		hba->vops->setup_regulators(hba, false);
	ufshcd_vops_setup_regulators(hba, false);

	if (hba->vops->exit)
		hba->vops->exit(hba);
	ufshcd_vops_exit(hba);
}

static int ufshcd_hba_init(struct ufs_hba *hba)
@@ -7839,17 +7810,13 @@ disable_clks:
	 * vendor specific host controller register space call them before the
	 * host clocks are ON.
	 */
	if (hba->vops && hba->vops->suspend) {
		ret = hba->vops->suspend(hba, pm_op);
	ret = ufshcd_vops_suspend(hba, pm_op);
	if (ret)
		goto set_link_active;
	}

	if (hba->vops && hba->vops->setup_clocks) {
		ret = hba->vops->setup_clocks(hba, false);
	ret = ufshcd_vops_setup_clocks(hba, false);
	if (ret)
		goto vops_resume;
	}

	if (!ufshcd_is_link_active(hba))
		ufshcd_setup_clocks(hba, false);
@@ -7869,8 +7836,7 @@ disable_clks:
	goto out;

vops_resume:
	if (hba->vops && hba->vops->resume)
		hba->vops->resume(hba, pm_op);
	ufshcd_vops_resume(hba, pm_op);
set_link_active:
	ufshcd_resume_clkscaling(hba);
	ufshcd_vreg_set_hpm(hba);
@@ -7939,11 +7905,9 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
	 * vendor specific host controller register space call them when the
	 * host clocks are ON.
	 */
	if (hba->vops && hba->vops->resume) {
		ret = hba->vops->resume(hba, pm_op);
	ret = ufshcd_vops_resume(hba, pm_op);
	if (ret)
		goto disable_vreg;
	}

	if (ufshcd_is_link_hibern8(hba)) {
		ret = ufshcd_uic_hibern8_exit(hba);
@@ -7999,8 +7963,7 @@ set_old_link_state:
	if (ufshcd_is_link_hibern8(hba))
		hba->hibern8_on_idle.state = HIBERN8_ENTERED;
vendor_suspend:
	if (hba->vops && hba->vops->suspend)
		hba->vops->suspend(hba, pm_op);
	ufshcd_vops_suspend(hba, pm_op);
disable_vreg:
	ufshcd_vreg_set_lpm(hba);
disable_irq_and_vops_clks:
+250 −29

File changed.

Preview size limit exceeded, changes collapsed.