Lines Matching refs:qce

36 static void qce_unregister_algs(struct qce_device *qce)  in qce_unregister_algs()  argument
43 ops->unregister_algs(qce); in qce_unregister_algs()
47 static int qce_register_algs(struct qce_device *qce) in qce_register_algs() argument
54 ret = ops->register_algs(qce); in qce_register_algs()
79 static int qce_handle_queue(struct qce_device *qce, in qce_handle_queue() argument
86 spin_lock_irqsave(&qce->lock, flags); in qce_handle_queue()
89 ret = crypto_enqueue_request(&qce->queue, req); in qce_handle_queue()
92 if (qce->req) { in qce_handle_queue()
93 spin_unlock_irqrestore(&qce->lock, flags); in qce_handle_queue()
97 backlog = crypto_get_backlog(&qce->queue); in qce_handle_queue()
98 async_req = crypto_dequeue_request(&qce->queue); in qce_handle_queue()
100 qce->req = async_req; in qce_handle_queue()
102 spin_unlock_irqrestore(&qce->lock, flags); in qce_handle_queue()
108 spin_lock_bh(&qce->lock); in qce_handle_queue()
110 spin_unlock_bh(&qce->lock); in qce_handle_queue()
115 qce->result = err; in qce_handle_queue()
116 tasklet_schedule(&qce->done_tasklet); in qce_handle_queue()
124 struct qce_device *qce = (struct qce_device *)data; in qce_tasklet_req_done() local
128 spin_lock_irqsave(&qce->lock, flags); in qce_tasklet_req_done()
129 req = qce->req; in qce_tasklet_req_done()
130 qce->req = NULL; in qce_tasklet_req_done()
131 spin_unlock_irqrestore(&qce->lock, flags); in qce_tasklet_req_done()
134 req->complete(req, qce->result); in qce_tasklet_req_done()
136 qce_handle_queue(qce, NULL); in qce_tasklet_req_done()
139 static int qce_async_request_enqueue(struct qce_device *qce, in qce_async_request_enqueue() argument
142 return qce_handle_queue(qce, req); in qce_async_request_enqueue()
145 static void qce_async_request_done(struct qce_device *qce, int ret) in qce_async_request_done() argument
147 qce->result = ret; in qce_async_request_done()
148 tasklet_schedule(&qce->done_tasklet); in qce_async_request_done()
151 static int qce_check_version(struct qce_device *qce) in qce_check_version() argument
155 qce_get_version(qce, &major, &minor, &step); in qce_check_version()
164 qce->burst_size = QCE_BAM_BURST_SIZE; in qce_check_version()
165 qce->pipe_pair_id = 1; in qce_check_version()
167 dev_dbg(qce->dev, "Crypto device found, version %d.%d.%d\n", in qce_check_version()
176 struct qce_device *qce; in qce_crypto_probe() local
180 qce = devm_kzalloc(dev, sizeof(*qce), GFP_KERNEL); in qce_crypto_probe()
181 if (!qce) in qce_crypto_probe()
184 qce->dev = dev; in qce_crypto_probe()
185 platform_set_drvdata(pdev, qce); in qce_crypto_probe()
188 qce->base = devm_ioremap_resource(&pdev->dev, res); in qce_crypto_probe()
189 if (IS_ERR(qce->base)) in qce_crypto_probe()
190 return PTR_ERR(qce->base); in qce_crypto_probe()
196 qce->core = devm_clk_get(qce->dev, "core"); in qce_crypto_probe()
197 if (IS_ERR(qce->core)) in qce_crypto_probe()
198 return PTR_ERR(qce->core); in qce_crypto_probe()
200 qce->iface = devm_clk_get(qce->dev, "iface"); in qce_crypto_probe()
201 if (IS_ERR(qce->iface)) in qce_crypto_probe()
202 return PTR_ERR(qce->iface); in qce_crypto_probe()
204 qce->bus = devm_clk_get(qce->dev, "bus"); in qce_crypto_probe()
205 if (IS_ERR(qce->bus)) in qce_crypto_probe()
206 return PTR_ERR(qce->bus); in qce_crypto_probe()
208 ret = clk_prepare_enable(qce->core); in qce_crypto_probe()
212 ret = clk_prepare_enable(qce->iface); in qce_crypto_probe()
216 ret = clk_prepare_enable(qce->bus); in qce_crypto_probe()
220 ret = qce_dma_request(qce->dev, &qce->dma); in qce_crypto_probe()
224 ret = qce_check_version(qce); in qce_crypto_probe()
228 spin_lock_init(&qce->lock); in qce_crypto_probe()
229 tasklet_init(&qce->done_tasklet, qce_tasklet_req_done, in qce_crypto_probe()
230 (unsigned long)qce); in qce_crypto_probe()
231 crypto_init_queue(&qce->queue, QCE_QUEUE_LENGTH); in qce_crypto_probe()
233 qce->async_req_enqueue = qce_async_request_enqueue; in qce_crypto_probe()
234 qce->async_req_done = qce_async_request_done; in qce_crypto_probe()
236 ret = qce_register_algs(qce); in qce_crypto_probe()
243 qce_dma_release(&qce->dma); in qce_crypto_probe()
245 clk_disable_unprepare(qce->bus); in qce_crypto_probe()
247 clk_disable_unprepare(qce->iface); in qce_crypto_probe()
249 clk_disable_unprepare(qce->core); in qce_crypto_probe()
255 struct qce_device *qce = platform_get_drvdata(pdev); in qce_crypto_remove() local
257 tasklet_kill(&qce->done_tasklet); in qce_crypto_remove()
258 qce_unregister_algs(qce); in qce_crypto_remove()
259 qce_dma_release(&qce->dma); in qce_crypto_remove()
260 clk_disable_unprepare(qce->bus); in qce_crypto_remove()
261 clk_disable_unprepare(qce->iface); in qce_crypto_remove()
262 clk_disable_unprepare(qce->core); in qce_crypto_remove()