Skip to content

Commit df12284

Browse files
jiajiehoherbertx
authored andcommitted
crypto: starfive - Update hash module irq handling
Hash driver needs to check the value of irq mask register before writing as it will mask irq of other modules. Co-developed-by: Huan Feng <[email protected]> Signed-off-by: Huan Feng <[email protected]> Signed-off-by: Jia Jie Ho <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 1abc896 commit df12284

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/crypto/starfive/jh7110-hash.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#define STARFIVE_HASH_SHAWKLEN (STARFIVE_HASH_REGS_OFFSET + 0x24)
4040

4141
#define STARFIVE_HASH_BUFLEN SHA512_BLOCK_SIZE
42+
#define STARFIVE_HASH_RESET 0x2
4243

4344
static inline int starfive_hash_wait_busy(struct starfive_cryp_ctx *ctx)
4445
{
@@ -95,6 +96,7 @@ static void starfive_hash_start(void *param)
9596
struct starfive_cryp_dev *cryp = ctx->cryp;
9697
union starfive_alg_cr alg_cr;
9798
union starfive_hash_csr csr;
99+
u32 stat;
98100

99101
dma_unmap_sg(cryp->dev, rctx->in_sg, rctx->in_sg_len, DMA_TO_DEVICE);
100102

@@ -107,7 +109,9 @@ static void starfive_hash_start(void *param)
107109
csr.firstb = 0;
108110
csr.final = 1;
109111

110-
writel(~STARFIVE_IE_MASK_HASH_DONE, cryp->base + STARFIVE_IE_MASK_OFFSET);
112+
stat = readl(cryp->base + STARFIVE_IE_MASK_OFFSET);
113+
stat &= ~STARFIVE_IE_MASK_HASH_DONE;
114+
writel(stat, cryp->base + STARFIVE_IE_MASK_OFFSET);
111115
writel(csr.v, cryp->base + STARFIVE_HASH_SHACSR);
112116
}
113117

@@ -223,6 +227,9 @@ void starfive_hash_done_task(unsigned long param)
223227
if (!err)
224228
err = starfive_hash_copy_hash(cryp->req.hreq);
225229

230+
/* Reset to clear hash_done in irq register*/
231+
writel(STARFIVE_HASH_RESET, cryp->base + STARFIVE_HASH_SHACSR);
232+
226233
crypto_finalize_hash_request(cryp->engine, cryp->req.hreq, err);
227234
}
228235

0 commit comments

Comments
 (0)