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

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

Merge "mmc: core: Add retuning to cmdq path"

parents d6dbc416 1f57af66
Loading
Loading
Loading
Loading
+41 −0
Original line number Diff line number Diff line
@@ -1170,6 +1170,46 @@ static int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
	return 0;
}

static int mmc_cmdq_check_retune(struct mmc_host *host)
{
	bool cmdq_mode;
	int err = 0;

	if (!host->need_retune || host->doing_retune || !host->card ||
			mmc_card_hs400es(host->card) ||
			(host->ios.clock <= MMC_HIGH_DDR_MAX_DTR))
		return 0;

	cmdq_mode = mmc_card_cmdq(host->card);
	if (cmdq_mode) {
		err = mmc_cmdq_halt(host, true);
		if (err) {
			pr_err("%s: %s: failed halting queue (%d)\n",
				mmc_hostname(host), __func__, err);
			host->cmdq_ops->dumpstate(host);
			goto halt_failed;
		}
	}

	mmc_retune_hold(host);
	err = mmc_retune(host);
	mmc_retune_release(host);

	if (cmdq_mode) {
		if (mmc_cmdq_halt(host, false)) {
			pr_err("%s: %s: cmdq unhalt failed\n",
			mmc_hostname(host), __func__);
			host->cmdq_ops->dumpstate(host);
		}
	}

halt_failed:
	pr_debug("%s: %s: Retuning done err: %d\n",
				mmc_hostname(host), __func__, err);

	return err;
}

static int mmc_start_cmdq_request(struct mmc_host *host,
				   struct mmc_request *mrq)
{
@@ -1196,6 +1236,7 @@ static int mmc_start_cmdq_request(struct mmc_host *host,
	}

	mmc_host_clk_hold(host);
	mmc_cmdq_check_retune(host);
	if (likely(host->cmdq_ops->request)) {
		ret = host->cmdq_ops->request(host, mrq);
	} else {
+2 −1
Original line number Diff line number Diff line
@@ -388,7 +388,8 @@ int mmc_retune(struct mmc_host *host)
	else
		return 0;

	if (!host->need_retune || host->doing_retune || !host->card)
	if (!host->need_retune || host->doing_retune || !host->card ||
			mmc_card_hs400es(host->card))
		return 0;

	host->need_retune = 0;