Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: omap-sham - correct dma burst size

Each cycle of SHA512 operates on 32 data words where as
SHA256 operates on 16 data words. This needs to be updated
while configuring DMA channels. Doing the same.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Lokesh Vutla and committed by
Herbert Xu
f5e46260 b8411ccd

+4 -7
+4 -7
drivers/crypto/omap-sham.c
··· 46 46 47 47 #define MD5_DIGEST_SIZE 16 48 48 49 - #define DST_MAXBURST 16 50 - #define DMA_MIN (DST_MAXBURST * sizeof(u32)) 51 - 52 49 #define SHA_REG_IDIGEST(dd, x) ((dd)->pdata->idigest_ofs + ((x)*0x04)) 53 50 #define SHA_REG_DIN(dd, x) ((dd)->pdata->din_ofs + ((x) * 0x04)) 54 51 #define SHA_REG_DIGCNT(dd) ((dd)->pdata->digcnt_ofs) ··· 555 558 struct omap_sham_reqctx *ctx = ahash_request_ctx(dd->req); 556 559 struct dma_async_tx_descriptor *tx; 557 560 struct dma_slave_config cfg; 558 - int len32, ret; 561 + int len32, ret, dma_min = get_block_size(ctx); 559 562 560 563 dev_dbg(dd->dev, "xmit_dma: digcnt: %d, length: %d, final: %d\n", 561 564 ctx->digcnt, length, final); ··· 564 567 565 568 cfg.dst_addr = dd->phys_base + SHA_REG_DIN(dd, 0); 566 569 cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; 567 - cfg.dst_maxburst = DST_MAXBURST; 570 + cfg.dst_maxburst = dma_min / DMA_SLAVE_BUSWIDTH_4_BYTES; 568 571 569 572 ret = dmaengine_slave_config(dd->dma_lch, &cfg); 570 573 if (ret) { ··· 572 575 return ret; 573 576 } 574 577 575 - len32 = DIV_ROUND_UP(length, DMA_MIN) * DMA_MIN; 578 + len32 = DIV_ROUND_UP(length, dma_min) * dma_min; 576 579 577 580 if (is_sg) { 578 581 /* ··· 726 729 * the dmaengine infrastructure will calculate that it needs 727 730 * to transfer 0 frames which ultimately fails. 728 731 */ 729 - if (ctx->total < (DST_MAXBURST * sizeof(u32))) 732 + if (ctx->total < get_block_size(ctx)) 730 733 return omap_sham_update_dma_slow(dd); 731 734 732 735 dev_dbg(dd->dev, "fast: digcnt: %d, bufcnt: %u, total: %u\n",