aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2014-03-02 19:23:15 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2014-03-10 08:15:48 -0400
commit1a7c685611713011179a0e92b06f43a378d3a8fd (patch)
tree71176ccfcabd37b84adde08b7b096eff7f469ee7 /drivers/crypto
parent26f25b2695aa0996aa01e86a212db94e8dd2006d (diff)
crypto: mxs-dcp - Align the bounce buffers
The DCP needs the bounce buffers, DMA descriptors and result buffers aligned to 64 bytes (yet another hardware limitation). Make sure they are aligned by properly aligning the structure which contains them during allocation. Signed-off-by: Marek Vasut <marex@denx.de> Cc: David S. Miller <davem@davemloft.net> Cc: Fabio Estevam <fabio.estevam@freescale.com> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Shawn Guo <shawn.guo@linaro.org> Cc: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/mxs-dcp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
index 08761d61d4f5..c7400fe9522c 100644
--- a/drivers/crypto/mxs-dcp.c
+++ b/drivers/crypto/mxs-dcp.c
@@ -29,6 +29,8 @@
29#define DCP_MAX_CHANS 4 29#define DCP_MAX_CHANS 4
30#define DCP_BUF_SZ PAGE_SIZE 30#define DCP_BUF_SZ PAGE_SIZE
31 31
32#define DCP_ALIGNMENT 64
33
32/* DCP DMA descriptor. */ 34/* DCP DMA descriptor. */
33struct dcp_dma_desc { 35struct dcp_dma_desc {
34 uint32_t next_cmd_addr; 36 uint32_t next_cmd_addr;
@@ -947,12 +949,16 @@ static int mxs_dcp_probe(struct platform_device *pdev)
947 } 949 }
948 950
949 /* Allocate coherent helper block. */ 951 /* Allocate coherent helper block. */
950 sdcp->coh = devm_kzalloc(dev, sizeof(*sdcp->coh), GFP_KERNEL); 952 sdcp->coh = devm_kzalloc(dev, sizeof(*sdcp->coh) + DCP_ALIGNMENT,
953 GFP_KERNEL);
951 if (!sdcp->coh) { 954 if (!sdcp->coh) {
952 ret = -ENOMEM; 955 ret = -ENOMEM;
953 goto err_mutex; 956 goto err_mutex;
954 } 957 }
955 958
959 /* Re-align the structure so it fits the DCP constraints. */
960 sdcp->coh = PTR_ALIGN(sdcp->coh, DCP_ALIGNMENT);
961
956 /* Restart the DCP block. */ 962 /* Restart the DCP block. */
957 ret = stmp_reset_block(sdcp->base); 963 ret = stmp_reset_block(sdcp->base);
958 if (ret) 964 if (ret)