import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / misc / mediatek / connectivity / common_detect / drv_init / wlan_drv_init.c
1 /*
2 * Copyright (C) 2011-2014 MediaTek Inc.
3 *
4 * This program is free software: you can redistribute it and/or modify it under the terms of the
5 * GNU General Public License version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 * See the GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License along with this program.
12 * If not, see <http://www.gnu.org/licenses/>.
13 */
14
15 #ifdef DFT_TAG
16 #undef DFT_TAG
17 #endif
18 #define DFT_TAG "[WLAN-MOD-INIT]"
19
20 #include "wmt_detect.h"
21 #include "wlan_drv_init.h"
22
23 int __weak mtk_wcn_wlan_soc_init(void)
24 {
25 WMT_DETECT_ERR_FUNC("mtk_wcn_wlan_soc_init is not define!\n");
26 return 0;
27 }
28
29 int do_wlan_drv_init(int chip_id)
30 {
31 int i_ret = 0;
32 int ret = 0;
33
34 #ifdef CONFIG_MTK_COMBO_WIFI
35 WMT_DETECT_INFO_FUNC("start to do wlan module init 0x%x\n", chip_id);
36
37 switch (chip_id)
38 {
39 case 0x6620:
40 #ifdef MT6620
41 /* WMT-WIFI char dev init */
42 ret = mtk_wcn_wmt_wifi_init();
43 WMT_DETECT_INFO_FUNC("WMT-WIFI char dev init, ret:%d\n", ret);
44 i_ret += ret;
45
46 /* WLAN driver init*/
47 ret = mtk_wcn_wlan_6620_init();
48 WMT_DETECT_INFO_FUNC("WLAN driver init, ret:%d\n", ret);
49 i_ret += ret;
50 #else
51 WMT_DETECT_ERR_FUNC("MT6620 is not supported, please check kernel makefile or project config\n");
52 i_ret = -1;
53 #endif
54 break;
55
56 case 0x6628:
57 #ifdef MT6628
58 /* WMT-WIFI char dev init */
59 ret = mtk_wcn_wmt_wifi_init();
60 WMT_DETECT_INFO_FUNC("WMT-WIFI char dev init, ret:%d\n", ret);
61 i_ret += ret;
62
63 /* WLAN driver init*/
64 ret = mtk_wcn_wlan_6628_init();
65 WMT_DETECT_INFO_FUNC("WLAN driver init, ret:%d\n", ret);
66 i_ret += ret;
67 #else
68 WMT_DETECT_ERR_FUNC("MT6628 is not supported, please check kernel makefile or project config\n");
69 i_ret = -1;
70 #endif
71 break;
72 case 0x6630:
73 #ifdef MT6630
74 /* WMT-WIFI char dev init */
75 ret = mtk_wcn_wmt_wifi_init();
76 WMT_DETECT_INFO_FUNC("WMT-WIFI char dev init, ret:%d\n", ret);
77 i_ret += ret;
78
79 /* WLAN driver init*/
80 ret = mtk_wcn_wlan_6630_init();
81 WMT_DETECT_INFO_FUNC("WLAN driver init, ret:%d\n", ret);
82 i_ret += ret;
83 #else
84 WMT_DETECT_ERR_FUNC("MT6630 is not supported, please check kernel makefile or project config\n");
85 i_ret = -1;
86 #endif
87 break;
88 case 0x6572:
89 case 0x6582:
90 case 0x6592:
91 case 0x6571:
92 case 0x8127:
93 case 0x6752:
94 case 0x6735:
95 #ifdef MTK_WCN_SOC_CHIP_SUPPORT
96 /* WMT-WIFI char dev init */
97 ret = mtk_wcn_wmt_wifi_soc_init();
98 WMT_DETECT_INFO_FUNC("WMT-WIFI char dev init, ret:%d\n", ret);
99 i_ret += ret;
100
101 /* WLAN driver init*/
102 ret = mtk_wcn_wlan_soc_init();
103 WMT_DETECT_INFO_FUNC("WLAN driver init, ret:%d\n", ret);
104 i_ret += ret;
105 #else
106 WMT_DETECT_ERR_FUNC("SOC is not supported, please check kernel makefile or project config\n");
107 i_ret = -1;
108 #endif
109 break;
110 }
111
112 WMT_DETECT_INFO_FUNC("finish wlan module init\n");
113
114 #else
115
116 WMT_DETECT_INFO_FUNC("WLAN function not supported, skip\n");
117
118 #endif
119
120 return i_ret;
121 }
122
123