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

Commit 124a4860 authored by Veerabhadrarao Badiganti's avatar Veerabhadrarao Badiganti
Browse files

mmc: core: retune after un-gating the clocks



We have seen that host controller's clock tuning circuit may go out of sync
if controller clocks are gated. To work-around this issue, we are now
triggering the retuning of tuning circuit once clocks are ungated.

This change enables re-tuning when tuning is executed, marks tuning is
needed whenever clock is ungated and disable re-tuning when card is
no longer initialized.

Change-Id: Id2db1cb4829fbb1af4f8c4e463d1e16c0f45e590
Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: default avatarVeerabhadrarao Badiganti <vbadigan@codeaurora.org>
parent 1e09ae1b
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -2230,6 +2230,14 @@ void mmc_ungate_clock(struct mmc_host *host)
		WARN_ON(host->ios.clock);
		/* This call will also set host->clk_gated to false */
		__mmc_set_clock(host, host->clk_old);
		/*
		 * We have seen that host controller's clock tuning circuit may
		 * go out of sync if controller clocks are gated.
		 * To workaround this issue, we are triggering retuning of the
		 * tuning circuit after ungating the controller clocks.
		 */
		if (host->sdr104_wa)
			mmc_retune_needed(host);
	}
}

@@ -2272,6 +2280,8 @@ int mmc_execute_tuning(struct mmc_card *card)

	if (err)
		pr_err("%s: tuning execution failed\n", mmc_hostname(host));
	else
		mmc_retune_enable(host);

	return err;
}
@@ -2774,6 +2784,7 @@ void mmc_power_up(struct mmc_host *host, u32 ocr)
		return;

	mmc_host_clk_hold(host);
	mmc_retune_disable(host);

	host->ios.vdd = fls(ocr) - 1;
	if (mmc_host_is_spi(host))
@@ -2821,6 +2832,7 @@ void mmc_power_off(struct mmc_host *host)
		return;

	mmc_host_clk_hold(host);
	mmc_retune_disable(host);

	host->ios.clock = 0;
	host->ios.vdd = 0;
@@ -3701,6 +3713,7 @@ static int mmc_do_hw_reset(struct mmc_host *host, int check)
		return -EOPNOTSUPP;

	mmc_host_clk_hold(host);
	mmc_retune_disable(host);
	mmc_set_clock(host, host->f_init);

	if (mmc_card_mmc(card) && host->ops->hw_reset)