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

Commit 94986e22 authored by Skylar Chang's avatar Skylar Chang
Browse files

msm: ipa3: wait for uC load before USB disconnect



In case RG10 workaround is in use, USB disconnect sequence
needs to be delayed until uC image is loaded in order to
allow to suspend and unsuspend pipes successfully.

Change-Id: I0ba41c9564c12b0b2c419222b54fa0e05be93b75
CRs-Fixed: 1083675
Acked-by: default avatarAdy Abraham <adya@qti.qualcomm.com>
Signed-off-by: default avatarSkylar Chang <chiaweic@codeaurora.org>
parent 64120cd2
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -3899,6 +3899,12 @@ static int ipa3_gsi_pre_fw_load_init(void)
	return 0;
}

static void ipa3_uc_is_loaded(void)
{
	IPADBG("\n");
	complete_all(&ipa3_ctx->uc_loaded_completion_obj);
}

/**
 * ipa3_post_init() - Initialize the IPA Driver (Part II).
 * This part contains all initialization which requires interaction with
@@ -3925,6 +3931,7 @@ static int ipa3_post_init(const struct ipa3_plat_drv_res *resource_p,
	int result;
	struct sps_bam_props bam_props = { 0 };
	struct gsi_per_props gsi_props;
	struct ipa3_uc_hdlrs uc_hdlrs = { 0 };

	if (ipa3_ctx->transport_prototype == IPA_TRANSPORT_TYPE_GSI) {
		memset(&gsi_props, 0, sizeof(gsi_props));
@@ -4000,6 +4007,9 @@ static int ipa3_post_init(const struct ipa3_plat_drv_res *resource_p,
	else
		IPADBG(":ipa Uc interface init ok\n");

	uc_hdlrs.ipa_uc_loaded_hdlr = ipa3_uc_is_loaded;
	ipa3_uc_register_handlers(IPA_HW_FEATURE_COMMON, &uc_hdlrs);

	result = ipa3_wdi_init();
	if (result)
		IPAERR(":wdi init failed (%d)\n", -result);
@@ -4716,6 +4726,7 @@ static int ipa3_pre_init(const struct ipa3_plat_drv_res *resource_p,
	INIT_LIST_HEAD(&ipa3_ctx->ipa_ready_cb_list);

	init_completion(&ipa3_ctx->init_completion_obj);
	init_completion(&ipa3_ctx->uc_loaded_completion_obj);

	/*
	 * For GSI, we can't register the GSI driver yet, as it expects
+12 −0
Original line number Diff line number Diff line
@@ -99,6 +99,18 @@ int ipa3_disable_data_path(u32 clnt_hdl)

	/* Suspend the pipe */
	if (IPA_CLIENT_IS_CONS(ep->client)) {
		/*
		 * for RG10 workaround uC needs to be loaded before pipe can
		 * be suspended in this case.
		 */
		if (ipa3_ctx->apply_rg10_wa && ipa3_uc_state_check()) {
			IPADBG("uC is not loaded yet, waiting...\n");
			res = wait_for_completion_timeout(
				&ipa3_ctx->uc_loaded_completion_obj, 60 * HZ);
			if (res == 0)
				IPADBG("timeout waiting for uC to load\n");
		}

		memset(&ep_cfg_ctrl, 0 , sizeof(struct ipa_ep_cfg_ctrl));
		ep_cfg_ctrl.ipa_ep_suspend = true;
		ipa3_cfg_ep_ctrl(clnt_hdl, &ep_cfg_ctrl);
+1 −0
Original line number Diff line number Diff line
@@ -1288,6 +1288,7 @@ struct ipa3_context {
	bool ipa_initialization_complete;
	struct list_head ipa_ready_cb_list;
	struct completion init_completion_obj;
	struct completion uc_loaded_completion_obj;
	struct ipa3_smp2p_info smp2p_info;
	u32 ipa_tz_unlock_reg_num;
	struct ipa_tz_unlock_reg_info *ipa_tz_unlock_reg;