net: wireless: rockchip_wlan: add rtl8723bs support
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rtl8723bs / platform / platform_ARM_WMT_sdio.c
1 /******************************************************************************\r
2  *\r
3  * Copyright(c) 2013 Realtek Corporation. All rights reserved.\r
4  *\r
5  * This program is free software; you can redistribute it and/or modify it\r
6  * under the terms of version 2 of the GNU General Public License as\r
7  * published by the Free Software Foundation.\r
8  *\r
9  * This program is distributed in the hope that it will be useful, but WITHOUT\r
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
12  * more details.\r
13  *\r
14  * You should have received a copy of the GNU General Public License along with\r
15  * this program; if not, write to the Free Software Foundation, Inc.,\r
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA\r
17  *\r
18  *\r
19  ******************************************************************************/\r
20 #include <drv_types.h>\r
21 #include <mach/wmt_iomux.h>\r
22 #include <linux/gpio.h>\r
23 \r
24 extern void wmt_detect_sdio2(void);\r
25 extern void force_remove_sdio2(void);\r
26 \r
27 int platform_wifi_power_on(void)\r
28 {\r
29         int err = 0;\r
30         err = gpio_request(WMT_PIN_GP62_SUSGPIO1, "wifi_chip_en");\r
31         if (err < 0){\r
32                 printk("request gpio for rtl8188eu failed!\n");\r
33                 return err;\r
34         }\r
35         gpio_direction_output(WMT_PIN_GP62_SUSGPIO1, 0);//pull sus_gpio1 to 0 to open vcc_wifi.\r
36         printk("power on rtl8189.\n");\r
37         msleep(500);\r
38         wmt_detect_sdio2();\r
39         printk("[rtl8189es] %s: new card, power on.\n", __FUNCTION__);\r
40         return err;\r
41 }\r
42 \r
43 void platform_wifi_power_off(void)\r
44 {\r
45         force_remove_sdio2();\r
46 \r
47         gpio_direction_output(WMT_PIN_GP62_SUSGPIO1, 1);//pull sus_gpio1 to 1 to close vcc_wifi.\r
48         printk("power off rtl8189.\n");\r
49         gpio_free(WMT_PIN_GP62_SUSGPIO1);\r
50         printk("[rtl8189es] %s: remove card, power off.\n", __FUNCTION__);\r
51 }\r