linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Baatz <gmbnomis@gmail.com>
To: phil.sutter@viprinet.com
Cc: linux-crypto@vger.kernel.org
Subject: [PATCH 2/2] ARM: Orion: mv_dma: Add support for clk
Date: Sat, 16 Jun 2012 02:20:21 +0200	[thread overview]
Message-ID: <1339806021-14271-3-git-send-email-gmbnomis@gmail.com> (raw)
In-Reply-To: <1339806021-14271-1-git-send-email-gmbnomis@gmail.com>

mv_dma needs the crypto clock. Some orion platforms support gating of the
clock.  If the clock exists enable/disable it as appropriate.

Signed-off-by: Simon Baatz <gmbnomis@gmail.com>
---
 arch/arm/mach-kirkwood/common.c |    1 +
 drivers/crypto/mv_dma.c         |   14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 560b920..e7bbc60 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -234,6 +234,7 @@ void __init kirkwood_clk_init(void)
 	orion_clkdev_add(NULL, "orion-ehci.0", usb0);
 	orion_clkdev_add(NULL, "orion_nand", runit);
 	orion_clkdev_add(NULL, "mvsdio", sdio);
+	orion_clkdev_add(NULL, "mv_tdma", crypto);
 	orion_clkdev_add(NULL, "mv_crypto", crypto);
 	orion_clkdev_add(NULL, MV_XOR_SHARED_NAME ".0", xor0);
 	orion_clkdev_add(NULL, MV_XOR_SHARED_NAME ".1", xor1);
diff --git a/drivers/crypto/mv_dma.c b/drivers/crypto/mv_dma.c
index 125dfee..9fdb7be 100644
--- a/drivers/crypto/mv_dma.c
+++ b/drivers/crypto/mv_dma.c
@@ -13,6 +13,7 @@
 #include <linux/dmapool.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
+#include <linux/clk.h>
 #include <linux/slab.h>
 #include <linux/platform_device.h>
 
@@ -36,6 +37,7 @@ struct mv_dma_priv {
 	struct device *dev;
 	void __iomem *reg;
 	int irq;
+	struct clk *clk;
 	/* protecting the dma descriptors and stuff */
 	spinlock_t lock;
 	struct dma_desclist desclist;
@@ -292,6 +294,12 @@ static int mv_init_engine(struct platform_device *pdev,
 		goto out_unmap_reg;
 	}
 
+	/* Not all platforms can gate the clock, so it is not
+	   an error if the clock does not exists. */
+	tpg.clk = clk_get(&pdev->dev, NULL);
+	if (!IS_ERR(tpg.clk))
+		clk_prepare_enable(tpg.clk);
+
 	/* initialise DMA descriptor list */
 	if (init_dma_desclist(&tpg.desclist, tpg.dev,
 			sizeof(struct mv_dma_desc), MV_DMA_ALIGN, 0)) {
@@ -343,6 +351,12 @@ static int mv_remove(struct platform_device *pdev)
 	fini_dma_desclist(&tpg.desclist);
 	free_irq(tpg.irq, &tpg);
 	iounmap(tpg.reg);
+
+	if (!IS_ERR(tpg.clk)) {
+		clk_disable_unprepare(tpg.clk);
+		clk_put(tpg.clk);
+	}
+
 	tpg.dev = NULL;
 	return 0;
 }
-- 
1.7.9.5

  parent reply	other threads:[~2012-06-16  0:21 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-25 16:08 RFC: support for MV_CESA with TDMA Phil Sutter
2012-05-25 16:08 ` [PATCH 01/13] mv_cesa: do not use scatterlist iterators Phil Sutter
2012-05-25 16:08 ` [PATCH 02/13] mv_cesa: minor formatting cleanup, will all make sense soon Phil Sutter
2012-05-25 16:08 ` [PATCH 03/13] mv_cesa: prepare the full sram config in dram Phil Sutter
2012-05-25 16:08 ` [PATCH 04/13] mv_cesa: split up processing callbacks Phil Sutter
2012-05-25 16:08 ` [PATCH 05/13] add a driver for the Marvell TDMA engine Phil Sutter
2012-05-25 16:08 ` [PATCH 06/13] mv_cesa: use TDMA engine for data transfers Phil Sutter
2012-05-25 16:08 ` [PATCH 07/13] mv_cesa: have TDMA copy back the digest result Phil Sutter
2012-05-25 16:08 ` [PATCH 08/13] mv_cesa: fetch extra_bytes via TDMA engine, too Phil Sutter
2012-05-25 16:08 ` [PATCH 09/13] mv_cesa: implementing packet chain mode, only aes for now Phil Sutter
2012-05-25 16:08 ` [PATCH 10/13] mv_cesa: reorganise mv_start_new_hash_req a bit Phil Sutter
2012-05-25 16:08 ` [PATCH 11/13] mv_cesa: implement descriptor chaining for hashes, too Phil Sutter
2012-05-25 16:08 ` [PATCH 12/13] mv_cesa: drop the now unused process callback Phil Sutter
2012-05-25 16:08 ` [PATCH 13/13] mv_cesa, mv_tdma: outsource common dma-pool handling code Phil Sutter
2012-05-27 14:03 ` RFC: support for MV_CESA with TDMA cloudy.linux
2012-05-29 11:34   ` Phil Sutter
2012-06-12 10:04 ` Herbert Xu
2012-06-12 10:24   ` Phil Sutter
2012-06-12 11:39     ` Herbert Xu
2012-06-12 17:17       ` RFC: support for MV_CESA with IDMA or TDMA Phil Sutter
2012-06-12 17:17         ` [PATCH 01/13] mv_cesa: do not use scatterlist iterators Phil Sutter
2012-06-12 17:17         ` [PATCH 02/13] mv_cesa: minor formatting cleanup, will all make sense soon Phil Sutter
2012-06-12 17:17         ` [PATCH 03/13] mv_cesa: prepare the full sram config in dram Phil Sutter
2012-06-12 17:17         ` [PATCH 04/13] mv_cesa: split up processing callbacks Phil Sutter
2012-06-12 17:17         ` [PATCH 05/13] add a driver for the Marvell IDMA/TDMA engines Phil Sutter
2012-06-12 17:17         ` [PATCH 06/13] mv_cesa: use DMA engine for data transfers Phil Sutter
2012-06-12 17:17         ` [PATCH 07/13] mv_cesa: have DMA engine copy back the digest result Phil Sutter
2012-06-12 17:17         ` [PATCH 08/13] mv_cesa: fetch extra_bytes via DMA engine, too Phil Sutter
2012-06-12 17:17         ` [PATCH 09/13] mv_cesa: implementing packet chain mode, only aes for now Phil Sutter
2012-06-12 17:17         ` [PATCH 10/13] mv_cesa: reorganise mv_start_new_hash_req a bit Phil Sutter
2012-06-12 17:17         ` [PATCH 11/13] mv_cesa: implement descriptor chaining for hashes, too Phil Sutter
2012-06-12 17:17         ` [PATCH 12/13] mv_cesa: drop the now unused process callback Phil Sutter
2012-06-12 17:17         ` [PATCH 13/13] mv_cesa, mv_dma: outsource common dma-pool handling code Phil Sutter
2012-06-15  1:40         ` RFC: support for MV_CESA with IDMA or TDMA cloudy.linux
2012-06-15  9:51           ` Phil Sutter
2012-06-16  0:20         ` [PATCH 0/2] Fixes " Simon Baatz
2012-06-16  0:20           ` [PATCH 1/2] mv_dma: fix mv_init_engine() error case Simon Baatz
2012-06-16  0:20           ` Simon Baatz [this message]
2012-06-18 13:47           ` [PATCH 0/2] Fixes for MV_CESA with IDMA or TDMA Phil Sutter
2012-06-18 20:12             ` Simon Baatz
2012-06-19 11:51               ` Phil Sutter
2012-06-19 15:09                 ` cloudy.linux
2012-06-19 17:13                   ` Phil Sutter
2012-06-20  1:16                     ` cloudy.linux
2012-07-16  9:32                       ` Andrew Lunn
2012-07-16 13:52                         ` Phil Sutter
2012-07-16 14:03                           ` Andrew Lunn
2012-07-16 14:53                             ` Phil Sutter
2012-07-16 17:32                               ` Simon Baatz
2012-07-16 17:59                                 ` Andrew Lunn
2012-06-20 13:31               ` cloudy.linux
2012-06-20 15:41                 ` Phil Sutter
2012-06-25 13:40                   ` Phil Sutter
2012-06-25 14:25                     ` cloudy.linux
2012-06-25 14:36                       ` Phil Sutter
2012-06-25 16:05                       ` cloudy.linux
2012-06-25 21:59                         ` Phil Sutter
2012-06-26 11:24                           ` cloudy.linux
2012-06-30  7:35                           ` cloudy.linux
2012-07-06 15:30                             ` Phil Sutter
2012-07-08  5:38                               ` cloudy.linux
2012-07-09 12:54                                 ` Phil Sutter
2012-07-31 12:12                                   ` cloudy.linux
2012-10-23 17:11                                     ` Phil Sutter
2012-06-26 20:31             ` [PATCH 0/1] MV_CESA with DMA: Clk init fixes Simon Baatz
2012-06-26 20:31               ` [PATCH 1/1] mv_dma: mv_cesa: fixes for clock init Simon Baatz
2012-07-06 15:05               ` [PATCH 0/1] MV_CESA with DMA: Clk init fixes Phil Sutter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1339806021-14271-3-git-send-email-gmbnomis@gmail.com \
    --to=gmbnomis@gmail.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=phil.sutter@viprinet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).