summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoakim Bech <joakim.xx.bech@stericsson.com>2011-05-30 12:32:36 +0200
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 11:04:36 +0200
commit2632694663e15811bdda9389dc9c38e3dd249879 (patch)
treebd7955d3ef3a2eb41dd3d6e6143ecf33fa3ff5bf
parent1a2d5912e3212adcf88c7d51bd6d16e7c6389aef (diff)
ux500: cryp: Remove register access
Remove unnecessary call to function cryp_configure_for_dma when running in CPU mode only (we will gain performance by not calling this function, since it read and write to registers in the crypto hardware). ST-Ericsson ID: 343001 ST-Ericsson Linux next: Not tested, ER 320876 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: Ie5e99d2f96e6c9218ec767a76eb65a6683ad17dd Signed-off-by: Joakim Bech <joakim.xx.bech@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/24150 Reviewed-by: QATEST Reviewed-by: QATOOLS Reviewed-by: Berne HEBARK <berne.hebark@stericsson.com>
-rw-r--r--drivers/crypto/ux500/cryp/cryp.c7
-rw-r--r--drivers/crypto/ux500/cryp/cryp.h3
-rw-r--r--drivers/crypto/ux500/cryp/cryp_core.c7
3 files changed, 11 insertions, 6 deletions
diff --git a/drivers/crypto/ux500/cryp/cryp.c b/drivers/crypto/ux500/cryp/cryp.c
index f627c57d9bd..30318817b18 100644
--- a/drivers/crypto/ux500/cryp/cryp.c
+++ b/drivers/crypto/ux500/cryp/cryp.c
@@ -274,7 +274,8 @@ int cryp_configure_init_vector(struct cryp_device_data *device_data,
* @ctx: Crypto device context
*/
void cryp_save_device_context(struct cryp_device_data *device_data,
- struct cryp_device_context *ctx)
+ struct cryp_device_context *ctx,
+ int cryp_mode)
{
enum cryp_algo_mode algomode;
struct cryp_register *src_reg = device_data->base;
@@ -287,7 +288,9 @@ void cryp_save_device_context(struct cryp_device_data *device_data,
*/
cryp_activity(device_data, CRYP_CRYPEN_DISABLE);
cryp_wait_until_done(device_data);
- cryp_configure_for_dma(device_data, CRYP_DMA_DISABLE_BOTH);
+
+ if (cryp_mode == CRYP_MODE_DMA)
+ cryp_configure_for_dma(device_data, CRYP_DMA_DISABLE_BOTH);
if (CRYP_TEST_BITS(&src_reg->sr, CRYP_SR_IFEM_MASK) == 0)
ctx->din = readl(&src_reg->din);
diff --git a/drivers/crypto/ux500/cryp/cryp.h b/drivers/crypto/ux500/cryp/cryp.h
index 36835a3982e..df2e25d4671 100644
--- a/drivers/crypto/ux500/cryp/cryp.h
+++ b/drivers/crypto/ux500/cryp/cryp.h
@@ -278,7 +278,8 @@ int cryp_configure_protection(struct cryp_device_data *device_data,
/* Power management funtions */
void cryp_save_device_context(struct cryp_device_data *device_data,
- struct cryp_device_context *ctx);
+ struct cryp_device_context *ctx,
+ int cryp_mode);
void cryp_restore_device_context(struct cryp_device_data *device_data,
struct cryp_device_context *ctx);
diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c
index 9cbfc63ba2b..0276501831a 100644
--- a/drivers/crypto/ux500/cryp/cryp_core.c
+++ b/drivers/crypto/ux500/cryp/cryp_core.c
@@ -670,7 +670,8 @@ static int cryp_disable_power(struct device *dev,
spin_lock(&device_data->ctx_lock);
if (save_device_context && device_data->current_ctx) {
cryp_save_device_context(device_data,
- &device_data->current_ctx->dev_ctx);
+ &device_data->current_ctx->dev_ctx,
+ cryp_mode);
device_data->restore_dev_ctx = true;
}
spin_unlock(&device_data->ctx_lock);
@@ -788,7 +789,7 @@ static int hw_crypt_noxts(struct cryp_ctx *ctx,
goto out;
}
- cryp_save_device_context(device_data, &ctx->dev_ctx);
+ cryp_save_device_context(device_data, &ctx->dev_ctx, cryp_mode);
ctx->updated = 1;
out:
@@ -856,7 +857,7 @@ static int ablk_dma_crypt(struct ablkcipher_request *areq)
wait_for_completion(&ctx->device->dma.cryp_dma_complete);
cryp_dma_done(ctx);
- cryp_save_device_context(device_data, &ctx->dev_ctx);
+ cryp_save_device_context(device_data, &ctx->dev_ctx, cryp_mode);
ctx->updated = 1;
out_power: