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

Commit 647827f5 authored by Liangliang Lu's avatar Liangliang Lu
Browse files

mmc: mmc-debugfs: add error state



This change adds support to allow user space query if low level eMMC
driver has encountered any error or not, this state can be read/cleared
via debugfs.

CRs-Fixed: 1056483
Change-Id: Idc4ea375e9f308446dec04d443d062fe502658bd
Signed-off-by: default avatarLiangliang Lu <luliang@codeaurora.org>
parent 14f889c8
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -303,6 +303,33 @@ static int mmc_force_err_set(void *data, u64 val)

DEFINE_SIMPLE_ATTRIBUTE(mmc_force_err_fops, NULL, mmc_force_err_set, "%llu\n");

static int mmc_err_state_get(void *data, u64 *val)
{
	struct mmc_host *host = data;

	if (!host)
		return -EINVAL;

	*val = host->err_occurred ? 1 : 0;

	return 0;
}

static int mmc_err_state_clear(void *data, u64 val)
{
	struct mmc_host *host = data;

	if (!host)
		return -EINVAL;

	host->err_occurred = false;

	return 0;
}

DEFINE_SIMPLE_ATTRIBUTE(mmc_err_state, mmc_err_state_get,
		mmc_err_state_clear, "%llu\n");

void mmc_add_host_debugfs(struct mmc_host *host)
{
	struct dentry *root;
@@ -343,6 +370,10 @@ void mmc_add_host_debugfs(struct mmc_host *host)
		&host->cmdq_thist_enabled))
		goto err_node;

	if (!debugfs_create_file("err_state", S_IRUSR | S_IWUSR, root, host,
		&mmc_err_state))
		goto err_node;

#ifdef CONFIG_MMC_CLKGATE
	if (!debugfs_create_u32("clk_delay", (S_IRUSR | S_IWUSR),
				root, &host->clk_delay))
+2 −0
Original line number Diff line number Diff line
@@ -517,6 +517,8 @@ struct mmc_host {

	struct dentry		*debugfs_root;

	bool			err_occurred;

	struct mmc_async_req	*areq;		/* active async req */
	struct mmc_context_info	context_info;	/* async synchronization info */