acx.c 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336
  1. /*
  2. * This file is part of wl1271
  3. *
  4. * Copyright (C) 2008-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 "acx.h"
  24. #include <linux/module.h>
  25. #include <linux/platform_device.h>
  26. #include <linux/crc7.h>
  27. #include <linux/spi/spi.h>
  28. #include <linux/slab.h>
  29. #include "wl12xx.h"
  30. #include "wl12xx_80211.h"
  31. #include "reg.h"
  32. #include "ps.h"
  33. int wl1271_acx_wake_up_conditions(struct wl1271 *wl)
  34. {
  35. struct acx_wake_up_condition *wake_up;
  36. int ret;
  37. wl1271_debug(DEBUG_ACX, "acx wake up conditions");
  38. wake_up = kzalloc(sizeof(*wake_up), GFP_KERNEL);
  39. if (!wake_up) {
  40. ret = -ENOMEM;
  41. goto out;
  42. }
  43. wake_up->wake_up_event = wl->conf.conn.wake_up_event;
  44. wake_up->listen_interval = wl->conf.conn.listen_interval;
  45. ret = wl1271_cmd_configure(wl, ACX_WAKE_UP_CONDITIONS,
  46. wake_up, sizeof(*wake_up));
  47. if (ret < 0) {
  48. wl1271_warning("could not set wake up conditions: %d", ret);
  49. goto out;
  50. }
  51. out:
  52. kfree(wake_up);
  53. return ret;
  54. }
  55. int wl1271_acx_sleep_auth(struct wl1271 *wl, u8 sleep_auth)
  56. {
  57. struct acx_sleep_auth *auth;
  58. int ret;
  59. wl1271_debug(DEBUG_ACX, "acx sleep auth");
  60. auth = kzalloc(sizeof(*auth), GFP_KERNEL);
  61. if (!auth) {
  62. ret = -ENOMEM;
  63. goto out;
  64. }
  65. auth->sleep_auth = sleep_auth;
  66. ret = wl1271_cmd_configure(wl, ACX_SLEEP_AUTH, auth, sizeof(*auth));
  67. if (ret < 0)
  68. return ret;
  69. out:
  70. kfree(auth);
  71. return ret;
  72. }
  73. int wl1271_acx_tx_power(struct wl1271 *wl, int power)
  74. {
  75. struct acx_current_tx_power *acx;
  76. int ret;
  77. wl1271_debug(DEBUG_ACX, "acx dot11_cur_tx_pwr");
  78. if (power < 0 || power > 25)
  79. return -EINVAL;
  80. acx = kzalloc(sizeof(*acx), GFP_KERNEL);
  81. if (!acx) {
  82. ret = -ENOMEM;
  83. goto out;
  84. }
  85. acx->current_tx_power = power * 10;
  86. ret = wl1271_cmd_configure(wl, DOT11_CUR_TX_PWR, acx, sizeof(*acx));
  87. if (ret < 0) {
  88. wl1271_warning("configure of tx power failed: %d", ret);
  89. goto out;
  90. }
  91. out:
  92. kfree(acx);
  93. return ret;
  94. }
  95. int wl1271_acx_feature_cfg(struct wl1271 *wl)
  96. {
  97. struct acx_feature_config *feature;
  98. int ret;
  99. wl1271_debug(DEBUG_ACX, "acx feature cfg");
  100. feature = kzalloc(sizeof(*feature), GFP_KERNEL);
  101. if (!feature) {
  102. ret = -ENOMEM;
  103. goto out;
  104. }
  105. /* DF_ENCRYPTION_DISABLE and DF_SNIFF_MODE_ENABLE are disabled */
  106. feature->data_flow_options = 0;
  107. feature->options = 0;
  108. ret = wl1271_cmd_configure(wl, ACX_FEATURE_CFG,
  109. feature, sizeof(*feature));
  110. if (ret < 0) {
  111. wl1271_error("Couldnt set HW encryption");
  112. goto out;
  113. }
  114. out:
  115. kfree(feature);
  116. return ret;
  117. }
  118. int wl1271_acx_mem_map(struct wl1271 *wl, struct acx_header *mem_map,
  119. size_t len)
  120. {
  121. int ret;
  122. wl1271_debug(DEBUG_ACX, "acx mem map");
  123. ret = wl1271_cmd_interrogate(wl, ACX_MEM_MAP, mem_map, len);
  124. if (ret < 0)
  125. return ret;
  126. return 0;
  127. }
  128. int wl1271_acx_rx_msdu_life_time(struct wl1271 *wl)
  129. {
  130. struct acx_rx_msdu_lifetime *acx;
  131. int ret;
  132. wl1271_debug(DEBUG_ACX, "acx rx msdu life time");
  133. acx = kzalloc(sizeof(*acx), GFP_KERNEL);
  134. if (!acx) {
  135. ret = -ENOMEM;
  136. goto out;
  137. }
  138. acx->lifetime = cpu_to_le32(wl->conf.rx.rx_msdu_life_time);
  139. ret = wl1271_cmd_configure(wl, DOT11_RX_MSDU_LIFE_TIME,
  140. acx, sizeof(*acx));
  141. if (ret < 0) {
  142. wl1271_warning("failed to set rx msdu life time: %d", ret);
  143. goto out;
  144. }
  145. out:
  146. kfree(acx);
  147. return ret;
  148. }
  149. int wl1271_acx_rx_config(struct wl1271 *wl, u32 config, u32 filter)
  150. {
  151. struct acx_rx_config *rx_config;
  152. int ret;
  153. wl1271_debug(DEBUG_ACX, "acx rx config");
  154. rx_config = kzalloc(sizeof(*rx_config), GFP_KERNEL);
  155. if (!rx_config) {
  156. ret = -ENOMEM;
  157. goto out;
  158. }
  159. rx_config->config_options = cpu_to_le32(config);
  160. rx_config->filter_options = cpu_to_le32(filter);
  161. ret = wl1271_cmd_configure(wl, ACX_RX_CFG,
  162. rx_config, sizeof(*rx_config));
  163. if (ret < 0) {
  164. wl1271_warning("failed to set rx config: %d", ret);
  165. goto out;
  166. }
  167. out:
  168. kfree(rx_config);
  169. return ret;
  170. }
  171. int wl1271_acx_pd_threshold(struct wl1271 *wl)
  172. {
  173. struct acx_packet_detection *pd;
  174. int ret;
  175. wl1271_debug(DEBUG_ACX, "acx data pd threshold");
  176. pd = kzalloc(sizeof(*pd), GFP_KERNEL);
  177. if (!pd) {
  178. ret = -ENOMEM;
  179. goto out;
  180. }
  181. pd->threshold = cpu_to_le32(wl->conf.rx.packet_detection_threshold);
  182. ret = wl1271_cmd_configure(wl, ACX_PD_THRESHOLD, pd, sizeof(*pd));
  183. if (ret < 0) {
  184. wl1271_warning("failed to set pd threshold: %d", ret);
  185. goto out;
  186. }
  187. out:
  188. kfree(pd);
  189. return ret;
  190. }
  191. int wl1271_acx_slot(struct wl1271 *wl, enum acx_slot_type slot_time)
  192. {
  193. struct acx_slot *slot;
  194. int ret;
  195. wl1271_debug(DEBUG_ACX, "acx slot");
  196. slot = kzalloc(sizeof(*slot), GFP_KERNEL);
  197. if (!slot) {
  198. ret = -ENOMEM;
  199. goto out;
  200. }
  201. slot->wone_index = STATION_WONE_INDEX;
  202. slot->slot_time = slot_time;
  203. ret = wl1271_cmd_configure(wl, ACX_SLOT, slot, sizeof(*slot));
  204. if (ret < 0) {
  205. wl1271_warning("failed to set slot time: %d", ret);
  206. goto out;
  207. }
  208. out:
  209. kfree(slot);
  210. return ret;
  211. }
  212. int wl1271_acx_group_address_tbl(struct wl1271 *wl, bool enable,
  213. void *mc_list, u32 mc_list_len)
  214. {
  215. struct acx_dot11_grp_addr_tbl *acx;
  216. int ret;
  217. wl1271_debug(DEBUG_ACX, "acx group address tbl");
  218. acx = kzalloc(sizeof(*acx), GFP_KERNEL);
  219. if (!acx) {
  220. ret = -ENOMEM;
  221. goto out;
  222. }
  223. /* MAC filtering */
  224. acx->enabled = enable;
  225. acx->num_groups = mc_list_len;
  226. memcpy(acx->mac_table, mc_list, mc_list_len * ETH_ALEN);
  227. ret = wl1271_cmd_configure(wl, DOT11_GROUP_ADDRESS_TBL,
  228. acx, sizeof(*acx));
  229. if (ret < 0) {
  230. wl1271_warning("failed to set group addr table: %d", ret);
  231. goto out;
  232. }
  233. out:
  234. kfree(acx);
  235. return ret;
  236. }
  237. int wl1271_acx_service_period_timeout(struct wl1271 *wl)
  238. {
  239. struct acx_rx_timeout *rx_timeout;
  240. int ret;
  241. rx_timeout = kzalloc(sizeof(*rx_timeout), GFP_KERNEL);
  242. if (!rx_timeout) {
  243. ret = -ENOMEM;
  244. goto out;
  245. }
  246. wl1271_debug(DEBUG_ACX, "acx service period timeout");
  247. rx_timeout->ps_poll_timeout = cpu_to_le16(wl->conf.rx.ps_poll_timeout);
  248. rx_timeout->upsd_timeout = cpu_to_le16(wl->conf.rx.upsd_timeout);
  249. ret = wl1271_cmd_configure(wl, ACX_SERVICE_PERIOD_TIMEOUT,
  250. rx_timeout, sizeof(*rx_timeout));
  251. if (ret < 0) {
  252. wl1271_warning("failed to set service period timeout: %d",
  253. ret);
  254. goto out;
  255. }
  256. out:
  257. kfree(rx_timeout);
  258. return ret;
  259. }
  260. int wl1271_acx_rts_threshold(struct wl1271 *wl, u16 rts_threshold)
  261. {
  262. struct acx_rts_threshold *rts;
  263. int ret;
  264. wl1271_debug(DEBUG_ACX, "acx rts threshold");
  265. rts = kzalloc(sizeof(*rts), GFP_KERNEL);
  266. if (!rts) {
  267. ret = -ENOMEM;
  268. goto out;
  269. }
  270. rts->threshold = cpu_to_le16(rts_threshold);
  271. ret = wl1271_cmd_configure(wl, DOT11_RTS_THRESHOLD, rts, sizeof(*rts));
  272. if (ret < 0) {
  273. wl1271_warning("failed to set rts threshold: %d", ret);
  274. goto out;
  275. }
  276. out:
  277. kfree(rts);
  278. return ret;
  279. }
  280. int wl1271_acx_dco_itrim_params(struct wl1271 *wl)
  281. {
  282. struct acx_dco_itrim_params *dco;
  283. struct conf_itrim_settings *c = &wl->conf.itrim;
  284. int ret;
  285. wl1271_debug(DEBUG_ACX, "acx dco itrim parameters");
  286. dco = kzalloc(sizeof(*dco), GFP_KERNEL);
  287. if (!dco) {
  288. ret = -ENOMEM;
  289. goto out;
  290. }
  291. dco->enable = c->enable;
  292. dco->timeout = cpu_to_le32(c->timeout);
  293. ret = wl1271_cmd_configure(wl, ACX_SET_DCO_ITRIM_PARAMS,
  294. dco, sizeof(*dco));
  295. if (ret < 0) {
  296. wl1271_warning("failed to set dco itrim parameters: %d", ret);
  297. goto out;
  298. }
  299. out:
  300. kfree(dco);
  301. return ret;
  302. }
  303. int wl1271_acx_beacon_filter_opt(struct wl1271 *wl, bool enable_filter)
  304. {
  305. struct acx_beacon_filter_option *beacon_filter = NULL;
  306. int ret = 0;
  307. wl1271_debug(DEBUG_ACX, "acx beacon filter opt");
  308. if (enable_filter &&
  309. wl->conf.conn.bcn_filt_mode == CONF_BCN_FILT_MODE_DISABLED)
  310. goto out;
  311. beacon_filter = kzalloc(sizeof(*beacon_filter), GFP_KERNEL);
  312. if (!beacon_filter) {
  313. ret = -ENOMEM;
  314. goto out;
  315. }
  316. beacon_filter->enable = enable_filter;
  317. /*
  318. * When set to zero, and the filter is enabled, beacons
  319. * without the unicast TIM bit set are dropped.
  320. */
  321. beacon_filter->max_num_beacons = 0;
  322. ret = wl1271_cmd_configure(wl, ACX_BEACON_FILTER_OPT,
  323. beacon_filter, sizeof(*beacon_filter));
  324. if (ret < 0) {
  325. wl1271_warning("failed to set beacon filter opt: %d", ret);
  326. goto out;
  327. }
  328. out:
  329. kfree(beacon_filter);
  330. return ret;
  331. }
  332. int wl1271_acx_beacon_filter_table(struct wl1271 *wl)
  333. {
  334. struct acx_beacon_filter_ie_table *ie_table;
  335. int i, idx = 0;
  336. int ret;
  337. bool vendor_spec = false;
  338. wl1271_debug(DEBUG_ACX, "acx beacon filter table");
  339. ie_table = kzalloc(sizeof(*ie_table), GFP_KERNEL);
  340. if (!ie_table) {
  341. ret = -ENOMEM;
  342. goto out;
  343. }
  344. /* configure default beacon pass-through rules */
  345. ie_table->num_ie = 0;
  346. for (i = 0; i < wl->conf.conn.bcn_filt_ie_count; i++) {
  347. struct conf_bcn_filt_rule *r = &(wl->conf.conn.bcn_filt_ie[i]);
  348. ie_table->table[idx++] = r->ie;
  349. ie_table->table[idx++] = r->rule;
  350. if (r->ie == WLAN_EID_VENDOR_SPECIFIC) {
  351. /* only one vendor specific ie allowed */
  352. if (vendor_spec)
  353. continue;
  354. /* for vendor specific rules configure the
  355. additional fields */
  356. memcpy(&(ie_table->table[idx]), r->oui,
  357. CONF_BCN_IE_OUI_LEN);
  358. idx += CONF_BCN_IE_OUI_LEN;
  359. ie_table->table[idx++] = r->type;
  360. memcpy(&(ie_table->table[idx]), r->version,
  361. CONF_BCN_IE_VER_LEN);
  362. idx += CONF_BCN_IE_VER_LEN;
  363. vendor_spec = true;
  364. }
  365. ie_table->num_ie++;
  366. }
  367. ret = wl1271_cmd_configure(wl, ACX_BEACON_FILTER_TABLE,
  368. ie_table, sizeof(*ie_table));
  369. if (ret < 0) {
  370. wl1271_warning("failed to set beacon filter table: %d", ret);
  371. goto out;
  372. }
  373. out:
  374. kfree(ie_table);
  375. return ret;
  376. }
  377. #define ACX_CONN_MONIT_DISABLE_VALUE 0xffffffff
  378. int wl1271_acx_conn_monit_params(struct wl1271 *wl, bool enable)
  379. {
  380. struct acx_conn_monit_params *acx;
  381. u32 threshold = ACX_CONN_MONIT_DISABLE_VALUE;
  382. u32 timeout = ACX_CONN_MONIT_DISABLE_VALUE;
  383. int ret;
  384. wl1271_debug(DEBUG_ACX, "acx connection monitor parameters: %s",
  385. enable ? "enabled" : "disabled");
  386. acx = kzalloc(sizeof(*acx), GFP_KERNEL);
  387. if (!acx) {
  388. ret = -ENOMEM;
  389. goto out;
  390. }
  391. if (enable) {
  392. threshold = wl->conf.conn.synch_fail_thold;
  393. timeout = wl->conf.conn.bss_lose_timeout;
  394. }
  395. acx->synch_fail_thold = cpu_to_le32(threshold);
  396. acx->bss_lose_timeout = cpu_to_le32(timeout);
  397. ret = wl1271_cmd_configure(wl, ACX_CONN_MONIT_PARAMS,
  398. acx, sizeof(*acx));
  399. if (ret < 0) {
  400. wl1271_warning("failed to set connection monitor "
  401. "parameters: %d", ret);
  402. goto out;
  403. }
  404. out:
  405. kfree(acx);
  406. return ret;
  407. }
  408. int wl1271_acx_sg_enable(struct wl1271 *wl, bool enable)
  409. {
  410. struct acx_bt_wlan_coex *pta;
  411. int ret;
  412. wl1271_debug(DEBUG_ACX, "acx sg enable");
  413. pta = kzalloc(sizeof(*pta), GFP_KERNEL);
  414. if (!pta) {
  415. ret = -ENOMEM;
  416. goto out;
  417. }
  418. if (enable)
  419. pta->enable = wl->conf.sg.state;
  420. else
  421. pta->enable = CONF_SG_DISABLE;
  422. ret = wl1271_cmd_configure(wl, ACX_SG_ENABLE, pta, sizeof(*pta));
  423. if (ret < 0) {
  424. wl1271_warning("failed to set softgemini enable: %d", ret);
  425. goto out;
  426. }
  427. out:
  428. kfree(pta);
  429. return ret;
  430. }
  431. int wl1271_acx_sg_cfg(struct wl1271 *wl)
  432. {
  433. struct acx_bt_wlan_coex_param *param;
  434. struct conf_sg_settings *c = &wl->conf.sg;
  435. int i, ret;
  436. wl1271_debug(DEBUG_ACX, "acx sg cfg");
  437. param = kzalloc(sizeof(*param), GFP_KERNEL);
  438. if (!param) {
  439. ret = -ENOMEM;
  440. goto out;
  441. }
  442. /* BT-WLAN coext parameters */
  443. for (i = 0; i < CONF_SG_PARAMS_MAX; i++)
  444. param->params[i] = cpu_to_le32(c->params[i]);
  445. param->param_idx = CONF_SG_PARAMS_ALL;
  446. ret = wl1271_cmd_configure(wl, ACX_SG_CFG, param, sizeof(*param));
  447. if (ret < 0) {
  448. wl1271_warning("failed to set sg config: %d", ret);
  449. goto out;
  450. }
  451. out:
  452. kfree(param);
  453. return ret;
  454. }
  455. int wl1271_acx_cca_threshold(struct wl1271 *wl)
  456. {
  457. struct acx_energy_detection *detection;
  458. int ret;
  459. wl1271_debug(DEBUG_ACX, "acx cca threshold");
  460. detection = kzalloc(sizeof(*detection), GFP_KERNEL);
  461. if (!detection) {
  462. ret = -ENOMEM;
  463. goto out;
  464. }
  465. detection->rx_cca_threshold = cpu_to_le16(wl->conf.rx.rx_cca_threshold);
  466. detection->tx_energy_detection = wl->conf.tx.tx_energy_detection;
  467. ret = wl1271_cmd_configure(wl, ACX_CCA_THRESHOLD,
  468. detection, sizeof(*detection));
  469. if (ret < 0) {
  470. wl1271_warning("failed to set cca threshold: %d", ret);
  471. return ret;
  472. }
  473. out:
  474. kfree(detection);
  475. return ret;
  476. }
  477. int wl1271_acx_bcn_dtim_options(struct wl1271 *wl)
  478. {
  479. struct acx_beacon_broadcast *bb;
  480. int ret;
  481. wl1271_debug(DEBUG_ACX, "acx bcn dtim options");
  482. bb = kzalloc(sizeof(*bb), GFP_KERNEL);
  483. if (!bb) {
  484. ret = -ENOMEM;
  485. goto out;
  486. }
  487. bb->beacon_rx_timeout = cpu_to_le16(wl->conf.conn.beacon_rx_timeout);
  488. bb->broadcast_timeout = cpu_to_le16(wl->conf.conn.broadcast_timeout);
  489. bb->rx_broadcast_in_ps = wl->conf.conn.rx_broadcast_in_ps;
  490. bb->ps_poll_threshold = wl->conf.conn.ps_poll_threshold;
  491. ret = wl1271_cmd_configure(wl, ACX_BCN_DTIM_OPTIONS, bb, sizeof(*bb));
  492. if (ret < 0) {
  493. wl1271_warning("failed to set rx config: %d", ret);
  494. goto out;
  495. }
  496. out:
  497. kfree(bb);
  498. return ret;
  499. }
  500. int wl1271_acx_aid(struct wl1271 *wl, u16 aid)
  501. {
  502. struct acx_aid *acx_aid;
  503. int ret;
  504. wl1271_debug(DEBUG_ACX, "acx aid");
  505. acx_aid = kzalloc(sizeof(*acx_aid), GFP_KERNEL);
  506. if (!acx_aid) {
  507. ret = -ENOMEM;
  508. goto out;
  509. }
  510. acx_aid->aid = cpu_to_le16(aid);
  511. ret = wl1271_cmd_configure(wl, ACX_AID, acx_aid, sizeof(*acx_aid));
  512. if (ret < 0) {
  513. wl1271_warning("failed to set aid: %d", ret);
  514. goto out;
  515. }
  516. out:
  517. kfree(acx_aid);
  518. return ret;
  519. }
  520. int wl1271_acx_event_mbox_mask(struct wl1271 *wl, u32 event_mask)
  521. {
  522. struct acx_event_mask *mask;
  523. int ret;
  524. wl1271_debug(DEBUG_ACX, "acx event mbox mask");
  525. mask = kzalloc(sizeof(*mask), GFP_KERNEL);
  526. if (!mask) {
  527. ret = -ENOMEM;
  528. goto out;
  529. }
  530. /* high event mask is unused */
  531. mask->high_event_mask = cpu_to_le32(0xffffffff);
  532. mask->event_mask = cpu_to_le32(event_mask);
  533. ret = wl1271_cmd_configure(wl, ACX_EVENT_MBOX_MASK,
  534. mask, sizeof(*mask));
  535. if (ret < 0) {
  536. wl1271_warning("failed to set acx_event_mbox_mask: %d", ret);
  537. goto out;
  538. }
  539. out:
  540. kfree(mask);
  541. return ret;
  542. }
  543. int wl1271_acx_set_preamble(struct wl1271 *wl, enum acx_preamble_type preamble)
  544. {
  545. struct acx_preamble *acx;
  546. int ret;
  547. wl1271_debug(DEBUG_ACX, "acx_set_preamble");
  548. acx = kzalloc(sizeof(*acx), GFP_KERNEL);
  549. if (!acx) {
  550. ret = -ENOMEM;
  551. goto out;
  552. }
  553. acx->preamble = preamble;
  554. ret = wl1271_cmd_configure(wl, ACX_PREAMBLE_TYPE, acx, sizeof(*acx));
  555. if (ret < 0) {
  556. wl1271_warning("Setting of preamble failed: %d", ret);
  557. goto out;
  558. }
  559. out:
  560. kfree(acx);
  561. return ret;
  562. }
  563. int wl1271_acx_cts_protect(struct wl1271 *wl,
  564. enum acx_ctsprotect_type ctsprotect)
  565. {
  566. struct acx_ctsprotect *acx;
  567. int ret;
  568. wl1271_debug(DEBUG_ACX, "acx_set_ctsprotect");
  569. acx = kzalloc(sizeof(*acx), GFP_KERNEL);
  570. if (!acx) {
  571. ret = -ENOMEM;
  572. goto out;
  573. }
  574. acx->ctsprotect = ctsprotect;
  575. ret = wl1271_cmd_configure(wl, ACX_CTS_PROTECTION, acx, sizeof(*acx));
  576. if (ret < 0) {
  577. wl1271_warning("Setting of ctsprotect failed: %d", ret);
  578. goto out;
  579. }
  580. out:
  581. kfree(acx);
  582. return ret;
  583. }
  584. int wl1271_acx_statistics(struct wl1271 *wl, struct acx_statistics *stats)
  585. {
  586. int ret;
  587. wl1271_debug(DEBUG_ACX, "acx statistics");
  588. ret = wl1271_cmd_interrogate(wl, ACX_STATISTICS, stats,
  589. sizeof(*stats));
  590. if (ret < 0) {
  591. wl1271_warning("acx statistics failed: %d", ret);
  592. return -ENOMEM;
  593. }
  594. return 0;
  595. }
  596. int wl1271_acx_rate_policies(struct wl1271 *wl)
  597. {
  598. struct acx_rate_policy *acx;
  599. struct conf_tx_rate_class *c = &wl->conf.tx.rc_conf;
  600. int idx = 0;
  601. int ret = 0;
  602. wl1271_debug(DEBUG_ACX, "acx rate policies");
  603. acx = kzalloc(sizeof(*acx), GFP_KERNEL);
  604. if (!acx) {
  605. ret = -ENOMEM;
  606. goto out;
  607. }
  608. /* configure one basic rate class */
  609. idx = ACX_TX_BASIC_RATE;
  610. acx->rate_class[idx].enabled_rates = cpu_to_le32(wl->basic_rate);
  611. acx->rate_class[idx].short_retry_limit = c->short_retry_limit;
  612. acx->rate_class[idx].long_retry_limit = c->long_retry_limit;
  613. acx->rate_class[idx].aflags = c->aflags;
  614. /* configure one AP supported rate class */
  615. idx = ACX_TX_AP_FULL_RATE;
  616. acx->rate_class[idx].enabled_rates = cpu_to_le32(wl->rate_set);
  617. acx->rate_class[idx].short_retry_limit = c->short_retry_limit;
  618. acx->rate_class[idx].long_retry_limit = c->long_retry_limit;
  619. acx->rate_class[idx].aflags = c->aflags;
  620. acx->rate_class_cnt = cpu_to_le32(ACX_TX_RATE_POLICY_CNT);
  621. ret = wl1271_cmd_configure(wl, ACX_RATE_POLICY, acx, sizeof(*acx));
  622. if (ret < 0) {
  623. wl1271_warning("Setting of rate policies failed: %d", ret);
  624. goto out;
  625. }
  626. out:
  627. kfree(acx);
  628. return ret;
  629. }
  630. int wl1271_acx_ac_cfg(struct wl1271 *wl, u8 ac, u8 cw_min, u16 cw_max,
  631. u8 aifsn, u16 txop)
  632. {
  633. struct acx_ac_cfg *acx;
  634. int ret = 0;
  635. wl1271_debug(DEBUG_ACX, "acx ac cfg %d cw_ming %d cw_max %d "
  636. "aifs %d txop %d", ac, cw_min, cw_max, aifsn, txop);
  637. acx = kzalloc(sizeof(*acx), GFP_KERNEL);
  638. if (!acx) {
  639. ret = -ENOMEM;
  640. goto out;
  641. }
  642. acx->ac = ac;
  643. acx->cw_min = cw_min;
  644. acx->cw_max = cpu_to_le16(cw_max);
  645. acx->aifsn = aifsn;
  646. acx->tx_op_limit = cpu_to_le16(txop);
  647. ret = wl1271_cmd_configure(wl, ACX_AC_CFG, acx, sizeof(*acx));
  648. if (ret < 0) {
  649. wl1271_warning("acx ac cfg failed: %d", ret);
  650. goto out;
  651. }
  652. out:
  653. kfree(acx);
  654. return ret;
  655. }
  656. int wl1271_acx_tid_cfg(struct wl1271 *wl, u8 queue_id, u8 channel_type,
  657. u8 tsid, u8 ps_scheme, u8 ack_policy,
  658. u32 apsd_conf0, u32 apsd_conf1)
  659. {
  660. struct acx_tid_config *acx;
  661. int ret = 0;
  662. wl1271_debug(DEBUG_ACX, "acx tid config");
  663. acx = kzalloc(sizeof(*acx), GFP_KERNEL);
  664. if (!acx) {
  665. ret = -ENOMEM;
  666. goto out;
  667. }
  668. acx->queue_id = queue_id;
  669. acx->channel_type = channel_type;
  670. acx->tsid = tsid;
  671. acx->ps_scheme = ps_scheme;
  672. acx->ack_policy = ack_policy;
  673. acx->apsd_conf[0] = cpu_to_le32(apsd_conf0);
  674. acx->apsd_conf[1] = cpu_to_le32(apsd_conf1);
  675. ret = wl1271_cmd_configure(wl, ACX_TID_CFG, acx, sizeof(*acx));
  676. if (ret < 0) {
  677. wl1271_warning("Setting of tid config failed: %d", ret);
  678. goto out;
  679. }
  680. out:
  681. kfree(acx);
  682. return ret;
  683. }
  684. int wl1271_acx_frag_threshold(struct wl1271 *wl, u16 frag_threshold)
  685. {
  686. struct acx_frag_threshold *acx;
  687. int ret = 0;
  688. wl1271_debug(DEBUG_ACX, "acx frag threshold");
  689. acx = kzalloc(sizeof(*acx), GFP_KERNEL);
  690. if (!acx) {
  691. ret = -ENOMEM;
  692. goto out;
  693. }
  694. acx->frag_threshold = cpu_to_le16(frag_threshold);
  695. ret = wl1271_cmd_configure(wl, ACX_FRAG_CFG, acx, sizeof(*acx));
  696. if (ret < 0) {
  697. wl1271_warning("Setting of frag threshold failed: %d", ret);
  698. goto out;
  699. }
  700. out:
  701. kfree(acx);
  702. return ret;
  703. }
  704. int wl1271_acx_tx_config_options(struct wl1271 *wl)
  705. {
  706. struct acx_tx_config_options *acx;
  707. int ret = 0;
  708. wl1271_debug(DEBUG_ACX, "acx tx config options");
  709. acx = kzalloc(sizeof(*acx), GFP_KERNEL);
  710. if (!acx) {
  711. ret = -ENOMEM;
  712. goto out;
  713. }
  714. acx->tx_compl_timeout = cpu_to_le16(wl->conf.tx.tx_compl_timeout);
  715. acx->tx_compl_threshold = cpu_to_le16(wl->conf.tx.tx_compl_threshold);
  716. ret = wl1271_cmd_configure(wl, ACX_TX_CONFIG_OPT, acx, sizeof(*acx));
  717. if (ret < 0) {
  718. wl1271_warning("Setting of tx options failed: %d", ret);
  719. goto out;
  720. }
  721. out:
  722. kfree(acx);
  723. return ret;
  724. }
  725. int wl1271_acx_mem_cfg(struct wl1271 *wl)
  726. {
  727. struct wl1271_acx_config_memory *mem_conf;
  728. int ret;
  729. wl1271_debug(DEBUG_ACX, "wl1271 mem cfg");
  730. mem_conf = kzalloc(sizeof(*mem_conf), GFP_KERNEL);
  731. if (!mem_conf) {
  732. ret = -ENOMEM;
  733. goto out;
  734. }
  735. /* memory config */
  736. mem_conf->num_stations = DEFAULT_NUM_STATIONS;
  737. mem_conf->rx_mem_block_num = ACX_RX_MEM_BLOCKS;
  738. mem_conf->tx_min_mem_block_num = ACX_TX_MIN_MEM_BLOCKS;
  739. mem_conf->num_ssid_profiles = ACX_NUM_SSID_PROFILES;
  740. mem_conf->total_tx_descriptors = cpu_to_le32(ACX_TX_DESCRIPTORS);
  741. ret = wl1271_cmd_configure(wl, ACX_MEM_CFG, mem_conf,
  742. sizeof(*mem_conf));
  743. if (ret < 0) {
  744. wl1271_warning("wl1271 mem config failed: %d", ret);
  745. goto out;
  746. }
  747. out:
  748. kfree(mem_conf);
  749. return ret;
  750. }
  751. int wl1271_acx_init_mem_config(struct wl1271 *wl)
  752. {
  753. int ret;
  754. ret = wl1271_acx_mem_cfg(wl);
  755. if (ret < 0)
  756. return ret;
  757. wl->target_mem_map = kzalloc(sizeof(struct wl1271_acx_mem_map),
  758. GFP_KERNEL);
  759. if (!wl->target_mem_map) {
  760. wl1271_error("couldn't allocate target memory map");
  761. return -ENOMEM;
  762. }
  763. /* we now ask for the firmware built memory map */
  764. ret = wl1271_acx_mem_map(wl, (void *)wl->target_mem_map,
  765. sizeof(struct wl1271_acx_mem_map));
  766. if (ret < 0) {
  767. wl1271_error("couldn't retrieve firmware memory map");
  768. kfree(wl->target_mem_map);
  769. wl->target_mem_map = NULL;
  770. return ret;
  771. }
  772. /* initialize TX block book keeping */
  773. wl->tx_blocks_available =
  774. le32_to_cpu(wl->target_mem_map->num_tx_mem_blocks);
  775. wl1271_debug(DEBUG_TX, "available tx blocks: %d",
  776. wl->tx_blocks_available);
  777. return 0;
  778. }
  779. int wl1271_acx_init_rx_interrupt(struct wl1271 *wl)
  780. {
  781. struct wl1271_acx_rx_config_opt *rx_conf;
  782. int ret;
  783. wl1271_debug(DEBUG_ACX, "wl1271 rx interrupt config");
  784. rx_conf = kzalloc(sizeof(*rx_conf), GFP_KERNEL);
  785. if (!rx_conf) {
  786. ret = -ENOMEM;
  787. goto out;
  788. }
  789. rx_conf->threshold = cpu_to_le16(wl->conf.rx.irq_pkt_threshold);
  790. rx_conf->timeout = cpu_to_le16(wl->conf.rx.irq_timeout);
  791. rx_conf->mblk_threshold = cpu_to_le16(wl->conf.rx.irq_blk_threshold);
  792. rx_conf->queue_type = wl->conf.rx.queue_type;
  793. ret = wl1271_cmd_configure(wl, ACX_RX_CONFIG_OPT, rx_conf,
  794. sizeof(*rx_conf));
  795. if (ret < 0) {
  796. wl1271_warning("wl1271 rx config opt failed: %d", ret);
  797. goto out;
  798. }
  799. out:
  800. kfree(rx_conf);
  801. return ret;
  802. }
  803. int wl1271_acx_bet_enable(struct wl1271 *wl, bool enable)
  804. {
  805. struct wl1271_acx_bet_enable *acx = NULL;
  806. int ret = 0;
  807. wl1271_debug(DEBUG_ACX, "acx bet enable");
  808. if (enable && wl->conf.conn.bet_enable == CONF_BET_MODE_DISABLE)
  809. goto out;
  810. acx = kzalloc(sizeof(*acx), GFP_KERNEL);
  811. if (!acx) {
  812. ret = -ENOMEM;
  813. goto out;
  814. }
  815. acx->enable = enable ? CONF_BET_MODE_ENABLE : CONF_BET_MODE_DISABLE;
  816. acx->max_consecutive = wl->conf.conn.bet_max_consecutive;
  817. ret = wl1271_cmd_configure(wl, ACX_BET_ENABLE, acx, sizeof(*acx));
  818. if (ret < 0) {
  819. wl1271_warning("acx bet enable failed: %d", ret);
  820. goto out;
  821. }
  822. out:
  823. kfree(acx);
  824. return ret;
  825. }
  826. int wl1271_acx_arp_ip_filter(struct wl1271 *wl, bool enable, __be32 address)
  827. {
  828. struct wl1271_acx_arp_filter *acx;
  829. int ret;
  830. wl1271_debug(DEBUG_ACX, "acx arp ip filter, enable: %d", enable);
  831. acx = kzalloc(sizeof(*acx), GFP_KERNEL);
  832. if (!acx) {
  833. ret = -ENOMEM;
  834. goto out;
  835. }
  836. acx->version = ACX_IPV4_VERSION;
  837. acx->enable = enable;
  838. if (enable == true)
  839. memcpy(acx->address, &address, ACX_IPV4_ADDR_SIZE);
  840. ret = wl1271_cmd_configure(wl, ACX_ARP_IP_FILTER,
  841. acx, sizeof(*acx));
  842. if (ret < 0) {
  843. wl1271_warning("failed to set arp ip filter: %d", ret);
  844. goto out;
  845. }
  846. out:
  847. kfree(acx);
  848. return ret;
  849. }
  850. int wl1271_acx_pm_config(struct wl1271 *wl)
  851. {
  852. struct wl1271_acx_pm_config *acx = NULL;
  853. struct conf_pm_config_settings *c = &wl->conf.pm_config;
  854. int ret = 0;
  855. wl1271_debug(DEBUG_ACX, "acx pm config");
  856. acx = kzalloc(sizeof(*acx), GFP_KERNEL);
  857. if (!acx) {
  858. ret = -ENOMEM;
  859. goto out;
  860. }
  861. acx->host_clk_settling_time = cpu_to_le32(c->host_clk_settling_time);
  862. acx->host_fast_wakeup_support = c->host_fast_wakeup_support;
  863. ret = wl1271_cmd_configure(wl, ACX_PM_CONFIG, acx, sizeof(*acx));
  864. if (ret < 0) {
  865. wl1271_warning("acx pm config failed: %d", ret);
  866. goto out;
  867. }
  868. out:
  869. kfree(acx);
  870. return ret;
  871. }
  872. int wl1271_acx_keep_alive_mode(struct wl1271 *wl, bool enable)
  873. {
  874. struct wl1271_acx_keep_alive_mode *acx = NULL;
  875. int ret = 0;
  876. wl1271_debug(DEBUG_ACX, "acx keep alive mode: %d", enable);
  877. acx = kzalloc(sizeof(*acx), GFP_KERNEL);
  878. if (!acx) {
  879. ret = -ENOMEM;
  880. goto out;
  881. }
  882. acx->enabled = enable;
  883. ret = wl1271_cmd_configure(wl, ACX_KEEP_ALIVE_MODE, acx, sizeof(*acx));
  884. if (ret < 0) {
  885. wl1271_warning("acx keep alive mode failed: %d", ret);
  886. goto out;
  887. }
  888. out:
  889. kfree(acx);
  890. return ret;
  891. }
  892. int wl1271_acx_keep_alive_config(struct wl1271 *wl, u8 index, u8 tpl_valid)
  893. {
  894. struct wl1271_acx_keep_alive_config *acx = NULL;
  895. int ret = 0;
  896. wl1271_debug(DEBUG_ACX, "acx keep alive config");
  897. acx = kzalloc(sizeof(*acx), GFP_KERNEL);
  898. if (!acx) {
  899. ret = -ENOMEM;
  900. goto out;
  901. }
  902. acx->period = cpu_to_le32(wl->conf.conn.keep_alive_interval);
  903. acx->index = index;
  904. acx->tpl_validation = tpl_valid;
  905. acx->trigger = ACX_KEEP_ALIVE_NO_TX;
  906. ret = wl1271_cmd_configure(wl, ACX_SET_KEEP_ALIVE_CONFIG,
  907. acx, sizeof(*acx));
  908. if (ret < 0) {
  909. wl1271_warning("acx keep alive config failed: %d", ret);
  910. goto out;
  911. }
  912. out:
  913. kfree(acx);
  914. return ret;
  915. }
  916. int wl1271_acx_rssi_snr_trigger(struct wl1271 *wl, bool enable,
  917. s16 thold, u8 hyst)
  918. {
  919. struct wl1271_acx_rssi_snr_trigger *acx = NULL;
  920. int ret = 0;
  921. wl1271_debug(DEBUG_ACX, "acx rssi snr trigger");
  922. acx = kzalloc(sizeof(*acx), GFP_KERNEL);
  923. if (!acx) {
  924. ret = -ENOMEM;
  925. goto out;
  926. }
  927. wl->last_rssi_event = -1;
  928. acx->pacing = cpu_to_le16(wl->conf.roam_trigger.trigger_pacing);
  929. acx->metric = WL1271_ACX_TRIG_METRIC_RSSI_BEACON;
  930. acx->type = WL1271_ACX_TRIG_TYPE_EDGE;
  931. if (enable)
  932. acx->enable = WL1271_ACX_TRIG_ENABLE;
  933. else
  934. acx->enable = WL1271_ACX_TRIG_DISABLE;
  935. acx->index = WL1271_ACX_TRIG_IDX_RSSI;
  936. acx->dir = WL1271_ACX_TRIG_DIR_BIDIR;
  937. acx->threshold = cpu_to_le16(thold);
  938. acx->hysteresis = hyst;
  939. ret = wl1271_cmd_configure(wl, ACX_RSSI_SNR_TRIGGER, acx, sizeof(*acx));
  940. if (ret < 0) {
  941. wl1271_warning("acx rssi snr trigger setting failed: %d", ret);
  942. goto out;
  943. }
  944. out:
  945. kfree(acx);
  946. return ret;
  947. }
  948. int wl1271_acx_rssi_snr_avg_weights(struct wl1271 *wl)
  949. {
  950. struct wl1271_acx_rssi_snr_avg_weights *acx = NULL;
  951. struct conf_roam_trigger_settings *c = &wl->conf.roam_trigger;
  952. int ret = 0;
  953. wl1271_debug(DEBUG_ACX, "acx rssi snr avg weights");
  954. acx = kzalloc(sizeof(*acx), GFP_KERNEL);
  955. if (!acx) {
  956. ret = -ENOMEM;
  957. goto out;
  958. }
  959. acx->rssi_beacon = c->avg_weight_rssi_beacon;
  960. acx->rssi_data = c->avg_weight_rssi_data;
  961. acx->snr_beacon = c->avg_weight_snr_beacon;
  962. acx->snr_data = c->avg_weight_snr_data;
  963. ret = wl1271_cmd_configure(wl, ACX_RSSI_SNR_WEIGHTS, acx, sizeof(*acx));
  964. if (ret < 0) {
  965. wl1271_warning("acx rssi snr trigger weights failed: %d", ret);
  966. goto out;
  967. }
  968. out:
  969. kfree(acx);
  970. return ret;
  971. }
  972. int wl1271_acx_set_ht_capabilities(struct wl1271 *wl,
  973. struct ieee80211_sta_ht_cap *ht_cap,
  974. bool allow_ht_operation)
  975. {
  976. struct wl1271_acx_ht_capabilities *acx;
  977. u8 mac_address[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
  978. int ret = 0;
  979. wl1271_debug(DEBUG_ACX, "acx ht capabilities setting");
  980. acx = kzalloc(sizeof(*acx), GFP_KERNEL);
  981. if (!acx) {
  982. ret = -ENOMEM;
  983. goto out;
  984. }
  985. /* Allow HT Operation ? */
  986. if (allow_ht_operation) {
  987. acx->ht_capabilites =
  988. WL1271_ACX_FW_CAP_HT_OPERATION;
  989. if (ht_cap->cap & IEEE80211_HT_CAP_GRN_FLD)
  990. acx->ht_capabilites |=
  991. WL1271_ACX_FW_CAP_GREENFIELD_FRAME_FORMAT;
  992. if (ht_cap->cap & IEEE80211_HT_CAP_SGI_20)
  993. acx->ht_capabilites |=
  994. WL1271_ACX_FW_CAP_SHORT_GI_FOR_20MHZ_PACKETS;
  995. if (ht_cap->cap & IEEE80211_HT_CAP_LSIG_TXOP_PROT)
  996. acx->ht_capabilites |=
  997. WL1271_ACX_FW_CAP_LSIG_TXOP_PROTECTION;
  998. /* get data from A-MPDU parameters field */
  999. acx->ampdu_max_length = ht_cap->ampdu_factor;
  1000. acx->ampdu_min_spacing = ht_cap->ampdu_density;
  1001. memcpy(acx->mac_address, mac_address, ETH_ALEN);
  1002. } else { /* HT operations are not allowed */
  1003. acx->ht_capabilites = 0;
  1004. }
  1005. ret = wl1271_cmd_configure(wl, ACX_PEER_HT_CAP, acx, sizeof(*acx));
  1006. if (ret < 0) {
  1007. wl1271_warning("acx ht capabilities setting failed: %d", ret);
  1008. goto out;
  1009. }
  1010. out:
  1011. kfree(acx);
  1012. return ret;
  1013. }
  1014. int wl1271_acx_set_ht_information(struct wl1271 *wl,
  1015. u16 ht_operation_mode)
  1016. {
  1017. struct wl1271_acx_ht_information *acx;
  1018. int ret = 0;
  1019. wl1271_debug(DEBUG_ACX, "acx ht information setting");
  1020. acx = kzalloc(sizeof(*acx), GFP_KERNEL);
  1021. if (!acx) {
  1022. ret = -ENOMEM;
  1023. goto out;
  1024. }
  1025. acx->ht_protection =
  1026. (u8)(ht_operation_mode & IEEE80211_HT_OP_MODE_PROTECTION);
  1027. acx->rifs_mode = 0;
  1028. acx->gf_protection = 0;
  1029. acx->ht_tx_burst_limit = 0;
  1030. acx->dual_cts_protection = 0;
  1031. ret = wl1271_cmd_configure(wl, ACX_HT_BSS_OPERATION, acx, sizeof(*acx));
  1032. if (ret < 0) {
  1033. wl1271_warning("acx ht information setting failed: %d", ret);
  1034. goto out;
  1035. }
  1036. out:
  1037. kfree(acx);
  1038. return ret;
  1039. }
  1040. int wl1271_acx_tsf_info(struct wl1271 *wl, u64 *mactime)
  1041. {
  1042. struct wl1271_acx_fw_tsf_information *tsf_info;
  1043. int ret;
  1044. tsf_info = kzalloc(sizeof(*tsf_info), GFP_KERNEL);
  1045. if (!tsf_info) {
  1046. ret = -ENOMEM;
  1047. goto out;
  1048. }
  1049. ret = wl1271_cmd_interrogate(wl, ACX_TSF_INFO,
  1050. tsf_info, sizeof(*tsf_info));
  1051. if (ret < 0) {
  1052. wl1271_warning("acx tsf info interrogate failed");
  1053. goto out;
  1054. }
  1055. *mactime = le32_to_cpu(tsf_info->current_tsf_low) |
  1056. ((u64) le32_to_cpu(tsf_info->current_tsf_high) << 32);
  1057. out:
  1058. kfree(tsf_info);
  1059. return ret;
  1060. }