diff options
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1271_init.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_init.c | 162 |
1 files changed, 94 insertions, 68 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_init.c b/drivers/net/wireless/wl12xx/wl1271_init.c index 490df217605..7c2017f480e 100644 --- a/drivers/net/wireless/wl12xx/wl1271_init.c +++ b/drivers/net/wireless/wl12xx/wl1271_init.c | |||
@@ -59,6 +59,14 @@ static int wl1271_init_templates_config(struct wl1271 *wl) | |||
59 | if (ret < 0) | 59 | if (ret < 0) |
60 | return ret; | 60 | return ret; |
61 | 61 | ||
62 | if (wl1271_11a_enabled()) { | ||
63 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_5, | ||
64 | NULL, | ||
65 | sizeof(struct wl12xx_probe_req_template)); | ||
66 | if (ret < 0) | ||
67 | return ret; | ||
68 | } | ||
69 | |||
62 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, NULL, | 70 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, NULL, |
63 | sizeof(struct wl12xx_null_data_template)); | 71 | sizeof(struct wl12xx_null_data_template)); |
64 | if (ret < 0) | 72 | if (ret < 0) |
@@ -94,7 +102,7 @@ static int wl1271_init_rx_config(struct wl1271 *wl, u32 config, u32 filter) | |||
94 | { | 102 | { |
95 | int ret; | 103 | int ret; |
96 | 104 | ||
97 | ret = wl1271_acx_rx_msdu_life_time(wl, RX_MSDU_LIFETIME_DEF); | 105 | ret = wl1271_acx_rx_msdu_life_time(wl); |
98 | if (ret < 0) | 106 | if (ret < 0) |
99 | return ret; | 107 | return ret; |
100 | 108 | ||
@@ -117,7 +125,7 @@ static int wl1271_init_phy_config(struct wl1271 *wl) | |||
117 | if (ret < 0) | 125 | if (ret < 0) |
118 | return ret; | 126 | return ret; |
119 | 127 | ||
120 | ret = wl1271_acx_group_address_tbl(wl); | 128 | ret = wl1271_acx_group_address_tbl(wl, true, NULL, 0); |
121 | if (ret < 0) | 129 | if (ret < 0) |
122 | return ret; | 130 | return ret; |
123 | 131 | ||
@@ -125,7 +133,7 @@ static int wl1271_init_phy_config(struct wl1271 *wl) | |||
125 | if (ret < 0) | 133 | if (ret < 0) |
126 | return ret; | 134 | return ret; |
127 | 135 | ||
128 | ret = wl1271_acx_rts_threshold(wl, RTS_THRESHOLD_DEF); | 136 | ret = wl1271_acx_rts_threshold(wl, wl->conf.rx.rts_threshold); |
129 | if (ret < 0) | 137 | if (ret < 0) |
130 | return ret; | 138 | return ret; |
131 | 139 | ||
@@ -136,7 +144,8 @@ static int wl1271_init_beacon_filter(struct wl1271 *wl) | |||
136 | { | 144 | { |
137 | int ret; | 145 | int ret; |
138 | 146 | ||
139 | ret = wl1271_acx_beacon_filter_opt(wl); | 147 | /* disable beacon filtering at this stage */ |
148 | ret = wl1271_acx_beacon_filter_opt(wl, false); | ||
140 | if (ret < 0) | 149 | if (ret < 0) |
141 | return ret; | 150 | return ret; |
142 | 151 | ||
@@ -187,6 +196,7 @@ static int wl1271_init_beacon_broadcast(struct wl1271 *wl) | |||
187 | static int wl1271_init_general_parms(struct wl1271 *wl) | 196 | static int wl1271_init_general_parms(struct wl1271 *wl) |
188 | { | 197 | { |
189 | struct wl1271_general_parms *gen_parms; | 198 | struct wl1271_general_parms *gen_parms; |
199 | struct conf_general_parms *g = &wl->conf.init.genparam; | ||
190 | int ret; | 200 | int ret; |
191 | 201 | ||
192 | gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL); | 202 | gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL); |
@@ -195,15 +205,14 @@ static int wl1271_init_general_parms(struct wl1271 *wl) | |||
195 | 205 | ||
196 | gen_parms->id = TEST_CMD_INI_FILE_GENERAL_PARAM; | 206 | gen_parms->id = TEST_CMD_INI_FILE_GENERAL_PARAM; |
197 | 207 | ||
198 | gen_parms->ref_clk = REF_CLK_38_4_E; | 208 | gen_parms->ref_clk = g->ref_clk; |
199 | /* FIXME: magic numbers */ | 209 | gen_parms->settling_time = g->settling_time; |
200 | gen_parms->settling_time = 5; | 210 | gen_parms->clk_valid_on_wakeup = g->clk_valid_on_wakeup; |
201 | gen_parms->clk_valid_on_wakeup = 0; | 211 | gen_parms->dc2dcmode = g->dc2dcmode; |
202 | gen_parms->dc2dcmode = 0; | 212 | gen_parms->single_dual_band = g->single_dual_band; |
203 | gen_parms->single_dual_band = 0; | 213 | gen_parms->tx_bip_fem_autodetect = g->tx_bip_fem_autodetect; |
204 | gen_parms->tx_bip_fem_autodetect = 1; | 214 | gen_parms->tx_bip_fem_manufacturer = g->tx_bip_fem_manufacturer; |
205 | gen_parms->tx_bip_fem_manufacturer = 1; | 215 | gen_parms->settings = g->settings; |
206 | gen_parms->settings = 1; | ||
207 | 216 | ||
208 | ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), 0); | 217 | ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), 0); |
209 | if (ret < 0) { | 218 | if (ret < 0) { |
@@ -217,32 +226,9 @@ static int wl1271_init_general_parms(struct wl1271 *wl) | |||
217 | 226 | ||
218 | static int wl1271_init_radio_parms(struct wl1271 *wl) | 227 | static int wl1271_init_radio_parms(struct wl1271 *wl) |
219 | { | 228 | { |
220 | /* | ||
221 | * FIXME: All these magic numbers should be moved to some place where | ||
222 | * they can be configured (separate file?) | ||
223 | */ | ||
224 | |||
225 | struct wl1271_radio_parms *radio_parms; | 229 | struct wl1271_radio_parms *radio_parms; |
226 | int ret; | 230 | struct conf_radio_parms *r = &wl->conf.init.radioparam; |
227 | u8 compensation[] = { 0xec, 0xf6, 0x00, 0x0c, 0x18, 0xf8, 0xfc, 0x00, | 231 | int i, ret; |
228 | 0x08, 0x10, 0xf0, 0xf8, 0x00, 0x0a, 0x14 }; | ||
229 | |||
230 | u8 tx_rate_limits_normal[] = { 0x1e, 0x1f, 0x22, 0x24, 0x28, 0x29 }; | ||
231 | u8 tx_rate_limits_degraded[] = { 0x1b, 0x1c, 0x1e, 0x20, 0x24, 0x25 }; | ||
232 | |||
233 | u8 tx_channel_limits_11b[] = { 0x22, 0x50, 0x50, 0x50, | ||
234 | 0x50, 0x50, 0x50, 0x50, | ||
235 | 0x50, 0x50, 0x22, 0x50, | ||
236 | 0x22, 0x50 }; | ||
237 | |||
238 | u8 tx_channel_limits_ofdm[] = { 0x20, 0x50, 0x50, 0x50, | ||
239 | 0x50, 0x50, 0x50, 0x50, | ||
240 | 0x50, 0x50, 0x20, 0x50, | ||
241 | 0x20, 0x50 }; | ||
242 | |||
243 | u8 tx_pdv_rate_offsets[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; | ||
244 | |||
245 | u8 tx_ibias[] = { 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x27 }; | ||
246 | 232 | ||
247 | radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL); | 233 | radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL); |
248 | if (!radio_parms) | 234 | if (!radio_parms) |
@@ -251,33 +237,59 @@ static int wl1271_init_radio_parms(struct wl1271 *wl) | |||
251 | radio_parms->id = TEST_CMD_INI_FILE_RADIO_PARAM; | 237 | radio_parms->id = TEST_CMD_INI_FILE_RADIO_PARAM; |
252 | 238 | ||
253 | /* Static radio parameters */ | 239 | /* Static radio parameters */ |
254 | radio_parms->rx_trace_loss = 10; | 240 | radio_parms->rx_trace_loss = r->rx_trace_loss; |
255 | radio_parms->tx_trace_loss = 10; | 241 | radio_parms->tx_trace_loss = r->tx_trace_loss; |
256 | memcpy(radio_parms->rx_rssi_and_proc_compens, compensation, | 242 | memcpy(radio_parms->rx_rssi_and_proc_compens, |
257 | sizeof(compensation)); | 243 | r->rx_rssi_and_proc_compens, |
258 | 244 | CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE); | |
259 | /* We don't set the 5GHz -- N/A */ | 245 | |
246 | memcpy(radio_parms->rx_trace_loss_5, r->rx_trace_loss_5, | ||
247 | CONF_NUMBER_OF_SUB_BANDS_5); | ||
248 | memcpy(radio_parms->tx_trace_loss_5, r->tx_trace_loss_5, | ||
249 | CONF_NUMBER_OF_SUB_BANDS_5); | ||
250 | memcpy(radio_parms->rx_rssi_and_proc_compens_5, | ||
251 | r->rx_rssi_and_proc_compens_5, | ||
252 | CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE); | ||
260 | 253 | ||
261 | /* Dynamic radio parameters */ | 254 | /* Dynamic radio parameters */ |
262 | radio_parms->tx_ref_pd_voltage = cpu_to_le16(0x24e); | 255 | radio_parms->tx_ref_pd_voltage = cpu_to_le16(r->tx_ref_pd_voltage); |
263 | radio_parms->tx_ref_power = 0x78; | 256 | radio_parms->tx_ref_power = r->tx_ref_power; |
264 | radio_parms->tx_offset_db = 0x0; | 257 | radio_parms->tx_offset_db = r->tx_offset_db; |
265 | 258 | ||
266 | memcpy(radio_parms->tx_rate_limits_normal, tx_rate_limits_normal, | 259 | memcpy(radio_parms->tx_rate_limits_normal, r->tx_rate_limits_normal, |
267 | sizeof(tx_rate_limits_normal)); | 260 | CONF_NUMBER_OF_RATE_GROUPS); |
268 | memcpy(radio_parms->tx_rate_limits_degraded, tx_rate_limits_degraded, | 261 | memcpy(radio_parms->tx_rate_limits_degraded, r->tx_rate_limits_degraded, |
269 | sizeof(tx_rate_limits_degraded)); | 262 | CONF_NUMBER_OF_RATE_GROUPS); |
270 | 263 | ||
271 | memcpy(radio_parms->tx_channel_limits_11b, tx_channel_limits_11b, | 264 | memcpy(radio_parms->tx_channel_limits_11b, r->tx_channel_limits_11b, |
272 | sizeof(tx_channel_limits_11b)); | 265 | CONF_NUMBER_OF_CHANNELS_2_4); |
273 | memcpy(radio_parms->tx_channel_limits_ofdm, tx_channel_limits_ofdm, | 266 | memcpy(radio_parms->tx_channel_limits_ofdm, r->tx_channel_limits_ofdm, |
274 | sizeof(tx_channel_limits_ofdm)); | 267 | CONF_NUMBER_OF_CHANNELS_2_4); |
275 | memcpy(radio_parms->tx_pdv_rate_offsets, tx_pdv_rate_offsets, | 268 | memcpy(radio_parms->tx_pdv_rate_offsets, r->tx_pdv_rate_offsets, |
276 | sizeof(tx_pdv_rate_offsets)); | 269 | CONF_NUMBER_OF_RATE_GROUPS); |
277 | memcpy(radio_parms->tx_ibias, tx_ibias, | 270 | memcpy(radio_parms->tx_ibias, r->tx_ibias, CONF_NUMBER_OF_RATE_GROUPS); |
278 | sizeof(tx_ibias)); | 271 | |
279 | 272 | radio_parms->rx_fem_insertion_loss = r->rx_fem_insertion_loss; | |
280 | radio_parms->rx_fem_insertion_loss = 0x14; | 273 | |
274 | for (i = 0; i < CONF_NUMBER_OF_SUB_BANDS_5; i++) | ||
275 | radio_parms->tx_ref_pd_voltage_5[i] = | ||
276 | cpu_to_le16(r->tx_ref_pd_voltage_5[i]); | ||
277 | memcpy(radio_parms->tx_ref_power_5, r->tx_ref_power_5, | ||
278 | CONF_NUMBER_OF_SUB_BANDS_5); | ||
279 | memcpy(radio_parms->tx_offset_db_5, r->tx_offset_db_5, | ||
280 | CONF_NUMBER_OF_SUB_BANDS_5); | ||
281 | memcpy(radio_parms->tx_rate_limits_normal_5, | ||
282 | r->tx_rate_limits_normal_5, CONF_NUMBER_OF_RATE_GROUPS); | ||
283 | memcpy(radio_parms->tx_rate_limits_degraded_5, | ||
284 | r->tx_rate_limits_degraded_5, CONF_NUMBER_OF_RATE_GROUPS); | ||
285 | memcpy(radio_parms->tx_channel_limits_ofdm_5, | ||
286 | r->tx_channel_limits_ofdm_5, CONF_NUMBER_OF_CHANNELS_5); | ||
287 | memcpy(radio_parms->tx_pdv_rate_offsets_5, r->tx_pdv_rate_offsets_5, | ||
288 | CONF_NUMBER_OF_RATE_GROUPS); | ||
289 | memcpy(radio_parms->tx_ibias_5, r->tx_ibias_5, | ||
290 | CONF_NUMBER_OF_RATE_GROUPS); | ||
291 | memcpy(radio_parms->rx_fem_insertion_loss_5, | ||
292 | r->rx_fem_insertion_loss_5, CONF_NUMBER_OF_SUB_BANDS_5); | ||
281 | 293 | ||
282 | ret = wl1271_cmd_test(wl, radio_parms, sizeof(*radio_parms), 0); | 294 | ret = wl1271_cmd_test(wl, radio_parms, sizeof(*radio_parms), 0); |
283 | if (ret < 0) | 295 | if (ret < 0) |
@@ -291,12 +303,15 @@ int wl1271_hw_init(struct wl1271 *wl) | |||
291 | { | 303 | { |
292 | int ret; | 304 | int ret; |
293 | 305 | ||
306 | /* FIXME: the following parameter setting functions return error | ||
307 | * codes - the reason is so far unknown. The -EIO is therefore | ||
308 | * ignored for the time being. */ | ||
294 | ret = wl1271_init_general_parms(wl); | 309 | ret = wl1271_init_general_parms(wl); |
295 | if (ret < 0) | 310 | if (ret < 0 && ret != -EIO) |
296 | return ret; | 311 | return ret; |
297 | 312 | ||
298 | ret = wl1271_init_radio_parms(wl); | 313 | ret = wl1271_init_radio_parms(wl); |
299 | if (ret < 0) | 314 | if (ret < 0 && ret != -EIO) |
300 | return ret; | 315 | return ret; |
301 | 316 | ||
302 | /* Template settings */ | 317 | /* Template settings */ |
@@ -311,8 +326,8 @@ int wl1271_hw_init(struct wl1271 *wl) | |||
311 | 326 | ||
312 | /* RX config */ | 327 | /* RX config */ |
313 | ret = wl1271_init_rx_config(wl, | 328 | ret = wl1271_init_rx_config(wl, |
314 | RX_CFG_PROMISCUOUS | RX_CFG_TSF, | 329 | RX_CFG_PROMISCUOUS | RX_CFG_TSF, |
315 | RX_FILTER_OPTION_DEF); | 330 | RX_FILTER_OPTION_DEF); |
316 | /* RX_CONFIG_OPTION_ANY_DST_ANY_BSS, | 331 | /* RX_CONFIG_OPTION_ANY_DST_ANY_BSS, |
317 | RX_FILTER_OPTION_FILTER_ALL); */ | 332 | RX_FILTER_OPTION_FILTER_ALL); */ |
318 | if (ret < 0) | 333 | if (ret < 0) |
@@ -323,6 +338,11 @@ int wl1271_hw_init(struct wl1271 *wl) | |||
323 | if (ret < 0) | 338 | if (ret < 0) |
324 | goto out_free_memmap; | 339 | goto out_free_memmap; |
325 | 340 | ||
341 | /* Initialize connection monitoring thresholds */ | ||
342 | ret = wl1271_acx_conn_monit_params(wl); | ||
343 | if (ret < 0) | ||
344 | goto out_free_memmap; | ||
345 | |||
326 | /* Beacon filtering */ | 346 | /* Beacon filtering */ |
327 | ret = wl1271_init_beacon_filter(wl); | 347 | ret = wl1271_init_beacon_filter(wl); |
328 | if (ret < 0) | 348 | if (ret < 0) |
@@ -369,7 +389,7 @@ int wl1271_hw_init(struct wl1271 *wl) | |||
369 | goto out_free_memmap; | 389 | goto out_free_memmap; |
370 | 390 | ||
371 | /* Configure TX rate classes */ | 391 | /* Configure TX rate classes */ |
372 | ret = wl1271_acx_rate_policies(wl); | 392 | ret = wl1271_acx_rate_policies(wl, CONF_TX_RATE_MASK_ALL); |
373 | if (ret < 0) | 393 | if (ret < 0) |
374 | goto out_free_memmap; | 394 | goto out_free_memmap; |
375 | 395 | ||
@@ -388,10 +408,16 @@ int wl1271_hw_init(struct wl1271 *wl) | |||
388 | if (ret < 0) | 408 | if (ret < 0) |
389 | goto out_free_memmap; | 409 | goto out_free_memmap; |
390 | 410 | ||
411 | /* Configure smart reflex */ | ||
412 | ret = wl1271_acx_smart_reflex(wl); | ||
413 | if (ret < 0) | ||
414 | goto out_free_memmap; | ||
415 | |||
391 | return 0; | 416 | return 0; |
392 | 417 | ||
393 | out_free_memmap: | 418 | out_free_memmap: |
394 | kfree(wl->target_mem_map); | 419 | kfree(wl->target_mem_map); |
420 | wl->target_mem_map = NULL; | ||
395 | 421 | ||
396 | return ret; | 422 | return ret; |
397 | } | 423 | } |