Skip to content

Commit

Permalink
crypto: mxs-dcp - Align the bounce buffers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marek Vasut authored and Herbert Xu committed Mar 10, 2014
1 parent 26f25b2 commit 1a7c685
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/crypto/mxs-dcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#define DCP_MAX_CHANS 4
#define DCP_BUF_SZ PAGE_SIZE

#define DCP_ALIGNMENT 64

/* DCP DMA descriptor. */
struct dcp_dma_desc {
uint32_t next_cmd_addr;
Expand Down Expand Up @@ -947,12 +949,16 @@ static int mxs_dcp_probe(struct platform_device *pdev)
}

/* Allocate coherent helper block. */
sdcp->coh = devm_kzalloc(dev, sizeof(*sdcp->coh), GFP_KERNEL);
sdcp->coh = devm_kzalloc(dev, sizeof(*sdcp->coh) + DCP_ALIGNMENT,
GFP_KERNEL);
if (!sdcp->coh) {
ret = -ENOMEM;
goto err_mutex;
}

/* Re-align the structure so it fits the DCP constraints. */
sdcp->coh = PTR_ALIGN(sdcp->coh, DCP_ALIGNMENT);

/* Restart the DCP block. */
ret = stmp_reset_block(sdcp->base);
if (ret)
Expand Down

0 comments on commit 1a7c685

Please sign in to comment.