diff options
author | Corentin Labbe <clabbe@baylibre.com> | 2019-11-17 17:09:53 +0100 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2019-11-22 11:48:39 +0100 |
commit | 3d04158814e7a808c38124c87502b430b916dfcb (patch) | |
tree | 2325ae2f55419dacb47d6f2526386c5014fc84a5 /drivers/crypto/amlogic/amlogic-gxl-cipher.c | |
parent | crypto: sun8i-ce - enable working on big endian (diff) | |
download | linux-3d04158814e7a808c38124c87502b430b916dfcb.tar.xz linux-3d04158814e7a808c38124c87502b430b916dfcb.zip |
crypto: amlogic - enable working on big endian kernel
On big endian kernel, the GXL crypto driver does not works.
This patch do the necessary modification to permit it to work on BE
kernel (removing bitfield and adds some cpu_to_le32).
Fixes: 48fe583fe541 ("crypto: amlogic - Add crypto accelerator for amlogic GXL")
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/amlogic/amlogic-gxl-cipher.c')
-rw-r--r-- | drivers/crypto/amlogic/amlogic-gxl-cipher.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/crypto/amlogic/amlogic-gxl-cipher.c b/drivers/crypto/amlogic/amlogic-gxl-cipher.c index 1ddb14e9a99a..e589015aac1c 100644 --- a/drivers/crypto/amlogic/amlogic-gxl-cipher.c +++ b/drivers/crypto/amlogic/amlogic-gxl-cipher.c @@ -101,6 +101,7 @@ static int meson_cipher(struct skcipher_request *areq) unsigned int keyivlen, ivsize, offset, tloffset; dma_addr_t phykeyiv; void *backup_iv = NULL, *bkeyiv; + __le32 v; algt = container_of(alg, struct meson_alg_template, alg.skcipher); @@ -165,11 +166,11 @@ static int meson_cipher(struct skcipher_request *areq) desc = &mc->chanlist[flow].tl[tloffset]; memset(desc, 0, sizeof(struct meson_desc)); todo = min(keyivlen - eat, 16u); - desc->t_src = phykeyiv + i * 16; - desc->t_dst = i * 16; - desc->len = 16; - desc->mode = MODE_KEY; - desc->owner = 1; + desc->t_src = cpu_to_le32(phykeyiv + i * 16); + desc->t_dst = cpu_to_le32(i * 16); + v = (MODE_KEY << 20) | DESC_OWN | 16; + desc->t_status = cpu_to_le32(v); + eat += todo; i++; tloffset++; @@ -208,18 +209,17 @@ static int meson_cipher(struct skcipher_request *areq) desc = &mc->chanlist[flow].tl[tloffset]; memset(desc, 0, sizeof(struct meson_desc)); - desc->t_src = sg_dma_address(src_sg); - desc->t_dst = sg_dma_address(dst_sg); + desc->t_src = cpu_to_le32(sg_dma_address(src_sg)); + desc->t_dst = cpu_to_le32(sg_dma_address(dst_sg)); todo = min(len, sg_dma_len(src_sg)); - desc->owner = 1; - desc->len = todo; - desc->mode = op->keymode; - desc->op_mode = algt->blockmode; - desc->enc = rctx->op_dir; + v = (op->keymode << 20) | DESC_OWN | todo | (algt->blockmode << 26); + if (rctx->op_dir) + v |= DESC_ENCRYPTION; len -= todo; if (!sg_next(src_sg)) - desc->eoc = 1; + v |= DESC_LAST; + desc->t_status = cpu_to_le32(v); tloffset++; src_sg = sg_next(src_sg); dst_sg = sg_next(dst_sg); |