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

Commit 4eca099a authored by Sahitya Tummala's avatar Sahitya Tummala Committed by Veerabhadrarao Badiganti
Browse files

mmc: sdhci: Add Inline Crypto Engine (ICE) support



This patch adds ICE support to sdhci driver. It uses the
new ICE host->ops like config/reset to configure/reset the
ICE HW as appropriate.

Change-Id: I64946d15d2f6ec8981e95c8817e82a2115b1196c
Signed-off-by: default avatarSahitya Tummala <stummala@codeaurora.org>
Signed-off-by: default avatarVenkat Gopalakrishnan <venkatg@codeaurora.org>
[subhashj@codeaurora.org: fixed trivial merge conflicts]
Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: default avatarVeerabhadrarao Badiganti <vbadigan@codeaurora.org>
parent 9325fb08
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
@@ -305,6 +305,8 @@ 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_init(struct sdhci_host *host, int soft)
@@ -1749,6 +1751,33 @@ static int sdhci_get_tuning_cmd(struct sdhci_host *host)
		return MMC_SEND_TUNING_BLOCK;
}

static int sdhci_crypto_cfg(struct sdhci_host *host, struct mmc_request *mrq,
		u32 slot)
{
	int err = 0;

	if (host->crypto_reset_reqd && 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;
	}

	if (host->ops->crypto_engine_cfg) {
		err = host->ops->crypto_engine_cfg(host, mrq, slot);
		if (err) {
			pr_err("%s: failed to configure crypto\n",
					mmc_hostname(host->mmc));
			goto out;
		}
	}
out:
	return err;
}

static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
{
	struct sdhci_host *host;
@@ -1815,6 +1844,13 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
					sdhci_get_tuning_cmd(host));
		}

		if (host->is_crypto_en) {
			spin_unlock_irqrestore(&host->lock, flags);
			if (sdhci_crypto_cfg(host, mrq, 0))
				goto end_req;
			spin_lock_irqsave(&host->lock, flags);
		}

		if (mrq->sbc && !(host->flags & SDHCI_AUTO_CMD23))
			sdhci_send_command(host, mrq->sbc);
		else
@@ -1823,6 +1859,12 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)

	mmiowb();
	spin_unlock_irqrestore(&host->lock, flags);
	return;
end_req:
	mrq->cmd->error = -EIO;
	if (mrq->data)
		mrq->data->error = -EIO;
	mmc_request_done(host->mmc, mrq);
}

void sdhci_set_bus_width(struct sdhci_host *host, int width)
+1 −0
Original line number Diff line number Diff line
@@ -629,6 +629,7 @@ 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;