blob: bdb61232f80cdc530a594dedad500dfb9521590a [file] [log] [blame]
Luciano Coelhof5fc0f82009-08-06 16:25:28 +03001/*
2 * This file is part of wl1271
3 *
4 * Copyright (C) 2009 Nokia Corporation
5 *
6 * Contact: Luciano Coelho <luciano.coelho@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
24#include <linux/kernel.h>
25#include <linux/module.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090026#include <linux/slab.h>
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030027
Shahar Levi00d20102010-11-08 11:20:10 +000028#include "init.h"
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030029#include "wl12xx_80211.h"
Shahar Levi00d20102010-11-08 11:20:10 +000030#include "acx.h"
31#include "cmd.h"
32#include "reg.h"
Arik Nemtsove0fe3712010-10-16 18:19:53 +020033#include "tx.h"
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030034
Arik Nemtsove0fe3712010-10-16 18:19:53 +020035int wl1271_sta_init_templates_config(struct wl1271 *wl)
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030036{
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +020037 int ret, i;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030038
39 /* send empty templates for fw memory reservation */
40 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_2_4, NULL,
Guy Eilamea559b42010-12-09 16:54:59 +020041 WL1271_CMD_TEMPL_MAX_SIZE,
Juuso Oikarinen606c1482010-04-01 11:38:21 +030042 0, WL1271_RATE_AUTOMATIC);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030043 if (ret < 0)
44 return ret;
45
Juuso Oikarinen11eb5422010-08-24 06:28:03 +030046 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_5,
Guy Eilamea559b42010-12-09 16:54:59 +020047 NULL, WL1271_CMD_TEMPL_MAX_SIZE, 0,
Juuso Oikarinen11eb5422010-08-24 06:28:03 +030048 WL1271_RATE_AUTOMATIC);
49 if (ret < 0)
50 return ret;
Teemu Paasikiviabb0b3b2009-10-13 12:47:50 +030051
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030052 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, NULL,
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +020053 sizeof(struct wl12xx_null_data_template),
Juuso Oikarinen606c1482010-04-01 11:38:21 +030054 0, WL1271_RATE_AUTOMATIC);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030055 if (ret < 0)
56 return ret;
57
58 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_PS_POLL, NULL,
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +020059 sizeof(struct wl12xx_ps_poll_template),
Juuso Oikarinen606c1482010-04-01 11:38:21 +030060 0, WL1271_RATE_AUTOMATIC);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030061 if (ret < 0)
62 return ret;
63
64 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_QOS_NULL_DATA, NULL,
65 sizeof
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +020066 (struct wl12xx_qos_null_data_template),
Juuso Oikarinen606c1482010-04-01 11:38:21 +030067 0, WL1271_RATE_AUTOMATIC);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030068 if (ret < 0)
69 return ret;
70
71 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_PROBE_RESPONSE, NULL,
72 sizeof
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +020073 (struct wl12xx_probe_resp_template),
Juuso Oikarinen606c1482010-04-01 11:38:21 +030074 0, WL1271_RATE_AUTOMATIC);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030075 if (ret < 0)
76 return ret;
77
78 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_BEACON, NULL,
79 sizeof
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +020080 (struct wl12xx_beacon_template),
Juuso Oikarinen606c1482010-04-01 11:38:21 +030081 0, WL1271_RATE_AUTOMATIC);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030082 if (ret < 0)
83 return ret;
84
Eliad Pellerc5312772010-12-09 11:31:27 +020085 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_ARP_RSP, NULL,
86 sizeof
87 (struct wl12xx_arp_rsp_template),
88 0, WL1271_RATE_AUTOMATIC);
89 if (ret < 0)
90 return ret;
91
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +020092 for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) {
93 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_KLV, NULL,
Juuso Oikarinen606c1482010-04-01 11:38:21 +030094 WL1271_CMD_TEMPL_MAX_SIZE, i,
95 WL1271_RATE_AUTOMATIC);
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +020096 if (ret < 0)
97 return ret;
98 }
99
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300100 return 0;
101}
102
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200103static int wl1271_ap_init_deauth_template(struct wl1271 *wl)
104{
105 struct wl12xx_disconn_template *tmpl;
106 int ret;
107
108 tmpl = kzalloc(sizeof(*tmpl), GFP_KERNEL);
109 if (!tmpl) {
110 ret = -ENOMEM;
111 goto out;
112 }
113
114 tmpl->header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_MGMT |
115 IEEE80211_STYPE_DEAUTH);
116
117 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_DEAUTH_AP,
118 tmpl, sizeof(*tmpl), 0,
119 wl1271_tx_min_rate_get(wl));
120
121out:
122 kfree(tmpl);
123 return ret;
124}
125
126static int wl1271_ap_init_null_template(struct wl1271 *wl)
127{
128 struct ieee80211_hdr_3addr *nullfunc;
129 int ret;
130
131 nullfunc = kzalloc(sizeof(*nullfunc), GFP_KERNEL);
132 if (!nullfunc) {
133 ret = -ENOMEM;
134 goto out;
135 }
136
137 nullfunc->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA |
138 IEEE80211_STYPE_NULLFUNC |
139 IEEE80211_FCTL_FROMDS);
140
141 /* nullfunc->addr1 is filled by FW */
142
143 memcpy(nullfunc->addr2, wl->mac_addr, ETH_ALEN);
144 memcpy(nullfunc->addr3, wl->mac_addr, ETH_ALEN);
145
146 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, nullfunc,
147 sizeof(*nullfunc), 0,
148 wl1271_tx_min_rate_get(wl));
149
150out:
151 kfree(nullfunc);
152 return ret;
153}
154
155static int wl1271_ap_init_qos_null_template(struct wl1271 *wl)
156{
157 struct ieee80211_qos_hdr *qosnull;
158 int ret;
159
160 qosnull = kzalloc(sizeof(*qosnull), GFP_KERNEL);
161 if (!qosnull) {
162 ret = -ENOMEM;
163 goto out;
164 }
165
166 qosnull->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA |
167 IEEE80211_STYPE_QOS_NULLFUNC |
168 IEEE80211_FCTL_FROMDS);
169
170 /* qosnull->addr1 is filled by FW */
171
172 memcpy(qosnull->addr2, wl->mac_addr, ETH_ALEN);
173 memcpy(qosnull->addr3, wl->mac_addr, ETH_ALEN);
174
175 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_QOS_NULL_DATA, qosnull,
176 sizeof(*qosnull), 0,
177 wl1271_tx_min_rate_get(wl));
178
179out:
180 kfree(qosnull);
181 return ret;
182}
183
184static int wl1271_ap_init_templates_config(struct wl1271 *wl)
185{
186 int ret;
187
188 /*
189 * Put very large empty placeholders for all templates. These
190 * reserve memory for later.
191 */
192 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_AP_PROBE_RESPONSE, NULL,
193 sizeof
194 (struct wl12xx_probe_resp_template),
195 0, WL1271_RATE_AUTOMATIC);
196 if (ret < 0)
197 return ret;
198
199 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_AP_BEACON, NULL,
200 sizeof
201 (struct wl12xx_beacon_template),
202 0, WL1271_RATE_AUTOMATIC);
203 if (ret < 0)
204 return ret;
205
206 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_DEAUTH_AP, NULL,
207 sizeof
208 (struct wl12xx_disconn_template),
209 0, WL1271_RATE_AUTOMATIC);
210 if (ret < 0)
211 return ret;
212
213 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, NULL,
214 sizeof(struct wl12xx_null_data_template),
215 0, WL1271_RATE_AUTOMATIC);
216 if (ret < 0)
217 return ret;
218
219 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_QOS_NULL_DATA, NULL,
220 sizeof
221 (struct wl12xx_qos_null_data_template),
222 0, WL1271_RATE_AUTOMATIC);
223 if (ret < 0)
224 return ret;
225
226 return 0;
227}
228
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300229static int wl1271_init_rx_config(struct wl1271 *wl, u32 config, u32 filter)
230{
231 int ret;
232
Juuso Oikarinen8793f9b2009-10-13 12:47:40 +0300233 ret = wl1271_acx_rx_msdu_life_time(wl);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300234 if (ret < 0)
235 return ret;
236
237 ret = wl1271_acx_rx_config(wl, config, filter);
238 if (ret < 0)
239 return ret;
240
241 return 0;
242}
243
Luciano Coelho12419cc2010-02-18 13:25:44 +0200244int wl1271_init_phy_config(struct wl1271 *wl)
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300245{
246 int ret;
247
248 ret = wl1271_acx_pd_threshold(wl);
249 if (ret < 0)
250 return ret;
251
252 ret = wl1271_acx_slot(wl, DEFAULT_SLOT_TIME);
253 if (ret < 0)
254 return ret;
255
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300256 ret = wl1271_acx_service_period_timeout(wl);
257 if (ret < 0)
258 return ret;
259
Juuso Oikarinen8793f9b2009-10-13 12:47:40 +0300260 ret = wl1271_acx_rts_threshold(wl, wl->conf.rx.rts_threshold);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300261 if (ret < 0)
262 return ret;
263
264 return 0;
265}
266
267static int wl1271_init_beacon_filter(struct wl1271 *wl)
268{
269 int ret;
270
Juuso Oikarinen19221672009-10-08 21:56:35 +0300271 /* disable beacon filtering at this stage */
272 ret = wl1271_acx_beacon_filter_opt(wl, false);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300273 if (ret < 0)
274 return ret;
275
276 ret = wl1271_acx_beacon_filter_table(wl);
277 if (ret < 0)
278 return ret;
279
280 return 0;
281}
282
Luciano Coelho12419cc2010-02-18 13:25:44 +0200283int wl1271_init_pta(struct wl1271 *wl)
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300284{
285 int ret;
286
Juuso Oikarinen1b00f542010-03-18 12:26:30 +0200287 ret = wl1271_acx_sg_cfg(wl);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300288 if (ret < 0)
289 return ret;
290
Juuso Oikarinen7fc3a862010-03-18 12:26:32 +0200291 ret = wl1271_acx_sg_enable(wl, wl->sg_enabled);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300292 if (ret < 0)
293 return ret;
294
295 return 0;
296}
297
Luciano Coelho12419cc2010-02-18 13:25:44 +0200298int wl1271_init_energy_detection(struct wl1271 *wl)
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300299{
300 int ret;
301
302 ret = wl1271_acx_cca_threshold(wl);
303 if (ret < 0)
304 return ret;
305
306 return 0;
307}
308
309static int wl1271_init_beacon_broadcast(struct wl1271 *wl)
310{
311 int ret;
312
313 ret = wl1271_acx_bcn_dtim_options(wl);
314 if (ret < 0)
315 return ret;
316
317 return 0;
318}
319
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200320static int wl1271_sta_hw_init(struct wl1271 *wl)
321{
322 int ret;
323
324 ret = wl1271_cmd_ext_radio_parms(wl);
325 if (ret < 0)
326 return ret;
327
328 ret = wl1271_sta_init_templates_config(wl);
329 if (ret < 0)
330 return ret;
331
332 ret = wl1271_acx_group_address_tbl(wl, true, NULL, 0);
333 if (ret < 0)
334 return ret;
335
336 /* Initialize connection monitoring thresholds */
337 ret = wl1271_acx_conn_monit_params(wl, false);
338 if (ret < 0)
339 return ret;
340
341 /* Beacon filtering */
342 ret = wl1271_init_beacon_filter(wl);
343 if (ret < 0)
344 return ret;
345
346 /* Bluetooth WLAN coexistence */
347 ret = wl1271_init_pta(wl);
348 if (ret < 0)
349 return ret;
350
351 /* Beacons and broadcast settings */
352 ret = wl1271_init_beacon_broadcast(wl);
353 if (ret < 0)
354 return ret;
355
356 /* Configure for ELP power saving */
357 ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_ELP);
358 if (ret < 0)
359 return ret;
360
361 /* Configure rssi/snr averaging weights */
362 ret = wl1271_acx_rssi_snr_avg_weights(wl);
363 if (ret < 0)
364 return ret;
365
366 ret = wl1271_acx_sta_rate_policies(wl);
367 if (ret < 0)
368 return ret;
369
370 return 0;
371}
372
373static int wl1271_sta_hw_init_post_mem(struct wl1271 *wl)
374{
375 int ret, i;
376
377 ret = wl1271_cmd_set_sta_default_wep_key(wl, wl->default_key);
378 if (ret < 0) {
379 wl1271_warning("couldn't set default key");
380 return ret;
381 }
382
383 /* disable all keep-alive templates */
384 for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) {
385 ret = wl1271_acx_keep_alive_config(wl, i,
386 ACX_KEEP_ALIVE_TPL_INVALID);
387 if (ret < 0)
388 return ret;
389 }
390
391 /* disable the keep-alive feature */
392 ret = wl1271_acx_keep_alive_mode(wl, false);
393 if (ret < 0)
394 return ret;
395
396 return 0;
397}
398
399static int wl1271_ap_hw_init(struct wl1271 *wl)
400{
401 int ret, i;
402
403 ret = wl1271_ap_init_templates_config(wl);
404 if (ret < 0)
405 return ret;
406
407 /* Configure for power always on */
408 ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM);
409 if (ret < 0)
410 return ret;
411
412 /* Configure initial TX rate classes */
413 for (i = 0; i < wl->conf.tx.ac_conf_count; i++) {
414 ret = wl1271_acx_ap_rate_policy(wl,
415 &wl->conf.tx.ap_rc_conf[i], i);
416 if (ret < 0)
417 return ret;
418 }
419
420 ret = wl1271_acx_ap_rate_policy(wl,
421 &wl->conf.tx.ap_mgmt_conf,
422 ACX_TX_AP_MODE_MGMT_RATE);
423 if (ret < 0)
424 return ret;
425
426 ret = wl1271_acx_ap_rate_policy(wl,
427 &wl->conf.tx.ap_bcst_conf,
428 ACX_TX_AP_MODE_BCST_RATE);
429 if (ret < 0)
430 return ret;
431
432 ret = wl1271_acx_max_tx_retry(wl);
433 if (ret < 0)
434 return ret;
435
436 return 0;
437}
438
439static int wl1271_ap_hw_init_post_mem(struct wl1271 *wl)
440{
441 int ret;
442
443 ret = wl1271_ap_init_deauth_template(wl);
444 if (ret < 0)
445 return ret;
446
447 ret = wl1271_ap_init_null_template(wl);
448 if (ret < 0)
449 return ret;
450
451 ret = wl1271_ap_init_qos_null_template(wl);
452 if (ret < 0)
453 return ret;
454
455 return 0;
456}
457
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300458int wl1271_hw_init(struct wl1271 *wl)
459{
Kalle Valo243eeb52010-02-18 13:25:39 +0200460 struct conf_tx_ac_category *conf_ac;
Kalle Valof2054df2010-02-18 13:25:40 +0200461 struct conf_tx_tid *conf_tid;
Kalle Valo243eeb52010-02-18 13:25:39 +0200462 int ret, i;
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200463 bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300464
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200465 ret = wl1271_cmd_general_parms(wl);
Luciano Coelho4a904062009-11-23 23:22:18 +0200466 if (ret < 0)
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300467 return ret;
468
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200469 ret = wl1271_cmd_radio_parms(wl);
Luciano Coelho4a904062009-11-23 23:22:18 +0200470 if (ret < 0)
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300471 return ret;
472
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200473 /* Mode specific init */
474 if (is_ap)
475 ret = wl1271_ap_hw_init(wl);
476 else
477 ret = wl1271_sta_hw_init(wl);
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200478
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300479 if (ret < 0)
480 return ret;
481
482 /* Default memory configuration */
483 ret = wl1271_acx_init_mem_config(wl);
484 if (ret < 0)
485 return ret;
486
487 /* RX config */
488 ret = wl1271_init_rx_config(wl,
Juuso Oikarineneb5b28d2009-10-13 12:47:45 +0300489 RX_CFG_PROMISCUOUS | RX_CFG_TSF,
490 RX_FILTER_OPTION_DEF);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300491 /* RX_CONFIG_OPTION_ANY_DST_ANY_BSS,
492 RX_FILTER_OPTION_FILTER_ALL); */
493 if (ret < 0)
494 goto out_free_memmap;
495
496 /* PHY layer config */
497 ret = wl1271_init_phy_config(wl);
498 if (ret < 0)
499 goto out_free_memmap;
500
Luciano Coelho6e92b412009-12-11 15:40:50 +0200501 ret = wl1271_acx_dco_itrim_params(wl);
502 if (ret < 0)
503 goto out_free_memmap;
504
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300505 /* Configure TX patch complete interrupt behavior */
506 ret = wl1271_acx_tx_config_options(wl);
507 if (ret < 0)
508 goto out_free_memmap;
509
510 /* RX complete interrupt pacing */
511 ret = wl1271_acx_init_rx_interrupt(wl);
512 if (ret < 0)
513 goto out_free_memmap;
514
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300515 /* Energy detection */
516 ret = wl1271_init_energy_detection(wl);
517 if (ret < 0)
518 goto out_free_memmap;
519
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300520 /* Default fragmentation threshold */
Arik Nemtsov68d069c2010-11-08 10:51:07 +0100521 ret = wl1271_acx_frag_threshold(wl, wl->conf.tx.frag_threshold);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300522 if (ret < 0)
523 goto out_free_memmap;
524
Juuso Oikarinen9987a9d2010-09-01 11:31:12 +0200525 /* Default TID/AC configuration */
526 BUG_ON(wl->conf.tx.tid_conf_count != wl->conf.tx.ac_conf_count);
Kalle Valof2054df2010-02-18 13:25:40 +0200527 for (i = 0; i < wl->conf.tx.tid_conf_count; i++) {
Juuso Oikarinen9987a9d2010-09-01 11:31:12 +0200528 conf_ac = &wl->conf.tx.ac_conf[i];
529 ret = wl1271_acx_ac_cfg(wl, conf_ac->ac, conf_ac->cw_min,
530 conf_ac->cw_max, conf_ac->aifsn,
531 conf_ac->tx_op_limit);
532 if (ret < 0)
533 goto out_free_memmap;
534
Kalle Valof2054df2010-02-18 13:25:40 +0200535 conf_tid = &wl->conf.tx.tid_conf[i];
536 ret = wl1271_acx_tid_cfg(wl, conf_tid->queue_id,
537 conf_tid->channel_type,
538 conf_tid->tsid,
539 conf_tid->ps_scheme,
540 conf_tid->ack_policy,
541 conf_tid->apsd_conf[0],
542 conf_tid->apsd_conf[1]);
543 if (ret < 0)
544 goto out_free_memmap;
545 }
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300546
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300547 /* Enable data path */
Luciano Coelho94210892009-12-11 15:40:55 +0200548 ret = wl1271_cmd_data_path(wl, 1);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300549 if (ret < 0)
550 goto out_free_memmap;
551
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300552 /* Configure HW encryption */
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200553 ret = wl1271_acx_feature_cfg(wl);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300554 if (ret < 0)
555 goto out_free_memmap;
556
Juuso Oikarinen38ad2d82009-12-11 15:41:08 +0200557 /* configure PM */
558 ret = wl1271_acx_pm_config(wl);
559 if (ret < 0)
560 goto out_free_memmap;
561
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200562 /* Mode specific init - post mem init */
563 if (is_ap)
564 ret = wl1271_ap_hw_init_post_mem(wl);
565 else
566 ret = wl1271_sta_hw_init_post_mem(wl);
Juuso Oikarinenc1899552010-03-26 12:53:32 +0200567
Juuso Oikarinen00236aed2010-04-09 11:07:30 +0300568 if (ret < 0)
569 goto out_free_memmap;
570
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300571 return 0;
572
573 out_free_memmap:
574 kfree(wl->target_mem_map);
Juuso Oikarinen34415232009-10-08 21:56:33 +0300575 wl->target_mem_map = NULL;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300576
577 return ret;
578}