blob: 549965d4d91fea6e316e31c68ca43b89178b0613 [file] [log] [blame]
Stanimir Varbanovec8f5d82014-06-25 19:28:57 +03001/*
2 * Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef _CORE_H_
15#define _CORE_H_
16
17#include "dma.h"
18
19/**
20 * struct qce_device - crypto engine device structure
21 * @queue: crypto request queue
22 * @lock: the lock protects queue and req
23 * @done_tasklet: done tasklet object
24 * @req: current active request
25 * @result: result of current transform
26 * @base: virtual IO base
27 * @dev: pointer to device structure
28 * @core: core device clock
29 * @iface: interface clock
30 * @bus: bus clock
31 * @dma: pointer to dma data
32 * @burst_size: the crypto burst size
33 * @pipe_pair_id: which pipe pair id the device using
34 * @async_req_enqueue: invoked by every algorithm to enqueue a request
35 * @async_req_done: invoked by every algorithm to finish its request
36 */
37struct qce_device {
38 struct crypto_queue queue;
39 spinlock_t lock;
40 struct tasklet_struct done_tasklet;
41 struct crypto_async_request *req;
42 int result;
43 void __iomem *base;
44 struct device *dev;
45 struct clk *core, *iface, *bus;
46 struct qce_dma_data dma;
47 int burst_size;
48 unsigned int pipe_pair_id;
49 int (*async_req_enqueue)(struct qce_device *qce,
50 struct crypto_async_request *req);
51 void (*async_req_done)(struct qce_device *qce, int ret);
52};
53
54/**
55 * struct qce_algo_ops - algorithm operations per crypto type
56 * @type: should be CRYPTO_ALG_TYPE_XXX
57 * @register_algs: invoked by core to register the algorithms
58 * @unregister_algs: invoked by core to unregister the algorithms
59 * @async_req_handle: invoked by core to handle enqueued request
60 */
61struct qce_algo_ops {
62 u32 type;
63 int (*register_algs)(struct qce_device *qce);
64 void (*unregister_algs)(struct qce_device *qce);
65 int (*async_req_handle)(struct crypto_async_request *async_req);
66};
67
68#endif /* _CORE_H_ */