Skip to content

Commit 87f3426

Browse files
montjoieherbertx
authored andcommitted
crypto: sun8i-ce - handle endianness of t_common_ctl
t_common_ctl is LE32 so we need to convert its value before using it. This value is only used on H6 (ignored on other SoCs) and not handling the endianness cause failure on xRNG/hashes operations on H6 when running BE. Fixes: 06f751b ("crypto: allwinner - Add sun8i-ce Crypto Engine") Signed-off-by: Corentin Labbe <clabbe@baylibre.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 68cbba1 commit 87f3426

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ int sun8i_ce_run_task(struct sun8i_ce_dev *ce, int flow, const char *name)
120120
/* Be sure all data is written before enabling the task */
121121
wmb();
122122

123-
v = 1 | (ce->chanlist[flow].tl->t_common_ctl & 0x7F) << 8;
123+
/* Only H6 needs to write a part of t_common_ctl along with "1", but since it is ignored
124+
* on older SoCs, we have no reason to complicate things.
125+
*/
126+
v = 1 | ((le32_to_cpu(ce->chanlist[flow].tl->t_common_ctl) & 0x7F) << 8);
124127
writel(v, ce->base + CE_TLR);
125128
mutex_unlock(&ce->mlock);
126129

0 commit comments

Comments
 (0)