mmc: sdhci-msm-ice: Add new sdhci host_op for updating ice config
Add new sdhci host_op for updating ice configuration while sending request through cmdq. Adding provision for supporting the ice context configuration for ICE HCI. Change-Id: I0e7299cfb1064c117aa94fb2416cc5cc4f1ec5f6 Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
This commit is contained in:
parent
0a8547207f
commit
a60300ce47
5 changed files with 67 additions and 1 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
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;
|
||||
|
|
|
@ -3997,6 +3997,7 @@ 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,
|
||||
|
|
|
@ -3635,11 +3635,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)
|
||||
|
|
|
@ -657,6 +657,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);
|
||||
|
|
Loading…
Add table
Reference in a new issue