aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto/omap-aes.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/crypto/omap-aes.c')
-rw-r--r--drivers/crypto/omap-aes.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
index ee15b0f7849a..5f7980586850 100644
--- a/drivers/crypto/omap-aes.c
+++ b/drivers/crypto/omap-aes.c
@@ -203,13 +203,6 @@ static void omap_aes_write_n(struct omap_aes_dev *dd, u32 offset,
203 203
204static int omap_aes_hw_init(struct omap_aes_dev *dd) 204static int omap_aes_hw_init(struct omap_aes_dev *dd)
205{ 205{
206 /*
207 * clocks are enabled when request starts and disabled when finished.
208 * It may be long delays between requests.
209 * Device might go to off mode to save power.
210 */
211 pm_runtime_get_sync(dd->dev);
212
213 if (!(dd->flags & FLAGS_INIT)) { 206 if (!(dd->flags & FLAGS_INIT)) {
214 dd->flags |= FLAGS_INIT; 207 dd->flags |= FLAGS_INIT;
215 dd->err = 0; 208 dd->err = 0;
@@ -636,7 +629,6 @@ static void omap_aes_finish_req(struct omap_aes_dev *dd, int err)
636 629
637 pr_debug("err: %d\n", err); 630 pr_debug("err: %d\n", err);
638 631
639 pm_runtime_put(dd->dev);
640 dd->flags &= ~FLAGS_BUSY; 632 dd->flags &= ~FLAGS_BUSY;
641 633
642 req->base.complete(&req->base, err); 634 req->base.complete(&req->base, err);
@@ -837,8 +829,16 @@ static int omap_aes_ctr_decrypt(struct ablkcipher_request *req)
837 829
838static int omap_aes_cra_init(struct crypto_tfm *tfm) 830static int omap_aes_cra_init(struct crypto_tfm *tfm)
839{ 831{
840 pr_debug("enter\n"); 832 struct omap_aes_dev *dd = NULL;
833
834 /* Find AES device, currently picks the first device */
835 spin_lock_bh(&list_lock);
836 list_for_each_entry(dd, &dev_list, list) {
837 break;
838 }
839 spin_unlock_bh(&list_lock);
841 840
841 pm_runtime_get_sync(dd->dev);
842 tfm->crt_ablkcipher.reqsize = sizeof(struct omap_aes_reqctx); 842 tfm->crt_ablkcipher.reqsize = sizeof(struct omap_aes_reqctx);
843 843
844 return 0; 844 return 0;
@@ -846,7 +846,16 @@ static int omap_aes_cra_init(struct crypto_tfm *tfm)
846 846
847static void omap_aes_cra_exit(struct crypto_tfm *tfm) 847static void omap_aes_cra_exit(struct crypto_tfm *tfm)
848{ 848{
849 pr_debug("enter\n"); 849 struct omap_aes_dev *dd = NULL;
850
851 /* Find AES device, currently picks the first device */
852 spin_lock_bh(&list_lock);
853 list_for_each_entry(dd, &dev_list, list) {
854 break;
855 }
856 spin_unlock_bh(&list_lock);
857
858 pm_runtime_put_sync(dd->dev);
850} 859}
851 860
852/* ********************** ALGS ************************************ */ 861/* ********************** ALGS ************************************ */
@@ -1125,10 +1134,9 @@ static int omap_aes_probe(struct platform_device *pdev)
1125 if (err) 1134 if (err)
1126 goto err_res; 1135 goto err_res;
1127 1136
1128 dd->io_base = devm_request_and_ioremap(dev, &res); 1137 dd->io_base = devm_ioremap_resource(dev, &res);
1129 if (!dd->io_base) { 1138 if (IS_ERR(dd->io_base)) {
1130 dev_err(dev, "can't ioremap\n"); 1139 err = PTR_ERR(dd->io_base);
1131 err = -ENOMEM;
1132 goto err_res; 1140 goto err_res;
1133 } 1141 }
1134 dd->phys_base = res.start; 1142 dd->phys_base = res.start;