linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: lee.jones@linaro.org (Lee Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/9] crypto: ux500/hash - Set DMA configuration though dma_slave_config()
Date: Thu, 18 Apr 2013 11:26:58 +0100	[thread overview]
Message-ID: <1366280825-31136-3-git-send-email-lee.jones@linaro.org> (raw)
In-Reply-To: <1366280825-31136-1-git-send-email-lee.jones@linaro.org>

The DMA controller currently takes configuration information from
information passed though dma_channel_request(), but it shouldn't.
Using the API, the DMA channel should only be configured during
a dma_slave_config() call.

Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: David S. Miller <davem@davemloft.net>
Cc: Andreas Westin <andreas.westin@stericsson.com>
Cc: linux-crypto at vger.kernel.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/crypto/ux500/hash/hash_alg.h  |    5 ++++-
 drivers/crypto/ux500/hash/hash_core.c |   10 ++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/ux500/hash/hash_alg.h b/drivers/crypto/ux500/hash/hash_alg.h
index cd9351c..be6eb54 100644
--- a/drivers/crypto/ux500/hash/hash_alg.h
+++ b/drivers/crypto/ux500/hash/hash_alg.h
@@ -11,6 +11,7 @@
 #include <linux/bitops.h>
 
 #define HASH_BLOCK_SIZE			64
+#define HASH_DMA_FIFO			4
 #define HASH_DMA_ALIGN_SIZE		4
 #define HASH_DMA_PERFORMANCE_MIN_SIZE	1024
 #define HASH_BYTES_PER_WORD		4
@@ -347,7 +348,8 @@ struct hash_req_ctx {
 
 /**
  * struct hash_device_data - structure for a hash device.
- * @base:		Pointer to the hardware base address.
+ * @base:		Pointer to virtual base address of the hash device.
+ * @phybase:		Pointer to physical memory location of the hash device.
  * @list_node:		For inclusion in klist.
  * @dev:		Pointer to the device dev structure.
  * @ctx_lock:		Spinlock for current_ctx.
@@ -361,6 +363,7 @@ struct hash_req_ctx {
  */
 struct hash_device_data {
 	struct hash_register __iomem	*base;
+	phys_addr_t             phybase;
 	struct klist_node	list_node;
 	struct device		*dev;
 	struct spinlock		ctx_lock;
diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c
index 118386a..f9126f4 100644
--- a/drivers/crypto/ux500/hash/hash_core.c
+++ b/drivers/crypto/ux500/hash/hash_core.c
@@ -123,6 +123,13 @@ static void hash_dma_setup_channel(struct hash_device_data *device_data,
 				struct device *dev)
 {
 	struct hash_platform_data *platform_data = dev->platform_data;
+	struct dma_slave_config conf = {
+		.direction = DMA_MEM_TO_DEV,
+		.dst_addr = device_data->phybase + HASH_DMA_FIFO,
+		.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES,
+		.dst_maxburst = 16,
+        };
+
 	dma_cap_zero(device_data->dma.mask);
 	dma_cap_set(DMA_SLAVE, device_data->dma.mask);
 
@@ -132,6 +139,8 @@ static void hash_dma_setup_channel(struct hash_device_data *device_data,
 				platform_data->dma_filter,
 				device_data->dma.cfg_mem2hash);
 
+	dmaengine_slave_config(device_data->dma.chan_mem2hash, &conf);
+
 	init_completion(&device_data->dma.complete);
 }
 
@@ -1700,6 +1709,7 @@ static int ux500_hash_probe(struct platform_device *pdev)
 		goto out_kfree;
 	}
 
+	device_data->phybase = res->start;
 	device_data->base = ioremap(res->start, resource_size(res));
 	if (!device_data->base) {
 		dev_err(dev, "[%s] ioremap() failed!",
-- 
1.7.10.4

  parent reply	other threads:[~2013-04-18 10:26 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-18 10:26 [PATCH 0/9] Fix ux500 crypto drivers and init DMA in the correct way Lee Jones
2013-04-18 10:26 ` [PATCH 1/9] crypto: ux500/hash - Prepare clock before enabling it Lee Jones
2013-04-19 12:24   ` [PATCH 1/9 v2] " Lee Jones
2013-04-19 12:26     ` Arnd Bergmann
2013-04-25 11:49     ` Linus Walleij
2013-04-25 13:46       ` Lee Jones
2013-04-18 10:26 ` Lee Jones [this message]
2013-04-25 11:55   ` [PATCH 2/9] crypto: ux500/hash - Set DMA configuration though dma_slave_config() Linus Walleij
2013-04-18 10:26 ` [PATCH 3/9] ARM: ux500: Stop passing Hash DMA channel config information though pdata Lee Jones
2013-04-25 11:56   ` Linus Walleij
2013-04-18 10:27 ` [PATCH 4/9] crypto: ux500/cryp - Prepare clock before enabling it Lee Jones
2013-04-19 12:22   ` [PATCH 4/9 v2] " Lee Jones
2013-04-19 12:23     ` Arnd Bergmann
2013-04-25 11:57     ` Linus Walleij
2013-04-18 10:27 ` [PATCH 5/9] crypto: ux500/cryp - Fix compile error Lee Jones
2013-04-25 12:00   ` Linus Walleij
2013-04-25 13:44     ` Lee Jones
2013-04-18 10:27 ` [PATCH 6/9] crypto: ux500/cryp - Set DMA configuration though dma_slave_config() Lee Jones
2013-04-25 12:02   ` Linus Walleij
2013-04-25 13:44     ` Lee Jones
2013-04-25 14:05       ` Linus Walleij
2013-04-25 14:11       ` Arnd Bergmann
2013-04-26  8:28         ` Linus Walleij
2013-04-26  8:16           ` Vinod Koul
2013-04-26  9:07             ` Linus Walleij
2013-04-26  9:39             ` Arnd Bergmann
2013-04-26  9:44               ` Russell King - ARM Linux
2013-04-26  9:41             ` Russell King - ARM Linux
2013-04-30 10:08               ` Vinod Koul
2013-04-26  9:34           ` Arnd Bergmann
2013-04-18 10:27 ` [PATCH 7/9] ARM: ux500: Stop passing Cryp DMA channel config information though pdata Lee Jones
2013-04-25 12:02   ` Linus Walleij
2013-04-18 10:27 ` [PATCH 8/9] crypto: ux500/[cryp|hash] - Show successful start-up in the bootlog Lee Jones
2013-04-25 12:03   ` Linus Walleij
2013-04-18 10:27 ` [PATCH 9/9] ARM: ux500: Register Cyrp and Hash platform drivers on Snowball Lee Jones
2013-04-25 12:04   ` Linus Walleij
2013-04-18 10:44 ` [PATCH 0/9] Fix ux500 crypto drivers and init DMA in the correct way Arnd Bergmann

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=1366280825-31136-3-git-send-email-lee.jones@linaro.org \
    --to=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).