Lines Matching full:qce

43 	struct qce_device *qce = data;  in qce_unregister_algs()  local
48 ops->unregister_algs(qce); in qce_unregister_algs()
52 static int devm_qce_register_algs(struct qce_device *qce) in devm_qce_register_algs() argument
59 ret = ops->register_algs(qce); in devm_qce_register_algs()
62 ops->unregister_algs(qce); in devm_qce_register_algs()
67 return devm_add_action_or_reset(qce->dev, qce_unregister_algs, qce); in devm_qce_register_algs()
87 static int qce_handle_queue(struct qce_device *qce, in qce_handle_queue() argument
93 scoped_guard(mutex, &qce->lock) { in qce_handle_queue()
95 ret = crypto_enqueue_request(&qce->queue, req); in qce_handle_queue()
98 if (qce->req) in qce_handle_queue()
101 backlog = crypto_get_backlog(&qce->queue); in qce_handle_queue()
102 async_req = crypto_dequeue_request(&qce->queue); in qce_handle_queue()
104 qce->req = async_req; in qce_handle_queue()
111 scoped_guard(mutex, &qce->lock) in qce_handle_queue()
117 qce->result = err; in qce_handle_queue()
118 schedule_work(&qce->done_work); in qce_handle_queue()
126 struct qce_device *qce = container_of(work, struct qce_device, in qce_req_done_work() local
130 scoped_guard(mutex, &qce->lock) { in qce_req_done_work()
131 req = qce->req; in qce_req_done_work()
132 qce->req = NULL; in qce_req_done_work()
136 crypto_request_complete(req, qce->result); in qce_req_done_work()
138 qce_handle_queue(qce, NULL); in qce_req_done_work()
141 static int qce_async_request_enqueue(struct qce_device *qce, in qce_async_request_enqueue() argument
144 return qce_handle_queue(qce, req); in qce_async_request_enqueue()
147 static void qce_async_request_done(struct qce_device *qce, int ret) in qce_async_request_done() argument
149 qce->result = ret; in qce_async_request_done()
150 schedule_work(&qce->done_work); in qce_async_request_done()
153 static int qce_check_version(struct qce_device *qce) in qce_check_version() argument
157 qce_get_version(qce, &major, &minor, &step); in qce_check_version()
166 qce->burst_size = QCE_BAM_BURST_SIZE; in qce_check_version()
181 qce->pipe_pair_id = qce->dma.rxchan->chan_id >> 1; in qce_check_version()
183 dev_dbg(qce->dev, "Crypto device found, version %d.%d.%d\n", in qce_check_version()
192 struct qce_device *qce; in qce_crypto_probe() local
195 qce = devm_kzalloc(dev, sizeof(*qce), GFP_KERNEL); in qce_crypto_probe()
196 if (!qce) in qce_crypto_probe()
199 qce->dev = dev; in qce_crypto_probe()
200 platform_set_drvdata(pdev, qce); in qce_crypto_probe()
202 qce->base = devm_platform_ioremap_resource(pdev, 0); in qce_crypto_probe()
203 if (IS_ERR(qce->base)) in qce_crypto_probe()
204 return PTR_ERR(qce->base); in qce_crypto_probe()
210 qce->core = devm_clk_get_optional_enabled(qce->dev, "core"); in qce_crypto_probe()
211 if (IS_ERR(qce->core)) in qce_crypto_probe()
212 return PTR_ERR(qce->core); in qce_crypto_probe()
214 qce->iface = devm_clk_get_optional_enabled(qce->dev, "iface"); in qce_crypto_probe()
215 if (IS_ERR(qce->iface)) in qce_crypto_probe()
216 return PTR_ERR(qce->iface); in qce_crypto_probe()
218 qce->bus = devm_clk_get_optional_enabled(qce->dev, "bus"); in qce_crypto_probe()
219 if (IS_ERR(qce->bus)) in qce_crypto_probe()
220 return PTR_ERR(qce->bus); in qce_crypto_probe()
222 qce->mem_path = devm_of_icc_get(qce->dev, "memory"); in qce_crypto_probe()
223 if (IS_ERR(qce->mem_path)) in qce_crypto_probe()
224 return PTR_ERR(qce->mem_path); in qce_crypto_probe()
226 ret = icc_set_bw(qce->mem_path, QCE_DEFAULT_MEM_BANDWIDTH, QCE_DEFAULT_MEM_BANDWIDTH); in qce_crypto_probe()
230 ret = devm_qce_dma_request(qce->dev, &qce->dma); in qce_crypto_probe()
234 ret = qce_check_version(qce); in qce_crypto_probe()
238 ret = devm_mutex_init(qce->dev, &qce->lock); in qce_crypto_probe()
242 INIT_WORK(&qce->done_work, qce_req_done_work); in qce_crypto_probe()
243 crypto_init_queue(&qce->queue, QCE_QUEUE_LENGTH); in qce_crypto_probe()
245 qce->async_req_enqueue = qce_async_request_enqueue; in qce_crypto_probe()
246 qce->async_req_done = qce_async_request_done; in qce_crypto_probe()
248 return devm_qce_register_algs(qce); in qce_crypto_probe()
254 { .compatible = "qcom,qce", },