net: wireless: rockchip_wlan: add rtl8188fu support
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rtl8188fu / platform / platform_ARM_WMT_sdio.c
diff --git a/drivers/net/wireless/rockchip_wlan/rtl8188fu/platform/platform_ARM_WMT_sdio.c b/drivers/net/wireless/rockchip_wlan/rtl8188fu/platform/platform_ARM_WMT_sdio.c
new file mode 100644 (file)
index 0000000..62e5825
--- /dev/null
@@ -0,0 +1,51 @@
+/******************************************************************************\r
+ *\r
+ * Copyright(c) 2013 Realtek Corporation. All rights reserved.\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify it\r
+ * under the terms of version 2 of the GNU General Public License as\r
+ * published by the Free Software Foundation.\r
+ *\r
+ * This program is distributed in the hope that it will be useful, but WITHOUT\r
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
+ * more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License along with\r
+ * this program; if not, write to the Free Software Foundation, Inc.,\r
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA\r
+ *\r
+ *\r
+ ******************************************************************************/\r
+#include <drv_types.h>\r
+#include <mach/wmt_iomux.h>\r
+#include <linux/gpio.h>\r
+\r
+extern void wmt_detect_sdio2(void);\r
+extern void force_remove_sdio2(void);\r
+\r
+int platform_wifi_power_on(void)\r
+{\r
+       int err = 0;\r
+       err = gpio_request(WMT_PIN_GP62_SUSGPIO1, "wifi_chip_en");\r
+       if (err < 0){\r
+               printk("request gpio for rtl8188eu failed!\n");\r
+               return err;\r
+       }\r
+       gpio_direction_output(WMT_PIN_GP62_SUSGPIO1, 0);//pull sus_gpio1 to 0 to open vcc_wifi.\r
+       printk("power on rtl8189.\n");\r
+       msleep(500);\r
+       wmt_detect_sdio2();\r
+       printk("[rtl8189es] %s: new card, power on.\n", __FUNCTION__);\r
+       return err;\r
+}\r
+\r
+void platform_wifi_power_off(void)\r
+{\r
+       force_remove_sdio2();\r
+\r
+       gpio_direction_output(WMT_PIN_GP62_SUSGPIO1, 1);//pull sus_gpio1 to 1 to close vcc_wifi.\r
+       printk("power off rtl8189.\n");\r
+       gpio_free(WMT_PIN_GP62_SUSGPIO1);\r
+       printk("[rtl8189es] %s: remove card, power off.\n", __FUNCTION__);\r
+}\r