From b2c36ddc22d2dc68ae27452bf6480baf7cc9b039 Mon Sep 17 00:00:00 2001 From: Dinesh K Garg Date: Mon, 26 Oct 2015 11:40:37 -0700 Subject: crypto: ice: Make ICE init & reset API synchronous ICE init & reset can be synchronous now because ICE does not need to go to secure side for any ICE configuration. This would simplify interface and make call more efficient. Change-Id: I7aa4e2d3ba3383d25758b21b8ae261a0220f35f9 Signed-off-by: Dinesh K Garg Signed-off-by: Subhash Jadavani Signed-off-by: Gilad Broner [venkatg@codeaurora.org: dropped ice driver and mmc ice changes] Signed-off-by: Venkat Gopalakrishnan --- drivers/scsi/ufs/ufs-qcom-ice.c | 68 +++-------------------------------------- drivers/scsi/ufs/ufs-qcom.h | 1 - 2 files changed, 5 insertions(+), 64 deletions(-) diff --git a/drivers/scsi/ufs/ufs-qcom-ice.c b/drivers/scsi/ufs/ufs-qcom-ice.c index d8d5ebf7e47c..37af20ed7955 100644 --- a/drivers/scsi/ufs/ufs-qcom-ice.c +++ b/drivers/scsi/ufs/ufs-qcom-ice.c @@ -13,7 +13,6 @@ #include #include -#include #include #include @@ -53,26 +52,10 @@ void ufs_qcom_ice_print_regs(struct ufs_qcom_host *qcom_host) pr_err("REG_UFS_QCOM_ICE_CTRL_INFO_2_%d = 0x%08X\n", i, ufshcd_readl(qcom_host->hba, (REG_UFS_QCOM_ICE_CTRL_INFO_2_n + 8 * i))); - } } -static void ufs_qcom_ice_success_cb(void *host_ctrl, - enum ice_event_completion evt) -{ - struct ufs_qcom_host *qcom_host = (struct ufs_qcom_host *)host_ctrl; - - if (qcom_host->ice.state == UFS_QCOM_ICE_STATE_DISABLED && - evt == ICE_INIT_COMPLETION) - qcom_host->ice.state = UFS_QCOM_ICE_STATE_ACTIVE; - else if (qcom_host->ice.state == UFS_QCOM_ICE_STATE_SUSPENDED && - evt == ICE_RESUME_COMPLETION) - qcom_host->ice.state = UFS_QCOM_ICE_STATE_ACTIVE; - - complete(&qcom_host->ice.async_done); -} - static void ufs_qcom_ice_error_cb(void *host_ctrl, enum ice_error_code evt) { struct ufs_qcom_host *qcom_host = (struct ufs_qcom_host *)host_ctrl; @@ -82,8 +65,6 @@ static void ufs_qcom_ice_error_cb(void *host_ctrl, enum ice_error_code evt) if (qcom_host->ice.state == UFS_QCOM_ICE_STATE_ACTIVE) qcom_host->ice.state = UFS_QCOM_ICE_STATE_DISABLED; - - complete(&qcom_host->ice.async_done); } static struct platform_device *ufs_qcom_ice_get_pdevice(struct device *ufs_dev) @@ -195,33 +176,17 @@ out: int ufs_qcom_ice_init(struct ufs_qcom_host *qcom_host) { struct device *ufs_dev = qcom_host->hba->dev; - int err = -EINVAL; + int err; - init_completion(&qcom_host->ice.async_done); err = qcom_host->ice.vops->init(qcom_host->ice.pdev, qcom_host, - ufs_qcom_ice_success_cb, ufs_qcom_ice_error_cb); if (err) { dev_err(ufs_dev, "%s: ice init failed. err = %d\n", __func__, err); goto out; - } - - if (!wait_for_completion_timeout(&qcom_host->ice.async_done, - msecs_to_jiffies(UFS_QCOM_ICE_COMPLETION_TIMEOUT_MS))) { - dev_err(qcom_host->hba->dev, - "%s: error. got timeout after %d ms\n", - __func__, UFS_QCOM_ICE_COMPLETION_TIMEOUT_MS); - err = -ETIMEDOUT; - goto out; - } - - if (qcom_host->ice.state != UFS_QCOM_ICE_STATE_ACTIVE) { - dev_err(qcom_host->hba->dev, - "%s: error. ice.state (%d) is not in active state\n", - __func__, qcom_host->ice.state); - err = -EINVAL; + } else { + qcom_host->ice.state = UFS_QCOM_ICE_STATE_ACTIVE; } qcom_host->dbg_print_en |= UFS_QCOM_ICE_DEFAULT_DBG_PRINT_EN; @@ -390,8 +355,6 @@ int ufs_qcom_ice_reset(struct ufs_qcom_host *qcom_host) if (qcom_host->ice.state != UFS_QCOM_ICE_STATE_ACTIVE) goto out; - init_completion(&qcom_host->ice.async_done); - if (qcom_host->ice.vops->reset) { err = qcom_host->ice.vops->reset(qcom_host->ice.pdev); if (err) { @@ -401,14 +364,6 @@ int ufs_qcom_ice_reset(struct ufs_qcom_host *qcom_host) } } - if (!wait_for_completion_timeout(&qcom_host->ice.async_done, - msecs_to_jiffies(UFS_QCOM_ICE_COMPLETION_TIMEOUT_MS))) { - dev_err(dev, - "%s: error. got timeout after %d ms\n", - __func__, UFS_QCOM_ICE_COMPLETION_TIMEOUT_MS); - err = -ETIMEDOUT; - } - if (qcom_host->ice.state != UFS_QCOM_ICE_STATE_ACTIVE) { dev_err(qcom_host->hba->dev, "%s: error. ice.state (%d) is not in active state\n", @@ -450,28 +405,15 @@ int ufs_qcom_ice_resume(struct ufs_qcom_host *qcom_host) return -EINVAL; } - init_completion(&qcom_host->ice.async_done); - if (qcom_host->ice.vops->resume) { err = qcom_host->ice.vops->resume(qcom_host->ice.pdev); if (err) { dev_err(dev, "%s: ice_vops->resume failed. err %d\n", __func__, err); - return -EINVAL; + return err; } } - - if (!wait_for_completion_timeout(&qcom_host->ice.async_done, - msecs_to_jiffies(UFS_QCOM_ICE_COMPLETION_TIMEOUT_MS))) { - dev_err(dev, - "%s: error. got timeout after %d ms\n", - __func__, UFS_QCOM_ICE_COMPLETION_TIMEOUT_MS); - err = -ETIMEDOUT; - goto out; - } - - if (qcom_host->ice.state != UFS_QCOM_ICE_STATE_ACTIVE) - err = -EINVAL; + qcom_host->ice.state = UFS_QCOM_ICE_STATE_ACTIVE; out: return err; } diff --git a/drivers/scsi/ufs/ufs-qcom.h b/drivers/scsi/ufs/ufs-qcom.h index 956ee8a9c13f..9db2c327e4b7 100644 --- a/drivers/scsi/ufs/ufs-qcom.h +++ b/drivers/scsi/ufs/ufs-qcom.h @@ -209,7 +209,6 @@ struct ufs_qcom_bus_vote { */ struct ufs_qcom_ice_data { struct qcom_ice_variant_ops *vops; - struct completion async_done; struct platform_device *pdev; int state; -- cgit v1.2.3