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()
166 qce->pipe_pair_id = 1; in qce_check_version()
168 dev_dbg(qce->dev, "Crypto device found, version %d.%d.%d\n", in qce_check_version()
177 struct qce_device *qce; in qce_crypto_probe() local
181 qce = devm_kzalloc(dev, sizeof(*qce), GFP_KERNEL); in qce_crypto_probe()
182 if (!qce) in qce_crypto_probe()
185 qce->dev = dev; in qce_crypto_probe()
186 platform_set_drvdata(pdev, qce); in qce_crypto_probe()
189 qce->base = devm_ioremap_resource(&pdev->dev, res); in qce_crypto_probe()
190 if (IS_ERR(qce->base)) in qce_crypto_probe()
191 return PTR_ERR(qce->base); in qce_crypto_probe()
197 qce->core = devm_clk_get(qce->dev, "core"); in qce_crypto_probe()
198 if (IS_ERR(qce->core)) in qce_crypto_probe()
199 return PTR_ERR(qce->core); in qce_crypto_probe()
201 qce->iface = devm_clk_get(qce->dev, "iface"); in qce_crypto_probe()
202 if (IS_ERR(qce->iface)) in qce_crypto_probe()
203 return PTR_ERR(qce->iface); in qce_crypto_probe()
205 qce->bus = devm_clk_get(qce->dev, "bus"); in qce_crypto_probe()
206 if (IS_ERR(qce->bus)) in qce_crypto_probe()
207 return PTR_ERR(qce->bus); in qce_crypto_probe()
209 ret = clk_prepare_enable(qce->core); in qce_crypto_probe()
213 ret = clk_prepare_enable(qce->iface); in qce_crypto_probe()
217 ret = clk_prepare_enable(qce->bus); in qce_crypto_probe()
221 ret = qce_dma_request(qce->dev, &qce->dma); in qce_crypto_probe()
225 ret = qce_check_version(qce); in qce_crypto_probe()
229 spin_lock_init(&qce->lock); in qce_crypto_probe()
230 tasklet_init(&qce->done_tasklet, qce_tasklet_req_done, in qce_crypto_probe()
231 (unsigned long)qce); in qce_crypto_probe()
232 crypto_init_queue(&qce->queue, QCE_QUEUE_LENGTH); in qce_crypto_probe()
234 qce->async_req_enqueue = qce_async_request_enqueue; in qce_crypto_probe()
235 qce->async_req_done = qce_async_request_done; in qce_crypto_probe()
237 ret = qce_register_algs(qce); in qce_crypto_probe()
244 qce_dma_release(&qce->dma); in qce_crypto_probe()
246 clk_disable_unprepare(qce->bus); in qce_crypto_probe()
248 clk_disable_unprepare(qce->iface); in qce_crypto_probe()
250 clk_disable_unprepare(qce->core); in qce_crypto_probe()
256 struct qce_device *qce = platform_get_drvdata(pdev); in qce_crypto_remove() local
258 tasklet_kill(&qce->done_tasklet); in qce_crypto_remove()
259 qce_unregister_algs(qce); in qce_crypto_remove()
260 qce_dma_release(&qce->dma); in qce_crypto_remove()
261 clk_disable_unprepare(qce->bus); in qce_crypto_remove()
262 clk_disable_unprepare(qce->iface); in qce_crypto_remove()
263 clk_disable_unprepare(qce->core); in qce_crypto_remove()