Lines Matching refs:qce

37 static void qce_unregister_algs(struct qce_device *qce)  in qce_unregister_algs()  argument
44 ops->unregister_algs(qce); in qce_unregister_algs()
48 static int qce_register_algs(struct qce_device *qce) in qce_register_algs() argument
55 ret = ops->register_algs(qce); in qce_register_algs()
80 static int qce_handle_queue(struct qce_device *qce, in qce_handle_queue() argument
87 spin_lock_irqsave(&qce->lock, flags); in qce_handle_queue()
90 ret = crypto_enqueue_request(&qce->queue, req); in qce_handle_queue()
93 if (qce->req) { in qce_handle_queue()
94 spin_unlock_irqrestore(&qce->lock, flags); in qce_handle_queue()
98 backlog = crypto_get_backlog(&qce->queue); in qce_handle_queue()
99 async_req = crypto_dequeue_request(&qce->queue); in qce_handle_queue()
101 qce->req = async_req; in qce_handle_queue()
103 spin_unlock_irqrestore(&qce->lock, flags); in qce_handle_queue()
109 spin_lock_bh(&qce->lock); in qce_handle_queue()
111 spin_unlock_bh(&qce->lock); in qce_handle_queue()
116 qce->result = err; in qce_handle_queue()
117 tasklet_schedule(&qce->done_tasklet); in qce_handle_queue()
125 struct qce_device *qce = (struct qce_device *)data; in qce_tasklet_req_done() local
129 spin_lock_irqsave(&qce->lock, flags); in qce_tasklet_req_done()
130 req = qce->req; in qce_tasklet_req_done()
131 qce->req = NULL; in qce_tasklet_req_done()
132 spin_unlock_irqrestore(&qce->lock, flags); in qce_tasklet_req_done()
135 req->complete(req, qce->result); in qce_tasklet_req_done()
137 qce_handle_queue(qce, NULL); in qce_tasklet_req_done()
140 static int qce_async_request_enqueue(struct qce_device *qce, in qce_async_request_enqueue() argument
143 return qce_handle_queue(qce, req); in qce_async_request_enqueue()
146 static void qce_async_request_done(struct qce_device *qce, int ret) in qce_async_request_done() argument
148 qce->result = ret; in qce_async_request_done()
149 tasklet_schedule(&qce->done_tasklet); in qce_async_request_done()
152 static int qce_check_version(struct qce_device *qce) in qce_check_version() argument
156 qce_get_version(qce, &major, &minor, &step); in qce_check_version()
165 qce->burst_size = QCE_BAM_BURST_SIZE; in qce_check_version()
180 qce->pipe_pair_id = qce->dma.rxchan->chan_id >> 1; in qce_check_version()
182 dev_dbg(qce->dev, "Crypto device found, version %d.%d.%d\n", in qce_check_version()
191 struct qce_device *qce; in qce_crypto_probe() local
194 qce = devm_kzalloc(dev, sizeof(*qce), GFP_KERNEL); in qce_crypto_probe()
195 if (!qce) in qce_crypto_probe()
198 qce->dev = dev; in qce_crypto_probe()
199 platform_set_drvdata(pdev, qce); in qce_crypto_probe()
201 qce->base = devm_platform_ioremap_resource(pdev, 0); in qce_crypto_probe()
202 if (IS_ERR(qce->base)) in qce_crypto_probe()
203 return PTR_ERR(qce->base); in qce_crypto_probe()
209 qce->core = devm_clk_get(qce->dev, "core"); in qce_crypto_probe()
210 if (IS_ERR(qce->core)) in qce_crypto_probe()
211 return PTR_ERR(qce->core); in qce_crypto_probe()
213 qce->iface = devm_clk_get(qce->dev, "iface"); in qce_crypto_probe()
214 if (IS_ERR(qce->iface)) in qce_crypto_probe()
215 return PTR_ERR(qce->iface); in qce_crypto_probe()
217 qce->bus = devm_clk_get(qce->dev, "bus"); in qce_crypto_probe()
218 if (IS_ERR(qce->bus)) in qce_crypto_probe()
219 return PTR_ERR(qce->bus); in qce_crypto_probe()
221 ret = clk_prepare_enable(qce->core); in qce_crypto_probe()
225 ret = clk_prepare_enable(qce->iface); in qce_crypto_probe()
229 ret = clk_prepare_enable(qce->bus); in qce_crypto_probe()
233 ret = qce_dma_request(qce->dev, &qce->dma); in qce_crypto_probe()
237 ret = qce_check_version(qce); in qce_crypto_probe()
241 spin_lock_init(&qce->lock); in qce_crypto_probe()
242 tasklet_init(&qce->done_tasklet, qce_tasklet_req_done, in qce_crypto_probe()
243 (unsigned long)qce); in qce_crypto_probe()
244 crypto_init_queue(&qce->queue, QCE_QUEUE_LENGTH); in qce_crypto_probe()
246 qce->async_req_enqueue = qce_async_request_enqueue; in qce_crypto_probe()
247 qce->async_req_done = qce_async_request_done; in qce_crypto_probe()
249 ret = qce_register_algs(qce); in qce_crypto_probe()
256 qce_dma_release(&qce->dma); in qce_crypto_probe()
258 clk_disable_unprepare(qce->bus); in qce_crypto_probe()
260 clk_disable_unprepare(qce->iface); in qce_crypto_probe()
262 clk_disable_unprepare(qce->core); in qce_crypto_probe()
268 struct qce_device *qce = platform_get_drvdata(pdev); in qce_crypto_remove() local
270 tasklet_kill(&qce->done_tasklet); in qce_crypto_remove()
271 qce_unregister_algs(qce); in qce_crypto_remove()
272 qce_dma_release(&qce->dma); in qce_crypto_remove()
273 clk_disable_unprepare(qce->bus); in qce_crypto_remove()
274 clk_disable_unprepare(qce->iface); in qce_crypto_remove()
275 clk_disable_unprepare(qce->core); in qce_crypto_remove()