Lines Matching refs:ce
25 struct sun8i_ce_dev *ce; in sun8i_ce_trng_read() local
35 ce = container_of(rng, struct sun8i_ce_dev, trng); in sun8i_ce_trng_read()
46 ce->hwrng_stat_req++; in sun8i_ce_trng_read()
47 ce->hwrng_stat_bytes += todo; in sun8i_ce_trng_read()
50 dma_dst = dma_map_single(ce->dev, d, todo, DMA_FROM_DEVICE); in sun8i_ce_trng_read()
51 if (dma_mapping_error(ce->dev, dma_dst)) { in sun8i_ce_trng_read()
52 dev_err(ce->dev, "Cannot DMA MAP DST\n"); in sun8i_ce_trng_read()
57 err = pm_runtime_get_sync(ce->dev); in sun8i_ce_trng_read()
59 pm_runtime_put_noidle(ce->dev); in sun8i_ce_trng_read()
63 mutex_lock(&ce->rnglock); in sun8i_ce_trng_read()
64 chan = &ce->chanlist[flow]; in sun8i_ce_trng_read()
70 common = ce->variant->trng | CE_COMM_INT; in sun8i_ce_trng_read()
74 if (ce->variant->trng_t_dlen_in_bytes) in sun8i_ce_trng_read()
84 ce->chanlist[flow].timeout = todo; in sun8i_ce_trng_read()
86 err = sun8i_ce_run_task(ce, 3, "TRNG"); in sun8i_ce_trng_read()
87 mutex_unlock(&ce->rnglock); in sun8i_ce_trng_read()
89 pm_runtime_put(ce->dev); in sun8i_ce_trng_read()
92 dma_unmap_single(ce->dev, dma_dst, todo, DMA_FROM_DEVICE); in sun8i_ce_trng_read()
103 int sun8i_ce_hwrng_register(struct sun8i_ce_dev *ce) in sun8i_ce_hwrng_register() argument
107 if (ce->variant->trng == CE_ID_NOTSUPP) { in sun8i_ce_hwrng_register()
108 dev_info(ce->dev, "TRNG not supported\n"); in sun8i_ce_hwrng_register()
111 ce->trng.name = "sun8i Crypto Engine TRNG"; in sun8i_ce_hwrng_register()
112 ce->trng.read = sun8i_ce_trng_read; in sun8i_ce_hwrng_register()
113 ce->trng.quality = 1000; in sun8i_ce_hwrng_register()
115 ret = hwrng_register(&ce->trng); in sun8i_ce_hwrng_register()
117 dev_err(ce->dev, "Fail to register the TRNG\n"); in sun8i_ce_hwrng_register()
121 void sun8i_ce_hwrng_unregister(struct sun8i_ce_dev *ce) in sun8i_ce_hwrng_unregister() argument
123 if (ce->variant->trng == CE_ID_NOTSUPP) in sun8i_ce_hwrng_unregister()
125 hwrng_unregister(&ce->trng); in sun8i_ce_hwrng_unregister()