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

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

Merge "msm: Add ipc router config in Makefile and Kconfig"

parents 8d75d72e 9ea2de0a
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -180,6 +180,7 @@ void qti_client_queue_rx(int id, u8 *buf, unsigned int bytes)
	if (!data_node) {
		to_console = 1;
		qlog(qsbdev[id], "client %d dnode allocation failed\n", id);
		to_console = 0;
		return;
	}

@@ -255,6 +256,7 @@ void qti_client_data_avail_cb(struct sdio_al_channel_handle *ch_handle,
	if (!rx_dma_buf) {
		to_console = 1;
		qlog(qsb, "Unable to allocate rx_dma_buf\n");
		to_console = 0;
		return;
	}

@@ -276,6 +278,7 @@ void qti_client_data_avail_cb(struct sdio_al_channel_handle *ch_handle,
			to_console = 1;
			qlog(qsb, "%s: data queueing failed %d\n", qsb->name,
									ret);
			to_console = 0;
			return;
		}
	} else {
@@ -289,6 +292,7 @@ void qti_client_data_avail_cb(struct sdio_al_channel_handle *ch_handle,
			to_console = 1;
			qlog(qsb, "%s: data transfer failed %d\n", qsb->name,
									ret);
			to_console = 0;
			return;
		}
		qti_client_queue_rx(cl_data->id, rx_dma_buf, bytes);
@@ -348,6 +352,7 @@ static void sdio_dl_meta_data_cb(struct sdio_al_channel_handle *ch_handle,
	default:
		to_console = 1;
		qlog(qsb, "client %s INVALID_DATA\n", qsb->name);
		to_console = 0;
	}
}

@@ -371,6 +376,7 @@ int qti_client_open(int id, void *ops)
	default:
		to_console = 1;
		qlog(qsb, "Invalid client\n");
		to_console = 0;
		return ret;
	}

@@ -425,6 +431,7 @@ int qti_client_read(int id, char *buf, size_t count)
	if (id == QCN_SDIO_CLI_ID_DIAG && !qsb->ops) {
		to_console = 1;
		qlog(qsb, "%s: no diag operations assigned\n", qsb->name);
		to_console = 0;
		ret = -ENODEV;
		goto out;
	}
@@ -446,6 +453,7 @@ int qti_client_read(int id, char *buf, size_t count)
				to_console = 1;
				qlog(qsb, "%s: failed to copy to user buffer\n",
								qsb->name);
				to_console = 0;
				return -EIO;
			}
		} else {
@@ -463,6 +471,7 @@ int qti_client_read(int id, char *buf, size_t count)
				to_console = 1;
				qlog(qsb, "%s: failed to copy to user buffer\n",
						qsb->name);
				to_console = 0;
				return -EIO;
			}
		} else {
@@ -516,6 +525,7 @@ int qti_client_write(int id, char *buf, size_t count)
	default:
		to_console = 1;
		qlog(qsb, "Invalid client\n");
		to_console = 0;
		return ret;
	}

@@ -527,6 +537,7 @@ int qti_client_write(int id, char *buf, size_t count)
	if (id == QCN_SDIO_CLI_ID_DIAG && !qsb->ops) {
		to_console = 1;
		qlog(qsb, "%s: no diag operations assigned\n", qsb->name);
		to_console = 0;
		ret = -ENODEV;
		return ret;
	}
@@ -573,6 +584,7 @@ int qti_client_write(int id, char *buf, size_t count)
			to_console = 1;
			qlog(qsb, "%s: meta data transfer failed %d\n",
								qsb->name, ret);
			to_console = 0;
			return ret;
		}

@@ -594,6 +606,7 @@ int qti_client_write(int id, char *buf, size_t count)
				to_console = 1;
				qlog(qsb, "%s: data transfer failed %d\n",
								qsb->name, ret);
				to_console = 0;
				return ret;
			}

@@ -607,6 +620,7 @@ int qti_client_write(int id, char *buf, size_t count)
				to_console = 1;
				qlog(qsb, "%s: data transfer failed %d\n",
								qsb->name, ret);
				to_console = 0;
				return ret;
			}
		}
@@ -757,6 +771,7 @@ static int qti_client_probe(struct sdio_al_client_handle *client_handle)
		to_console = 1;
		qlog(qsb, "client %s failed to allocate channel_data\n",
								qsb->name);
		to_console = 0;
		ret = -ENOMEM;
		goto err;
	}
@@ -780,6 +795,7 @@ static int qti_client_probe(struct sdio_al_client_handle *client_handle)
		qlog(qsb,
		       "client %s failed to register channel_handle ret = %d\n",
								qsb->name, ret);
		to_console = 0;
		goto channel_data_err;
	}

@@ -789,6 +805,7 @@ static int qti_client_probe(struct sdio_al_client_handle *client_handle)
	if (!qsb->tx_dma_buf) {
		to_console = 1;
		qlog(qsb, "client %s failed to allocate tx_buf\n", qsb->name);
		to_console = 0;
		ret = -ENOMEM;
		goto channel_handle_err;
	}
@@ -800,6 +817,7 @@ static int qti_client_probe(struct sdio_al_client_handle *client_handle)
		if (!tty_dev) {
			to_console = 1;
			qlog(qsb, "unable to allocate platform device\n");
			to_console = 0;
			ret = -ENOMEM;
			goto tx_err;
		}
@@ -809,6 +827,7 @@ static int qti_client_probe(struct sdio_al_client_handle *client_handle)
			to_console = 1;
			qlog(qsb, "client %s failed to allocate major_no\n",
								qsb->name);
			to_console = 0;
			ret = major_no;
			goto tx_err;
		}
@@ -818,6 +837,7 @@ static int qti_client_probe(struct sdio_al_client_handle *client_handle)
			to_console = 1;
			qlog(qsb, "client %s failed to create class\n",
								qsb->name);
			to_console = 0;
			ret = PTR_ERR(tty_dev->qsb_class);
			goto reg_err;
		}
@@ -828,6 +848,7 @@ static int qti_client_probe(struct sdio_al_client_handle *client_handle)
			to_console = 1;
			qlog(qsb, "client %s failed to create device node\n",
								qsb->name);
			to_console = 0;
			ret = PTR_ERR(tty_dev->qsb_device);

			goto dev_err;
@@ -841,6 +862,7 @@ static int qti_client_probe(struct sdio_al_client_handle *client_handle)
		if (!ipc_pdev) {
			to_console = 1;
			qlog(qsb, "unable to allocate platform device\n");
			to_console = 0;
			ret = -ENOMEM;
			goto tx_err;
		}
@@ -850,6 +872,7 @@ static int qti_client_probe(struct sdio_al_client_handle *client_handle)
		if (ret) {
			to_console = 1;
			qlog(qsb, "failed to add pdata\n");
			to_console = 0;
			goto put_pdev;
		}

@@ -857,6 +880,7 @@ static int qti_client_probe(struct sdio_al_client_handle *client_handle)
		if (ret) {
			to_console = 1;
			qlog(qsb, "failed to add ipc_pdev\n");
			to_console = 0;
			goto put_pdev;
		}
		qsb->priv_dev_info = ipc_pdev;
@@ -869,6 +893,7 @@ static int qti_client_probe(struct sdio_al_client_handle *client_handle)
			to_console = 1;
			qlog(qsb, "%s: unable to allocate platform device\n",
								__func__);
			to_console = 0;
			ret = PTR_ERR(diag_pdev);
			goto put_pdev;
		}
@@ -975,6 +1000,7 @@ static void data_avail_worker(struct kthread_work *work)
			wake_up(&qsb->wait_q);

		wait_for_completion(&read_complete);
		kfree(data_node->rx_dma_buf);
		kfree(data_node);
		spin_lock(&list_lock);
	}
+71 −14
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <linux/mmc/sd.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/kthread.h>
#include "qcn_sdio.h"

static bool tx_dump;
@@ -33,6 +34,19 @@ module_param(rx_dump, bool, S_IRUGO | S_IWUSR | S_IWGRP);
static int dump_len = 32;
module_param(dump_len, int, S_IRUGO | S_IWUSR | S_IWGRP);

static bool retune;
module_param(retune, bool, S_IRUGO | S_IWUSR | S_IWGRP);

/* driver_state :
 *	QCN_SDIO_SW_RESET = 0,
 *	QCN_SDIO_SW_PBL,
 *	QCN_SDIO_SW_SBL,
 *	QCN_SDIO_SW_RDDM,
 *	QCN_SDIO_SW_MROM,
*/
static int driver_state;
module_param(driver_state, int, S_IRUGO | S_IRUSR | S_IRGRP);

static struct mmc_host *current_host;

#define HEX_DUMP(mode, buf, len)				\
@@ -65,7 +79,9 @@ struct completion client_probe_complete;
static struct mutex lock;
static struct list_head cinfo_head;
static atomic_t status;
static atomic_t xport_status;
static spinlock_t async_lock;
static struct task_struct *reset_task;

static int qcn_create_sysfs(struct device *dev);

@@ -133,6 +149,18 @@ static void qcn_sdio_free_rw_req(struct qcn_sdio_rw_info *rw_req)
	spin_unlock(&sdio_ctxt->lock_free_q);
}

static void qcn_sdio_purge_rw_buff(void)
{
	struct qcn_sdio_rw_info *rw_req = NULL;

	while (!list_empty(&sdio_ctxt->rw_wait_q)) {
		rw_req = list_first_entry(&sdio_ctxt->rw_wait_q,
						struct qcn_sdio_rw_info, list);
		list_del(&rw_req->list);
		qcn_sdio_free_rw_req(rw_req);
	}
}

void qcn_sdio_client_probe_complete(int id)
{
	complete(&client_probe_complete);
@@ -441,6 +469,7 @@ int qcn_sw_mode_change(enum qcn_sdio_sw_mode mode)
		pr_err("Invalid mode\n");
	}

	driver_state = mode;
	sdio_ctxt->curr_sw_mode = mode;
	return 0;
}
@@ -513,13 +542,35 @@ static int qcn_read_meta_info(void)
	return ret;
}

static int reset_thread(void *data)
{
	qcn_sdio_purge_rw_buff();
	qcn_sdio_card_state(false);
	qcn_sdio_card_state(true);
	kthread_stop(reset_task);
	reset_task = NULL;

	return 0;
}

static void qcn_sdio_irq_handler(struct sdio_func *func)
{
	u8 data = 0;

	int ret = 0;

	sdio_claim_host(sdio_ctxt->func);
	data = sdio_readb(sdio_ctxt->func, SDIO_QCN_IRQ_STATUS, NULL);
	data = sdio_readb(sdio_ctxt->func, SDIO_QCN_IRQ_STATUS, &ret);
	if (ret) {
		sdio_release_host(sdio_ctxt->func);

		pr_err("%s: IRQ status read error ret = %d\n", __func__, ret);

		reset_task = kthread_run(reset_thread, NULL, "qcn_reset");
		if (IS_ERR(reset_task))
			pr_err("Failed to run qcn_reset thread\n");

		return;
	}
	sdio_release_host(sdio_ctxt->func);

	if (data & SDIO_QCN_IRQ_CRQ_READY_MASK) {
@@ -591,18 +642,6 @@ static int qcn_sdio_recv_buff(u32 cid, void *buff, size_t len)
	return ret;
}

static void qcn_sdio_purge_rw_buff(void)
{
	struct qcn_sdio_rw_info *rw_req = NULL;

	while (!list_empty(&sdio_ctxt->rw_wait_q)) {
		rw_req = list_first_entry(&sdio_ctxt->rw_wait_q,
						struct qcn_sdio_rw_info, list);
		list_del(&rw_req->list);
		qcn_sdio_free_rw_req(rw_req);
	}
}

static void qcn_sdio_rw_work(struct work_struct *work)
{
	int ret = 0;
@@ -709,6 +748,13 @@ int qcn_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)

	current_host = func->card->host;

	if (!retune) {
		pr_debug("%s Probing driver with retune disabled\n", __func__);
		mmc_retune_disable(current_host);
	}

	atomic_set(&xport_status, 1);

	return 0;
err:
	kfree(sdio_ctxt);
@@ -721,6 +767,7 @@ static void qcn_sdio_remove(struct sdio_func *func)
	struct qcn_sdio_client_info *cinfo = NULL;
	struct qcn_sdio_ch_info *ch_info = NULL;

	atomic_set(&xport_status, 0);
	sdio_claim_host(sdio_ctxt->func);
	qcn_enable_async_irq(false);
	sdio_release_host(sdio_ctxt->func);
@@ -750,6 +797,7 @@ static void qcn_sdio_remove(struct sdio_func *func)

	kfree(sdio_ctxt);
	sdio_ctxt = NULL;
	mmc_retune_enable(current_host);
}

static const struct sdio_device_id qcn_sdio_devices[] = {
@@ -1027,6 +1075,9 @@ int sdio_al_queue_transfer_async(struct sdio_al_channel_handle *handle,
	struct qcn_sdio_rw_info *rw_req = NULL;
	u32 cid = QCN_SDIO_CH_MAX;

	if (!atomic_read(&xport_status))
		return -ENODEV;

	if (!handle) {
		pr_err("%s: Error: Invalid Param\n", __func__);
		return -EINVAL;
@@ -1071,6 +1122,9 @@ int sdio_al_queue_transfer(struct sdio_al_channel_handle *ch_handle,
	int ret = 0;
	u32 cid = QCN_SDIO_CH_MAX;

	if (!atomic_read(&xport_status))
		return -ENODEV;

	if (!ch_handle) {
		pr_err("%s: SDIO: Invalid Param\n", __func__);
		return -EINVAL;
@@ -1118,6 +1172,9 @@ int sdio_al_meta_transfer(struct sdio_al_channel_handle *handle,
	u32 cid = QCN_SDIO_CH_MAX;
	u8 event = 0;

	if (!atomic_read(&xport_status))
		return -ENODEV;

	if (!handle)
		return -EINVAL;

+10 −0
Original line number Diff line number Diff line
@@ -326,6 +326,16 @@ config MSM_IPC_ROUTER_GLINK_XPRT
	  this layer registers a transport with IPC Router and enable
	  message exchange.

config MSM_IPC_ROUTER_SDIO_XPRT
	depends on QCOM_SDIO_CLIENT
	depends on IPC_ROUTER
	bool "MSM SDIO XPRT Layer"
	help
	  SDIO Transport Layer that enables off-chip communication of
	  IPC Router. When the SDIO endpoint becomes available, this layer
	  registers the transport with IPC Router and enable message
	  exchange.

config MSM_SYSTEM_HEALTH_MONITOR
	bool "System Health Monitor"
	depends on MSM_QMI_INTERFACE && MSM_SUBSYSTEM_RESTART
+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ obj-$(CONFIG_MSM_RPM_SMD) += rpm-smd-debug.o
endif
obj-$(CONFIG_MSM_IPC_ROUTER_SMD_XPRT)	+=	ipc_router_smd_xprt.o
obj-$(CONFIG_MSM_IPC_ROUTER_HSIC_XPRT)	+=	ipc_router_hsic_xprt.o
obj-$(CONFIG_MSM_IPC_ROUTER_SDIO_XPRT)	+=	ipc_router_sdio_xprt.o
obj-$(CONFIG_MSM_IPC_ROUTER_MHI_XPRT)	+=	ipc_router_mhi_xprt.o
obj-$(CONFIG_MSM_IPC_ROUTER_GLINK_XPRT)	+=	ipc_router_glink_xprt.o
obj-$(CONFIG_MSM_SPCOM) += spcom.o