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

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

Merge "mmc: sdhci-msm-ice: Add new sdhci host_op for updating ice config"

parents 060a26bc dec5880f
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -312,6 +312,42 @@ int sdhci_msm_ice_cfg(struct sdhci_host *host, struct mmc_request *mrq,
	return 0;
}

int sdhci_msm_ice_cmdq_cfg(struct sdhci_host *host,
			struct mmc_request *mrq, u32 slot, u64 *ice_ctx)
{
	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
	struct sdhci_msm_host *msm_host = pltfm_host->priv;
	int err = 0;
	short key_index;
	sector_t lba = 0;
	unsigned int bypass = SDHCI_MSM_ICE_ENABLE_BYPASS;
	struct request *req;

	if (msm_host->ice.state != SDHCI_MSM_ICE_STATE_ACTIVE) {
		pr_err("%s: ice is in invalid state %d\n",
			mmc_hostname(host->mmc), msm_host->ice.state);
		return -EINVAL;
	}

	WARN_ON(!mrq);
	if (!mrq)
		return -EINVAL;
	req = mrq->req;
	if (req) {
		lba = req->__sector;
		err = sdhci_msm_ice_get_cfg(msm_host, req, &bypass, &key_index);
		if (err)
			return err;
		pr_debug("%s: %s: slot %d bypass %d key_index %d\n",
				mmc_hostname(host->mmc),
				(rq_data_dir(req) == WRITE) ? "WRITE" : "READ",
				slot, bypass, key_index);
	}

	sdhci_msm_ice_update_cfg(host, lba, slot, bypass, key_index);
	return 0;
}

int sdhci_msm_ice_reset(struct sdhci_host *host)
{
	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+7 −0
Original line number Diff line number Diff line
@@ -99,6 +99,8 @@ int sdhci_msm_ice_init(struct sdhci_host *host);
void sdhci_msm_ice_cfg_reset(struct sdhci_host *host, u32 slot);
int sdhci_msm_ice_cfg(struct sdhci_host *host, struct mmc_request *mrq,
			u32 slot);
int sdhci_msm_ice_cmdq_cfg(struct sdhci_host *host,
			struct mmc_request *mrq, u32 slot, u64 *ice_ctx);
int sdhci_msm_ice_reset(struct sdhci_host *host);
int sdhci_msm_ice_resume(struct sdhci_host *host);
int sdhci_msm_ice_suspend(struct sdhci_host *host);
@@ -130,6 +132,11 @@ inline int sdhci_msm_ice_cfg(struct sdhci_host *host,
{
	return 0;
}
static inline int sdhci_msm_ice_cmdq_cfg(struct sdhci_host *host,
		struct mmc_request *mrq, u32 slot, u64 *ice_ctx)
{
	return 0;
}
inline int sdhci_msm_ice_reset(struct sdhci_host *host)
{
	return 0;
+2 −0
Original line number Diff line number Diff line
@@ -4115,6 +4115,8 @@ static unsigned int sdhci_msm_get_current_limit(struct sdhci_host *host)

static struct sdhci_ops sdhci_msm_ops = {
	.crypto_engine_cfg = sdhci_msm_ice_cfg,
	.crypto_engine_cmdq_cfg = sdhci_msm_ice_cmdq_cfg,
	.crypto_cfg_reset = sdhci_msm_ice_cfg_reset,
	.crypto_engine_reset = sdhci_msm_ice_reset,
	.set_uhs_signaling = sdhci_msm_set_uhs_signaling,
	.check_power_status = sdhci_msm_check_power_status,
+21 −1
Original line number Diff line number Diff line
@@ -3778,11 +3778,31 @@ static int sdhci_cmdq_crypto_cfg(struct mmc_host *mmc,
		struct mmc_request *mrq, u32 slot)
{
	struct sdhci_host *host = mmc_priv(mmc);
	int err = 0;

	if (!host->is_crypto_en)
		return 0;

	return sdhci_crypto_cfg(host, mrq, slot);
	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_cmdq_cfg) {
		err = host->ops->crypto_engine_cmdq_cfg(host, mrq, slot, NULL);
		if (err) {
			pr_err("%s: failed to configure crypto\n",
					mmc_hostname(host->mmc));
			goto out;
		}
	}
out:
	return err;
}

static void sdhci_cmdq_crypto_cfg_reset(struct mmc_host *mmc, unsigned int slot)
+2 −0
Original line number Diff line number Diff line
@@ -671,6 +671,8 @@ struct sdhci_ops {
	int	(*platform_execute_tuning)(struct sdhci_host *host, u32 opcode);
	int	(*crypto_engine_cfg)(struct sdhci_host *host,
				struct mmc_request *mrq, u32 slot);
	int	(*crypto_engine_cmdq_cfg)(struct sdhci_host *host,
			struct mmc_request *mrq, u32 slot, u64 *ice_ctx);
	int	(*crypto_engine_reset)(struct sdhci_host *host);
	void	(*crypto_cfg_reset)(struct sdhci_host *host, unsigned int slot);
	void	(*set_uhs_signaling)(struct sdhci_host *host, unsigned int uhs);