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

crypto: stm32 - CRC use relaxed function

In case of arm soc support, readl and writel will
be optimized using relaxed functions

Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

lionel.debieve@st.com and committed by
Herbert Xu
39177519 430f1338

+8 -7
+8 -7
drivers/crypto/stm32/stm32_crc32.c
··· 107 107 spin_unlock_bh(&crc_list.lock); 108 108 109 109 /* Reset, set key, poly and configure in bit reverse mode */ 110 - writel(bitrev32(mctx->key), ctx->crc->regs + CRC_INIT); 111 - writel(bitrev32(mctx->poly), ctx->crc->regs + CRC_POL); 112 - writel(CRC_CR_RESET | CRC_CR_REVERSE, ctx->crc->regs + CRC_CR); 110 + writel_relaxed(bitrev32(mctx->key), ctx->crc->regs + CRC_INIT); 111 + writel_relaxed(bitrev32(mctx->poly), ctx->crc->regs + CRC_POL); 112 + writel_relaxed(CRC_CR_RESET | CRC_CR_REVERSE, ctx->crc->regs + CRC_CR); 113 113 114 114 /* Store partial result */ 115 - ctx->partial = readl(ctx->crc->regs + CRC_DR); 115 + ctx->partial = readl_relaxed(ctx->crc->regs + CRC_DR); 116 116 ctx->crc->nb_pending_bytes = 0; 117 117 118 118 return 0; ··· 135 135 136 136 if (crc->nb_pending_bytes == sizeof(u32)) { 137 137 /* Process completed pending data */ 138 - writel(*(u32 *)crc->pending_data, crc->regs + CRC_DR); 138 + writel_relaxed(*(u32 *)crc->pending_data, 139 + crc->regs + CRC_DR); 139 140 crc->nb_pending_bytes = 0; 140 141 } 141 142 } ··· 144 143 d32 = (u32 *)d8; 145 144 for (i = 0; i < length >> 2; i++) 146 145 /* Process 32 bits data */ 147 - writel(*(d32++), crc->regs + CRC_DR); 146 + writel_relaxed(*(d32++), crc->regs + CRC_DR); 148 147 149 148 /* Store partial result */ 150 - ctx->partial = readl(crc->regs + CRC_DR); 149 + ctx->partial = readl_relaxed(crc->regs + CRC_DR); 151 150 152 151 /* Check for pending data (non 32 bits) */ 153 152 length &= 3;