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_resume_and_get(ce->dev); in sun8i_ce_trng_read()
61 mutex_lock(&ce->rnglock); in sun8i_ce_trng_read()
62 chan = &ce->chanlist[flow]; in sun8i_ce_trng_read()
68 common = ce->variant->trng | CE_COMM_INT; in sun8i_ce_trng_read()
72 if (ce->variant->trng_t_dlen_in_bytes) in sun8i_ce_trng_read()
82 ce->chanlist[flow].timeout = todo; in sun8i_ce_trng_read()
84 err = sun8i_ce_run_task(ce, 3, "TRNG"); in sun8i_ce_trng_read()
85 mutex_unlock(&ce->rnglock); in sun8i_ce_trng_read()
87 pm_runtime_put(ce->dev); in sun8i_ce_trng_read()
90 dma_unmap_single(ce->dev, dma_dst, todo, DMA_FROM_DEVICE); in sun8i_ce_trng_read()
101 int sun8i_ce_hwrng_register(struct sun8i_ce_dev *ce) in sun8i_ce_hwrng_register() argument
105 if (ce->variant->trng == CE_ID_NOTSUPP) { in sun8i_ce_hwrng_register()
106 dev_info(ce->dev, "TRNG not supported\n"); in sun8i_ce_hwrng_register()
109 ce->trng.name = "sun8i Crypto Engine TRNG"; in sun8i_ce_hwrng_register()
110 ce->trng.read = sun8i_ce_trng_read; in sun8i_ce_hwrng_register()
112 ret = hwrng_register(&ce->trng); in sun8i_ce_hwrng_register()
114 dev_err(ce->dev, "Fail to register the TRNG\n"); in sun8i_ce_hwrng_register()
118 void sun8i_ce_hwrng_unregister(struct sun8i_ce_dev *ce) in sun8i_ce_hwrng_unregister() argument
120 if (ce->variant->trng == CE_ID_NOTSUPP) in sun8i_ce_hwrng_unregister()
122 hwrng_unregister(&ce->trng); in sun8i_ce_hwrng_unregister()