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

Commit cf6313a0 authored by Talel Shenhar's avatar Talel Shenhar
Browse files

msm: ecm_ipa: add debug ability to manually stall IPA core



This change add the ability to cause IPA core simulate
a stall. this adds the ability to debug and analyze issues that
only happen during data stall.
There is no functional change to the driver and this feature
is only used for debugging.

Change-Id: I12f5db9809f8a16ebe23751197925c4d380aac81
Signed-off-by: default avatarTalel Shenhar <tatias@codeaurora.org>
parent b72200de
Loading
Loading
Loading
Loading
+56 −0
Original line number Diff line number Diff line
@@ -167,6 +167,10 @@ static int resource_request(struct ecm_ipa_dev *ecm_ipa_ctx);
static void resource_release(struct ecm_ipa_dev *ecm_ipa_ctx);
static netdev_tx_t ecm_ipa_start_xmit(struct sk_buff *skb,
					struct net_device *net);
static int ecm_ipa_debugfs_stall_open(struct inode *inode,
	struct file *file);
static ssize_t ecm_ipa_debugfs_stall_write(struct file *file,
		const char __user *buf, size_t count, loff_t *ppos);
static int ecm_ipa_debugfs_atomic_open(struct inode *inode, struct file *file);
static ssize_t ecm_ipa_debugfs_enable_write_dma(struct file *file,
		const char __user *buf, size_t count, loff_t *ppos);
@@ -209,6 +213,11 @@ const struct file_operations ecm_ipa_debugfs_atomic_ops = {
	.read = ecm_ipa_debugfs_atomic_read,
};

const struct file_operations ecm_ipa_debugfs_stall_ops = {
	.open = ecm_ipa_debugfs_stall_open,
	.write = ecm_ipa_debugfs_stall_write,
};

static void ecm_ipa_msg_free_cb(void *buff, u32 len, u32 type)
{
	kfree(buff);
@@ -1186,6 +1195,44 @@ static void ecm_ipa_tx_timeout(struct net_device *net)
	ipa_bam_reg_dump();
}

static int ecm_ipa_debugfs_stall_open(struct inode *inode,
	struct file *file)
{
	ECM_IPA_LOG_ENTRY();

	ECM_IPA_LOG_EXIT();

	return 0;
}

static ssize_t ecm_ipa_debugfs_stall_write(struct file *file,
		const char __user *buf, size_t count, loff_t *ppos)
{
	u32 cmdq_cfg_mmio_phy = 0xFD4E3038;
	void *cmdq_cfg_mmio_virt;
	int result;
	bool val = 0;

	ECM_IPA_LOG_ENTRY();

	file->private_data = &val;
	result = ecm_ipa_debugfs_enable_write(file, buf, count, ppos);

	cmdq_cfg_mmio_virt = ioremap(cmdq_cfg_mmio_phy, sizeof(u32));
	if (!cmdq_cfg_mmio_virt) {
		ECM_IPA_ERROR("fail on mmio for cmdq_cfg_mmio_phy=0x%x",
			cmdq_cfg_mmio_phy);
		return result;
	}

	iowrite32(val, cmdq_cfg_mmio_virt);
	ECM_IPA_DEBUG("Value %d was written to cfgq", val);

	ECM_IPA_LOG_EXIT();

	return result;

}

static int ecm_ipa_debugfs_atomic_open(struct inode *inode, struct file *file)
{
@@ -1283,6 +1330,7 @@ static int ecm_ipa_debugfs_init(struct ecm_ipa_dev *ecm_ipa_ctx)
{
	const mode_t flags_read_write = S_IRUGO | S_IWUGO;
	const mode_t flags_read_only = S_IRUGO;
	const mode_t flags_write_only = S_IWUGO;
	struct dentry *file;

	ECM_IPA_LOG_ENTRY();
@@ -1340,6 +1388,14 @@ static int ecm_ipa_debugfs_init(struct ecm_ipa_dev *ecm_ipa_ctx)
		goto fail_file;
	}

	file = debugfs_create_file("stall_ipa_rx_proc", flags_write_only,
			ecm_ipa_ctx->directory,
			ecm_ipa_ctx, &ecm_ipa_debugfs_stall_ops);
	if (!file) {
		ECM_IPA_ERROR("could not create stall_ipa_rx_proc file\n");
		goto fail_file;
	}

	ECM_IPA_LOG_EXIT();

	return 0;