Lines Matching full:ss
3 * sun8i-ss-prng.c - hardware cryptographic offloader for
8 * This file handle the PRNG found in the SS
12 #include "sun8i-ss.h"
61 struct sun8i_ss_dev *ss; in sun8i_ss_prng_generate() local
70 ss = algt->ss; in sun8i_ss_prng_generate()
73 dev_err(ss->dev, "The PRNG is not seeded\n"); in sun8i_ss_prng_generate()
77 /* The SS does not give an updated seed, so we need to get a new one. in sun8i_ss_prng_generate()
88 flow = sun8i_ss_get_engine_number(ss); in sun8i_ss_prng_generate()
101 dma_iv = dma_map_single(ss->dev, ctx->seed, ctx->slen, DMA_TO_DEVICE); in sun8i_ss_prng_generate()
102 if (dma_mapping_error(ss->dev, dma_iv)) { in sun8i_ss_prng_generate()
103 dev_err(ss->dev, "Cannot DMA MAP IV\n"); in sun8i_ss_prng_generate()
108 dma_dst = dma_map_single(ss->dev, d, todo, DMA_FROM_DEVICE); in sun8i_ss_prng_generate()
109 if (dma_mapping_error(ss->dev, dma_dst)) { in sun8i_ss_prng_generate()
110 dev_err(ss->dev, "Cannot DMA MAP DST\n"); in sun8i_ss_prng_generate()
115 err = pm_runtime_resume_and_get(ss->dev); in sun8i_ss_prng_generate()
120 mutex_lock(&ss->mlock); in sun8i_ss_prng_generate()
121 writel(dma_iv, ss->base + SS_IV_ADR_REG); in sun8i_ss_prng_generate()
123 writel(dma_iv, ss->base + SS_KEY_ADR_REG); in sun8i_ss_prng_generate()
124 writel(dma_dst, ss->base + SS_DST_ADR_REG); in sun8i_ss_prng_generate()
125 writel(todo / 4, ss->base + SS_LEN_ADR_REG); in sun8i_ss_prng_generate()
127 reinit_completion(&ss->flows[flow].complete); in sun8i_ss_prng_generate()
128 ss->flows[flow].status = 0; in sun8i_ss_prng_generate()
132 writel(v, ss->base + SS_CTL_REG); in sun8i_ss_prng_generate()
134 wait_for_completion_interruptible_timeout(&ss->flows[flow].complete, in sun8i_ss_prng_generate()
136 if (ss->flows[flow].status == 0) { in sun8i_ss_prng_generate()
137 dev_err(ss->dev, "DMA timeout for PRNG (size=%u)\n", todo); in sun8i_ss_prng_generate()
152 mutex_unlock(&ss->mlock); in sun8i_ss_prng_generate()
154 pm_runtime_put(ss->dev); in sun8i_ss_prng_generate()
157 dma_unmap_single(ss->dev, dma_dst, todo, DMA_FROM_DEVICE); in sun8i_ss_prng_generate()
159 dma_unmap_single(ss->dev, dma_iv, ctx->slen, DMA_TO_DEVICE); in sun8i_ss_prng_generate()