Lines Matching refs:qce
29 static void qce_unregister_algs(struct qce_device *qce) in qce_unregister_algs() argument
36 ops->unregister_algs(qce); in qce_unregister_algs()
40 static int qce_register_algs(struct qce_device *qce) in qce_register_algs() argument
47 ret = ops->register_algs(qce); in qce_register_algs()
72 static int qce_handle_queue(struct qce_device *qce, in qce_handle_queue() argument
79 spin_lock_irqsave(&qce->lock, flags); in qce_handle_queue()
82 ret = crypto_enqueue_request(&qce->queue, req); in qce_handle_queue()
85 if (qce->req) { in qce_handle_queue()
86 spin_unlock_irqrestore(&qce->lock, flags); in qce_handle_queue()
90 backlog = crypto_get_backlog(&qce->queue); in qce_handle_queue()
91 async_req = crypto_dequeue_request(&qce->queue); in qce_handle_queue()
93 qce->req = async_req; in qce_handle_queue()
95 spin_unlock_irqrestore(&qce->lock, flags); in qce_handle_queue()
101 spin_lock_bh(&qce->lock); in qce_handle_queue()
103 spin_unlock_bh(&qce->lock); in qce_handle_queue()
108 qce->result = err; in qce_handle_queue()
109 tasklet_schedule(&qce->done_tasklet); in qce_handle_queue()
117 struct qce_device *qce = (struct qce_device *)data; in qce_tasklet_req_done() local
121 spin_lock_irqsave(&qce->lock, flags); in qce_tasklet_req_done()
122 req = qce->req; in qce_tasklet_req_done()
123 qce->req = NULL; in qce_tasklet_req_done()
124 spin_unlock_irqrestore(&qce->lock, flags); in qce_tasklet_req_done()
127 req->complete(req, qce->result); in qce_tasklet_req_done()
129 qce_handle_queue(qce, NULL); in qce_tasklet_req_done()
132 static int qce_async_request_enqueue(struct qce_device *qce, in qce_async_request_enqueue() argument
135 return qce_handle_queue(qce, req); in qce_async_request_enqueue()
138 static void qce_async_request_done(struct qce_device *qce, int ret) in qce_async_request_done() argument
140 qce->result = ret; in qce_async_request_done()
141 tasklet_schedule(&qce->done_tasklet); in qce_async_request_done()
144 static int qce_check_version(struct qce_device *qce) in qce_check_version() argument
148 qce_get_version(qce, &major, &minor, &step); in qce_check_version()
157 qce->burst_size = QCE_BAM_BURST_SIZE; in qce_check_version()
158 qce->pipe_pair_id = 1; in qce_check_version()
160 dev_dbg(qce->dev, "Crypto device found, version %d.%d.%d\n", in qce_check_version()
169 struct qce_device *qce; in qce_crypto_probe() local
172 qce = devm_kzalloc(dev, sizeof(*qce), GFP_KERNEL); in qce_crypto_probe()
173 if (!qce) in qce_crypto_probe()
176 qce->dev = dev; in qce_crypto_probe()
177 platform_set_drvdata(pdev, qce); in qce_crypto_probe()
179 qce->base = devm_platform_ioremap_resource(pdev, 0); in qce_crypto_probe()
180 if (IS_ERR(qce->base)) in qce_crypto_probe()
181 return PTR_ERR(qce->base); in qce_crypto_probe()
187 qce->core = devm_clk_get(qce->dev, "core"); in qce_crypto_probe()
188 if (IS_ERR(qce->core)) in qce_crypto_probe()
189 return PTR_ERR(qce->core); in qce_crypto_probe()
191 qce->iface = devm_clk_get(qce->dev, "iface"); in qce_crypto_probe()
192 if (IS_ERR(qce->iface)) in qce_crypto_probe()
193 return PTR_ERR(qce->iface); in qce_crypto_probe()
195 qce->bus = devm_clk_get(qce->dev, "bus"); in qce_crypto_probe()
196 if (IS_ERR(qce->bus)) in qce_crypto_probe()
197 return PTR_ERR(qce->bus); in qce_crypto_probe()
199 ret = clk_prepare_enable(qce->core); in qce_crypto_probe()
203 ret = clk_prepare_enable(qce->iface); in qce_crypto_probe()
207 ret = clk_prepare_enable(qce->bus); in qce_crypto_probe()
211 ret = qce_dma_request(qce->dev, &qce->dma); in qce_crypto_probe()
215 ret = qce_check_version(qce); in qce_crypto_probe()
219 spin_lock_init(&qce->lock); in qce_crypto_probe()
220 tasklet_init(&qce->done_tasklet, qce_tasklet_req_done, in qce_crypto_probe()
221 (unsigned long)qce); in qce_crypto_probe()
222 crypto_init_queue(&qce->queue, QCE_QUEUE_LENGTH); in qce_crypto_probe()
224 qce->async_req_enqueue = qce_async_request_enqueue; in qce_crypto_probe()
225 qce->async_req_done = qce_async_request_done; in qce_crypto_probe()
227 ret = qce_register_algs(qce); in qce_crypto_probe()
234 qce_dma_release(&qce->dma); in qce_crypto_probe()
236 clk_disable_unprepare(qce->bus); in qce_crypto_probe()
238 clk_disable_unprepare(qce->iface); in qce_crypto_probe()
240 clk_disable_unprepare(qce->core); in qce_crypto_probe()
246 struct qce_device *qce = platform_get_drvdata(pdev); in qce_crypto_remove() local
248 tasklet_kill(&qce->done_tasklet); in qce_crypto_remove()
249 qce_unregister_algs(qce); in qce_crypto_remove()
250 qce_dma_release(&qce->dma); in qce_crypto_remove()
251 clk_disable_unprepare(qce->bus); in qce_crypto_remove()
252 clk_disable_unprepare(qce->iface); in qce_crypto_remove()
253 clk_disable_unprepare(qce->core); in qce_crypto_remove()