crypto: rockchip - do not do custom power management
[ Upstream commit c50ef1411c8cbad0c7db100c477126076b6e3348 ]
The clock enable/disable at tfm init/exit is fragile,
if 2 tfm are init in the same time and one is removed just after,
it will leave the hardware uncloked even if a user remains.
Instead simply enable clocks at probe time.
We will do PM later.
Fixes: ce0183cb64
("crypto: rockchip - switch to skcipher API")
Reviewed-by: John Keeping <john@metanate.com>
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
f1acf7e693
commit
a13c0ff862
@@ -395,8 +395,7 @@ static int rk_crypto_probe(struct platform_device *pdev)
|
|||||||
rk_crypto_done_task_cb, (unsigned long)crypto_info);
|
rk_crypto_done_task_cb, (unsigned long)crypto_info);
|
||||||
crypto_init_queue(&crypto_info->queue, 50);
|
crypto_init_queue(&crypto_info->queue, 50);
|
||||||
|
|
||||||
crypto_info->enable_clk = rk_crypto_enable_clk;
|
rk_crypto_enable_clk(crypto_info);
|
||||||
crypto_info->disable_clk = rk_crypto_disable_clk;
|
|
||||||
crypto_info->load_data = rk_load_data;
|
crypto_info->load_data = rk_load_data;
|
||||||
crypto_info->unload_data = rk_unload_data;
|
crypto_info->unload_data = rk_unload_data;
|
||||||
crypto_info->enqueue = rk_crypto_enqueue;
|
crypto_info->enqueue = rk_crypto_enqueue;
|
||||||
@@ -423,6 +422,7 @@ static int rk_crypto_remove(struct platform_device *pdev)
|
|||||||
struct rk_crypto_info *crypto_tmp = platform_get_drvdata(pdev);
|
struct rk_crypto_info *crypto_tmp = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
rk_crypto_unregister();
|
rk_crypto_unregister();
|
||||||
|
rk_crypto_disable_clk(crypto_tmp);
|
||||||
tasklet_kill(&crypto_tmp->done_task);
|
tasklet_kill(&crypto_tmp->done_task);
|
||||||
tasklet_kill(&crypto_tmp->queue_task);
|
tasklet_kill(&crypto_tmp->queue_task);
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -219,8 +219,6 @@ struct rk_crypto_info {
|
|||||||
int (*start)(struct rk_crypto_info *dev);
|
int (*start)(struct rk_crypto_info *dev);
|
||||||
int (*update)(struct rk_crypto_info *dev);
|
int (*update)(struct rk_crypto_info *dev);
|
||||||
void (*complete)(struct crypto_async_request *base, int err);
|
void (*complete)(struct crypto_async_request *base, int err);
|
||||||
int (*enable_clk)(struct rk_crypto_info *dev);
|
|
||||||
void (*disable_clk)(struct rk_crypto_info *dev);
|
|
||||||
int (*load_data)(struct rk_crypto_info *dev,
|
int (*load_data)(struct rk_crypto_info *dev,
|
||||||
struct scatterlist *sg_src,
|
struct scatterlist *sg_src,
|
||||||
struct scatterlist *sg_dst);
|
struct scatterlist *sg_dst);
|
||||||
|
@@ -301,7 +301,7 @@ static int rk_cra_hash_init(struct crypto_tfm *tfm)
|
|||||||
sizeof(struct rk_ahash_rctx) +
|
sizeof(struct rk_ahash_rctx) +
|
||||||
crypto_ahash_reqsize(tctx->fallback_tfm));
|
crypto_ahash_reqsize(tctx->fallback_tfm));
|
||||||
|
|
||||||
return tctx->dev->enable_clk(tctx->dev);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rk_cra_hash_exit(struct crypto_tfm *tfm)
|
static void rk_cra_hash_exit(struct crypto_tfm *tfm)
|
||||||
@@ -309,7 +309,6 @@ static void rk_cra_hash_exit(struct crypto_tfm *tfm)
|
|||||||
struct rk_ahash_ctx *tctx = crypto_tfm_ctx(tfm);
|
struct rk_ahash_ctx *tctx = crypto_tfm_ctx(tfm);
|
||||||
|
|
||||||
free_page((unsigned long)tctx->dev->addr_vir);
|
free_page((unsigned long)tctx->dev->addr_vir);
|
||||||
return tctx->dev->disable_clk(tctx->dev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct rk_crypto_tmp rk_ahash_sha1 = {
|
struct rk_crypto_tmp rk_ahash_sha1 = {
|
||||||
|
@@ -388,8 +388,10 @@ static int rk_ablk_init_tfm(struct crypto_skcipher *tfm)
|
|||||||
ctx->dev->update = rk_ablk_rx;
|
ctx->dev->update = rk_ablk_rx;
|
||||||
ctx->dev->complete = rk_crypto_complete;
|
ctx->dev->complete = rk_crypto_complete;
|
||||||
ctx->dev->addr_vir = (char *)__get_free_page(GFP_KERNEL);
|
ctx->dev->addr_vir = (char *)__get_free_page(GFP_KERNEL);
|
||||||
|
if (!ctx->dev->addr_vir)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
return ctx->dev->addr_vir ? ctx->dev->enable_clk(ctx->dev) : -ENOMEM;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rk_ablk_exit_tfm(struct crypto_skcipher *tfm)
|
static void rk_ablk_exit_tfm(struct crypto_skcipher *tfm)
|
||||||
@@ -397,7 +399,6 @@ static void rk_ablk_exit_tfm(struct crypto_skcipher *tfm)
|
|||||||
struct rk_cipher_ctx *ctx = crypto_skcipher_ctx(tfm);
|
struct rk_cipher_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||||
|
|
||||||
free_page((unsigned long)ctx->dev->addr_vir);
|
free_page((unsigned long)ctx->dev->addr_vir);
|
||||||
ctx->dev->disable_clk(ctx->dev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct rk_crypto_tmp rk_ecb_aes_alg = {
|
struct rk_crypto_tmp rk_ecb_aes_alg = {
|
||||||
|
Reference in New Issue
Block a user