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

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

Merge "crypto: ice: split the config callback"

parents 6356fc2f 149b76de
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -1363,8 +1363,9 @@ static int qcom_ice_reset(struct platform_device *pdev)
	return qcom_ice_finish_power_collapse(ice_dev);
}

static int qcom_ice_config(struct platform_device *pdev, struct request *req,
		struct ice_data_setting *setting)
static int qcom_ice_config_start(struct platform_device *pdev,
		struct request *req,
		struct ice_data_setting *setting, bool async)
{
	struct ice_crypto_setting *crypto_data;
	struct ice_crypto_setting pfk_crypto_data = {0};
@@ -1392,7 +1393,7 @@ static int qcom_ice_config(struct platform_device *pdev, struct request *req,
		return 0;
	}

	ret = pfk_load_key_start(req->bio, &pfk_crypto_data, &is_pfe, false);
	ret = pfk_load_key_start(req->bio, &pfk_crypto_data, &is_pfe, async);
	if (is_pfe) {
		if (ret) {
			if (ret != -EBUSY && ret != -EAGAIN)
@@ -1436,6 +1437,7 @@ static int qcom_ice_config(struct platform_device *pdev, struct request *req,
	 */
	return 0;
}
EXPORT_SYMBOL(qcom_ice_config_start);

static int qcom_ice_config_end(struct request *req)
{
@@ -1497,7 +1499,7 @@ struct qcom_ice_variant_ops qcom_ice_ops = {
	.reset            = qcom_ice_reset,
	.resume           = qcom_ice_resume,
	.suspend          = qcom_ice_suspend,
	.config		  = qcom_ice_config,
	.config_start     = qcom_ice_config_start,
	.config_end       = qcom_ice_config_end,
	.status           = qcom_ice_status,
	.debug            = qcom_ice_debug,
+6 −5
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -102,7 +102,7 @@ int sdhci_msm_ice_init(struct sdhci_host *host)
	struct sdhci_msm_host *msm_host = pltfm_host->priv;
	int err = 0;

	if (msm_host->ice.vops->config) {
	if (msm_host->ice.vops->init) {
		err = msm_host->ice.vops->init(msm_host->ice.pdev,
					msm_host,
					sdhci_msm_ice_error_cb);
@@ -148,9 +148,10 @@ int sdhci_msm_ice_cfg(struct sdhci_host *host, struct mmc_request *mrq,
	req = mrq->req;
	if (req) {
		lba = req->__sector;
		if (msm_host->ice.vops->config) {
			err = msm_host->ice.vops->config(msm_host->ice.pdev,
							req, &ice_set);
		if (msm_host->ice.vops->config_start) {
			err = msm_host->ice.vops->config_start(
							msm_host->ice.pdev,
							req, &ice_set, false);
			if (err) {
				pr_err("%s: ice config failed %d\n",
						mmc_hostname(host->mmc), err);
+10 −9
Original line number Diff line number Diff line
@@ -226,10 +226,10 @@ int ufs_qcom_ice_req_setup(struct ufs_qcom_host *qcom_host,
		return 0;
	}

	if (qcom_host->ice.vops->config) {
	if (qcom_host->ice.vops->config_start) {
		memset(&ice_set, 0, sizeof(ice_set));
		err = qcom_host->ice.vops->config(qcom_host->ice.pdev,
			cmd->request, &ice_set);
		err = qcom_host->ice.vops->config_start(qcom_host->ice.pdev,
			cmd->request, &ice_set, true);
		if (err) {
			dev_err(qcom_host->hba->dev,
				"%s: error in ice_vops->config %d\n",
@@ -249,7 +249,8 @@ int ufs_qcom_ice_req_setup(struct ufs_qcom_host *qcom_host,
}

/**
 * ufs_qcom_ice_cfg() - configures UFS's ICE registers for an ICE transaction
 * ufs_qcom_ice_cfg_start() - starts configuring UFS's ICE registers
 *							  for an ICE transaction
 * @qcom_host:	Pointer to a UFS QCom internal host structure.
 *		qcom_host, qcom_host->hba and qcom_host->hba->dev should all
 *		be valid pointers.
@@ -259,7 +260,8 @@ int ufs_qcom_ice_req_setup(struct ufs_qcom_host *qcom_host,
 * Return: -EINVAL in-case of an error
 *         0 otherwise
 */
int ufs_qcom_ice_cfg(struct ufs_qcom_host *qcom_host, struct scsi_cmnd *cmd)
int ufs_qcom_ice_cfg_start(struct ufs_qcom_host *qcom_host,
		struct scsi_cmnd *cmd)
{
	struct device *dev = qcom_host->hba->dev;
	int err = 0;
@@ -294,10 +296,9 @@ int ufs_qcom_ice_cfg(struct ufs_qcom_host *qcom_host, struct scsi_cmnd *cmd)
	}

	memset(&ice_set, 0, sizeof(ice_set));
	if (qcom_host->ice.vops->config) {
		err = qcom_host->ice.vops->config(qcom_host->ice.pdev,
							req, &ice_set);

	if (qcom_host->ice.vops->config_start) {
		err = qcom_host->ice.vops->config_start(qcom_host->ice.pdev,
							req, &ice_set, true);
		if (err) {
			dev_err(dev, "%s: error in ice_vops->config %d\n",
				__func__, err);
+12 −4
Original line number Diff line number Diff line
/*
 * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
 * Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -74,7 +74,10 @@ int ufs_qcom_ice_get_dev(struct ufs_qcom_host *qcom_host);
int ufs_qcom_ice_init(struct ufs_qcom_host *qcom_host);
int ufs_qcom_ice_req_setup(struct ufs_qcom_host *qcom_host,
			   struct scsi_cmnd *cmd, u8 *cc_index, bool *enable);
int ufs_qcom_ice_cfg(struct ufs_qcom_host *qcom_host, struct scsi_cmnd *cmd);
int ufs_qcom_ice_cfg_start(struct ufs_qcom_host *qcom_host,
		struct scsi_cmnd *cmd);
int ufs_qcom_ice_cfg_end(struct ufs_qcom_host *qcom_host,
		struct request *req);
int ufs_qcom_ice_reset(struct ufs_qcom_host *qcom_host);
int ufs_qcom_ice_resume(struct ufs_qcom_host *qcom_host);
int ufs_qcom_ice_suspend(struct ufs_qcom_host *qcom_host);
@@ -93,11 +96,16 @@ inline int ufs_qcom_ice_init(struct ufs_qcom_host *qcom_host)
{
	return 0;
}
inline int ufs_qcom_ice_cfg(struct ufs_qcom_host *qcom_host,
inline int ufs_qcom_ice_cfg_start(struct ufs_qcom_host *qcom_host,
					struct scsi_cmnd *cmd)
{
	return 0;
}
inline int ufs_qcom_ice_cfg_end(struct ufs_qcom_host *qcom_host,
					struct request *req)
{
	return 0;
}
inline int ufs_qcom_ice_reset(struct ufs_qcom_host *qcom_host)
{
	return 0;
+19 −3
Original line number Diff line number Diff line
@@ -702,7 +702,7 @@ static int ufs_qcom_crypto_req_setup(struct ufs_hba *hba,
}

static
int ufs_qcom_crytpo_engine_cfg(struct ufs_hba *hba, unsigned int task_tag)
int ufs_qcom_crytpo_engine_cfg_start(struct ufs_hba *hba, unsigned int task_tag)
{
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
	struct ufshcd_lrb *lrbp = &hba->lrb[task_tag];
@@ -712,7 +712,22 @@ int ufs_qcom_crytpo_engine_cfg(struct ufs_hba *hba, unsigned int task_tag)
	    !lrbp->cmd || lrbp->command_type != UTP_CMD_TYPE_SCSI)
		goto out;

	err = ufs_qcom_ice_cfg(host, lrbp->cmd);
	err = ufs_qcom_ice_cfg_start(host, lrbp->cmd);
out:
	return err;
}

static
int ufs_qcom_crytpo_engine_cfg_end(struct ufs_hba *hba,
		struct ufshcd_lrb *lrbp, struct request *req)
{
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
	int err = 0;

	if (!host->ice.pdev || lrbp->command_type != UTP_CMD_TYPE_SCSI)
		goto out;

	err = ufs_qcom_ice_cfg_end(host, req);
out:
	return err;
}
@@ -2330,7 +2345,8 @@ static struct ufs_hba_variant_ops ufs_hba_qcom_vops = {

static struct ufs_hba_crypto_variant_ops ufs_hba_crypto_variant_ops = {
	.crypto_req_setup	= ufs_qcom_crypto_req_setup,
	.crypto_engine_cfg	  = ufs_qcom_crytpo_engine_cfg,
	.crypto_engine_cfg_start	= ufs_qcom_crytpo_engine_cfg_start,
	.crypto_engine_cfg_end	= ufs_qcom_crytpo_engine_cfg_end,
	.crypto_engine_reset	  = ufs_qcom_crytpo_engine_reset,
	.crypto_engine_get_status = ufs_qcom_crypto_engine_get_status,
};
Loading