init.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725
  1. /*
  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. #include <linux/kernel.h>
  24. #include <linux/module.h>
  25. #include <linux/slab.h>
  26. #include "init.h"
  27. #include "wl12xx_80211.h"
  28. #include "acx.h"
  29. #include "cmd.h"
  30. #include "reg.h"
  31. #include "tx.h"
  32. #include "io.h"
  33. int wl1271_sta_init_templates_config(struct wl1271 *wl)
  34. {
  35. int ret, i;
  36. /* send empty templates for fw memory reservation */
  37. ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_2_4, NULL,
  38. WL1271_CMD_TEMPL_DFLT_SIZE,
  39. 0, WL1271_RATE_AUTOMATIC);
  40. if (ret < 0)
  41. return ret;
  42. ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_5,
  43. NULL, WL1271_CMD_TEMPL_DFLT_SIZE, 0,
  44. WL1271_RATE_AUTOMATIC);
  45. if (ret < 0)
  46. return ret;
  47. ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, NULL,
  48. sizeof(struct wl12xx_null_data_template),
  49. 0, WL1271_RATE_AUTOMATIC);
  50. if (ret < 0)
  51. return ret;
  52. ret = wl1271_cmd_template_set(wl, CMD_TEMPL_PS_POLL, NULL,
  53. sizeof(struct wl12xx_ps_poll_template),
  54. 0, WL1271_RATE_AUTOMATIC);
  55. if (ret < 0)
  56. return ret;
  57. ret = wl1271_cmd_template_set(wl, CMD_TEMPL_QOS_NULL_DATA, NULL,
  58. sizeof
  59. (struct wl12xx_qos_null_data_template),
  60. 0, WL1271_RATE_AUTOMATIC);
  61. if (ret < 0)
  62. return ret;
  63. ret = wl1271_cmd_template_set(wl, CMD_TEMPL_PROBE_RESPONSE, NULL,
  64. WL1271_CMD_TEMPL_DFLT_SIZE,
  65. 0, WL1271_RATE_AUTOMATIC);
  66. if (ret < 0)
  67. return ret;
  68. ret = wl1271_cmd_template_set(wl, CMD_TEMPL_BEACON, NULL,
  69. WL1271_CMD_TEMPL_DFLT_SIZE,
  70. 0, WL1271_RATE_AUTOMATIC);
  71. if (ret < 0)
  72. return ret;
  73. ret = wl1271_cmd_template_set(wl, CMD_TEMPL_ARP_RSP, NULL,
  74. sizeof
  75. (struct wl12xx_arp_rsp_template),
  76. 0, WL1271_RATE_AUTOMATIC);
  77. if (ret < 0)
  78. return ret;
  79. for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) {
  80. ret = wl1271_cmd_template_set(wl, CMD_TEMPL_KLV, NULL,
  81. WL1271_CMD_TEMPL_DFLT_SIZE, i,
  82. WL1271_RATE_AUTOMATIC);
  83. if (ret < 0)
  84. return ret;
  85. }
  86. return 0;
  87. }
  88. static int wl1271_ap_init_deauth_template(struct wl1271 *wl)
  89. {
  90. struct wl12xx_disconn_template *tmpl;
  91. int ret;
  92. u32 rate;
  93. tmpl = kzalloc(sizeof(*tmpl), GFP_KERNEL);
  94. if (!tmpl) {
  95. ret = -ENOMEM;
  96. goto out;
  97. }
  98. tmpl->header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_MGMT |
  99. IEEE80211_STYPE_DEAUTH);
  100. rate = wl1271_tx_min_rate_get(wl, wl->basic_rate_set);
  101. ret = wl1271_cmd_template_set(wl, CMD_TEMPL_DEAUTH_AP,
  102. tmpl, sizeof(*tmpl), 0, rate);
  103. out:
  104. kfree(tmpl);
  105. return ret;
  106. }
  107. static int wl1271_ap_init_null_template(struct wl1271 *wl)
  108. {
  109. struct ieee80211_hdr_3addr *nullfunc;
  110. int ret;
  111. u32 rate;
  112. nullfunc = kzalloc(sizeof(*nullfunc), GFP_KERNEL);
  113. if (!nullfunc) {
  114. ret = -ENOMEM;
  115. goto out;
  116. }
  117. nullfunc->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA |
  118. IEEE80211_STYPE_NULLFUNC |
  119. IEEE80211_FCTL_FROMDS);
  120. /* nullfunc->addr1 is filled by FW */
  121. memcpy(nullfunc->addr2, wl->mac_addr, ETH_ALEN);
  122. memcpy(nullfunc->addr3, wl->mac_addr, ETH_ALEN);
  123. rate = wl1271_tx_min_rate_get(wl, wl->basic_rate_set);
  124. ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, nullfunc,
  125. sizeof(*nullfunc), 0, rate);
  126. out:
  127. kfree(nullfunc);
  128. return ret;
  129. }
  130. static int wl1271_ap_init_qos_null_template(struct wl1271 *wl)
  131. {
  132. struct ieee80211_qos_hdr *qosnull;
  133. int ret;
  134. u32 rate;
  135. qosnull = kzalloc(sizeof(*qosnull), GFP_KERNEL);
  136. if (!qosnull) {
  137. ret = -ENOMEM;
  138. goto out;
  139. }
  140. qosnull->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA |
  141. IEEE80211_STYPE_QOS_NULLFUNC |
  142. IEEE80211_FCTL_FROMDS);
  143. /* qosnull->addr1 is filled by FW */
  144. memcpy(qosnull->addr2, wl->mac_addr, ETH_ALEN);
  145. memcpy(qosnull->addr3, wl->mac_addr, ETH_ALEN);
  146. rate = wl1271_tx_min_rate_get(wl, wl->basic_rate_set);
  147. ret = wl1271_cmd_template_set(wl, CMD_TEMPL_QOS_NULL_DATA, qosnull,
  148. sizeof(*qosnull), 0, rate);
  149. out:
  150. kfree(qosnull);
  151. return ret;
  152. }
  153. static int wl1271_ap_init_templates_config(struct wl1271 *wl)
  154. {
  155. int ret;
  156. /*
  157. * Put very large empty placeholders for all templates. These
  158. * reserve memory for later.
  159. */
  160. ret = wl1271_cmd_template_set(wl, CMD_TEMPL_AP_PROBE_RESPONSE, NULL,
  161. WL1271_CMD_TEMPL_MAX_SIZE,
  162. 0, WL1271_RATE_AUTOMATIC);
  163. if (ret < 0)
  164. return ret;
  165. ret = wl1271_cmd_template_set(wl, CMD_TEMPL_AP_BEACON, NULL,
  166. WL1271_CMD_TEMPL_MAX_SIZE,
  167. 0, WL1271_RATE_AUTOMATIC);
  168. if (ret < 0)
  169. return ret;
  170. ret = wl1271_cmd_template_set(wl, CMD_TEMPL_DEAUTH_AP, NULL,
  171. sizeof
  172. (struct wl12xx_disconn_template),
  173. 0, WL1271_RATE_AUTOMATIC);
  174. if (ret < 0)
  175. return ret;
  176. ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, NULL,
  177. sizeof(struct wl12xx_null_data_template),
  178. 0, WL1271_RATE_AUTOMATIC);
  179. if (ret < 0)
  180. return ret;
  181. ret = wl1271_cmd_template_set(wl, CMD_TEMPL_QOS_NULL_DATA, NULL,
  182. sizeof
  183. (struct wl12xx_qos_null_data_template),
  184. 0, WL1271_RATE_AUTOMATIC);
  185. if (ret < 0)
  186. return ret;
  187. return 0;
  188. }
  189. static int wl12xx_init_rx_config(struct wl1271 *wl)
  190. {
  191. int ret;
  192. ret = wl1271_acx_rx_msdu_life_time(wl);
  193. if (ret < 0)
  194. return ret;
  195. return 0;
  196. }
  197. int wl1271_init_phy_config(struct wl1271 *wl)
  198. {
  199. int ret;
  200. ret = wl1271_acx_pd_threshold(wl);
  201. if (ret < 0)
  202. return ret;
  203. ret = wl1271_acx_slot(wl, DEFAULT_SLOT_TIME);
  204. if (ret < 0)
  205. return ret;
  206. ret = wl1271_acx_service_period_timeout(wl);
  207. if (ret < 0)
  208. return ret;
  209. ret = wl1271_acx_rts_threshold(wl, wl->hw->wiphy->rts_threshold);
  210. if (ret < 0)
  211. return ret;
  212. return 0;
  213. }
  214. static int wl1271_init_beacon_filter(struct wl1271 *wl)
  215. {
  216. int ret;
  217. /* disable beacon filtering at this stage */
  218. ret = wl1271_acx_beacon_filter_opt(wl, false);
  219. if (ret < 0)
  220. return ret;
  221. ret = wl1271_acx_beacon_filter_table(wl);
  222. if (ret < 0)
  223. return ret;
  224. return 0;
  225. }
  226. int wl1271_init_pta(struct wl1271 *wl)
  227. {
  228. int ret;
  229. ret = wl12xx_acx_sg_cfg(wl);
  230. if (ret < 0)
  231. return ret;
  232. ret = wl1271_acx_sg_enable(wl, wl->sg_enabled);
  233. if (ret < 0)
  234. return ret;
  235. return 0;
  236. }
  237. int wl1271_init_energy_detection(struct wl1271 *wl)
  238. {
  239. int ret;
  240. ret = wl1271_acx_cca_threshold(wl);
  241. if (ret < 0)
  242. return ret;
  243. return 0;
  244. }
  245. static int wl1271_init_beacon_broadcast(struct wl1271 *wl)
  246. {
  247. int ret;
  248. ret = wl1271_acx_bcn_dtim_options(wl);
  249. if (ret < 0)
  250. return ret;
  251. return 0;
  252. }
  253. static int wl12xx_init_fwlog(struct wl1271 *wl)
  254. {
  255. int ret;
  256. if (wl->quirks & WL12XX_QUIRK_FWLOG_NOT_IMPLEMENTED)
  257. return 0;
  258. ret = wl12xx_cmd_config_fwlog(wl);
  259. if (ret < 0)
  260. return ret;
  261. return 0;
  262. }
  263. static int wl1271_sta_hw_init(struct wl1271 *wl)
  264. {
  265. int ret;
  266. if (wl->chip.id != CHIP_ID_1283_PG20) {
  267. ret = wl1271_cmd_ext_radio_parms(wl);
  268. if (ret < 0)
  269. return ret;
  270. }
  271. /* PS config */
  272. ret = wl1271_acx_config_ps(wl);
  273. if (ret < 0)
  274. return ret;
  275. ret = wl1271_sta_init_templates_config(wl);
  276. if (ret < 0)
  277. return ret;
  278. ret = wl1271_acx_group_address_tbl(wl, true, NULL, 0);
  279. if (ret < 0)
  280. return ret;
  281. /* Initialize connection monitoring thresholds */
  282. ret = wl1271_acx_conn_monit_params(wl, false);
  283. if (ret < 0)
  284. return ret;
  285. /* Beacon filtering */
  286. ret = wl1271_init_beacon_filter(wl);
  287. if (ret < 0)
  288. return ret;
  289. /* FM WLAN coexistence */
  290. ret = wl1271_acx_fm_coex(wl);
  291. if (ret < 0)
  292. return ret;
  293. /* Beacons and broadcast settings */
  294. ret = wl1271_init_beacon_broadcast(wl);
  295. if (ret < 0)
  296. return ret;
  297. /* Configure for ELP power saving */
  298. ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_ELP);
  299. if (ret < 0)
  300. return ret;
  301. /* Configure rssi/snr averaging weights */
  302. ret = wl1271_acx_rssi_snr_avg_weights(wl);
  303. if (ret < 0)
  304. return ret;
  305. ret = wl1271_acx_sta_rate_policies(wl);
  306. if (ret < 0)
  307. return ret;
  308. ret = wl12xx_acx_mem_cfg(wl);
  309. if (ret < 0)
  310. return ret;
  311. /* Configure the FW logger */
  312. ret = wl12xx_init_fwlog(wl);
  313. if (ret < 0)
  314. return ret;
  315. return 0;
  316. }
  317. static int wl1271_sta_hw_init_post_mem(struct wl1271 *wl)
  318. {
  319. int ret, i;
  320. /* disable all keep-alive templates */
  321. for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) {
  322. ret = wl1271_acx_keep_alive_config(wl, i,
  323. ACX_KEEP_ALIVE_TPL_INVALID);
  324. if (ret < 0)
  325. return ret;
  326. }
  327. /* disable the keep-alive feature */
  328. ret = wl1271_acx_keep_alive_mode(wl, false);
  329. if (ret < 0)
  330. return ret;
  331. return 0;
  332. }
  333. static int wl1271_ap_hw_init(struct wl1271 *wl)
  334. {
  335. int ret;
  336. ret = wl1271_ap_init_templates_config(wl);
  337. if (ret < 0)
  338. return ret;
  339. /* Configure for power always on */
  340. ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM);
  341. if (ret < 0)
  342. return ret;
  343. ret = wl1271_init_ap_rates(wl);
  344. if (ret < 0)
  345. return ret;
  346. ret = wl1271_acx_ap_max_tx_retry(wl);
  347. if (ret < 0)
  348. return ret;
  349. ret = wl12xx_acx_mem_cfg(wl);
  350. if (ret < 0)
  351. return ret;
  352. /* initialize Tx power */
  353. ret = wl1271_acx_tx_power(wl, wl->power_level);
  354. if (ret < 0)
  355. return ret;
  356. return 0;
  357. }
  358. int wl1271_ap_init_templates(struct wl1271 *wl)
  359. {
  360. int ret;
  361. ret = wl1271_ap_init_deauth_template(wl);
  362. if (ret < 0)
  363. return ret;
  364. ret = wl1271_ap_init_null_template(wl);
  365. if (ret < 0)
  366. return ret;
  367. ret = wl1271_ap_init_qos_null_template(wl);
  368. if (ret < 0)
  369. return ret;
  370. /*
  371. * when operating as AP we want to receive external beacons for
  372. * configuring ERP protection.
  373. */
  374. ret = wl1271_acx_beacon_filter_opt(wl, false);
  375. if (ret < 0)
  376. return ret;
  377. return 0;
  378. }
  379. static int wl1271_ap_hw_init_post_mem(struct wl1271 *wl)
  380. {
  381. return wl1271_ap_init_templates(wl);
  382. }
  383. int wl1271_init_ap_rates(struct wl1271 *wl)
  384. {
  385. int i, ret;
  386. struct conf_tx_rate_class rc;
  387. u32 supported_rates;
  388. wl1271_debug(DEBUG_AP, "AP basic rate set: 0x%x", wl->basic_rate_set);
  389. if (wl->basic_rate_set == 0)
  390. return -EINVAL;
  391. rc.enabled_rates = wl->basic_rate_set;
  392. rc.long_retry_limit = 10;
  393. rc.short_retry_limit = 10;
  394. rc.aflags = 0;
  395. ret = wl1271_acx_ap_rate_policy(wl, &rc, ACX_TX_AP_MODE_MGMT_RATE);
  396. if (ret < 0)
  397. return ret;
  398. /* use the min basic rate for AP broadcast/multicast */
  399. rc.enabled_rates = wl1271_tx_min_rate_get(wl, wl->basic_rate_set);
  400. rc.short_retry_limit = 10;
  401. rc.long_retry_limit = 10;
  402. rc.aflags = 0;
  403. ret = wl1271_acx_ap_rate_policy(wl, &rc, ACX_TX_AP_MODE_BCST_RATE);
  404. if (ret < 0)
  405. return ret;
  406. /*
  407. * If the basic rates contain OFDM rates, use OFDM only
  408. * rates for unicast TX as well. Else use all supported rates.
  409. */
  410. if ((wl->basic_rate_set & CONF_TX_OFDM_RATES))
  411. supported_rates = CONF_TX_OFDM_RATES;
  412. else
  413. supported_rates = CONF_TX_AP_ENABLED_RATES;
  414. /* unconditionally enable HT rates */
  415. supported_rates |= CONF_TX_MCS_RATES;
  416. /* configure unicast TX rate classes */
  417. for (i = 0; i < wl->conf.tx.ac_conf_count; i++) {
  418. rc.enabled_rates = supported_rates;
  419. rc.short_retry_limit = 10;
  420. rc.long_retry_limit = 10;
  421. rc.aflags = 0;
  422. ret = wl1271_acx_ap_rate_policy(wl, &rc, i);
  423. if (ret < 0)
  424. return ret;
  425. }
  426. return 0;
  427. }
  428. static int wl1271_set_ba_policies(struct wl1271 *wl)
  429. {
  430. /* Reset the BA RX indicators */
  431. wl->ba_rx_bitmap = 0;
  432. wl->ba_allowed = true;
  433. wl->ba_rx_session_count = 0;
  434. /* BA is supported in STA/AP modes */
  435. if (wl->bss_type != BSS_TYPE_AP_BSS &&
  436. wl->bss_type != BSS_TYPE_STA_BSS) {
  437. wl->ba_support = false;
  438. return 0;
  439. }
  440. wl->ba_support = true;
  441. /* 802.11n initiator BA session setting */
  442. return wl12xx_acx_set_ba_initiator_policy(wl);
  443. }
  444. int wl1271_chip_specific_init(struct wl1271 *wl)
  445. {
  446. int ret = 0;
  447. if (wl->chip.id == CHIP_ID_1283_PG20) {
  448. u32 host_cfg_bitmap = HOST_IF_CFG_RX_FIFO_ENABLE;
  449. if (wl->quirks & WL12XX_QUIRK_BLOCKSIZE_ALIGNMENT)
  450. /* Enable SDIO padding */
  451. host_cfg_bitmap |= HOST_IF_CFG_TX_PAD_TO_SDIO_BLK;
  452. /* Must be before wl1271_acx_init_mem_config() */
  453. ret = wl1271_acx_host_if_cfg_bitmap(wl, host_cfg_bitmap);
  454. if (ret < 0)
  455. goto out;
  456. }
  457. out:
  458. return ret;
  459. }
  460. int wl1271_hw_init(struct wl1271 *wl)
  461. {
  462. struct conf_tx_ac_category *conf_ac;
  463. struct conf_tx_tid *conf_tid;
  464. int ret, i;
  465. bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS);
  466. if (wl->chip.id == CHIP_ID_1283_PG20)
  467. ret = wl128x_cmd_general_parms(wl);
  468. else
  469. ret = wl1271_cmd_general_parms(wl);
  470. if (ret < 0)
  471. return ret;
  472. if (wl->chip.id == CHIP_ID_1283_PG20)
  473. ret = wl128x_cmd_radio_parms(wl);
  474. else
  475. ret = wl1271_cmd_radio_parms(wl);
  476. if (ret < 0)
  477. return ret;
  478. /* Chip-specific init */
  479. ret = wl1271_chip_specific_init(wl);
  480. if (ret < 0)
  481. return ret;
  482. /* Mode specific init */
  483. if (is_ap)
  484. ret = wl1271_ap_hw_init(wl);
  485. else
  486. ret = wl1271_sta_hw_init(wl);
  487. if (ret < 0)
  488. return ret;
  489. /* Bluetooth WLAN coexistence */
  490. ret = wl1271_init_pta(wl);
  491. if (ret < 0)
  492. return ret;
  493. /* Default memory configuration */
  494. ret = wl1271_acx_init_mem_config(wl);
  495. if (ret < 0)
  496. return ret;
  497. /* RX config */
  498. ret = wl12xx_init_rx_config(wl);
  499. if (ret < 0)
  500. goto out_free_memmap;
  501. /* PHY layer config */
  502. ret = wl1271_init_phy_config(wl);
  503. if (ret < 0)
  504. goto out_free_memmap;
  505. ret = wl1271_acx_dco_itrim_params(wl);
  506. if (ret < 0)
  507. goto out_free_memmap;
  508. /* Configure TX patch complete interrupt behavior */
  509. ret = wl1271_acx_tx_config_options(wl);
  510. if (ret < 0)
  511. goto out_free_memmap;
  512. /* RX complete interrupt pacing */
  513. ret = wl1271_acx_init_rx_interrupt(wl);
  514. if (ret < 0)
  515. goto out_free_memmap;
  516. /* Energy detection */
  517. ret = wl1271_init_energy_detection(wl);
  518. if (ret < 0)
  519. goto out_free_memmap;
  520. /* Default fragmentation threshold */
  521. ret = wl1271_acx_frag_threshold(wl, wl->hw->wiphy->frag_threshold);
  522. if (ret < 0)
  523. goto out_free_memmap;
  524. /* Default TID/AC configuration */
  525. BUG_ON(wl->conf.tx.tid_conf_count != wl->conf.tx.ac_conf_count);
  526. for (i = 0; i < wl->conf.tx.tid_conf_count; i++) {
  527. conf_ac = &wl->conf.tx.ac_conf[i];
  528. ret = wl1271_acx_ac_cfg(wl, conf_ac->ac, conf_ac->cw_min,
  529. conf_ac->cw_max, conf_ac->aifsn,
  530. conf_ac->tx_op_limit);
  531. if (ret < 0)
  532. goto out_free_memmap;
  533. conf_tid = &wl->conf.tx.tid_conf[i];
  534. ret = wl1271_acx_tid_cfg(wl, conf_tid->queue_id,
  535. conf_tid->channel_type,
  536. conf_tid->tsid,
  537. conf_tid->ps_scheme,
  538. conf_tid->ack_policy,
  539. conf_tid->apsd_conf[0],
  540. conf_tid->apsd_conf[1]);
  541. if (ret < 0)
  542. goto out_free_memmap;
  543. }
  544. /* Enable data path */
  545. ret = wl1271_cmd_data_path(wl, 1);
  546. if (ret < 0)
  547. goto out_free_memmap;
  548. /* Configure HW encryption */
  549. ret = wl1271_acx_feature_cfg(wl);
  550. if (ret < 0)
  551. goto out_free_memmap;
  552. /* configure PM */
  553. ret = wl1271_acx_pm_config(wl);
  554. if (ret < 0)
  555. goto out_free_memmap;
  556. /* Mode specific init - post mem init */
  557. if (is_ap)
  558. ret = wl1271_ap_hw_init_post_mem(wl);
  559. else
  560. ret = wl1271_sta_hw_init_post_mem(wl);
  561. if (ret < 0)
  562. goto out_free_memmap;
  563. ret = wl12xx_acx_set_rate_mgmt_params(wl);
  564. if (ret < 0)
  565. goto out_free_memmap;
  566. /* Configure initiator BA sessions policies */
  567. ret = wl1271_set_ba_policies(wl);
  568. if (ret < 0)
  569. goto out_free_memmap;
  570. /* configure hangover */
  571. ret = wl12xx_acx_config_hangover(wl);
  572. if (ret < 0)
  573. goto out_free_memmap;
  574. return 0;
  575. out_free_memmap:
  576. kfree(wl->target_mem_map);
  577. wl->target_mem_map = NULL;
  578. return ret;
  579. }