1 /******************************************************************************
3 ** FILE NAME : ifxmips_deu.c
5 ** MODULES : DEU Module for Danube
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 *******************************************************************************/
25 \defgroup IFX_DEU IFX_DEU_DRIVERS
27 \brief ifx deu driver module
33 \brief main deu driver file
37 \defgroup IFX_DEU_FUNCTIONS IFX_DEU_FUNCTIONS
39 \brief IFX DEU functions
43 #include <linux/version.h>
44 #if defined(CONFIG_MODVERSIONS)
46 #include <linux/modversions.h>
48 #include <linux/module.h>
49 #include <linux/init.h>
50 #include <linux/types.h>
51 #include <linux/errno.h>
52 #include <linux/crypto.h>
53 #include <linux/proc_fs.h>
54 #include <linux/platform_device.h>
55 #include <linux/fs.h> /* Stuff about file systems that we need */
56 #include <asm/byteorder.h>
57 #include "ifxmips_deu.h"
59 #include <lantiq_soc.h>
61 #if defined(CONFIG_DANUBE)
62 #include "ifxmips_deu_danube.h"
63 #elif defined(CONFIG_AR9)
64 #include "ifxmips_deu_ar9.h"
65 #elif defined(CONFIG_VR9) || defined(CONFIG_AR10)
66 #include "ifxmips_deu_vr9.h"
68 #error "Platform unknown!"
69 #endif /* CONFIG_xxxx */
71 int disable_deudma
= 1;
72 spinlock_t ltq_deu_hash_lock
;
73 EXPORT_SYMBOL_GPL(ltq_deu_hash_lock
);
75 void chip_version(void);
77 /*! \fn static int __init deu_init (void)
78 * \ingroup IFX_DEU_FUNCTIONS
79 * \brief link all modules that have been selected in kernel config for ifx hw crypto support
83 static int ltq_deu_probe(struct platform_device
*pdev
)
91 #define IFX_DEU_DRV_VERSION "2.0.0"
92 printk(KERN_INFO
"Infineon Technologies DEU driver version %s \n", IFX_DEU_DRV_VERSION
);
94 FIND_DEU_CHIP_VERSION
;
96 #if defined(CONFIG_CRYPTO_DEV_DES)
97 if ((ret
= ifxdeu_init_des ())) {
98 printk (KERN_ERR
"IFX DES initialization failed!\n");
101 #if defined(CONFIG_CRYPTO_DEV_AES)
102 if ((ret
= ifxdeu_init_aes ())) {
103 printk (KERN_ERR
"IFX AES initialization failed!\n");
107 #if defined(CONFIG_CRYPTO_DEV_ARC4)
108 if ((ret
= ifxdeu_init_arc4 ())) {
109 printk (KERN_ERR
"IFX ARC4 initialization failed!\n");
113 #if defined(CONFIG_CRYPTO_DEV_SHA1)
114 if ((ret
= ifxdeu_init_sha1 ())) {
115 printk (KERN_ERR
"IFX SHA1 initialization failed!\n");
118 #if defined(CONFIG_CRYPTO_DEV_MD5)
119 if ((ret
= ifxdeu_init_md5 ())) {
120 printk (KERN_ERR
"IFX MD5 initialization failed!\n");
124 #if defined(CONFIG_CRYPTO_DEV_SHA1_HMAC)
125 if ((ret
= ifxdeu_init_sha1_hmac ())) {
126 printk (KERN_ERR
"IFX SHA1_HMAC initialization failed!\n");
129 #if defined(CONFIG_CRYPTO_DEV_MD5_HMAC)
130 if ((ret
= ifxdeu_init_md5_hmac ())) {
131 printk (KERN_ERR
"IFX MD5_HMAC initialization failed!\n");
141 /*! \fn static void __exit deu_fini (void)
142 * \ingroup IFX_DEU_FUNCTIONS
143 * \brief remove the loaded crypto algorithms
145 static int ltq_deu_remove(struct platform_device
*pdev
)
147 //#ifdef CONFIG_CRYPTO_DEV_PWR_SAVE_MODE
148 #if defined(CONFIG_CRYPTO_DEV_DES)
151 #if defined(CONFIG_CRYPTO_DEV_AES)
154 #if defined(CONFIG_CRYPTO_DEV_ARC4)
157 #if defined(CONFIG_CRYPTO_DEV_SHA1)
160 #if defined(CONFIG_CRYPTO_DEV_MD5)
163 #if defined(CONFIG_CRYPTO_DEV_SHA1_HMAC)
164 ifxdeu_fini_sha1_hmac ();
166 #if defined(CONFIG_CRYPTO_DEV_MD5_HMAC)
167 ifxdeu_fini_md5_hmac ();
169 printk("DEU has exited successfully\n");
175 int disable_multiblock
= 0;
177 module_param(disable_multiblock
,int,0);
180 static const struct of_device_id ltq_deu_match
[] = {
182 { .compatible
= "lantiq,deu-danube"},
183 #elif defined CONFIG_AR9
184 { .compatible
= "lantiq,deu-arx100"},
185 #elif defined CONFIG_VR9
186 { .compatible
= "lantiq,deu-xrx200"},
190 MODULE_DEVICE_TABLE(of
, ltq_deu_match
);
193 static struct platform_driver ltq_deu_driver
= {
194 .probe
= ltq_deu_probe
,
195 .remove
= ltq_deu_remove
,
198 .owner
= THIS_MODULE
,
199 .of_match_table
= ltq_deu_match
,
203 module_platform_driver(ltq_deu_driver
);
205 MODULE_DESCRIPTION ("Infineon DEU crypto engine support.");
206 MODULE_LICENSE ("GPL");
207 MODULE_AUTHOR ("Mohammad Firdaus");