Lines Matching full:qce
44 struct qce_device *qce = data; in qce_unregister_algs() local
49 ops->unregister_algs(qce); in qce_unregister_algs()
53 static int devm_qce_register_algs(struct qce_device *qce) in devm_qce_register_algs() argument
60 ret = ops->register_algs(qce); in devm_qce_register_algs()
63 ops->unregister_algs(qce); in devm_qce_register_algs()
68 return devm_add_action_or_reset(qce->dev, qce_unregister_algs, qce); in devm_qce_register_algs()
88 static int qce_handle_queue(struct qce_device *qce, in qce_handle_queue() argument
94 scoped_guard(mutex, &qce->lock) { in qce_handle_queue()
96 ret = crypto_enqueue_request(&qce->queue, req); in qce_handle_queue()
99 if (qce->req) in qce_handle_queue()
102 backlog = crypto_get_backlog(&qce->queue); in qce_handle_queue()
103 async_req = crypto_dequeue_request(&qce->queue); in qce_handle_queue()
105 qce->req = async_req; in qce_handle_queue()
112 scoped_guard(mutex, &qce->lock) in qce_handle_queue()
118 qce->result = err; in qce_handle_queue()
119 schedule_work(&qce->done_work); in qce_handle_queue()
127 struct qce_device *qce = container_of(work, struct qce_device, in qce_req_done_work() local
131 scoped_guard(mutex, &qce->lock) { in qce_req_done_work()
132 req = qce->req; in qce_req_done_work()
133 qce->req = NULL; in qce_req_done_work()
137 crypto_request_complete(req, qce->result); in qce_req_done_work()
139 qce_handle_queue(qce, NULL); in qce_req_done_work()
142 static int qce_async_request_enqueue(struct qce_device *qce, in qce_async_request_enqueue() argument
145 return qce_handle_queue(qce, req); in qce_async_request_enqueue()
148 static void qce_async_request_done(struct qce_device *qce, int ret) in qce_async_request_done() argument
150 qce->result = ret; in qce_async_request_done()
151 schedule_work(&qce->done_work); in qce_async_request_done()
154 static int qce_check_version(struct qce_device *qce) in qce_check_version() argument
158 qce_get_version(qce, &major, &minor, &step); in qce_check_version()
167 qce->burst_size = QCE_BAM_BURST_SIZE; in qce_check_version()
182 qce->pipe_pair_id = qce->dma.rxchan->chan_id >> 1; in qce_check_version()
184 dev_dbg(qce->dev, "Crypto device found, version %d.%d.%d\n", in qce_check_version()
193 struct qce_device *qce; in qce_crypto_probe() local
196 qce = devm_kzalloc(dev, sizeof(*qce), GFP_KERNEL); in qce_crypto_probe()
197 if (!qce) in qce_crypto_probe()
200 qce->dev = dev; in qce_crypto_probe()
201 platform_set_drvdata(pdev, qce); in qce_crypto_probe()
203 qce->base = devm_platform_ioremap_resource(pdev, 0); in qce_crypto_probe()
204 if (IS_ERR(qce->base)) in qce_crypto_probe()
205 return PTR_ERR(qce->base); in qce_crypto_probe()
211 qce->core = devm_clk_get_optional_enabled(qce->dev, "core"); in qce_crypto_probe()
212 if (IS_ERR(qce->core)) in qce_crypto_probe()
213 return PTR_ERR(qce->core); in qce_crypto_probe()
215 qce->iface = devm_clk_get_optional_enabled(qce->dev, "iface"); in qce_crypto_probe()
216 if (IS_ERR(qce->iface)) in qce_crypto_probe()
217 return PTR_ERR(qce->iface); in qce_crypto_probe()
219 qce->bus = devm_clk_get_optional_enabled(qce->dev, "bus"); in qce_crypto_probe()
220 if (IS_ERR(qce->bus)) in qce_crypto_probe()
221 return PTR_ERR(qce->bus); in qce_crypto_probe()
223 qce->mem_path = devm_of_icc_get(qce->dev, "memory"); in qce_crypto_probe()
224 if (IS_ERR(qce->mem_path)) in qce_crypto_probe()
225 return PTR_ERR(qce->mem_path); in qce_crypto_probe()
227 ret = icc_set_bw(qce->mem_path, QCE_DEFAULT_MEM_BANDWIDTH, QCE_DEFAULT_MEM_BANDWIDTH); in qce_crypto_probe()
231 ret = devm_qce_dma_request(qce->dev, &qce->dma); in qce_crypto_probe()
235 ret = qce_check_version(qce); in qce_crypto_probe()
239 ret = devm_mutex_init(qce->dev, &qce->lock); in qce_crypto_probe()
243 INIT_WORK(&qce->done_work, qce_req_done_work); 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 return devm_qce_register_algs(qce); in qce_crypto_probe()
255 { .compatible = "qcom,qce", },