diff options
-rw-r--r-- | drivers/net/wireless/ti/wl12xx/Makefile | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wl12xx/acx.c | 53 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wl12xx/acx.h | 36 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wl12xx/cmd.c | 252 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wl12xx/cmd.h | 110 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wl12xx/main.c | 40 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wlcore/acx.c | 26 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wlcore/acx.h | 8 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wlcore/cmd.c | 228 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wlcore/cmd.h | 82 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wlcore/init.c | 43 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wlcore/main.c | 23 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wlcore/wlcore.h | 1 |
13 files changed, 499 insertions, 405 deletions
diff --git a/drivers/net/wireless/ti/wl12xx/Makefile b/drivers/net/wireless/ti/wl12xx/Makefile index 1df22d55943e..87f64b14db35 100644 --- a/drivers/net/wireless/ti/wl12xx/Makefile +++ b/drivers/net/wireless/ti/wl12xx/Makefile | |||
@@ -1,3 +1,3 @@ | |||
1 | wl12xx-objs = main.o | 1 | wl12xx-objs = main.o cmd.o acx.o |
2 | 2 | ||
3 | obj-$(CONFIG_WL12XX) += wl12xx.o | 3 | obj-$(CONFIG_WL12XX) += wl12xx.o |
diff --git a/drivers/net/wireless/ti/wl12xx/acx.c b/drivers/net/wireless/ti/wl12xx/acx.c new file mode 100644 index 000000000000..bea06b2d7bf4 --- /dev/null +++ b/drivers/net/wireless/ti/wl12xx/acx.c | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | * This file is part of wl12xx | ||
3 | * | ||
4 | * Copyright (C) 2008-2009 Nokia Corporation | ||
5 | * Copyright (C) 2011 Texas Instruments Inc. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * version 2 as published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
19 | * 02110-1301 USA | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #include "../wlcore/cmd.h" | ||
24 | #include "../wlcore/debug.h" | ||
25 | #include "../wlcore/acx.h" | ||
26 | |||
27 | #include "acx.h" | ||
28 | |||
29 | int wl1271_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap) | ||
30 | { | ||
31 | struct wl1271_acx_host_config_bitmap *bitmap_conf; | ||
32 | int ret; | ||
33 | |||
34 | bitmap_conf = kzalloc(sizeof(*bitmap_conf), GFP_KERNEL); | ||
35 | if (!bitmap_conf) { | ||
36 | ret = -ENOMEM; | ||
37 | goto out; | ||
38 | } | ||
39 | |||
40 | bitmap_conf->host_cfg_bitmap = cpu_to_le32(host_cfg_bitmap); | ||
41 | |||
42 | ret = wl1271_cmd_configure(wl, ACX_HOST_IF_CFG_BITMAP, | ||
43 | bitmap_conf, sizeof(*bitmap_conf)); | ||
44 | if (ret < 0) { | ||
45 | wl1271_warning("wl1271 bitmap config opt failed: %d", ret); | ||
46 | goto out; | ||
47 | } | ||
48 | |||
49 | out: | ||
50 | kfree(bitmap_conf); | ||
51 | |||
52 | return ret; | ||
53 | } | ||
diff --git a/drivers/net/wireless/ti/wl12xx/acx.h b/drivers/net/wireless/ti/wl12xx/acx.h new file mode 100644 index 000000000000..d1f5aba0afce --- /dev/null +++ b/drivers/net/wireless/ti/wl12xx/acx.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * This file is part of wl12xx | ||
3 | * | ||
4 | * Copyright (C) 1998-2009, 2011 Texas Instruments. All rights reserved. | ||
5 | * Copyright (C) 2008-2010 Nokia Corporation | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * version 2 as published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
19 | * 02110-1301 USA | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #ifndef __WL12XX_ACX_H__ | ||
24 | #define __WL12XX_ACX_H__ | ||
25 | |||
26 | #include "../wlcore/wlcore.h" | ||
27 | |||
28 | struct wl1271_acx_host_config_bitmap { | ||
29 | struct acx_header header; | ||
30 | |||
31 | __le32 host_cfg_bitmap; | ||
32 | } __packed; | ||
33 | |||
34 | int wl1271_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap); | ||
35 | |||
36 | #endif /* __WL12XX_ACX_H__ */ | ||
diff --git a/drivers/net/wireless/ti/wl12xx/cmd.c b/drivers/net/wireless/ti/wl12xx/cmd.c new file mode 100644 index 000000000000..e46512d185a6 --- /dev/null +++ b/drivers/net/wireless/ti/wl12xx/cmd.c | |||
@@ -0,0 +1,252 @@ | |||
1 | /* | ||
2 | * This file is part of wl12xx | ||
3 | * | ||
4 | * Copyright (C) 2009-2010 Nokia Corporation | ||
5 | * Copyright (C) 2011 Texas Instruments Inc. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * version 2 as published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
19 | * 02110-1301 USA | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #include "../wlcore/cmd.h" | ||
24 | #include "../wlcore/debug.h" | ||
25 | |||
26 | #include "cmd.h" | ||
27 | |||
28 | int wl1271_cmd_ext_radio_parms(struct wl1271 *wl) | ||
29 | { | ||
30 | struct wl1271_ext_radio_parms_cmd *ext_radio_parms; | ||
31 | struct conf_rf_settings *rf = &wl->conf.rf; | ||
32 | int ret; | ||
33 | |||
34 | if (!wl->nvs) | ||
35 | return -ENODEV; | ||
36 | |||
37 | ext_radio_parms = kzalloc(sizeof(*ext_radio_parms), GFP_KERNEL); | ||
38 | if (!ext_radio_parms) | ||
39 | return -ENOMEM; | ||
40 | |||
41 | ext_radio_parms->test.id = TEST_CMD_INI_FILE_RF_EXTENDED_PARAM; | ||
42 | |||
43 | memcpy(ext_radio_parms->tx_per_channel_power_compensation_2, | ||
44 | rf->tx_per_channel_power_compensation_2, | ||
45 | CONF_TX_PWR_COMPENSATION_LEN_2); | ||
46 | memcpy(ext_radio_parms->tx_per_channel_power_compensation_5, | ||
47 | rf->tx_per_channel_power_compensation_5, | ||
48 | CONF_TX_PWR_COMPENSATION_LEN_5); | ||
49 | |||
50 | wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_EXT_RADIO_PARAM: ", | ||
51 | ext_radio_parms, sizeof(*ext_radio_parms)); | ||
52 | |||
53 | ret = wl1271_cmd_test(wl, ext_radio_parms, sizeof(*ext_radio_parms), 0); | ||
54 | if (ret < 0) | ||
55 | wl1271_warning("TEST_CMD_INI_FILE_RF_EXTENDED_PARAM failed"); | ||
56 | |||
57 | kfree(ext_radio_parms); | ||
58 | return ret; | ||
59 | } | ||
60 | |||
61 | int wl1271_cmd_general_parms(struct wl1271 *wl) | ||
62 | { | ||
63 | struct wl1271_general_parms_cmd *gen_parms; | ||
64 | struct wl1271_ini_general_params *gp = | ||
65 | &((struct wl1271_nvs_file *)wl->nvs)->general_params; | ||
66 | bool answer = false; | ||
67 | int ret; | ||
68 | |||
69 | if (!wl->nvs) | ||
70 | return -ENODEV; | ||
71 | |||
72 | if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) { | ||
73 | wl1271_warning("FEM index from INI out of bounds"); | ||
74 | return -EINVAL; | ||
75 | } | ||
76 | |||
77 | gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL); | ||
78 | if (!gen_parms) | ||
79 | return -ENOMEM; | ||
80 | |||
81 | gen_parms->test.id = TEST_CMD_INI_FILE_GENERAL_PARAM; | ||
82 | |||
83 | memcpy(&gen_parms->general_params, gp, sizeof(*gp)); | ||
84 | |||
85 | if (gp->tx_bip_fem_auto_detect) | ||
86 | answer = true; | ||
87 | |||
88 | /* Override the REF CLK from the NVS with the one from platform data */ | ||
89 | gen_parms->general_params.ref_clock = wl->ref_clock; | ||
90 | |||
91 | ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), answer); | ||
92 | if (ret < 0) { | ||
93 | wl1271_warning("CMD_INI_FILE_GENERAL_PARAM failed"); | ||
94 | goto out; | ||
95 | } | ||
96 | |||
97 | gp->tx_bip_fem_manufacturer = | ||
98 | gen_parms->general_params.tx_bip_fem_manufacturer; | ||
99 | |||
100 | if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) { | ||
101 | wl1271_warning("FEM index from FW out of bounds"); | ||
102 | ret = -EINVAL; | ||
103 | goto out; | ||
104 | } | ||
105 | |||
106 | wl1271_debug(DEBUG_CMD, "FEM autodetect: %s, manufacturer: %d\n", | ||
107 | answer ? "auto" : "manual", gp->tx_bip_fem_manufacturer); | ||
108 | |||
109 | out: | ||
110 | kfree(gen_parms); | ||
111 | return ret; | ||
112 | } | ||
113 | |||
114 | int wl128x_cmd_general_parms(struct wl1271 *wl) | ||
115 | { | ||
116 | struct wl128x_general_parms_cmd *gen_parms; | ||
117 | struct wl128x_ini_general_params *gp = | ||
118 | &((struct wl128x_nvs_file *)wl->nvs)->general_params; | ||
119 | bool answer = false; | ||
120 | int ret; | ||
121 | |||
122 | if (!wl->nvs) | ||
123 | return -ENODEV; | ||
124 | |||
125 | if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) { | ||
126 | wl1271_warning("FEM index from ini out of bounds"); | ||
127 | return -EINVAL; | ||
128 | } | ||
129 | |||
130 | gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL); | ||
131 | if (!gen_parms) | ||
132 | return -ENOMEM; | ||
133 | |||
134 | gen_parms->test.id = TEST_CMD_INI_FILE_GENERAL_PARAM; | ||
135 | |||
136 | memcpy(&gen_parms->general_params, gp, sizeof(*gp)); | ||
137 | |||
138 | if (gp->tx_bip_fem_auto_detect) | ||
139 | answer = true; | ||
140 | |||
141 | /* Replace REF and TCXO CLKs with the ones from platform data */ | ||
142 | gen_parms->general_params.ref_clock = wl->ref_clock; | ||
143 | gen_parms->general_params.tcxo_ref_clock = wl->tcxo_clock; | ||
144 | |||
145 | ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), answer); | ||
146 | if (ret < 0) { | ||
147 | wl1271_warning("CMD_INI_FILE_GENERAL_PARAM failed"); | ||
148 | goto out; | ||
149 | } | ||
150 | |||
151 | gp->tx_bip_fem_manufacturer = | ||
152 | gen_parms->general_params.tx_bip_fem_manufacturer; | ||
153 | |||
154 | if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) { | ||
155 | wl1271_warning("FEM index from FW out of bounds"); | ||
156 | ret = -EINVAL; | ||
157 | goto out; | ||
158 | } | ||
159 | |||
160 | wl1271_debug(DEBUG_CMD, "FEM autodetect: %s, manufacturer: %d\n", | ||
161 | answer ? "auto" : "manual", gp->tx_bip_fem_manufacturer); | ||
162 | |||
163 | out: | ||
164 | kfree(gen_parms); | ||
165 | return ret; | ||
166 | } | ||
167 | |||
168 | int wl1271_cmd_radio_parms(struct wl1271 *wl) | ||
169 | { | ||
170 | struct wl1271_nvs_file *nvs = (struct wl1271_nvs_file *)wl->nvs; | ||
171 | struct wl1271_radio_parms_cmd *radio_parms; | ||
172 | struct wl1271_ini_general_params *gp = &nvs->general_params; | ||
173 | int ret; | ||
174 | |||
175 | if (!wl->nvs) | ||
176 | return -ENODEV; | ||
177 | |||
178 | radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL); | ||
179 | if (!radio_parms) | ||
180 | return -ENOMEM; | ||
181 | |||
182 | radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM; | ||
183 | |||
184 | /* 2.4GHz parameters */ | ||
185 | memcpy(&radio_parms->static_params_2, &nvs->stat_radio_params_2, | ||
186 | sizeof(struct wl1271_ini_band_params_2)); | ||
187 | memcpy(&radio_parms->dyn_params_2, | ||
188 | &nvs->dyn_radio_params_2[gp->tx_bip_fem_manufacturer].params, | ||
189 | sizeof(struct wl1271_ini_fem_params_2)); | ||
190 | |||
191 | /* 5GHz parameters */ | ||
192 | memcpy(&radio_parms->static_params_5, | ||
193 | &nvs->stat_radio_params_5, | ||
194 | sizeof(struct wl1271_ini_band_params_5)); | ||
195 | memcpy(&radio_parms->dyn_params_5, | ||
196 | &nvs->dyn_radio_params_5[gp->tx_bip_fem_manufacturer].params, | ||
197 | sizeof(struct wl1271_ini_fem_params_5)); | ||
198 | |||
199 | wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ", | ||
200 | radio_parms, sizeof(*radio_parms)); | ||
201 | |||
202 | ret = wl1271_cmd_test(wl, radio_parms, sizeof(*radio_parms), 0); | ||
203 | if (ret < 0) | ||
204 | wl1271_warning("CMD_INI_FILE_RADIO_PARAM failed"); | ||
205 | |||
206 | kfree(radio_parms); | ||
207 | return ret; | ||
208 | } | ||
209 | |||
210 | int wl128x_cmd_radio_parms(struct wl1271 *wl) | ||
211 | { | ||
212 | struct wl128x_nvs_file *nvs = (struct wl128x_nvs_file *)wl->nvs; | ||
213 | struct wl128x_radio_parms_cmd *radio_parms; | ||
214 | struct wl128x_ini_general_params *gp = &nvs->general_params; | ||
215 | int ret; | ||
216 | |||
217 | if (!wl->nvs) | ||
218 | return -ENODEV; | ||
219 | |||
220 | radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL); | ||
221 | if (!radio_parms) | ||
222 | return -ENOMEM; | ||
223 | |||
224 | radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM; | ||
225 | |||
226 | /* 2.4GHz parameters */ | ||
227 | memcpy(&radio_parms->static_params_2, &nvs->stat_radio_params_2, | ||
228 | sizeof(struct wl128x_ini_band_params_2)); | ||
229 | memcpy(&radio_parms->dyn_params_2, | ||
230 | &nvs->dyn_radio_params_2[gp->tx_bip_fem_manufacturer].params, | ||
231 | sizeof(struct wl128x_ini_fem_params_2)); | ||
232 | |||
233 | /* 5GHz parameters */ | ||
234 | memcpy(&radio_parms->static_params_5, | ||
235 | &nvs->stat_radio_params_5, | ||
236 | sizeof(struct wl128x_ini_band_params_5)); | ||
237 | memcpy(&radio_parms->dyn_params_5, | ||
238 | &nvs->dyn_radio_params_5[gp->tx_bip_fem_manufacturer].params, | ||
239 | sizeof(struct wl128x_ini_fem_params_5)); | ||
240 | |||
241 | radio_parms->fem_vendor_and_options = nvs->fem_vendor_and_options; | ||
242 | |||
243 | wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ", | ||
244 | radio_parms, sizeof(*radio_parms)); | ||
245 | |||
246 | ret = wl1271_cmd_test(wl, radio_parms, sizeof(*radio_parms), 0); | ||
247 | if (ret < 0) | ||
248 | wl1271_warning("CMD_INI_FILE_RADIO_PARAM failed"); | ||
249 | |||
250 | kfree(radio_parms); | ||
251 | return ret; | ||
252 | } | ||
diff --git a/drivers/net/wireless/ti/wl12xx/cmd.h b/drivers/net/wireless/ti/wl12xx/cmd.h new file mode 100644 index 000000000000..ff458302ab04 --- /dev/null +++ b/drivers/net/wireless/ti/wl12xx/cmd.h | |||
@@ -0,0 +1,110 @@ | |||
1 | /* | ||
2 | * This file is part of wl12xx | ||
3 | * | ||
4 | * Copyright (C) 1998-2009, 2011 Texas Instruments. All rights reserved. | ||
5 | * Copyright (C) 2009 Nokia Corporation | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * version 2 as published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
19 | * 02110-1301 USA | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #ifndef __WL12XX_CMD_H__ | ||
24 | #define __WL12XX_CMD_H__ | ||
25 | |||
26 | #define TEST_CMD_INI_FILE_RADIO_PARAM 0x19 | ||
27 | #define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E | ||
28 | |||
29 | struct wl1271_general_parms_cmd { | ||
30 | struct wl1271_cmd_header header; | ||
31 | |||
32 | struct wl1271_cmd_test_header test; | ||
33 | |||
34 | struct wl1271_ini_general_params general_params; | ||
35 | |||
36 | u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM]; | ||
37 | u8 sr_sen_n_p; | ||
38 | u8 sr_sen_n_p_gain; | ||
39 | u8 sr_sen_nrn; | ||
40 | u8 sr_sen_prn; | ||
41 | u8 padding[3]; | ||
42 | } __packed; | ||
43 | |||
44 | struct wl128x_general_parms_cmd { | ||
45 | struct wl1271_cmd_header header; | ||
46 | |||
47 | struct wl1271_cmd_test_header test; | ||
48 | |||
49 | struct wl128x_ini_general_params general_params; | ||
50 | |||
51 | u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM]; | ||
52 | u8 sr_sen_n_p; | ||
53 | u8 sr_sen_n_p_gain; | ||
54 | u8 sr_sen_nrn; | ||
55 | u8 sr_sen_prn; | ||
56 | u8 padding[3]; | ||
57 | } __packed; | ||
58 | |||
59 | struct wl1271_radio_parms_cmd { | ||
60 | struct wl1271_cmd_header header; | ||
61 | |||
62 | struct wl1271_cmd_test_header test; | ||
63 | |||
64 | /* Static radio parameters */ | ||
65 | struct wl1271_ini_band_params_2 static_params_2; | ||
66 | struct wl1271_ini_band_params_5 static_params_5; | ||
67 | |||
68 | /* Dynamic radio parameters */ | ||
69 | struct wl1271_ini_fem_params_2 dyn_params_2; | ||
70 | u8 padding2; | ||
71 | struct wl1271_ini_fem_params_5 dyn_params_5; | ||
72 | u8 padding3[2]; | ||
73 | } __packed; | ||
74 | |||
75 | struct wl128x_radio_parms_cmd { | ||
76 | struct wl1271_cmd_header header; | ||
77 | |||
78 | struct wl1271_cmd_test_header test; | ||
79 | |||
80 | /* Static radio parameters */ | ||
81 | struct wl128x_ini_band_params_2 static_params_2; | ||
82 | struct wl128x_ini_band_params_5 static_params_5; | ||
83 | |||
84 | u8 fem_vendor_and_options; | ||
85 | |||
86 | /* Dynamic radio parameters */ | ||
87 | struct wl128x_ini_fem_params_2 dyn_params_2; | ||
88 | u8 padding2; | ||
89 | struct wl128x_ini_fem_params_5 dyn_params_5; | ||
90 | } __packed; | ||
91 | |||
92 | #define TEST_CMD_INI_FILE_RF_EXTENDED_PARAM 0x26 | ||
93 | |||
94 | struct wl1271_ext_radio_parms_cmd { | ||
95 | struct wl1271_cmd_header header; | ||
96 | |||
97 | struct wl1271_cmd_test_header test; | ||
98 | |||
99 | u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2]; | ||
100 | u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5]; | ||
101 | u8 padding[3]; | ||
102 | } __packed; | ||
103 | |||
104 | int wl1271_cmd_general_parms(struct wl1271 *wl); | ||
105 | int wl128x_cmd_general_parms(struct wl1271 *wl); | ||
106 | int wl1271_cmd_radio_parms(struct wl1271 *wl); | ||
107 | int wl128x_cmd_radio_parms(struct wl1271 *wl); | ||
108 | int wl1271_cmd_ext_radio_parms(struct wl1271 *wl); | ||
109 | |||
110 | #endif /* __WL12XX_CMD_H__ */ | ||
diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c index 00ecd2ad495a..9b2f40cd58d7 100644 --- a/drivers/net/wireless/ti/wl12xx/main.c +++ b/drivers/net/wireless/ti/wl12xx/main.c | |||
@@ -36,6 +36,8 @@ | |||
36 | #include "../wlcore/boot.h" | 36 | #include "../wlcore/boot.h" |
37 | 37 | ||
38 | #include "reg.h" | 38 | #include "reg.h" |
39 | #include "cmd.h" | ||
40 | #include "acx.h" | ||
39 | 41 | ||
40 | #define WL12XX_TX_HW_BLOCK_SPARE_DEFAULT 1 | 42 | #define WL12XX_TX_HW_BLOCK_SPARE_DEFAULT 1 |
41 | #define WL12XX_TX_HW_BLOCK_GEM_SPARE 2 | 43 | #define WL12XX_TX_HW_BLOCK_GEM_SPARE 2 |
@@ -800,6 +802,43 @@ static void wl12xx_tx_delayed_compl(struct wl1271 *wl) | |||
800 | wl1271_tx_complete(wl); | 802 | wl1271_tx_complete(wl); |
801 | } | 803 | } |
802 | 804 | ||
805 | static int wl12xx_hw_init(struct wl1271 *wl) | ||
806 | { | ||
807 | int ret; | ||
808 | |||
809 | if (wl->chip.id == CHIP_ID_1283_PG20) { | ||
810 | u32 host_cfg_bitmap = HOST_IF_CFG_RX_FIFO_ENABLE; | ||
811 | |||
812 | ret = wl128x_cmd_general_parms(wl); | ||
813 | if (ret < 0) | ||
814 | goto out; | ||
815 | ret = wl128x_cmd_radio_parms(wl); | ||
816 | if (ret < 0) | ||
817 | goto out; | ||
818 | |||
819 | if (wl->quirks & WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN) | ||
820 | /* Enable SDIO padding */ | ||
821 | host_cfg_bitmap |= HOST_IF_CFG_TX_PAD_TO_SDIO_BLK; | ||
822 | |||
823 | /* Must be before wl1271_acx_init_mem_config() */ | ||
824 | ret = wl1271_acx_host_if_cfg_bitmap(wl, host_cfg_bitmap); | ||
825 | if (ret < 0) | ||
826 | goto out; | ||
827 | } else { | ||
828 | ret = wl1271_cmd_general_parms(wl); | ||
829 | if (ret < 0) | ||
830 | goto out; | ||
831 | ret = wl1271_cmd_radio_parms(wl); | ||
832 | if (ret < 0) | ||
833 | goto out; | ||
834 | ret = wl1271_cmd_ext_radio_parms(wl); | ||
835 | if (ret < 0) | ||
836 | goto out; | ||
837 | } | ||
838 | out: | ||
839 | return ret; | ||
840 | } | ||
841 | |||
803 | static bool wl12xx_mac_in_fuse(struct wl1271 *wl) | 842 | static bool wl12xx_mac_in_fuse(struct wl1271 *wl) |
804 | { | 843 | { |
805 | bool supported = false; | 844 | bool supported = false; |
@@ -875,6 +914,7 @@ static struct wlcore_ops wl12xx_ops = { | |||
875 | .get_rx_packet_len = wl12xx_get_rx_packet_len, | 914 | .get_rx_packet_len = wl12xx_get_rx_packet_len, |
876 | .tx_immediate_compl = NULL, | 915 | .tx_immediate_compl = NULL, |
877 | .tx_delayed_compl = wl12xx_tx_delayed_compl, | 916 | .tx_delayed_compl = wl12xx_tx_delayed_compl, |
917 | .hw_init = wl12xx_hw_init, | ||
878 | .get_pg_ver = wl12xx_get_pg_ver, | 918 | .get_pg_ver = wl12xx_get_pg_ver, |
879 | .get_mac = wl12xx_get_mac, | 919 | .get_mac = wl12xx_get_mac, |
880 | }; | 920 | }; |
diff --git a/drivers/net/wireless/ti/wlcore/acx.c b/drivers/net/wireless/ti/wlcore/acx.c index c811f75fc8d4..01dba462e521 100644 --- a/drivers/net/wireless/ti/wlcore/acx.c +++ b/drivers/net/wireless/ti/wlcore/acx.c | |||
@@ -997,32 +997,6 @@ out: | |||
997 | return ret; | 997 | return ret; |
998 | } | 998 | } |
999 | 999 | ||
1000 | int wl1271_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap) | ||
1001 | { | ||
1002 | struct wl1271_acx_host_config_bitmap *bitmap_conf; | ||
1003 | int ret; | ||
1004 | |||
1005 | bitmap_conf = kzalloc(sizeof(*bitmap_conf), GFP_KERNEL); | ||
1006 | if (!bitmap_conf) { | ||
1007 | ret = -ENOMEM; | ||
1008 | goto out; | ||
1009 | } | ||
1010 | |||
1011 | bitmap_conf->host_cfg_bitmap = cpu_to_le32(host_cfg_bitmap); | ||
1012 | |||
1013 | ret = wl1271_cmd_configure(wl, ACX_HOST_IF_CFG_BITMAP, | ||
1014 | bitmap_conf, sizeof(*bitmap_conf)); | ||
1015 | if (ret < 0) { | ||
1016 | wl1271_warning("wl1271 bitmap config opt failed: %d", ret); | ||
1017 | goto out; | ||
1018 | } | ||
1019 | |||
1020 | out: | ||
1021 | kfree(bitmap_conf); | ||
1022 | |||
1023 | return ret; | ||
1024 | } | ||
1025 | |||
1026 | int wl1271_acx_init_mem_config(struct wl1271 *wl) | 1000 | int wl1271_acx_init_mem_config(struct wl1271 *wl) |
1027 | { | 1001 | { |
1028 | int ret; | 1002 | int ret; |
diff --git a/drivers/net/wireless/ti/wlcore/acx.h b/drivers/net/wireless/ti/wlcore/acx.h index e24511a04610..b2f88831b7a9 100644 --- a/drivers/net/wireless/ti/wlcore/acx.h +++ b/drivers/net/wireless/ti/wlcore/acx.h | |||
@@ -824,16 +824,11 @@ struct wl1271_acx_keep_alive_config { | |||
824 | __le32 period; | 824 | __le32 period; |
825 | } __packed; | 825 | } __packed; |
826 | 826 | ||
827 | /* TODO: maybe this needs to be moved somewhere else? */ | ||
827 | #define HOST_IF_CFG_RX_FIFO_ENABLE BIT(0) | 828 | #define HOST_IF_CFG_RX_FIFO_ENABLE BIT(0) |
828 | #define HOST_IF_CFG_TX_EXTRA_BLKS_SWAP BIT(1) | 829 | #define HOST_IF_CFG_TX_EXTRA_BLKS_SWAP BIT(1) |
829 | #define HOST_IF_CFG_TX_PAD_TO_SDIO_BLK BIT(3) | 830 | #define HOST_IF_CFG_TX_PAD_TO_SDIO_BLK BIT(3) |
830 | 831 | ||
831 | struct wl1271_acx_host_config_bitmap { | ||
832 | struct acx_header header; | ||
833 | |||
834 | __le32 host_cfg_bitmap; | ||
835 | } __packed; | ||
836 | |||
837 | enum { | 832 | enum { |
838 | WL1271_ACX_TRIG_TYPE_LEVEL = 0, | 833 | WL1271_ACX_TRIG_TYPE_LEVEL = 0, |
839 | WL1271_ACX_TRIG_TYPE_EDGE, | 834 | WL1271_ACX_TRIG_TYPE_EDGE, |
@@ -1274,7 +1269,6 @@ int wl1271_acx_frag_threshold(struct wl1271 *wl, u32 frag_threshold); | |||
1274 | int wl1271_acx_tx_config_options(struct wl1271 *wl); | 1269 | int wl1271_acx_tx_config_options(struct wl1271 *wl); |
1275 | int wl12xx_acx_mem_cfg(struct wl1271 *wl); | 1270 | int wl12xx_acx_mem_cfg(struct wl1271 *wl); |
1276 | int wl1271_acx_init_mem_config(struct wl1271 *wl); | 1271 | int wl1271_acx_init_mem_config(struct wl1271 *wl); |
1277 | int wl1271_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap); | ||
1278 | int wl1271_acx_init_rx_interrupt(struct wl1271 *wl); | 1272 | int wl1271_acx_init_rx_interrupt(struct wl1271 *wl); |
1279 | int wl1271_acx_smart_reflex(struct wl1271 *wl); | 1273 | int wl1271_acx_smart_reflex(struct wl1271 *wl); |
1280 | int wl1271_acx_bet_enable(struct wl1271 *wl, struct wl12xx_vif *wlvif, | 1274 | int wl1271_acx_bet_enable(struct wl1271 *wl, struct wl12xx_vif *wlvif, |
diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c index e80f674e77cc..8407590cf6cc 100644 --- a/drivers/net/wireless/ti/wlcore/cmd.c +++ b/drivers/net/wireless/ti/wlcore/cmd.c | |||
@@ -112,232 +112,6 @@ fail: | |||
112 | return ret; | 112 | return ret; |
113 | } | 113 | } |
114 | 114 | ||
115 | int wl1271_cmd_general_parms(struct wl1271 *wl) | ||
116 | { | ||
117 | struct wl1271_general_parms_cmd *gen_parms; | ||
118 | struct wl1271_ini_general_params *gp = | ||
119 | &((struct wl1271_nvs_file *)wl->nvs)->general_params; | ||
120 | bool answer = false; | ||
121 | int ret; | ||
122 | |||
123 | if (!wl->nvs) | ||
124 | return -ENODEV; | ||
125 | |||
126 | if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) { | ||
127 | wl1271_warning("FEM index from INI out of bounds"); | ||
128 | return -EINVAL; | ||
129 | } | ||
130 | |||
131 | gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL); | ||
132 | if (!gen_parms) | ||
133 | return -ENOMEM; | ||
134 | |||
135 | gen_parms->test.id = TEST_CMD_INI_FILE_GENERAL_PARAM; | ||
136 | |||
137 | memcpy(&gen_parms->general_params, gp, sizeof(*gp)); | ||
138 | |||
139 | if (gp->tx_bip_fem_auto_detect) | ||
140 | answer = true; | ||
141 | |||
142 | /* Override the REF CLK from the NVS with the one from platform data */ | ||
143 | gen_parms->general_params.ref_clock = wl->ref_clock; | ||
144 | |||
145 | ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), answer); | ||
146 | if (ret < 0) { | ||
147 | wl1271_warning("CMD_INI_FILE_GENERAL_PARAM failed"); | ||
148 | goto out; | ||
149 | } | ||
150 | |||
151 | gp->tx_bip_fem_manufacturer = | ||
152 | gen_parms->general_params.tx_bip_fem_manufacturer; | ||
153 | |||
154 | if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) { | ||
155 | wl1271_warning("FEM index from FW out of bounds"); | ||
156 | ret = -EINVAL; | ||
157 | goto out; | ||
158 | } | ||
159 | |||
160 | wl1271_debug(DEBUG_CMD, "FEM autodetect: %s, manufacturer: %d\n", | ||
161 | answer ? "auto" : "manual", gp->tx_bip_fem_manufacturer); | ||
162 | |||
163 | out: | ||
164 | kfree(gen_parms); | ||
165 | return ret; | ||
166 | } | ||
167 | |||
168 | int wl128x_cmd_general_parms(struct wl1271 *wl) | ||
169 | { | ||
170 | struct wl128x_general_parms_cmd *gen_parms; | ||
171 | struct wl128x_ini_general_params *gp = | ||
172 | &((struct wl128x_nvs_file *)wl->nvs)->general_params; | ||
173 | bool answer = false; | ||
174 | int ret; | ||
175 | |||
176 | if (!wl->nvs) | ||
177 | return -ENODEV; | ||
178 | |||
179 | if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) { | ||
180 | wl1271_warning("FEM index from ini out of bounds"); | ||
181 | return -EINVAL; | ||
182 | } | ||
183 | |||
184 | gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL); | ||
185 | if (!gen_parms) | ||
186 | return -ENOMEM; | ||
187 | |||
188 | gen_parms->test.id = TEST_CMD_INI_FILE_GENERAL_PARAM; | ||
189 | |||
190 | memcpy(&gen_parms->general_params, gp, sizeof(*gp)); | ||
191 | |||
192 | if (gp->tx_bip_fem_auto_detect) | ||
193 | answer = true; | ||
194 | |||
195 | /* Replace REF and TCXO CLKs with the ones from platform data */ | ||
196 | gen_parms->general_params.ref_clock = wl->ref_clock; | ||
197 | gen_parms->general_params.tcxo_ref_clock = wl->tcxo_clock; | ||
198 | |||
199 | ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), answer); | ||
200 | if (ret < 0) { | ||
201 | wl1271_warning("CMD_INI_FILE_GENERAL_PARAM failed"); | ||
202 | goto out; | ||
203 | } | ||
204 | |||
205 | gp->tx_bip_fem_manufacturer = | ||
206 | gen_parms->general_params.tx_bip_fem_manufacturer; | ||
207 | |||
208 | if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) { | ||
209 | wl1271_warning("FEM index from FW out of bounds"); | ||
210 | ret = -EINVAL; | ||
211 | goto out; | ||
212 | } | ||
213 | |||
214 | wl1271_debug(DEBUG_CMD, "FEM autodetect: %s, manufacturer: %d\n", | ||
215 | answer ? "auto" : "manual", gp->tx_bip_fem_manufacturer); | ||
216 | |||
217 | out: | ||
218 | kfree(gen_parms); | ||
219 | return ret; | ||
220 | } | ||
221 | |||
222 | int wl1271_cmd_radio_parms(struct wl1271 *wl) | ||
223 | { | ||
224 | struct wl1271_nvs_file *nvs = (struct wl1271_nvs_file *)wl->nvs; | ||
225 | struct wl1271_radio_parms_cmd *radio_parms; | ||
226 | struct wl1271_ini_general_params *gp = &nvs->general_params; | ||
227 | int ret; | ||
228 | |||
229 | if (!wl->nvs) | ||
230 | return -ENODEV; | ||
231 | |||
232 | radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL); | ||
233 | if (!radio_parms) | ||
234 | return -ENOMEM; | ||
235 | |||
236 | radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM; | ||
237 | |||
238 | /* 2.4GHz parameters */ | ||
239 | memcpy(&radio_parms->static_params_2, &nvs->stat_radio_params_2, | ||
240 | sizeof(struct wl1271_ini_band_params_2)); | ||
241 | memcpy(&radio_parms->dyn_params_2, | ||
242 | &nvs->dyn_radio_params_2[gp->tx_bip_fem_manufacturer].params, | ||
243 | sizeof(struct wl1271_ini_fem_params_2)); | ||
244 | |||
245 | /* 5GHz parameters */ | ||
246 | memcpy(&radio_parms->static_params_5, | ||
247 | &nvs->stat_radio_params_5, | ||
248 | sizeof(struct wl1271_ini_band_params_5)); | ||
249 | memcpy(&radio_parms->dyn_params_5, | ||
250 | &nvs->dyn_radio_params_5[gp->tx_bip_fem_manufacturer].params, | ||
251 | sizeof(struct wl1271_ini_fem_params_5)); | ||
252 | |||
253 | wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ", | ||
254 | radio_parms, sizeof(*radio_parms)); | ||
255 | |||
256 | ret = wl1271_cmd_test(wl, radio_parms, sizeof(*radio_parms), 0); | ||
257 | if (ret < 0) | ||
258 | wl1271_warning("CMD_INI_FILE_RADIO_PARAM failed"); | ||
259 | |||
260 | kfree(radio_parms); | ||
261 | return ret; | ||
262 | } | ||
263 | |||
264 | int wl128x_cmd_radio_parms(struct wl1271 *wl) | ||
265 | { | ||
266 | struct wl128x_nvs_file *nvs = (struct wl128x_nvs_file *)wl->nvs; | ||
267 | struct wl128x_radio_parms_cmd *radio_parms; | ||
268 | struct wl128x_ini_general_params *gp = &nvs->general_params; | ||
269 | int ret; | ||
270 | |||
271 | if (!wl->nvs) | ||
272 | return -ENODEV; | ||
273 | |||
274 | radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL); | ||
275 | if (!radio_parms) | ||
276 | return -ENOMEM; | ||
277 | |||
278 | radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM; | ||
279 | |||
280 | /* 2.4GHz parameters */ | ||
281 | memcpy(&radio_parms->static_params_2, &nvs->stat_radio_params_2, | ||
282 | sizeof(struct wl128x_ini_band_params_2)); | ||
283 | memcpy(&radio_parms->dyn_params_2, | ||
284 | &nvs->dyn_radio_params_2[gp->tx_bip_fem_manufacturer].params, | ||
285 | sizeof(struct wl128x_ini_fem_params_2)); | ||
286 | |||
287 | /* 5GHz parameters */ | ||
288 | memcpy(&radio_parms->static_params_5, | ||
289 | &nvs->stat_radio_params_5, | ||
290 | sizeof(struct wl128x_ini_band_params_5)); | ||
291 | memcpy(&radio_parms->dyn_params_5, | ||
292 | &nvs->dyn_radio_params_5[gp->tx_bip_fem_manufacturer].params, | ||
293 | sizeof(struct wl128x_ini_fem_params_5)); | ||
294 | |||
295 | radio_parms->fem_vendor_and_options = nvs->fem_vendor_and_options; | ||
296 | |||
297 | wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ", | ||
298 | radio_parms, sizeof(*radio_parms)); | ||
299 | |||
300 | ret = wl1271_cmd_test(wl, radio_parms, sizeof(*radio_parms), 0); | ||
301 | if (ret < 0) | ||
302 | wl1271_warning("CMD_INI_FILE_RADIO_PARAM failed"); | ||
303 | |||
304 | kfree(radio_parms); | ||
305 | return ret; | ||
306 | } | ||
307 | |||
308 | int wl1271_cmd_ext_radio_parms(struct wl1271 *wl) | ||
309 | { | ||
310 | struct wl1271_ext_radio_parms_cmd *ext_radio_parms; | ||
311 | struct conf_rf_settings *rf = &wl->conf.rf; | ||
312 | int ret; | ||
313 | |||
314 | if (!wl->nvs) | ||
315 | return -ENODEV; | ||
316 | |||
317 | ext_radio_parms = kzalloc(sizeof(*ext_radio_parms), GFP_KERNEL); | ||
318 | if (!ext_radio_parms) | ||
319 | return -ENOMEM; | ||
320 | |||
321 | ext_radio_parms->test.id = TEST_CMD_INI_FILE_RF_EXTENDED_PARAM; | ||
322 | |||
323 | memcpy(ext_radio_parms->tx_per_channel_power_compensation_2, | ||
324 | rf->tx_per_channel_power_compensation_2, | ||
325 | CONF_TX_PWR_COMPENSATION_LEN_2); | ||
326 | memcpy(ext_radio_parms->tx_per_channel_power_compensation_5, | ||
327 | rf->tx_per_channel_power_compensation_5, | ||
328 | CONF_TX_PWR_COMPENSATION_LEN_5); | ||
329 | |||
330 | wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_EXT_RADIO_PARAM: ", | ||
331 | ext_radio_parms, sizeof(*ext_radio_parms)); | ||
332 | |||
333 | ret = wl1271_cmd_test(wl, ext_radio_parms, sizeof(*ext_radio_parms), 0); | ||
334 | if (ret < 0) | ||
335 | wl1271_warning("TEST_CMD_INI_FILE_RF_EXTENDED_PARAM failed"); | ||
336 | |||
337 | kfree(ext_radio_parms); | ||
338 | return ret; | ||
339 | } | ||
340 | |||
341 | /* | 115 | /* |
342 | * Poll the mailbox event field until any of the bits in the mask is set or a | 116 | * Poll the mailbox event field until any of the bits in the mask is set or a |
343 | * timeout occurs (WL1271_EVENT_TIMEOUT in msecs) | 117 | * timeout occurs (WL1271_EVENT_TIMEOUT in msecs) |
@@ -913,6 +687,7 @@ int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer) | |||
913 | 687 | ||
914 | return ret; | 688 | return ret; |
915 | } | 689 | } |
690 | EXPORT_SYMBOL_GPL(wl1271_cmd_test); | ||
916 | 691 | ||
917 | /** | 692 | /** |
918 | * read acx from firmware | 693 | * read acx from firmware |
@@ -969,6 +744,7 @@ int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len) | |||
969 | 744 | ||
970 | return 0; | 745 | return 0; |
971 | } | 746 | } |
747 | EXPORT_SYMBOL_GPL(wl1271_cmd_configure); | ||
972 | 748 | ||
973 | int wl1271_cmd_data_path(struct wl1271 *wl, bool enable) | 749 | int wl1271_cmd_data_path(struct wl1271 *wl, bool enable) |
974 | { | 750 | { |
diff --git a/drivers/net/wireless/ti/wlcore/cmd.h b/drivers/net/wireless/ti/wlcore/cmd.h index cd1eb2eef909..a46ae07cb77e 100644 --- a/drivers/net/wireless/ti/wlcore/cmd.h +++ b/drivers/net/wireless/ti/wlcore/cmd.h | |||
@@ -31,11 +31,6 @@ struct acx_header; | |||
31 | 31 | ||
32 | int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len, | 32 | int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len, |
33 | size_t res_len); | 33 | size_t res_len); |
34 | int wl1271_cmd_general_parms(struct wl1271 *wl); | ||
35 | int wl128x_cmd_general_parms(struct wl1271 *wl); | ||
36 | int wl1271_cmd_radio_parms(struct wl1271 *wl); | ||
37 | int wl128x_cmd_radio_parms(struct wl1271 *wl); | ||
38 | int wl1271_cmd_ext_radio_parms(struct wl1271 *wl); | ||
39 | int wl12xx_cmd_role_enable(struct wl1271 *wl, u8 *addr, u8 role_type, | 34 | int wl12xx_cmd_role_enable(struct wl1271 *wl, u8 *addr, u8 role_type, |
40 | u8 *role_id); | 35 | u8 *role_id); |
41 | int wl12xx_cmd_role_disable(struct wl1271 *wl, u8 *role_id); | 36 | int wl12xx_cmd_role_disable(struct wl1271 *wl, u8 *role_id); |
@@ -494,83 +489,6 @@ enum wl1271_channel_tune_bands { | |||
494 | 489 | ||
495 | #define WL1271_PD_REFERENCE_POINT_BAND_B_G 0 | 490 | #define WL1271_PD_REFERENCE_POINT_BAND_B_G 0 |
496 | 491 | ||
497 | #define TEST_CMD_INI_FILE_RADIO_PARAM 0x19 | ||
498 | #define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E | ||
499 | #define TEST_CMD_INI_FILE_RF_EXTENDED_PARAM 0x26 | ||
500 | |||
501 | struct wl1271_general_parms_cmd { | ||
502 | struct wl1271_cmd_header header; | ||
503 | |||
504 | struct wl1271_cmd_test_header test; | ||
505 | |||
506 | struct wl1271_ini_general_params general_params; | ||
507 | |||
508 | u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM]; | ||
509 | u8 sr_sen_n_p; | ||
510 | u8 sr_sen_n_p_gain; | ||
511 | u8 sr_sen_nrn; | ||
512 | u8 sr_sen_prn; | ||
513 | u8 padding[3]; | ||
514 | } __packed; | ||
515 | |||
516 | struct wl128x_general_parms_cmd { | ||
517 | struct wl1271_cmd_header header; | ||
518 | |||
519 | struct wl1271_cmd_test_header test; | ||
520 | |||
521 | struct wl128x_ini_general_params general_params; | ||
522 | |||
523 | u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM]; | ||
524 | u8 sr_sen_n_p; | ||
525 | u8 sr_sen_n_p_gain; | ||
526 | u8 sr_sen_nrn; | ||
527 | u8 sr_sen_prn; | ||
528 | u8 padding[3]; | ||
529 | } __packed; | ||
530 | |||
531 | struct wl1271_radio_parms_cmd { | ||
532 | struct wl1271_cmd_header header; | ||
533 | |||
534 | struct wl1271_cmd_test_header test; | ||
535 | |||
536 | /* Static radio parameters */ | ||
537 | struct wl1271_ini_band_params_2 static_params_2; | ||
538 | struct wl1271_ini_band_params_5 static_params_5; | ||
539 | |||
540 | /* Dynamic radio parameters */ | ||
541 | struct wl1271_ini_fem_params_2 dyn_params_2; | ||
542 | u8 padding2; | ||
543 | struct wl1271_ini_fem_params_5 dyn_params_5; | ||
544 | u8 padding3[2]; | ||
545 | } __packed; | ||
546 | |||
547 | struct wl128x_radio_parms_cmd { | ||
548 | struct wl1271_cmd_header header; | ||
549 | |||
550 | struct wl1271_cmd_test_header test; | ||
551 | |||
552 | /* Static radio parameters */ | ||
553 | struct wl128x_ini_band_params_2 static_params_2; | ||
554 | struct wl128x_ini_band_params_5 static_params_5; | ||
555 | |||
556 | u8 fem_vendor_and_options; | ||
557 | |||
558 | /* Dynamic radio parameters */ | ||
559 | struct wl128x_ini_fem_params_2 dyn_params_2; | ||
560 | u8 padding2; | ||
561 | struct wl128x_ini_fem_params_5 dyn_params_5; | ||
562 | } __packed; | ||
563 | |||
564 | struct wl1271_ext_radio_parms_cmd { | ||
565 | struct wl1271_cmd_header header; | ||
566 | |||
567 | struct wl1271_cmd_test_header test; | ||
568 | |||
569 | u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2]; | ||
570 | u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5]; | ||
571 | u8 padding[3]; | ||
572 | } __packed; | ||
573 | |||
574 | /* | 492 | /* |
575 | * There are three types of disconnections: | 493 | * There are three types of disconnections: |
576 | * | 494 | * |
diff --git a/drivers/net/wireless/ti/wlcore/init.c b/drivers/net/wireless/ti/wlcore/init.c index c332da2f1cb9..afe4f753f706 100644 --- a/drivers/net/wireless/ti/wlcore/init.c +++ b/drivers/net/wireless/ti/wlcore/init.c | |||
@@ -493,26 +493,6 @@ static int wl1271_set_ba_policies(struct wl1271 *wl, struct wl12xx_vif *wlvif) | |||
493 | return wl12xx_acx_set_ba_initiator_policy(wl, wlvif); | 493 | return wl12xx_acx_set_ba_initiator_policy(wl, wlvif); |
494 | } | 494 | } |
495 | 495 | ||
496 | int wl1271_chip_specific_init(struct wl1271 *wl) | ||
497 | { | ||
498 | int ret = 0; | ||
499 | |||
500 | if (wl->chip.id == CHIP_ID_1283_PG20) { | ||
501 | u32 host_cfg_bitmap = HOST_IF_CFG_RX_FIFO_ENABLE; | ||
502 | |||
503 | if (wl->quirks & WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN) | ||
504 | /* Enable SDIO padding */ | ||
505 | host_cfg_bitmap |= HOST_IF_CFG_TX_PAD_TO_SDIO_BLK; | ||
506 | |||
507 | /* Must be before wl1271_acx_init_mem_config() */ | ||
508 | ret = wl1271_acx_host_if_cfg_bitmap(wl, host_cfg_bitmap); | ||
509 | if (ret < 0) | ||
510 | goto out; | ||
511 | } | ||
512 | out: | ||
513 | return ret; | ||
514 | } | ||
515 | |||
516 | /* vif-specifc initialization */ | 496 | /* vif-specifc initialization */ |
517 | static int wl12xx_init_sta_role(struct wl1271 *wl, struct wl12xx_vif *wlvif) | 497 | static int wl12xx_init_sta_role(struct wl1271 *wl, struct wl12xx_vif *wlvif) |
518 | { | 498 | { |
@@ -665,27 +645,8 @@ int wl1271_hw_init(struct wl1271 *wl) | |||
665 | { | 645 | { |
666 | int ret; | 646 | int ret; |
667 | 647 | ||
668 | if (wl->chip.id == CHIP_ID_1283_PG20) { | 648 | /* Chip-specific hw init */ |
669 | ret = wl128x_cmd_general_parms(wl); | 649 | ret = wl->ops->hw_init(wl); |
670 | if (ret < 0) | ||
671 | return ret; | ||
672 | ret = wl128x_cmd_radio_parms(wl); | ||
673 | if (ret < 0) | ||
674 | return ret; | ||
675 | } else { | ||
676 | ret = wl1271_cmd_general_parms(wl); | ||
677 | if (ret < 0) | ||
678 | return ret; | ||
679 | ret = wl1271_cmd_radio_parms(wl); | ||
680 | if (ret < 0) | ||
681 | return ret; | ||
682 | ret = wl1271_cmd_ext_radio_parms(wl); | ||
683 | if (ret < 0) | ||
684 | return ret; | ||
685 | } | ||
686 | |||
687 | /* Chip-specific init */ | ||
688 | ret = wl1271_chip_specific_init(wl); | ||
689 | if (ret < 0) | 650 | if (ret < 0) |
690 | return ret; | 651 | return ret; |
691 | 652 | ||
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 83be5be32ff4..6a98013329db 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c | |||
@@ -672,28 +672,7 @@ static int wl1271_plt_init(struct wl1271 *wl) | |||
672 | { | 672 | { |
673 | int ret; | 673 | int ret; |
674 | 674 | ||
675 | if (wl->chip.id == CHIP_ID_1283_PG20) | 675 | ret = wl->ops->hw_init(wl); |
676 | ret = wl128x_cmd_general_parms(wl); | ||
677 | else | ||
678 | ret = wl1271_cmd_general_parms(wl); | ||
679 | if (ret < 0) | ||
680 | return ret; | ||
681 | |||
682 | if (wl->chip.id == CHIP_ID_1283_PG20) | ||
683 | ret = wl128x_cmd_radio_parms(wl); | ||
684 | else | ||
685 | ret = wl1271_cmd_radio_parms(wl); | ||
686 | if (ret < 0) | ||
687 | return ret; | ||
688 | |||
689 | if (wl->chip.id != CHIP_ID_1283_PG20) { | ||
690 | ret = wl1271_cmd_ext_radio_parms(wl); | ||
691 | if (ret < 0) | ||
692 | return ret; | ||
693 | } | ||
694 | |||
695 | /* Chip-specific initializations */ | ||
696 | ret = wl1271_chip_specific_init(wl); | ||
697 | if (ret < 0) | 676 | if (ret < 0) |
698 | return ret; | 677 | return ret; |
699 | 678 | ||
diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h index db7ad71a11e9..91ccd1e36389 100644 --- a/drivers/net/wireless/ti/wlcore/wlcore.h +++ b/drivers/net/wireless/ti/wlcore/wlcore.h | |||
@@ -53,6 +53,7 @@ struct wlcore_ops { | |||
53 | u32 data_len); | 53 | u32 data_len); |
54 | void (*tx_delayed_compl)(struct wl1271 *wl); | 54 | void (*tx_delayed_compl)(struct wl1271 *wl); |
55 | void (*tx_immediate_compl)(struct wl1271 *wl); | 55 | void (*tx_immediate_compl)(struct wl1271 *wl); |
56 | int (*hw_init)(struct wl1271 *wl); | ||
56 | s8 (*get_pg_ver)(struct wl1271 *wl); | 57 | s8 (*get_pg_ver)(struct wl1271 *wl); |
57 | void (*get_mac)(struct wl1271 *wl); | 58 | void (*get_mac)(struct wl1271 *wl); |
58 | }; | 59 | }; |