162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (c) 2010-2014, The Linux Foundation. All rights reserved. 462306a36Sopenharmony_ci */ 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#ifndef _CORE_H_ 762306a36Sopenharmony_ci#define _CORE_H_ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#include "dma.h" 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci/** 1262306a36Sopenharmony_ci * struct qce_device - crypto engine device structure 1362306a36Sopenharmony_ci * @queue: crypto request queue 1462306a36Sopenharmony_ci * @lock: the lock protects queue and req 1562306a36Sopenharmony_ci * @done_tasklet: done tasklet object 1662306a36Sopenharmony_ci * @req: current active request 1762306a36Sopenharmony_ci * @result: result of current transform 1862306a36Sopenharmony_ci * @base: virtual IO base 1962306a36Sopenharmony_ci * @dev: pointer to device structure 2062306a36Sopenharmony_ci * @core: core device clock 2162306a36Sopenharmony_ci * @iface: interface clock 2262306a36Sopenharmony_ci * @bus: bus clock 2362306a36Sopenharmony_ci * @dma: pointer to dma data 2462306a36Sopenharmony_ci * @burst_size: the crypto burst size 2562306a36Sopenharmony_ci * @pipe_pair_id: which pipe pair id the device using 2662306a36Sopenharmony_ci * @async_req_enqueue: invoked by every algorithm to enqueue a request 2762306a36Sopenharmony_ci * @async_req_done: invoked by every algorithm to finish its request 2862306a36Sopenharmony_ci */ 2962306a36Sopenharmony_cistruct qce_device { 3062306a36Sopenharmony_ci struct crypto_queue queue; 3162306a36Sopenharmony_ci spinlock_t lock; 3262306a36Sopenharmony_ci struct tasklet_struct done_tasklet; 3362306a36Sopenharmony_ci struct crypto_async_request *req; 3462306a36Sopenharmony_ci int result; 3562306a36Sopenharmony_ci void __iomem *base; 3662306a36Sopenharmony_ci struct device *dev; 3762306a36Sopenharmony_ci struct clk *core, *iface, *bus; 3862306a36Sopenharmony_ci struct icc_path *mem_path; 3962306a36Sopenharmony_ci struct qce_dma_data dma; 4062306a36Sopenharmony_ci int burst_size; 4162306a36Sopenharmony_ci unsigned int pipe_pair_id; 4262306a36Sopenharmony_ci int (*async_req_enqueue)(struct qce_device *qce, 4362306a36Sopenharmony_ci struct crypto_async_request *req); 4462306a36Sopenharmony_ci void (*async_req_done)(struct qce_device *qce, int ret); 4562306a36Sopenharmony_ci}; 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci/** 4862306a36Sopenharmony_ci * struct qce_algo_ops - algorithm operations per crypto type 4962306a36Sopenharmony_ci * @type: should be CRYPTO_ALG_TYPE_XXX 5062306a36Sopenharmony_ci * @register_algs: invoked by core to register the algorithms 5162306a36Sopenharmony_ci * @unregister_algs: invoked by core to unregister the algorithms 5262306a36Sopenharmony_ci * @async_req_handle: invoked by core to handle enqueued request 5362306a36Sopenharmony_ci */ 5462306a36Sopenharmony_cistruct qce_algo_ops { 5562306a36Sopenharmony_ci u32 type; 5662306a36Sopenharmony_ci int (*register_algs)(struct qce_device *qce); 5762306a36Sopenharmony_ci void (*unregister_algs)(struct qce_device *qce); 5862306a36Sopenharmony_ci int (*async_req_handle)(struct crypto_async_request *async_req); 5962306a36Sopenharmony_ci}; 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci#endif /* _CORE_H_ */ 62