Lines Matching full:rng

36 /* rng per-device context */
38 struct hwrng rng; member
78 print_hex_dump_debug("rng job desc@: ", DUMP_PREFIX_ADDRESS, in caam_init_desc()
147 static int caam_read(struct hwrng *rng, void *dst, size_t max, bool wait) in caam_read() argument
149 struct caam_rng_ctx *ctx = to_caam_rng_ctx(rng); in caam_read()
166 static void caam_cleanup(struct hwrng *rng) in caam_cleanup() argument
168 struct caam_rng_ctx *ctx = to_caam_rng_ctx(rng); in caam_cleanup()
176 static inline void test_len(struct hwrng *rng, size_t len, bool wait) in test_len() argument
180 struct caam_rng_ctx *ctx = to_caam_rng_ctx(rng); in test_len()
186 read_len = rng->read(rng, buf, len, wait); in test_len()
189 dev_err(dev, "RNG Read FAILED received %d bytes\n", in test_len()
205 static inline void test_mode_once(struct hwrng *rng, bool wait) in test_mode_once() argument
207 test_len(rng, 32, wait); in test_mode_once()
208 test_len(rng, 64, wait); in test_mode_once()
209 test_len(rng, 128, wait); in test_mode_once()
212 static void self_test(struct hwrng *rng) in self_test() argument
214 pr_info("Executing RNG SELF-TEST with wait\n"); in self_test()
215 test_mode_once(rng, true); in self_test()
219 static int caam_init(struct hwrng *rng) in caam_init() argument
221 struct caam_rng_ctx *ctx = to_caam_rng_ctx(rng); in caam_init()
272 /* Check for an instantiated RNG before registration */ in caam_rng_init()
277 rng_inst = rd_reg32(&priv->jr[0]->vreg.rng) & CHA_VER_NUM_MASK; in caam_rng_init()
291 ctx->rng.name = "rng-caam"; in caam_rng_init()
292 ctx->rng.init = caam_init; in caam_rng_init()
293 ctx->rng.cleanup = caam_cleanup; in caam_rng_init()
294 ctx->rng.read = caam_read; in caam_rng_init()
295 ctx->rng.priv = (unsigned long)ctx; in caam_rng_init()
297 dev_info(ctrldev, "registering rng-caam\n"); in caam_rng_init()
299 ret = devm_hwrng_register(ctrldev, &ctx->rng); in caam_rng_init()
306 self_test(&ctx->rng); in caam_rng_init()