1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (c) 2010-2014, The Linux Foundation. All rights reserved. 4 */ 5 6 #ifndef _CORE_H_ 7 #define _CORE_H_ 8 9 #include <linux/workqueue.h> 10 11 #include "dma.h" 12 13 /** 14 * struct qce_device - crypto engine device structure 15 * @queue: crypto request queue 16 * @lock: the lock protects queue and req 17 * @done_work: workqueue context 18 * @req: current active request 19 * @result: result of current transform 20 * @base: virtual IO base 21 * @dev: pointer to device structure 22 * @core: core device clock 23 * @iface: interface clock 24 * @bus: bus clock 25 * @dma: pointer to dma data 26 * @burst_size: the crypto burst size 27 * @pipe_pair_id: which pipe pair id the device using 28 * @async_req_enqueue: invoked by every algorithm to enqueue a request 29 * @async_req_done: invoked by every algorithm to finish its request 30 */ 31 struct qce_device { 32 struct crypto_queue queue; 33 spinlock_t lock; 34 struct work_struct done_work; 35 struct crypto_async_request *req; 36 int result; 37 void __iomem *base; 38 struct device *dev; 39 struct clk *core, *iface, *bus; 40 struct icc_path *mem_path; 41 struct qce_dma_data dma; 42 int burst_size; 43 unsigned int pipe_pair_id; 44 int (*async_req_enqueue)(struct qce_device *qce, 45 struct crypto_async_request *req); 46 void (*async_req_done)(struct qce_device *qce, int ret); 47 }; 48 49 /** 50 * struct qce_algo_ops - algorithm operations per crypto type 51 * @type: should be CRYPTO_ALG_TYPE_XXX 52 * @register_algs: invoked by core to register the algorithms 53 * @unregister_algs: invoked by core to unregister the algorithms 54 * @async_req_handle: invoked by core to handle enqueued request 55 */ 56 struct qce_algo_ops { 57 u32 type; 58 int (*register_algs)(struct qce_device *qce); 59 void (*unregister_algs)(struct qce_device *qce); 60 int (*async_req_handle)(struct crypto_async_request *async_req); 61 }; 62 63 #endif /* _CORE_H_ */ 64