1 /******************************************************************************
\r
3 * Copyright(c) 2013 Realtek Corporation. All rights reserved.
\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
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
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
19 ******************************************************************************/
\r
22 * This file can be applied to following platforms:
\r
23 * CONFIG_PLATFORM_ARM_SUNXI Series platform
\r
27 #include <drv_types.h>
\r
28 #include <mach/sys_config.h>
\r
30 #ifdef CONFIG_PLATFORM_ARM_SUNxI
\r
31 extern int sw_usb_disable_hcd(__u32 usbc_no);
\r
32 extern int sw_usb_enable_hcd(__u32 usbc_no);
\r
33 static int usb_wifi_host = 2;
\r
36 #if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
\r
37 extern int sw_usb_disable_hcd(__u32 usbc_no);
\r
38 extern int sw_usb_enable_hcd(__u32 usbc_no);
\r
39 extern void wifi_pm_power(int on);
\r
40 static script_item_u item;
\r
43 #ifdef CONFIG_PLATFORM_ARM_SUN8I
\r
44 extern int sunxi_usb_disable_hcd(__u32 usbc_no);
\r
45 extern int sunxi_usb_enable_hcd(__u32 usbc_no);
\r
46 extern void wifi_pm_power(int on);
\r
47 static script_item_u item;
\r
51 int platform_wifi_power_on(void)
\r
55 #ifdef CONFIG_PLATFORM_ARM_SUNxI
\r
56 #ifndef CONFIG_RTL8723A
\r
58 /* ----------get usb_wifi_usbc_num------------- */
\r
59 ret = script_parser_fetch("usb_wifi_para", "usb_wifi_usbc_num", (int *)&usb_wifi_host, 64);
\r
61 DBG_8192C("ERR: script_parser_fetch usb_wifi_usbc_num failed\n");
\r
65 DBG_8192C("sw_usb_enable_hcd: usbc_num = %d\n", usb_wifi_host);
\r
66 sw_usb_enable_hcd(usb_wifi_host);
\r
68 #endif //CONFIG_RTL8723A
\r
69 #endif //CONFIG_PLATFORM_ARM_SUNxI
\r
71 #if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
\r
73 script_item_value_type_e type;
\r
75 type = script_get_item("wifi_para", "wifi_usbc_id", &item);
\r
76 if(SCIRPT_ITEM_VALUE_TYPE_INT != type){
\r
77 printk("ERR: script_get_item wifi_usbc_id failed\n");
\r
82 printk("sw_usb_enable_hcd: usbc_num = %d\n", item.val);
\r
86 #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B))
\r
87 sw_usb_enable_hcd(item.val);
\r
90 #endif //defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
\r
92 #if defined(CONFIG_PLATFORM_ARM_SUN8I)
\r
94 script_item_value_type_e type;
\r
96 type = script_get_item("wifi_para", "wifi_usbc_id", &item);
\r
97 if(SCIRPT_ITEM_VALUE_TYPE_INT != type){
\r
98 printk("ERR: script_get_item wifi_usbc_id failed\n");
\r
103 printk("sw_usb_enable_hcd: usbc_num = %d\n", item.val);
\r
107 #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B))
\r
108 sunxi_usb_enable_hcd(item.val);
\r
111 #endif //CONFIG_PLATFORM_ARM_SUN8I
\r
117 void platform_wifi_power_off(void)
\r
120 #ifdef CONFIG_PLATFORM_ARM_SUNxI
\r
121 #ifndef CONFIG_RTL8723A
\r
122 DBG_8192C("sw_usb_disable_hcd: usbc_num = %d\n", usb_wifi_host);
\r
123 sw_usb_disable_hcd(usb_wifi_host);
\r
124 #endif //ifndef CONFIG_RTL8723A
\r
125 #endif //CONFIG_PLATFORM_ARM_SUNxI
\r
127 #if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
\r
128 #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B))
\r
129 sw_usb_disable_hcd(item.val);
\r
132 #endif //defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
\r
134 #if defined(CONFIG_PLATFORM_ARM_SUN8I)
\r
135 #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B))
\r
136 sunxi_usb_disable_hcd(item.val);
\r
139 #endif //defined(CONFIG_PLATFORM_ARM_SUN8I)
\r