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

Commit e9782e38 authored by Veerabhadrarao Badiganti's avatar Veerabhadrarao Badiganti
Browse files

mmc: host: Reset sdhc-crypto engine only during error recovery



No need to reset the inline-crypto-engine (ICE) when SDHC soft-
reset is triggered. ICE needs to be reset only when SDHC gets h/w
reset (this is to keep SHDC and ICE in sync) but mmc driver never
does h/w reset of SDHC controller

Resetting ICE whenever SDHC get soft reset (in suspend path)
resulting in TZ calls and causing latency issues.

But invoke ice reset during error handling path to ensure ice
s/w state machine is in sync with the mmc s/w state.

Change-Id: Ifb48bf215821a8318520e214370c78f2bc857622
Signed-off-by: default avatarVeerabhadrarao Badiganti <vbadigan@codeaurora.org>
parent a58339e5
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2976,6 +2976,9 @@ static int mmc_reset(struct mmc_host *host)
		mmc_pwrseq_reset(host);
	}

	if (host->inlinecrypt_support)
		host->inlinecrypt_reset_needed = true;

	ret = mmc_init_card(host, host->card->ocr, host->card);
	if (ret) {
		pr_err("%s: %s: mmc_init_card failed (%d)\n",
+5 −6
Original line number Diff line number Diff line
@@ -317,8 +317,6 @@ static void sdhci_do_reset(struct sdhci_host *host, u8 mask)
		/* Resetting the controller clears many */
		host->preset_enabled = false;
	}
	if (host->is_crypto_en)
		host->crypto_reset_reqd = true;
}

static void sdhci_set_default_irqs(struct sdhci_host *host)
@@ -1838,14 +1836,15 @@ static int sdhci_crypto_cfg(struct sdhci_host *host, struct mmc_request *mrq,
{
	int err = 0;

	if (host->crypto_reset_reqd && host->ops->crypto_engine_reset) {
	if (host->mmc->inlinecrypt_reset_needed &&
			host->ops->crypto_engine_reset) {
		err = host->ops->crypto_engine_reset(host);
		if (err) {
			pr_err("%s: crypto reset failed\n",
					mmc_hostname(host->mmc));
			goto out;
		}
		host->crypto_reset_reqd = false;
		host->mmc->inlinecrypt_reset_needed = false;
	}

	if (host->ops->crypto_engine_cfg) {
@@ -4066,14 +4065,14 @@ static int sdhci_cmdq_crypto_cfg(struct mmc_host *mmc,
	if (!host->is_crypto_en)
		return 0;

	if (host->crypto_reset_reqd && host->ops->crypto_engine_reset) {
	if (mmc->inlinecrypt_reset_needed && host->ops->crypto_engine_reset) {
		err = host->ops->crypto_engine_reset(host);
		if (err) {
			pr_err("%s: crypto reset failed\n",
					mmc_hostname(host->mmc));
			goto out;
		}
		host->crypto_reset_reqd = false;
		mmc->inlinecrypt_reset_needed = false;
	}

	if (host->ops->crypto_engine_cmdq_cfg) {
+0 −1
Original line number Diff line number Diff line
@@ -654,7 +654,6 @@ struct sdhci_host {

	bool sdio_irq_async_status;
	bool is_crypto_en;
	bool crypto_reset_reqd;

	u32 auto_cmd_err_sts;
	struct ratelimit_state dbg_dump_rs;
+1 −0
Original line number Diff line number Diff line
@@ -710,6 +710,7 @@ struct mmc_host {
	struct mmc_request	*err_mrq;

	bool inlinecrypt_support;  /* Inline encryption support */
	bool inlinecrypt_reset_needed;  /* Inline crypto reset */

	atomic_t rpmb_req_pending;
	struct mutex		rpmb_req_mutex;