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

Commit 39259796 authored by Sahitya Tummala's avatar Sahitya Tummala Committed by Matt Wagantall
Browse files

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



Add changes to configure ICE for data encryption/decryption
using CMDQ.

Change-Id: I9a10d18d617102916526e994e9f9d22d2aa5446b
Signed-off-by: default avatarSahitya Tummala <stummala@codeaurora.org>
parent 516bb888
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -557,6 +557,15 @@ static int cmdq_request(struct mmc_host *mmc, struct mmc_request *mrq)
		return 0;
	}

	if (cq_host->ops->crypto_cfg) {
		err = cq_host->ops->crypto_cfg(mmc, mrq, tag);
		if (err) {
			pr_err("%s: failed to configure crypto: err %d tag %d\n",
					mmc_hostname(mmc), err, tag);
			goto out;
		}
	}

	task_desc = (__le64 __force *)get_desc(cq_host, tag);

	cmdq_prep_task_desc(mrq, &data, 1,
+2 −0
Original line number Diff line number Diff line
@@ -199,6 +199,8 @@ struct cmdq_host_ops {
	u32 (*read_l)(struct cmdq_host *host, int reg);
	void (*clear_set_dumpregs)(struct mmc_host *mmc, bool set);
	int (*reset)(struct mmc_host *mmc);
	int (*crypto_cfg)(struct mmc_host *mmc, struct mmc_request *mrq,
				u32 slot);
};

static inline void cmdq_writel(struct cmdq_host *host, u32 val, int reg)
+16 −1
Original line number Diff line number Diff line
@@ -3458,6 +3458,16 @@ static void sdhci_cmdq_clear_set_dumpregs(struct mmc_host *mmc, bool set)
	if (host->ops->clear_set_dumpregs)
		host->ops->clear_set_dumpregs(host, set);
}
static int sdhci_cmdq_crypto_cfg(struct mmc_host *mmc,
		struct mmc_request *mrq, u32 slot)
{
	struct sdhci_host *host = mmc_priv(mmc);

	if (!host->is_crypto_en)
		return 0;

	return sdhci_crypto_cfg(host, mrq, slot);
}
#else
static void sdhci_cmdq_clear_set_irqs(struct mmc_host *mmc, bool clear)
{
@@ -3489,7 +3499,11 @@ static void sdhci_cmdq_clear_set_dumpregs(struct mmc_host *mmc, bool set)
{

}

static int sdhci_cmdq_crypto_cfg(struct mmc_host *mmc,
		struct mmc_request *mrq, u32 slot)
{
	return 0;
}
#endif

static const struct cmdq_host_ops sdhci_cmdq_ops = {
@@ -3498,6 +3512,7 @@ static const struct cmdq_host_ops sdhci_cmdq_ops = {
	.dump_vendor_regs = sdhci_cmdq_dump_vendor_regs,
	.set_block_size = sdhci_cmdq_set_block_size,
	.clear_set_dumpregs = sdhci_cmdq_clear_set_dumpregs,
	.crypto_cfg	= sdhci_cmdq_crypto_cfg,
};

int sdhci_add_host(struct sdhci_host *host)