Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cryp.h
Go to the documentation of this file.
1 
11 #ifndef _CRYP_H_
12 #define _CRYP_H_
13 
14 #include <linux/completion.h>
15 #include <linux/dmaengine.h>
16 #include <linux/klist.h>
17 #include <linux/mutex.h>
18 
19 #define DEV_DBG_NAME "crypX crypX:"
20 
21 /* CRYP enable/disable */
25 };
26 
27 /* CRYP Start Computation enable/disable */
28 enum cryp_start {
31 };
32 
33 /* CRYP Init Signal enable/disable */
34 enum cryp_init {
37 };
38 
39 /* Cryp State enable/disable */
40 enum cryp_state {
43 };
44 
45 /* Key preparation bit enable */
49 };
50 
51 /* Key size for AES */
52 #define CRYP_KEY_SIZE_128 (0)
53 #define CRYP_KEY_SIZE_192 (1)
54 #define CRYP_KEY_SIZE_256 (2)
55 
56 /* AES modes */
66 };
67 
68 /* Cryp Encryption or Decryption */
72 };
73 
74 /* Hardware access method */
75 enum cryp_mode {
79 };
80 
89 struct cryp_config {
90  int keysize;
93 };
94 
105 };
106 
107 /* Cryp status */
114 };
115 
116 /* Cryp DMA interface */
122 };
123 
127 };
128 
129 /* Key registers */
135 };
136 
137 /* Key register left and right */
141 };
142 
143 /* Cryp Initialization structure */
147 };
148 
149 /* struct cryp_init_vector_value -
150  * @init_value_left
151  * @init_value_right
152  * */
156 };
157 
184 
193 
198 
201 };
202 
203 struct cryp_dma {
216 };
217 
235  struct device *dev;
236  struct clk *clk;
242  struct cryp_dma dma;
246 };
247 
248 void cryp_wait_until_done(struct cryp_device_data *device_data);
249 
250 /* Initialization functions */
251 
252 int cryp_check(struct cryp_device_data *device_data);
253 
254 void cryp_activity(struct cryp_device_data *device_data,
255  enum cryp_crypen cryp_crypen);
256 
257 void cryp_flush_inoutfifo(struct cryp_device_data *device_data);
258 
259 int cryp_set_configuration(struct cryp_device_data *device_data,
260  struct cryp_config *cryp_config,
261  u32 *control_register);
262 
263 void cryp_configure_for_dma(struct cryp_device_data *device_data,
264  enum cryp_dma_req_type dma_req);
265 
266 int cryp_configure_key_values(struct cryp_device_data *device_data,
267  enum cryp_key_reg_index key_reg_index,
268  struct cryp_key_value key_value);
269 
270 int cryp_configure_init_vector(struct cryp_device_data *device_data,
272  init_vector_index,
274  init_vector_value);
275 
276 int cryp_configure_protection(struct cryp_device_data *device_data,
277  struct cryp_protection_config *p_protect_config);
278 
279 /* Power management funtions */
280 void cryp_save_device_context(struct cryp_device_data *device_data,
281  struct cryp_device_context *ctx,
282  int cryp_mode);
283 
284 void cryp_restore_device_context(struct cryp_device_data *device_data,
285  struct cryp_device_context *ctx);
286 
287 /* Data transfer and status bits. */
288 int cryp_is_logic_busy(struct cryp_device_data *device_data);
289 
290 int cryp_get_status(struct cryp_device_data *device_data);
291 
298 int cryp_write_indata(struct cryp_device_data *device_data, u32 write_data);
299 
306 int cryp_read_outdata(struct cryp_device_data *device_data, u32 *read_data);
307 
308 #endif /* _CRYP_H_ */