From patchwork Wed Nov 7 02:57:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Greer X-Patchwork-Id: 1707791 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 634F2DFE75 for ; Wed, 7 Nov 2012 03:01:08 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TVvrC-0001mF-UR; Wed, 07 Nov 2012 02:59:11 +0000 Received: from mail20.dotsterhost.com ([66.11.232.73]) by merlin.infradead.org with smtps (Exim 4.76 #1 (Red Hat Linux)) id 1TVvqE-0001WN-BV for linux-arm-kernel@lists.infradead.org; Wed, 07 Nov 2012 02:58:10 +0000 Received: (qmail 13864 invoked from network); 7 Nov 2012 02:57:31 -0000 Received: from unknown (HELO blue.animalcreek.com) (mgreer@animalcreek.com@[68.3.93.7]) by 66.11.232.73 with SMTP; 7 Nov 2012 02:57:31 -0000 Received: from blue.animalcreek.com (localhost [127.0.0.1]) by blue.animalcreek.com (Postfix) with ESMTP id 86CAB65B33; Tue, 6 Nov 2012 19:57:30 -0700 (MST) From: "Mark A. Greer" To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 5/7] crypto: omap-sham: Convert to use pm_runtime API Date: Tue, 6 Nov 2012 19:57:11 -0700 Message-Id: <1352257033-32495-6-git-send-email-mgreer@animalcreek.com> X-Mailer: git-send-email 1.7.12 In-Reply-To: <1352257033-32495-1-git-send-email-mgreer@animalcreek.com> References: <1352257033-32495-1-git-send-email-mgreer@animalcreek.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121106_215810_542198_A64751A4 X-CRM114-Status: GOOD ( 12.42 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [66.11.232.73 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: paul@pwsan.com, herbert@gondor.apana.org.au, khilman@deeprootsystems.com, "Mark A. Greer" , dmitry.kasatkin@intel.com, linux-crypto@vger.kernel.org, rmk+kernel@arm.linux.org.uk, davem@davemloft.net X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: "Mark A. Greer" Convert the omap-sham crypto driver to use the pm_runtime API instead of the clk API. CC: Kevin Hilman CC: Paul Walmsley CC: Dmitry Kasatkin Signed-off-by: Mark A. Greer Acked-by: Kevin Hilman --- drivers/crypto/omap-sham.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c index a3fd6fc..85d43b2 100644 --- a/drivers/crypto/omap-sham.c +++ b/drivers/crypto/omap-sham.c @@ -22,12 +22,12 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include #include @@ -141,7 +141,6 @@ struct omap_sham_dev { struct device *dev; void __iomem *io_base; int irq; - struct clk *iclk; spinlock_t lock; int err; int dma; @@ -238,7 +237,7 @@ static void omap_sham_copy_ready_hash(struct ahash_request *req) static int omap_sham_hw_init(struct omap_sham_dev *dd) { - clk_enable(dd->iclk); + pm_runtime_get_sync(dd->dev); if (!test_bit(FLAGS_INIT, &dd->flags)) { omap_sham_write_mask(dd, SHA_REG_MASK, @@ -653,7 +652,8 @@ static void omap_sham_finish_req(struct ahash_request *req, int err) /* atomic operation is not needed here */ dd->flags &= ~(BIT(FLAGS_BUSY) | BIT(FLAGS_FINAL) | BIT(FLAGS_CPU) | BIT(FLAGS_DMA_READY) | BIT(FLAGS_OUTPUT_READY)); - clk_disable(dd->iclk); + + pm_runtime_put_sync(dd->dev); if (req->base.complete) req->base.complete(&req->base, err); @@ -1198,14 +1198,6 @@ static int __devinit omap_sham_probe(struct platform_device *pdev) if (err) goto dma_err; - /* Initializing the clock */ - dd->iclk = clk_get(dev, "ick"); - if (IS_ERR(dd->iclk)) { - dev_err(dev, "clock intialization failed.\n"); - err = PTR_ERR(dd->iclk); - goto clk_err; - } - dd->io_base = ioremap(dd->phys_base, SZ_4K); if (!dd->io_base) { dev_err(dev, "can't ioremap\n"); @@ -1213,11 +1205,14 @@ static int __devinit omap_sham_probe(struct platform_device *pdev) goto io_err; } - clk_enable(dd->iclk); + pm_runtime_enable(dev); + pm_runtime_get_sync(dev); + dev_info(dev, "hw accel on OMAP rev %u.%u\n", (omap_sham_read(dd, SHA_REG_REV) & SHA_REG_REV_MAJOR) >> 4, omap_sham_read(dd, SHA_REG_REV) & SHA_REG_REV_MINOR); - clk_disable(dd->iclk); + + pm_runtime_put_sync(&pdev->dev); spin_lock(&sham.lock); list_add_tail(&dd->list, &sham.dev_list); @@ -1235,9 +1230,8 @@ err_algs: for (j = 0; j < i; j++) crypto_unregister_ahash(&algs[j]); iounmap(dd->io_base); + pm_runtime_disable(dev); io_err: - clk_put(dd->iclk); -clk_err: omap_sham_dma_cleanup(dd); dma_err: if (dd->irq >= 0) @@ -1266,7 +1260,7 @@ static int __devexit omap_sham_remove(struct platform_device *pdev) crypto_unregister_ahash(&algs[i]); tasklet_kill(&dd->done_task); iounmap(dd->io_base); - clk_put(dd->iclk); + pm_runtime_disable(&pdev->dev); omap_sham_dma_cleanup(dd); if (dd->irq >= 0) free_irq(dd->irq, dd);