diff options
author | Mark A. Greer <mgreer@animalcreek.com> | 2013-01-08 13:57:40 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2013-01-19 18:16:41 -0500 |
commit | 5946c4a5e7707d255faf430969d344ad98430b69 (patch) | |
tree | cc2efc002b1d1e4e48f4930f65bba5336202db5b /drivers/crypto/omap-aes.c | |
parent | 7219368b05bd05bd3366bfb22fc38d2dc41085e5 (diff) |
crypto: omap-aes - Convert to use pm_runtime API
Convert the omap-aes crypto driver to use the
pm_runtime API instead of the clk API.
CC: Kevin Hilman <khilman@deeprootsystems.com>
CC: Dmitry Kasatkin <dmitry.kasatkin@intel.com>
Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/omap-aes.c')
-rw-r--r-- | drivers/crypto/omap-aes.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c index 33cd78305461..c2298521388c 100644 --- a/drivers/crypto/omap-aes.c +++ b/drivers/crypto/omap-aes.c | |||
@@ -19,10 +19,10 @@ | |||
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/clk.h> | ||
23 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
24 | #include <linux/scatterlist.h> | 23 | #include <linux/scatterlist.h> |
25 | #include <linux/dma-mapping.h> | 24 | #include <linux/dma-mapping.h> |
25 | #include <linux/pm_runtime.h> | ||
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/crypto.h> | 27 | #include <linux/crypto.h> |
28 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
@@ -96,7 +96,6 @@ struct omap_aes_dev { | |||
96 | struct list_head list; | 96 | struct list_head list; |
97 | unsigned long phys_base; | 97 | unsigned long phys_base; |
98 | void __iomem *io_base; | 98 | void __iomem *io_base; |
99 | struct clk *iclk; | ||
100 | struct omap_aes_ctx *ctx; | 99 | struct omap_aes_ctx *ctx; |
101 | struct device *dev; | 100 | struct device *dev; |
102 | unsigned long flags; | 101 | unsigned long flags; |
@@ -167,7 +166,7 @@ static int omap_aes_hw_init(struct omap_aes_dev *dd) | |||
167 | * It may be long delays between requests. | 166 | * It may be long delays between requests. |
168 | * Device might go to off mode to save power. | 167 | * Device might go to off mode to save power. |
169 | */ | 168 | */ |
170 | clk_enable(dd->iclk); | 169 | pm_runtime_get_sync(dd->dev); |
171 | 170 | ||
172 | if (!(dd->flags & FLAGS_INIT)) { | 171 | if (!(dd->flags & FLAGS_INIT)) { |
173 | dd->flags |= FLAGS_INIT; | 172 | dd->flags |= FLAGS_INIT; |
@@ -518,7 +517,7 @@ static void omap_aes_finish_req(struct omap_aes_dev *dd, int err) | |||
518 | 517 | ||
519 | pr_debug("err: %d\n", err); | 518 | pr_debug("err: %d\n", err); |
520 | 519 | ||
521 | clk_disable(dd->iclk); | 520 | pm_runtime_put_sync(dd->dev); |
522 | dd->flags &= ~FLAGS_BUSY; | 521 | dd->flags &= ~FLAGS_BUSY; |
523 | 522 | ||
524 | req->base.complete(&req->base, err); | 523 | req->base.complete(&req->base, err); |
@@ -813,26 +812,21 @@ static int omap_aes_probe(struct platform_device *pdev) | |||
813 | else | 812 | else |
814 | dd->dma_in = res->start; | 813 | dd->dma_in = res->start; |
815 | 814 | ||
816 | /* Initializing the clock */ | ||
817 | dd->iclk = clk_get(dev, "ick"); | ||
818 | if (IS_ERR(dd->iclk)) { | ||
819 | dev_err(dev, "clock intialization failed.\n"); | ||
820 | err = PTR_ERR(dd->iclk); | ||
821 | goto err_res; | ||
822 | } | ||
823 | |||
824 | dd->io_base = ioremap(dd->phys_base, SZ_4K); | 815 | dd->io_base = ioremap(dd->phys_base, SZ_4K); |
825 | if (!dd->io_base) { | 816 | if (!dd->io_base) { |
826 | dev_err(dev, "can't ioremap\n"); | 817 | dev_err(dev, "can't ioremap\n"); |
827 | err = -ENOMEM; | 818 | err = -ENOMEM; |
828 | goto err_io; | 819 | goto err_res; |
829 | } | 820 | } |
830 | 821 | ||
831 | clk_enable(dd->iclk); | 822 | pm_runtime_enable(dev); |
823 | pm_runtime_get_sync(dev); | ||
824 | |||
832 | reg = omap_aes_read(dd, AES_REG_REV); | 825 | reg = omap_aes_read(dd, AES_REG_REV); |
833 | dev_info(dev, "OMAP AES hw accel rev: %u.%u\n", | 826 | dev_info(dev, "OMAP AES hw accel rev: %u.%u\n", |
834 | (reg & AES_REG_REV_MAJOR) >> 4, reg & AES_REG_REV_MINOR); | 827 | (reg & AES_REG_REV_MAJOR) >> 4, reg & AES_REG_REV_MINOR); |
835 | clk_disable(dd->iclk); | 828 | |
829 | pm_runtime_put_sync(dev); | ||
836 | 830 | ||
837 | tasklet_init(&dd->done_task, omap_aes_done_task, (unsigned long)dd); | 831 | tasklet_init(&dd->done_task, omap_aes_done_task, (unsigned long)dd); |
838 | tasklet_init(&dd->queue_task, omap_aes_queue_task, (unsigned long)dd); | 832 | tasklet_init(&dd->queue_task, omap_aes_queue_task, (unsigned long)dd); |
@@ -862,8 +856,7 @@ err_dma: | |||
862 | tasklet_kill(&dd->done_task); | 856 | tasklet_kill(&dd->done_task); |
863 | tasklet_kill(&dd->queue_task); | 857 | tasklet_kill(&dd->queue_task); |
864 | iounmap(dd->io_base); | 858 | iounmap(dd->io_base); |
865 | err_io: | 859 | pm_runtime_disable(dev); |
866 | clk_put(dd->iclk); | ||
867 | err_res: | 860 | err_res: |
868 | kfree(dd); | 861 | kfree(dd); |
869 | dd = NULL; | 862 | dd = NULL; |
@@ -891,7 +884,7 @@ static int omap_aes_remove(struct platform_device *pdev) | |||
891 | tasklet_kill(&dd->queue_task); | 884 | tasklet_kill(&dd->queue_task); |
892 | omap_aes_dma_cleanup(dd); | 885 | omap_aes_dma_cleanup(dd); |
893 | iounmap(dd->io_base); | 886 | iounmap(dd->io_base); |
894 | clk_put(dd->iclk); | 887 | pm_runtime_disable(dd->dev); |
895 | kfree(dd); | 888 | kfree(dd); |
896 | dd = NULL; | 889 | dd = NULL; |
897 | 890 | ||