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;
73 void chip_version(void);
75 /*! \fn static int __init deu_init (void)
76 * \ingroup IFX_DEU_FUNCTIONS
77 * \brief link all modules that have been selected in kernel config for ifx hw crypto support
81 static int ltq_deu_probe(struct platform_device
*pdev
)
88 #define IFX_DEU_DRV_VERSION "2.0.0"
89 printk(KERN_INFO
"Infineon Technologies DEU driver version %s \n", IFX_DEU_DRV_VERSION
);
91 FIND_DEU_CHIP_VERSION
;
93 #if defined(CONFIG_CRYPTO_DEV_DES)
94 if ((ret
= ifxdeu_init_des ())) {
95 printk (KERN_ERR
"IFX DES initialization failed!\n");
98 #if defined(CONFIG_CRYPTO_DEV_AES)
99 if ((ret
= ifxdeu_init_aes ())) {
100 printk (KERN_ERR
"IFX AES initialization failed!\n");
104 #if defined(CONFIG_CRYPTO_DEV_ARC4)
105 if ((ret
= ifxdeu_init_arc4 ())) {
106 printk (KERN_ERR
"IFX ARC4 initialization failed!\n");
110 #if defined(CONFIG_CRYPTO_DEV_SHA1)
111 if ((ret
= ifxdeu_init_sha1 ())) {
112 printk (KERN_ERR
"IFX SHA1 initialization failed!\n");
115 #if defined(CONFIG_CRYPTO_DEV_MD5)
116 if ((ret
= ifxdeu_init_md5 ())) {
117 printk (KERN_ERR
"IFX MD5 initialization failed!\n");
121 #if defined(CONFIG_CRYPTO_DEV_SHA1_HMAC)
122 if ((ret
= ifxdeu_init_sha1_hmac ())) {
123 printk (KERN_ERR
"IFX SHA1_HMAC initialization failed!\n");
126 #if defined(CONFIG_CRYPTO_DEV_MD5_HMAC)
127 if ((ret
= ifxdeu_init_md5_hmac ())) {
128 printk (KERN_ERR
"IFX MD5_HMAC initialization failed!\n");
138 /*! \fn static void __exit deu_fini (void)
139 * \ingroup IFX_DEU_FUNCTIONS
140 * \brief remove the loaded crypto algorithms
142 static int ltq_deu_remove(struct platform_device
*pdev
)
144 //#ifdef CONFIG_CRYPTO_DEV_PWR_SAVE_MODE
145 #if defined(CONFIG_CRYPTO_DEV_DES)
148 #if defined(CONFIG_CRYPTO_DEV_AES)
151 #if defined(CONFIG_CRYPTO_DEV_ARC4)
154 #if defined(CONFIG_CRYPTO_DEV_SHA1)
157 #if defined(CONFIG_CRYPTO_DEV_MD5)
160 #if defined(CONFIG_CRYPTO_DEV_SHA1_HMAC)
161 ifxdeu_fini_sha1_hmac ();
163 #if defined(CONFIG_CRYPTO_DEV_MD5_HMAC)
164 ifxdeu_fini_md5_hmac ();
166 printk("DEU has exited successfully\n");
172 int disable_multiblock
= 0;
174 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
175 module_param(disable_multiblock
,int,0);
178 //MODULE_PARM (disable_multiblock, "i");
179 MODULE_PARM_DESC (disable_multiblock
,
180 "Disable encryption of whole multiblock buffers.");
183 static const struct of_device_id ltq_deu_match
[] = {
185 { .compatible
= "lantiq,deu-danube"},
186 #elif defined CONFIG_AR9
187 { .compatible
= "lantiq,deu-arx100"},
188 #elif defined CONFIG_VR9
189 { .compatible
= "lantiq,deu-xrx200"},
193 MODULE_DEVICE_TABLE(of
, ltq_deu_match
);
196 static struct platform_driver ltq_deu_driver
= {
197 .probe
= ltq_deu_probe
,
198 .remove
= ltq_deu_remove
,
201 .owner
= THIS_MODULE
,
202 .of_match_table
= ltq_deu_match
,
206 module_platform_driver(ltq_deu_driver
);
208 MODULE_DESCRIPTION ("Infineon DEU crypto engine support.");
209 MODULE_LICENSE ("GPL");
210 MODULE_AUTHOR ("Mohammad Firdaus");