1 /* 2 * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. 3 * Copyright (c) 2015 iComm Corporation 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * This program is distributed in the hope that it will be useful, but 10 * WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 * See the GNU General Public License for more details. 13 * You should have received a copy of the GNU General Public License 14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 */ 16 17 #include <linux/irq.h> 18 #include <linux/version.h> 19 #include <linux/module.h> 20 #include <linux/vmalloc.h> 21 #include <linux/gpio.h> 22 #include <linux/mmc/host.h> 23 #include <linux/delay.h> 24 #include <linux/regulator/consumer.h> 25 #include <asm/io.h> 26 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) 27 #include <linux/printk.h> 28 #include <linux/err.h> 29 #else 30 #include <config/printk.h> 31 #endif 32 #ifdef CONFIG_CONTROL_SDIOCARD_PWR 33 extern void mmc_rescan_sdio(void); 34 extern void wifi_power(int on); 35 #endif 36 static int g_wifidev_registered = 0; 37 extern int ssvdevice_init(void); 38 extern void ssvdevice_exit(void); 39 #ifdef CONFIG_SSV_SUPPORT_AES_ASM 40 extern int aes_init(void); 41 extern void aes_fini(void); 42 extern int sha1_mod_init(void); 43 extern void sha1_mod_fini(void); 44 #endif initWlan(void)45int initWlan(void) 46 { 47 int ret = 0; 48 #ifdef CONFIG_CONTROL_SDIOCARD_PWR 49 wifi_power(0); 50 mdelay(10); 51 wifi_power(1); 52 mdelay(120); 53 mmc_rescan_sdio(); 54 mdelay(120); 55 #endif 56 g_wifidev_registered = 1; 57 ret = ssvdevice_init(); 58 return ret; 59 } exitWlan(void)60void exitWlan(void) 61 { 62 if (g_wifidev_registered) { 63 ssvdevice_exit(); 64 #ifdef CONFIG_CONTROL_SDIOCARD_PWR 65 wifi_power(0); 66 #endif 67 g_wifidev_registered = 0; 68 } 69 return; 70 } generic_wifi_init_module(void)71static __init int generic_wifi_init_module(void) 72 { 73 printk("%s\n", __func__); 74 #ifdef CONFIG_SSV_SUPPORT_AES_ASM 75 sha1_mod_init(); 76 aes_init(); 77 #endif 78 return initWlan(); 79 } generic_wifi_exit_module(void)80static __exit void generic_wifi_exit_module(void) 81 { 82 printk("%s\n", __func__); 83 #ifdef CONFIG_SSV_SUPPORT_AES_ASM 84 aes_fini(); 85 sha1_mod_fini(); 86 #endif 87 exitWlan(); 88 } 89 EXPORT_SYMBOL(generic_wifi_init_module); 90 EXPORT_SYMBOL(generic_wifi_exit_module); 91 module_init(generic_wifi_init_module); 92 module_exit(generic_wifi_exit_module); 93 MODULE_LICENSE("Dual BSD/GPL"); 94