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

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

Merge "msm: ipa3: Fix to start/stop gsi channel USB pipe connected"

parents fe8f35d3 ebd4f435
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -308,6 +308,17 @@ static char *ipa3_usb_notify_event_to_string(enum ipa_usb_notify_event event)
	return "UNSUPPORTED";
}

static bool ipa3_usb_get_teth_port_state(void)
{
	if (ipa3_usb_ctx == NULL)
		return false;
	if (ipa3_usb_ctx->ttype_ctx[IPA_USB_TRANSPORT_TETH].state ==
					IPA_USB_CONNECTED)
		return true;
	else
		return false;
}

static bool ipa3_usb_set_state(enum ipa3_usb_state new_state, bool err_permit,
	enum ipa3_usb_transport_type ttype)
{
@@ -2350,8 +2361,8 @@ int ipa_usb_xdci_connect(struct ipa_usb_xdci_chan_params *ul_chan_params,
	 * For IPA_USB_DIAG/DPL config there will not be any UL ep.
	 */
	if (connect_params->teth_prot != IPA_USB_DIAG)
		ipa3_register_lock_unlock_callback(&ipa_usb_set_lock_unlock,
			ul_out_params->clnt_hdl);
		ipa3_register_client_callback(&ipa_usb_set_lock_unlock,
			&ipa3_usb_get_teth_port_state, ul_out_params->clnt_hdl);

	IPA_USB_DBG_LOW("exit\n");
	mutex_unlock(&ipa3_usb_ctx->general_mutex);
@@ -2437,7 +2448,7 @@ static int ipa_usb_xdci_dismiss_channels(u32 ul_clnt_hdl, u32 dl_clnt_hdl,
	 * For IPA_USB_DIAG/DPL config there will not be any UL config.
	 */
	if (!IPA3_USB_IS_TTYPE_DPL(ttype))
		ipa3_deregister_lock_unlock_callback(ul_clnt_hdl);
		ipa3_deregister_client_callback(ul_clnt_hdl);

	/* Change state to STOPPED */
	if (!ipa3_usb_set_state(IPA_USB_STOPPED, false, ttype))
+49 −6
Original line number Diff line number Diff line
@@ -2550,6 +2550,7 @@ void ipa3_q6_pre_shutdown_cleanup(void)

	IPA_ACTIVE_CLIENTS_INC_SIMPLE();

	if (!ipa3_ctx->ipa_endp_delay_wa)
		ipa3_q6_pipe_delay(true);
	ipa3_q6_avoid_holb();
	if (ipa3_ctx->ipa_config_is_mhi)
@@ -2574,12 +2575,20 @@ void ipa3_q6_pre_shutdown_cleanup(void)
	/* Remove delay from Q6 PRODs to avoid pending descriptors
	 * on pipe reset procedure
	 */
	if (!ipa3_ctx->ipa_endp_delay_wa) {
		ipa3_q6_pipe_delay(false);
		ipa3_set_reset_client_prod_pipe_delay(true,
			IPA_CLIENT_USB_PROD);
		if (ipa3_ctx->ipa_config_is_mhi)
			ipa3_set_reset_client_prod_pipe_delay(true,
				IPA_CLIENT_MHI_PROD);
	} else {
		ipa3_start_stop_client_prod_gsi_chnl(IPA_CLIENT_USB_PROD,
						false);
		if (ipa3_ctx->ipa_config_is_mhi)
			ipa3_start_stop_client_prod_gsi_chnl(
					IPA_CLIENT_MHI_PROD, false);
	}

	IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
	IPADBG_LOW("Exit with success\n");
@@ -2642,6 +2651,32 @@ void ipa3_q6_post_shutdown_cleanup(void)
	IPADBG_LOW("Exit with success\n");
}

/*
 * ipa3_client_prod_post_shutdown_cleanup () - As part of this function
 * set end point delay client producer pipes and starting corresponding
 * gsi channels
 */

void ipa3_client_prod_post_shutdown_cleanup(void)
{
	IPADBG_LOW("ENTER\n");

	IPA_ACTIVE_CLIENTS_INC_SIMPLE();

	ipa3_set_reset_client_prod_pipe_delay(true,
				IPA_CLIENT_USB_PROD);
	ipa3_start_stop_client_prod_gsi_chnl(IPA_CLIENT_USB_PROD, true);

	if (ipa3_ctx->ipa_config_is_mhi) {
		ipa3_set_reset_client_prod_pipe_delay(true,
						IPA_CLIENT_MHI_PROD);
		ipa3_start_stop_client_prod_gsi_chnl(IPA_CLIENT_MHI_PROD, true);
	}

	IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
	IPADBG_LOW("Exit with success\n");
}

static inline void ipa3_sram_set_canary(u32 *sram_mmio, int offset)
{
	/* Set 4 bytes of CANARY before the offset */
@@ -5320,6 +5355,7 @@ static int ipa3_pre_init(const struct ipa3_plat_drv_res *resource_p,
		IPADBG("secure debug disabled\n");
		ipa3_ctx->do_testbus_collection_on_crash = false;
	}
	ipa3_ctx->ipa_endp_delay_wa = resource_p->ipa_endp_delay_wa;

	WARN(ipa3_ctx->ipa3_hw_mode != IPA_HW_MODE_NORMAL,
		"Non NORMAL IPA HW mode, is this emulation platform ?");
@@ -5914,6 +5950,7 @@ static int get_ipa_dts_configuration(struct platform_device *pdev,
	ipa_drv_res->mhi_evid_limits[0] = IPA_MHI_GSI_EVENT_RING_ID_START;
	ipa_drv_res->mhi_evid_limits[1] = IPA_MHI_GSI_EVENT_RING_ID_END;
	ipa_drv_res->ipa_fltrt_not_hashable = false;
	ipa_drv_res->ipa_endp_delay_wa = false;

	/* Get IPA HW Version */
	result = of_property_read_u32(pdev->dev.of_node, "qcom,ipa-hw-ver",
@@ -5999,6 +6036,12 @@ static int get_ipa_dts_configuration(struct platform_device *pdev,
	IPADBG(": WDI-2.0 over gsi= %s\n",
			ipa_drv_res->ipa_wdi2_over_gsi
			? "True" : "False");
	ipa_drv_res->ipa_endp_delay_wa =
			of_property_read_bool(pdev->dev.of_node,
			"qcom,ipa-endp-delay-wa");
	IPADBG(": endppoint delay wa = %s\n",
			ipa_drv_res->ipa_endp_delay_wa
			? "True" : "False");

	ipa_drv_res->ipa_wdi3_over_gsi =
			of_property_read_bool(pdev->dev.of_node,
+54 −4
Original line number Diff line number Diff line
@@ -387,8 +387,8 @@ static enum ipa_client_cb_type ipa_get_client_cb_type(

	return client_cb;
}
void ipa3_register_lock_unlock_callback(int (*client_cb)(bool is_lock),
						u32 ipa_ep_idx)
void ipa3_register_client_callback(int (*client_cb)(bool is_lock),
				bool (*teth_port_state)(void), u32 ipa_ep_idx)
{
	enum ipa_client_cb_type client;
	enum ipa_client_type client_type;
@@ -407,10 +407,12 @@ void ipa3_register_lock_unlock_callback(int (*client_cb)(bool is_lock),

	if (!ipa3_ctx->client_lock_unlock[client])
		ipa3_ctx->client_lock_unlock[client] = client_cb;
	if (!ipa3_ctx->get_teth_port_state[client])
		ipa3_ctx->get_teth_port_state[client] = teth_port_state;
	IPADBG("exit\n");
}

void ipa3_deregister_lock_unlock_callback(u32 ipa_ep_idx)
void ipa3_deregister_client_callback(u32 ipa_ep_idx)
{
	enum ipa_client_cb_type client_cb;
	enum ipa_client_type client_type;
@@ -422,12 +424,14 @@ void ipa3_deregister_lock_unlock_callback(u32 ipa_ep_idx)
	if (client_cb == IPA_MAX_CLNT)
		return;

	if (ipa3_ctx->client_lock_unlock[client_cb] == NULL) {
	if (ipa3_ctx->client_lock_unlock[client_cb] == NULL &&
		ipa3_ctx->get_teth_port_state[client_cb] == NULL) {
		IPAERR("client_lock_unlock is already NULL");
		return;
	}

	ipa3_ctx->client_lock_unlock[client_cb] = NULL;
	ipa3_ctx->get_teth_port_state[client_cb] = NULL;
	IPADBG("exit\n");
}

@@ -1136,6 +1140,52 @@ int ipa3_set_reset_client_prod_pipe_delay(bool set_reset,
	return result;
}

static bool ipa3_get_teth_port_status(enum ipa_client_type client)
{
	enum ipa_client_cb_type client_cb;

	client_cb = ipa_get_client_cb_type(client);
	if (client_cb == IPA_MAX_CLNT)
		return false;
	if (ipa3_ctx->get_teth_port_state[client_cb])
		return ipa3_ctx->get_teth_port_state[client_cb]();
	return false;
}

/*
 * Start/stop the CLIENT PROD pipes in SSR scenarios
 */

int ipa3_start_stop_client_prod_gsi_chnl(enum ipa_client_type client,
		bool start_chnl)
{
	int result = 0;
	int pipe_idx;
	struct ipa3_ep_context *ep;

	if (IPA_CLIENT_IS_CONS(client)) {
		IPAERR("client (%d) not PROD\n", client);
		return -EINVAL;
	}

	pipe_idx = ipa3_get_ep_mapping(client);

	if (pipe_idx == IPA_EP_NOT_ALLOCATED) {
		IPAERR("client (%d) not valid\n", client);
		return -EINVAL;
	}

	client_lock_unlock_cb(client, true);
	ep = &ipa3_ctx->ep[pipe_idx];
	if (ep->valid && ep->skip_ep_cfg && ipa3_get_teth_port_status(client)) {
		if (start_chnl)
			result = ipa3_start_gsi_channel(pipe_idx);
		else
			result = ipa3_stop_gsi_channel(pipe_idx);
	}
	client_lock_unlock_cb(client, false);
	return result;
}
int ipa3_set_reset_client_cons_pipe_sus_holb(bool set_reset,
		enum ipa_client_type client)
{
+11 −2
Original line number Diff line number Diff line
@@ -1626,6 +1626,7 @@ struct ipa3_context {
	bool ipa_wdi2;
	bool ipa_wdi2_over_gsi;
	bool ipa_wdi3_over_gsi;
	bool ipa_endp_delay_wa;
	bool ipa_fltrt_not_hashable;
	bool use_64_bit_dma_mask;
	/* featurize if memory footprint becomes a concern */
@@ -1702,6 +1703,7 @@ struct ipa3_context {
	atomic_t ipa_clk_vote;
	int (*client_lock_unlock[IPA_MAX_CLNT])(bool is_lock);
	bool fw_loaded;
	bool (*get_teth_port_state[IPA_MAX_CLNT])(void);
};

struct ipa3_plat_drv_res {
@@ -1746,6 +1748,7 @@ struct ipa3_plat_drv_res {
	bool do_testbus_collection_on_crash;
	bool do_non_tn_collection_on_crash;
	u32 secure_debug_check_action;
	bool ipa_endp_delay_wa;
};

/**
@@ -2023,10 +2026,16 @@ int ipa3_xdci_connect(u32 clnt_hdl);
int ipa3_xdci_disconnect(u32 clnt_hdl, bool should_force_clear, u32 qmi_req_id);

void ipa3_xdci_ep_delay_rm(u32 clnt_hdl);
void ipa3_register_lock_unlock_callback(int (*client_cb)(bool), u32 ipa_ep_idx);
void ipa3_deregister_lock_unlock_callback(u32 ipa_ep_idx);
void ipa3_register_client_callback(int (*client_cb)(bool),
		bool (*teth_port_state)(void), u32 ipa_ep_idx);
void ipa3_deregister_client_callback(u32 ipa_ep_idx);
int ipa3_set_reset_client_prod_pipe_delay(bool set_reset,
		enum ipa_client_type client);
int ipa3_start_stop_client_prod_gsi_chnl(enum ipa_client_type client,
		bool start_chnl);
void ipa3_client_prod_post_shutdown_cleanup(void);


int ipa3_set_reset_client_cons_pipe_sus_holb(bool set_reset,
		enum ipa_client_type client);

+4 −0
Original line number Diff line number Diff line
@@ -2905,6 +2905,10 @@ static int ipa3_lcl_mdm_ssr_notifier_cb(struct notifier_block *this,
		if (atomic_read(&rmnet_ipa3_ctx->is_ssr) &&
			ipa3_ctx->ipa_hw_type < IPA_HW_v4_0)
			ipa3_q6_post_shutdown_cleanup();

		if (ipa3_ctx->ipa_endp_delay_wa)
			ipa3_client_prod_post_shutdown_cleanup();

		IPAWANINFO("IPA AFTER_SHUTDOWN handling is complete\n");
		break;
	case SUBSYS_BEFORE_POWERUP: