1 /******************************************************************************
3 ** FILE NAME : ifxmips_deu_ar9.h
5 ** MODULES : DEU Module for AR9
7 ** DATE : September 8, 2009
8 ** AUTHOR : Mohammad Firdaus
9 ** DESCRIPTION : Data Encryption Unit Driver
10 ** COPYRIGHT : Copyright (c) 2009
11 ** Infineon Technologies AG
12 ** Am Campeon 1-12, 85579 Neubiberg, Germany
14 ** This program is free software; you can redistribute it and/or modify
15 ** it under the terms of the GNU General Public License as published by
16 ** the Free Software Foundation; either version 2 of the License, or
17 ** (at your option) any later version.
20 ** $Date $Author $Comment
21 ** 08,Sept 2009 Mohammad Firdaus Initial UEIP release
22 *******************************************************************************/
24 \defgroup IFX_DEU IFX_DEU_DRIVERS
26 \brief deu driver module
30 \defgroup IFX_DEU_DEFINITIONS IFX_DEU_DEFINITIONS
32 \brief ifx deu definitions
36 \file ifxmips_deu_ar9.h
37 \brief deu driver header file
41 #ifndef IFXMIPS_DEU_AR9_H
42 #define IFXMIPS_DEU_AR9_H
44 /* Project Header Files */
45 #include <linux/version.h>
46 #include <linux/module.h>
47 #include <linux/init.h>
48 #include <linux/types.h>
49 #include <linux/errno.h>
50 #include <linux/crypto.h>
51 #include <linux/interrupt.h>
52 #include <linux/delay.h>
53 #include <asm/byteorder.h>
54 #include <crypto/algapi.h>
55 #include <linux/module.h>
57 #include <linux/scatterlist.h>
58 #include <linux/skbuff.h>
59 #include <linux/netdevice.h>
60 #include "ifxmips_deu.h"
64 #define HASH_CON_VALUE 0x0700002C
66 #define INPUT_ENDIAN_SWAP(input) input_swap(input)
67 #define DEU_ENDIAN_SWAP(input) endian_swap(input)
68 #define DELAY_PERIOD 10
69 #define FIND_DEU_CHIP_VERSION chip_version()
70 #define CLC_START IFX_DEU_CLK
77 #define SHA1_HMAC_INIT 5
78 #define MD5_HMAC_INIT 6
80 #define AES_START IFX_AES_CON
81 #define DES_3DES_START IFX_DES_CON
83 #define WAIT_AES_DMA_READY() \
86 volatile struct deu_dma_t *dma = (struct deu_dma_t *) IFX_DEU_DMA_CON; \
87 volatile struct aes_t *aes = (volatile struct aes_t *) AES_START; \
88 for (i = 0; i < 10; i++) \
89 udelay(DELAY_PERIOD); \
90 while (dma->controlr.BSY) {}; \
91 while (aes->controlr.BUS) {}; \
94 #define WAIT_DES_DMA_READY() \
97 volatile struct deu_dma_t *dma = (struct deu_dma_t *) IFX_DEU_DMA_CON; \
98 volatile struct des_t *des = (struct des_t *) DES_3DES_START; \
99 for (i = 0; i < 10; i++) \
100 udelay(DELAY_PERIOD); \
101 while (dma->controlr.BSY) {}; \
102 while (des->controlr.BUS) {}; \
105 #define AES_DMA_MISC_CONFIG() \
107 volatile struct aes_t *aes = (volatile struct aes_t *) AES_START; \
108 aes->controlr.KRE = 1; \
109 aes->controlr.GO = 1; \
112 #define SHA_HASH_INIT \
114 volatile struct deu_hash_t *hash = (struct deu_hash_t *) HASH_START; \
115 hash->controlr.SM = 1; \
116 hash->controlr.ALGO = 0; \
117 hash->controlr.INIT = 1; \
120 /* DEU Common Structures for AR9*/
122 struct clc_controlr_t {
134 struct des_controlr { //10h
168 struct aes_controlr {
213 struct arc4_controlr {
250 struct hash_controlr {
286 struct dma_controlr {
299 #endif /* IFXMIPS_DEU_AR9_H */