From 2632694663e15811bdda9389dc9c38e3dd249879 Mon Sep 17 00:00:00 2001 From: Joakim Bech Date: Mon, 30 May 2011 12:32:36 +0200 Subject: 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 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/24150 Reviewed-by: QATEST Reviewed-by: QATOOLS Reviewed-by: Berne HEBARK --- drivers/crypto/ux500/cryp/cryp.c | 7 +++++-- drivers/crypto/ux500/cryp/cryp.h | 3 ++- drivers/crypto/ux500/cryp/cryp_core.c | 7 ++++--- 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: -- cgit v1.2.3