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

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

Merge "mmc: cmdq_hci: Add atomic context support in certain cmdq APIs"

parents d16704a7 1e2a5b44
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -2057,13 +2057,6 @@ void mmc_set_ios(struct mmc_host *host)
{
	struct mmc_ios *ios = &host->ios;

	if (unlikely(ios->power_mode == MMC_POWER_OFF &&
		     host->card && mmc_card_doing_auto_bkops(host->card))) {
		pr_err("%s: %s: illegal to disable power to card when running auto bkops\n",
				mmc_hostname(host), __func__);
		return;
	}

	pr_debug("%s: clock %uHz busmode %u powermode %u cs %u Vdd %u "
		"width %u timing %u\n",
		 mmc_hostname(host), ios->clock, ios->bus_mode,
+27 −9
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@
/* 1 sec */
#define HALT_TIMEOUT_MS 1000

static int cmdq_halt_poll(struct mmc_host *mmc);
static int cmdq_halt_poll(struct mmc_host *mmc, bool halt);
static int cmdq_halt(struct mmc_host *mmc, bool halt);

#ifdef CONFIG_PM_RUNTIME
@@ -427,11 +427,10 @@ out:
	return err;
}

static void cmdq_disable(struct mmc_host *mmc, bool soft)
static void cmdq_disable_nosync(struct mmc_host *mmc, bool soft)
{
	struct cmdq_host *cq_host = (struct cmdq_host *)mmc_cmdq_private(mmc);

	cmdq_runtime_pm_get(cq_host);
	if (soft) {
		cmdq_writel(cq_host, cmdq_readl(
				    cq_host, CQCFG) & ~(CQ_ENABLE),
@@ -440,11 +439,19 @@ static void cmdq_disable(struct mmc_host *mmc, bool soft)
	if (cq_host->ops->enhanced_strobe_mask)
		cq_host->ops->enhanced_strobe_mask(mmc, false);

	cmdq_runtime_pm_put(cq_host);
	cq_host->enabled = false;
	mmc_host_set_cq_disable(mmc);
}

static void cmdq_disable(struct mmc_host *mmc, bool soft)
{
	struct cmdq_host *cq_host = (struct cmdq_host *)mmc_cmdq_private(mmc);

	cmdq_runtime_pm_get(cq_host);
	cmdq_disable_nosync(mmc, soft);
	cmdq_runtime_pm_put(cq_host);
}

static void cmdq_reset(struct mmc_host *mmc, bool soft)
{
	struct cmdq_host *cq_host = (struct cmdq_host *)mmc_cmdq_private(mmc);
@@ -791,7 +798,7 @@ irqreturn_t cmdq_irq(struct mmc_host *mmc, int err)
		 * CMDQ error handling will make sure that it is unhalted after
		 * handling all the errors.
		 */
		ret = cmdq_halt_poll(mmc);
		ret = cmdq_halt_poll(mmc, true);
		if (ret)
			pr_err("%s: %s: halt failed ret=%d\n",
					mmc_hostname(mmc), __func__, ret);
@@ -812,7 +819,7 @@ irqreturn_t cmdq_irq(struct mmc_host *mmc, int err)
			if (!dbr_set) {
				pr_err("%s: spurious/force error interrupt\n",
						mmc_hostname(mmc));
				cmdq_halt(mmc, false);
				cmdq_halt_poll(mmc, false);
				mmc_host_clr_halt(mmc);
				return IRQ_HANDLED;
			}
@@ -857,7 +864,7 @@ skip_cqterri:
		 * from processing any further requests
		 */
		if (ret)
			cmdq_disable(mmc, true);
			cmdq_disable_nosync(mmc, true);

		/*
		 * CQE detected a reponse error from device
@@ -923,14 +930,25 @@ EXPORT_SYMBOL(cmdq_irq);

/* cmdq_halt_poll - Halting CQE using polling method.
 * @mmc: struct mmc_host
 * This is used mainly from interrupt context to halt
 * @halt: bool halt
 * This is used mainly from interrupt context to halt/unhalt
 * CQE engine.
 */
static int cmdq_halt_poll(struct mmc_host *mmc)
static int cmdq_halt_poll(struct mmc_host *mmc, bool halt)
{
	struct cmdq_host *cq_host = (struct cmdq_host *)mmc_cmdq_private(mmc);
	int retries = 100;

	if (!halt) {
		if (cq_host->ops->set_data_timeout)
			cq_host->ops->set_data_timeout(mmc, 0xf);
		if (cq_host->ops->clear_set_irqs)
			cq_host->ops->clear_set_irqs(mmc, true);
		cmdq_writel(cq_host, cmdq_readl(cq_host, CQCTL) & ~HALT,
			    CQCTL);
		return 0;
	}

	cmdq_set_halt_irq(cq_host, false);
	cmdq_writel(cq_host, cmdq_readl(cq_host, CQCTL) | HALT, CQCTL);
	while (retries) {