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

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

Merge "soc: qcom: ipc_router_mhi_xprt: Refactor for MHI register"

parents 82933472 190283f0
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
Qualcomm Technologies, Inc. IPC Router MHI Transport

Required properties:
-compatible:		should be "qcom,ipc_router_mhi_xprt"
-qcom,out-chan-id:	MHI Channel ID for the transmit path
-qcom,in-chan-id:	MHI Channel ID for the receive path
-qcom,xprt-remote:	string that defines the edge of the transport (PIL Name)
-compatible:		should be "qcom,ipc_router_mhi_xprt".
-qcom,mhi:		phandle of MHI Device to connect to.
-qcom,out-chan-id:	MHI Channel ID for the transmit path.
-qcom,in-chan-id:	MHI Channel ID for the receive path.
-qcom,xprt-remote:	string that defines the edge of the transport(PIL Name).
-qcom,xprt-linkid:	unique integer to identify the tier to which the link
			belongs to in the network and is used to avoid the
			routing loops while forwarding the broadcast messages
-qcom,xprt-version:	unique version ID used by MHI transport header
			routing loops while forwarding the broadcast messages.
-qcom,xprt-version:	unique version ID used by MHI transport header.

Example:
	qcom,ipc_router_external_modem_xprt2 {
		compatible = "qcom,ipc_router_mhi_xprt";
		qcom,mhi = <&mhi_wlan>;
	        qcom,out-chan-id = <34>;
		qcom,in-chan-id = <35>;
		qcom,xprt-remote = "external-modem";
+34 −14
Original line number Diff line number Diff line
/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -753,7 +753,8 @@ static void ipc_router_mhi_xprt_cb(struct mhi_cb_info *cb_info)
	mhi_xprtp = (struct ipc_router_mhi_xprt *)(cb_info->result->user_data);
	switch (cb_info->cb_reason) {
	case MHI_CB_MHI_ENABLED:
	case MHI_CB_MHI_DISABLED:
	case MHI_CB_MHI_SHUTDOWN:
	case MHI_CB_SYS_ERROR:
		xprt_work = kmalloc(sizeof(*xprt_work), GFP_KERNEL);
		if (!xprt_work) {
			IPC_RTR_ERR("%s: Couldn't handle %d event on %s\n",
@@ -772,6 +773,9 @@ static void ipc_router_mhi_xprt_cb(struct mhi_cb_info *cb_info)
	case MHI_CB_XFER:
		mhi_xprt_xfer_event(cb_info);
		break;
	case MHI_CB_MHI_DISABLED:
		D("%s: Recv DISABLED cb on chan %d\n", __func__, cb_info->chan);
		break;
	default:
		IPC_RTR_ERR("%s: Invalid cb reason %x\n",
			    __func__, cb_info->cb_reason);
@@ -788,22 +792,37 @@ static void ipc_router_mhi_xprt_cb(struct mhi_cb_info *cb_info)
 * This function is called when a new XPRT is added.
 */
static int ipc_router_mhi_driver_register(
		struct ipc_router_mhi_xprt *mhi_xprtp)
		struct ipc_router_mhi_xprt *mhi_xprtp, struct device *dev)
{
	int rc_status;

	rc_status = mhi_register_channel(&mhi_xprtp->ch_hndl.out_handle, NULL);
	if (rc_status) {
	int rc;
	const char *node_name = "qcom,mhi";
	struct mhi_client_info_t *mhi_info;

	if (!mhi_is_device_ready(dev, node_name))
		return -EPROBE_DEFER;

	mhi_info = &mhi_xprtp->ch_hndl.out_clnt_info;
	mhi_info->chan = mhi_xprtp->ch_hndl.out_chan_id;
	mhi_info->dev = dev;
	mhi_info->node_name = node_name;
	mhi_info->user_data = mhi_xprtp;
	rc = mhi_register_channel(&mhi_xprtp->ch_hndl.out_handle, mhi_info);
	if (rc) {
		IPC_RTR_ERR("%s: Error %d registering out_chan for %s\n",
			    __func__, rc_status, mhi_xprtp->xprt_name);
			    __func__, rc, mhi_xprtp->xprt_name);
		return -EFAULT;
	}

	rc_status = mhi_register_channel(&mhi_xprtp->ch_hndl.in_handle, NULL);
	if (rc_status) {
	mhi_info = &mhi_xprtp->ch_hndl.in_clnt_info;
	mhi_info->chan = mhi_xprtp->ch_hndl.in_chan_id;
	mhi_info->dev = dev;
	mhi_info->node_name = node_name;
	mhi_info->user_data = mhi_xprtp;
	rc = mhi_register_channel(&mhi_xprtp->ch_hndl.in_handle, mhi_info);
	if (rc) {
		mhi_deregister_channel(mhi_xprtp->ch_hndl.out_handle);
		IPC_RTR_ERR("%s: Error %d registering in_chan for %s\n",
			    __func__, rc_status, mhi_xprtp->xprt_name);
			    __func__, rc, mhi_xprtp->xprt_name);
		return -EFAULT;
	}
	return 0;
@@ -820,7 +839,8 @@ static int ipc_router_mhi_driver_register(
 * the MHI XPRT configurations from device tree.
 */
static int ipc_router_mhi_config_init(
	struct ipc_router_mhi_xprt_config *mhi_xprt_config)
			struct ipc_router_mhi_xprt_config *mhi_xprt_config,
			struct device *dev)
{
	struct ipc_router_mhi_xprt *mhi_xprtp;
	char wq_name[XPRT_NAME_LEN];
@@ -879,7 +899,7 @@ static int ipc_router_mhi_config_init(
	INIT_LIST_HEAD(&mhi_xprtp->rx_addr_map_list);
	spin_lock_init(&mhi_xprtp->rx_addr_map_list_lock);

	rc = ipc_router_mhi_driver_register(mhi_xprtp);
	rc = ipc_router_mhi_driver_register(mhi_xprtp, dev);
	return rc;
}

@@ -963,7 +983,7 @@ static int ipc_router_mhi_xprt_probe(struct platform_device *pdev)
			return rc;
		}

		rc = ipc_router_mhi_config_init(&mhi_xprt_config);
		rc = ipc_router_mhi_config_init(&mhi_xprt_config, &pdev->dev);
		if (rc) {
			IPC_RTR_ERR("%s: init failed\n", __func__);
			return rc;