1 /******************************************************************************
3 * Copyright(c) 2013 Realtek Corporation. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 ******************************************************************************/
22 * This file can be applied to following platforms:
23 * CONFIG_PLATFORM_ARM_SUNXI Series platform
27 #include <drv_types.h>
28 #include <mach/sys_config.h>
30 #ifdef CONFIG_PLATFORM_ARM_SUNxI
31 extern int sw_usb_disable_hcd(__u32 usbc_no);
32 extern int sw_usb_enable_hcd(__u32 usbc_no);
33 static int usb_wifi_host = 2;
36 #if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
37 extern int sw_usb_disable_hcd(__u32 usbc_no);
38 extern int sw_usb_enable_hcd(__u32 usbc_no);
39 extern void wifi_pm_power(int on);
40 static script_item_u item;
43 #ifdef CONFIG_PLATFORM_ARM_SUN8I
44 extern int sunxi_usb_disable_hcd(__u32 usbc_no);
45 extern int sunxi_usb_enable_hcd(__u32 usbc_no);
46 extern void wifi_pm_power(int on);
47 static script_item_u item;
51 int platform_wifi_power_on(void)
55 #ifdef CONFIG_PLATFORM_ARM_SUNxI
56 #ifndef CONFIG_RTL8723A
58 /* ----------get usb_wifi_usbc_num------------- */
59 ret = script_parser_fetch("usb_wifi_para", "usb_wifi_usbc_num", (int *)&usb_wifi_host, 64);
61 RTW_INFO("ERR: script_parser_fetch usb_wifi_usbc_num failed\n");
65 RTW_INFO("sw_usb_enable_hcd: usbc_num = %d\n", usb_wifi_host);
66 sw_usb_enable_hcd(usb_wifi_host);
68 #endif /* CONFIG_RTL8723A */
69 #endif /* CONFIG_PLATFORM_ARM_SUNxI */
71 #if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
73 script_item_value_type_e type;
75 type = script_get_item("wifi_para", "wifi_usbc_id", &item);
76 if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
77 printk("ERR: script_get_item wifi_usbc_id failed\n");
82 printk("sw_usb_enable_hcd: usbc_num = %d\n", item.val);
86 #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B))
87 sw_usb_enable_hcd(item.val);
90 #endif /* defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I) */
92 #if defined(CONFIG_PLATFORM_ARM_SUN8I)
94 script_item_value_type_e type;
96 type = script_get_item("wifi_para", "wifi_usbc_id", &item);
97 if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
98 printk("ERR: script_get_item wifi_usbc_id failed\n");
103 printk("sw_usb_enable_hcd: usbc_num = %d\n", item.val);
107 #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B))
108 sunxi_usb_enable_hcd(item.val);
111 #endif /* CONFIG_PLATFORM_ARM_SUN8I */
117 void platform_wifi_power_off(void)
120 #ifdef CONFIG_PLATFORM_ARM_SUNxI
121 #ifndef CONFIG_RTL8723A
122 RTW_INFO("sw_usb_disable_hcd: usbc_num = %d\n", usb_wifi_host);
123 sw_usb_disable_hcd(usb_wifi_host);
124 #endif /* ifndef CONFIG_RTL8723A */
125 #endif /* CONFIG_PLATFORM_ARM_SUNxI */
127 #if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
128 #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B))
129 sw_usb_disable_hcd(item.val);
132 #endif /* defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I) */
134 #if defined(CONFIG_PLATFORM_ARM_SUN8I)
135 #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B))
136 sunxi_usb_disable_hcd(item.val);
139 #endif /* defined(CONFIG_PLATFORM_ARM_SUN8I) */