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

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

Merge "mmc: debugfs: add debugfs entry to force raise host errors"

parents 286c96fb 81dcfe23
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -288,6 +288,21 @@ out:
DEFINE_SIMPLE_ATTRIBUTE(mmc_max_clock_fops, mmc_max_clock_get,
		mmc_max_clock_set, "%llu\n");

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

	if (host && host->ops && host->ops->force_err_irq) {
		mmc_host_clk_hold(host);
		host->ops->force_err_irq(host, val);
		mmc_host_clk_release(host);
	}

	return 0;
}

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

void mmc_add_host_debugfs(struct mmc_host *host)
{
	struct dentry *root;
@@ -337,6 +352,10 @@ void mmc_add_host_debugfs(struct mmc_host *host)
					     &host->fail_mmc_request)))
		goto err_node;
#endif
	if (!debugfs_create_file("force_error", S_IWUSR, root, host,
		&mmc_force_err_fops))
		goto err_node;

	return;

err_node:
+13 −0
Original line number Diff line number Diff line
@@ -2608,6 +2608,18 @@ static int sdhci_late_init(struct mmc_host *mmc)

	return 0;
}

static void sdhci_force_err_irq(struct mmc_host *mmc, u64 errmask)
{
	struct sdhci_host *host = mmc_priv(mmc);
	u16 mask = errmask & 0xFFFF;

	pr_err("%s: Force raise error mask:0x%04x\n", __func__, mask);
	sdhci_runtime_pm_get(host);
	sdhci_writew(host, mask, SDHCI_SET_INT_ERROR);
	sdhci_runtime_pm_put(host);
}

static const struct mmc_host_ops sdhci_ops = {
	.init           = sdhci_late_init,
	.pre_req	= sdhci_pre_req,
@@ -2628,6 +2640,7 @@ static const struct mmc_host_ops sdhci_ops = {
	.notify_load	= sdhci_notify_load,
	.notify_halt	= sdhci_notify_halt,
	.detect		= sdhci_detect,
	.force_err_irq	= sdhci_force_err_irq,
};

/*****************************************************************************\
+1 −0
Original line number Diff line number Diff line
@@ -178,6 +178,7 @@ struct mmc_host_ops {
	int	(*notify_load)(struct mmc_host *, enum mmc_load);
	void	(*notify_halt)(struct mmc_host *mmc, bool halt);
	void	(*detect)(struct mmc_host *host, bool detected);
	void	(*force_err_irq)(struct mmc_host *host, u64 errmask);
};

struct mmc_card;