acx.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134
  1. /*
  2. * This file is part of wl1271
  3. *
  4. * Copyright (C) 1998-2009 Texas Instruments. All rights reserved.
  5. * Copyright (C) 2008-2010 Nokia Corporation
  6. *
  7. * Contact: Luciano Coelho <luciano.coelho@nokia.com>
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * version 2 as published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  21. * 02110-1301 USA
  22. *
  23. */
  24. #ifndef __ACX_H__
  25. #define __ACX_H__
  26. #include "wlcore.h"
  27. #include "cmd.h"
  28. /*************************************************************************
  29. Host Interrupt Register (WiLink -> Host)
  30. **************************************************************************/
  31. /* HW Initiated interrupt Watchdog timer expiration */
  32. #define WL1271_ACX_INTR_WATCHDOG BIT(0)
  33. /* Init sequence is done (masked interrupt, detection through polling only ) */
  34. #define WL1271_ACX_INTR_INIT_COMPLETE BIT(1)
  35. /* Event was entered to Event MBOX #A*/
  36. #define WL1271_ACX_INTR_EVENT_A BIT(2)
  37. /* Event was entered to Event MBOX #B*/
  38. #define WL1271_ACX_INTR_EVENT_B BIT(3)
  39. /* Command processing completion*/
  40. #define WL1271_ACX_INTR_CMD_COMPLETE BIT(4)
  41. /* Signaling the host on HW wakeup */
  42. #define WL1271_ACX_INTR_HW_AVAILABLE BIT(5)
  43. /* The MISC bit is used for aggregation of RX, TxComplete and TX rate update */
  44. #define WL1271_ACX_INTR_DATA BIT(6)
  45. /* Trace message on MBOX #A */
  46. #define WL1271_ACX_INTR_TRACE_A BIT(7)
  47. /* Trace message on MBOX #B */
  48. #define WL1271_ACX_INTR_TRACE_B BIT(8)
  49. /* SW FW Initiated interrupt Watchdog timer expiration */
  50. #define WL1271_ACX_SW_INTR_WATCHDOG BIT(9)
  51. #define WL1271_ACX_INTR_ALL 0xFFFFFFFF
  52. /* all possible interrupts - only appropriate ones will be masked in */
  53. #define WLCORE_ALL_INTR_MASK (WL1271_ACX_INTR_WATCHDOG | \
  54. WL1271_ACX_INTR_EVENT_A | \
  55. WL1271_ACX_INTR_EVENT_B | \
  56. WL1271_ACX_INTR_HW_AVAILABLE | \
  57. WL1271_ACX_INTR_DATA | \
  58. WL1271_ACX_SW_INTR_WATCHDOG)
  59. /* Target's information element */
  60. struct acx_header {
  61. struct wl1271_cmd_header cmd;
  62. /* acx (or information element) header */
  63. __le16 id;
  64. /* payload length (not including headers */
  65. __le16 len;
  66. } __packed;
  67. struct acx_error_counter {
  68. struct acx_header header;
  69. /* The number of PLCP errors since the last time this */
  70. /* information element was interrogated. This field is */
  71. /* automatically cleared when it is interrogated.*/
  72. __le32 PLCP_error;
  73. /* The number of FCS errors since the last time this */
  74. /* information element was interrogated. This field is */
  75. /* automatically cleared when it is interrogated.*/
  76. __le32 FCS_error;
  77. /* The number of MPDUs without PLCP header errors received*/
  78. /* since the last time this information element was interrogated. */
  79. /* This field is automatically cleared when it is interrogated.*/
  80. __le32 valid_frame;
  81. /* the number of missed sequence numbers in the squentially */
  82. /* values of frames seq numbers */
  83. __le32 seq_num_miss;
  84. } __packed;
  85. enum wl12xx_role {
  86. WL1271_ROLE_STA = 0,
  87. WL1271_ROLE_IBSS,
  88. WL1271_ROLE_AP,
  89. WL1271_ROLE_DEVICE,
  90. WL1271_ROLE_P2P_CL,
  91. WL1271_ROLE_P2P_GO,
  92. WL12XX_INVALID_ROLE_TYPE = 0xff
  93. };
  94. enum wl1271_psm_mode {
  95. /* Active mode */
  96. WL1271_PSM_CAM = 0,
  97. /* Power save mode */
  98. WL1271_PSM_PS = 1,
  99. /* Extreme low power */
  100. WL1271_PSM_ELP = 2,
  101. WL1271_PSM_MAX = WL1271_PSM_ELP,
  102. /* illegal out of band value of PSM mode */
  103. WL1271_PSM_ILLEGAL = 0xff
  104. };
  105. struct acx_sleep_auth {
  106. struct acx_header header;
  107. /* The sleep level authorization of the device. */
  108. /* 0 - Always active*/
  109. /* 1 - Power down mode: light / fast sleep*/
  110. /* 2 - ELP mode: Deep / Max sleep*/
  111. u8 sleep_auth;
  112. u8 padding[3];
  113. } __packed;
  114. enum {
  115. HOSTIF_PCI_MASTER_HOST_INDIRECT,
  116. HOSTIF_PCI_MASTER_HOST_DIRECT,
  117. HOSTIF_SLAVE,
  118. HOSTIF_PKT_RING,
  119. HOSTIF_DONTCARE = 0xFF
  120. };
  121. #define DEFAULT_UCAST_PRIORITY 0
  122. #define DEFAULT_RX_Q_PRIORITY 0
  123. #define DEFAULT_RXQ_PRIORITY 0 /* low 0 .. 15 high */
  124. #define DEFAULT_RXQ_TYPE 0x07 /* All frames, Data/Ctrl/Mgmt */
  125. #define TRACE_BUFFER_MAX_SIZE 256
  126. #define DP_RX_PACKET_RING_CHUNK_SIZE 1600
  127. #define DP_TX_PACKET_RING_CHUNK_SIZE 1600
  128. #define DP_RX_PACKET_RING_CHUNK_NUM 2
  129. #define DP_TX_PACKET_RING_CHUNK_NUM 2
  130. #define DP_TX_COMPLETE_TIME_OUT 20
  131. #define TX_MSDU_LIFETIME_MIN 0
  132. #define TX_MSDU_LIFETIME_MAX 3000
  133. #define TX_MSDU_LIFETIME_DEF 512
  134. #define RX_MSDU_LIFETIME_MIN 0
  135. #define RX_MSDU_LIFETIME_MAX 0xFFFFFFFF
  136. #define RX_MSDU_LIFETIME_DEF 512000
  137. struct acx_rx_msdu_lifetime {
  138. struct acx_header header;
  139. /*
  140. * The maximum amount of time, in TU, before the
  141. * firmware discards the MSDU.
  142. */
  143. __le32 lifetime;
  144. } __packed;
  145. enum acx_slot_type {
  146. SLOT_TIME_LONG = 0,
  147. SLOT_TIME_SHORT = 1,
  148. DEFAULT_SLOT_TIME = SLOT_TIME_SHORT,
  149. MAX_SLOT_TIMES = 0xFF
  150. };
  151. #define STATION_WONE_INDEX 0
  152. struct acx_slot {
  153. struct acx_header header;
  154. u8 role_id;
  155. u8 wone_index; /* Reserved */
  156. u8 slot_time;
  157. u8 reserved[5];
  158. } __packed;
  159. #define ACX_MC_ADDRESS_GROUP_MAX (8)
  160. #define ADDRESS_GROUP_MAX_LEN (ETH_ALEN * ACX_MC_ADDRESS_GROUP_MAX)
  161. struct acx_dot11_grp_addr_tbl {
  162. struct acx_header header;
  163. u8 role_id;
  164. u8 enabled;
  165. u8 num_groups;
  166. u8 pad[1];
  167. u8 mac_table[ADDRESS_GROUP_MAX_LEN];
  168. } __packed;
  169. struct acx_rx_timeout {
  170. struct acx_header header;
  171. u8 role_id;
  172. u8 reserved;
  173. __le16 ps_poll_timeout;
  174. __le16 upsd_timeout;
  175. u8 padding[2];
  176. } __packed;
  177. struct acx_rts_threshold {
  178. struct acx_header header;
  179. u8 role_id;
  180. u8 reserved;
  181. __le16 threshold;
  182. } __packed;
  183. struct acx_beacon_filter_option {
  184. struct acx_header header;
  185. u8 role_id;
  186. u8 enable;
  187. /*
  188. * The number of beacons without the unicast TIM
  189. * bit set that the firmware buffers before
  190. * signaling the host about ready frames.
  191. * When set to 0 and the filter is enabled, beacons
  192. * without the unicast TIM bit set are dropped.
  193. */
  194. u8 max_num_beacons;
  195. u8 pad[1];
  196. } __packed;
  197. /*
  198. * ACXBeaconFilterEntry (not 221)
  199. * Byte Offset Size (Bytes) Definition
  200. * =========== ============ ==========
  201. * 0 1 IE identifier
  202. * 1 1 Treatment bit mask
  203. *
  204. * ACXBeaconFilterEntry (221)
  205. * Byte Offset Size (Bytes) Definition
  206. * =========== ============ ==========
  207. * 0 1 IE identifier
  208. * 1 1 Treatment bit mask
  209. * 2 3 OUI
  210. * 5 1 Type
  211. * 6 2 Version
  212. *
  213. *
  214. * Treatment bit mask - The information element handling:
  215. * bit 0 - The information element is compared and transferred
  216. * in case of change.
  217. * bit 1 - The information element is transferred to the host
  218. * with each appearance or disappearance.
  219. * Note that both bits can be set at the same time.
  220. */
  221. #define BEACON_FILTER_TABLE_MAX_IE_NUM (32)
  222. #define BEACON_FILTER_TABLE_MAX_VENDOR_SPECIFIC_IE_NUM (6)
  223. #define BEACON_FILTER_TABLE_IE_ENTRY_SIZE (2)
  224. #define BEACON_FILTER_TABLE_EXTRA_VENDOR_SPECIFIC_IE_SIZE (6)
  225. #define BEACON_FILTER_TABLE_MAX_SIZE ((BEACON_FILTER_TABLE_MAX_IE_NUM * \
  226. BEACON_FILTER_TABLE_IE_ENTRY_SIZE) + \
  227. (BEACON_FILTER_TABLE_MAX_VENDOR_SPECIFIC_IE_NUM * \
  228. BEACON_FILTER_TABLE_EXTRA_VENDOR_SPECIFIC_IE_SIZE))
  229. struct acx_beacon_filter_ie_table {
  230. struct acx_header header;
  231. u8 role_id;
  232. u8 num_ie;
  233. u8 pad[2];
  234. u8 table[BEACON_FILTER_TABLE_MAX_SIZE];
  235. } __packed;
  236. struct acx_conn_monit_params {
  237. struct acx_header header;
  238. u8 role_id;
  239. u8 padding[3];
  240. __le32 synch_fail_thold; /* number of beacons missed */
  241. __le32 bss_lose_timeout; /* number of TU's from synch fail */
  242. } __packed;
  243. struct acx_bt_wlan_coex {
  244. struct acx_header header;
  245. u8 enable;
  246. u8 pad[3];
  247. } __packed;
  248. struct acx_bt_wlan_coex_param {
  249. struct acx_header header;
  250. __le32 params[CONF_SG_PARAMS_MAX];
  251. u8 param_idx;
  252. u8 padding[3];
  253. } __packed;
  254. struct acx_dco_itrim_params {
  255. struct acx_header header;
  256. u8 enable;
  257. u8 padding[3];
  258. __le32 timeout;
  259. } __packed;
  260. struct acx_energy_detection {
  261. struct acx_header header;
  262. /* The RX Clear Channel Assessment threshold in the PHY */
  263. __le16 rx_cca_threshold;
  264. u8 tx_energy_detection;
  265. u8 pad;
  266. } __packed;
  267. struct acx_beacon_broadcast {
  268. struct acx_header header;
  269. u8 role_id;
  270. /* Enables receiving of broadcast packets in PS mode */
  271. u8 rx_broadcast_in_ps;
  272. __le16 beacon_rx_timeout;
  273. __le16 broadcast_timeout;
  274. /* Consecutive PS Poll failures before updating the host */
  275. u8 ps_poll_threshold;
  276. u8 pad[1];
  277. } __packed;
  278. struct acx_event_mask {
  279. struct acx_header header;
  280. __le32 event_mask;
  281. __le32 high_event_mask; /* Unused */
  282. } __packed;
  283. #define SCAN_PASSIVE BIT(0)
  284. #define SCAN_5GHZ_BAND BIT(1)
  285. #define SCAN_TRIGGERED BIT(2)
  286. #define SCAN_PRIORITY_HIGH BIT(3)
  287. /* When set, disable HW encryption */
  288. #define DF_ENCRYPTION_DISABLE 0x01
  289. #define DF_SNIFF_MODE_ENABLE 0x80
  290. struct acx_feature_config {
  291. struct acx_header header;
  292. u8 role_id;
  293. u8 padding[3];
  294. __le32 options;
  295. __le32 data_flow_options;
  296. } __packed;
  297. struct acx_current_tx_power {
  298. struct acx_header header;
  299. u8 role_id;
  300. u8 current_tx_power;
  301. u8 padding[2];
  302. } __packed;
  303. struct acx_wake_up_condition {
  304. struct acx_header header;
  305. u8 role_id;
  306. u8 wake_up_event; /* Only one bit can be set */
  307. u8 listen_interval;
  308. u8 pad[1];
  309. } __packed;
  310. struct acx_aid {
  311. struct acx_header header;
  312. /*
  313. * To be set when associated with an AP.
  314. */
  315. u8 role_id;
  316. u8 reserved;
  317. __le16 aid;
  318. } __packed;
  319. enum acx_preamble_type {
  320. ACX_PREAMBLE_LONG = 0,
  321. ACX_PREAMBLE_SHORT = 1
  322. };
  323. struct acx_preamble {
  324. struct acx_header header;
  325. /*
  326. * When set, the WiLink transmits the frames with a short preamble and
  327. * when cleared, the WiLink transmits the frames with a long preamble.
  328. */
  329. u8 role_id;
  330. u8 preamble;
  331. u8 padding[2];
  332. } __packed;
  333. enum acx_ctsprotect_type {
  334. CTSPROTECT_DISABLE = 0,
  335. CTSPROTECT_ENABLE = 1
  336. };
  337. struct acx_ctsprotect {
  338. struct acx_header header;
  339. u8 role_id;
  340. u8 ctsprotect;
  341. u8 padding[2];
  342. } __packed;
  343. struct acx_rate_class {
  344. __le32 enabled_rates;
  345. u8 short_retry_limit;
  346. u8 long_retry_limit;
  347. u8 aflags;
  348. u8 reserved;
  349. };
  350. struct acx_rate_policy {
  351. struct acx_header header;
  352. __le32 rate_policy_idx;
  353. struct acx_rate_class rate_policy;
  354. } __packed;
  355. struct acx_ac_cfg {
  356. struct acx_header header;
  357. u8 role_id;
  358. u8 ac;
  359. u8 aifsn;
  360. u8 cw_min;
  361. __le16 cw_max;
  362. __le16 tx_op_limit;
  363. } __packed;
  364. struct acx_tid_config {
  365. struct acx_header header;
  366. u8 role_id;
  367. u8 queue_id;
  368. u8 channel_type;
  369. u8 tsid;
  370. u8 ps_scheme;
  371. u8 ack_policy;
  372. u8 padding[2];
  373. __le32 apsd_conf[2];
  374. } __packed;
  375. struct acx_frag_threshold {
  376. struct acx_header header;
  377. __le16 frag_threshold;
  378. u8 padding[2];
  379. } __packed;
  380. struct acx_tx_config_options {
  381. struct acx_header header;
  382. __le16 tx_compl_timeout; /* msec */
  383. __le16 tx_compl_threshold; /* number of packets */
  384. } __packed;
  385. struct wl12xx_acx_config_memory {
  386. struct acx_header header;
  387. u8 rx_mem_block_num;
  388. u8 tx_min_mem_block_num;
  389. u8 num_stations;
  390. u8 num_ssid_profiles;
  391. __le32 total_tx_descriptors;
  392. u8 dyn_mem_enable;
  393. u8 tx_free_req;
  394. u8 rx_free_req;
  395. u8 tx_min;
  396. u8 fwlog_blocks;
  397. u8 padding[3];
  398. } __packed;
  399. struct wl1271_acx_mem_map {
  400. struct acx_header header;
  401. __le32 code_start;
  402. __le32 code_end;
  403. __le32 wep_defkey_start;
  404. __le32 wep_defkey_end;
  405. __le32 sta_table_start;
  406. __le32 sta_table_end;
  407. __le32 packet_template_start;
  408. __le32 packet_template_end;
  409. /* Address of the TX result interface (control block) */
  410. __le32 tx_result;
  411. __le32 tx_result_queue_start;
  412. __le32 queue_memory_start;
  413. __le32 queue_memory_end;
  414. __le32 packet_memory_pool_start;
  415. __le32 packet_memory_pool_end;
  416. __le32 debug_buffer1_start;
  417. __le32 debug_buffer1_end;
  418. __le32 debug_buffer2_start;
  419. __le32 debug_buffer2_end;
  420. /* Number of blocks FW allocated for TX packets */
  421. __le32 num_tx_mem_blocks;
  422. /* Number of blocks FW allocated for RX packets */
  423. __le32 num_rx_mem_blocks;
  424. /* the following 4 fields are valid in SLAVE mode only */
  425. u8 *tx_cbuf;
  426. u8 *rx_cbuf;
  427. __le32 rx_ctrl;
  428. __le32 tx_ctrl;
  429. } __packed;
  430. struct wl1271_acx_rx_config_opt {
  431. struct acx_header header;
  432. __le16 mblk_threshold;
  433. __le16 threshold;
  434. __le16 timeout;
  435. u8 queue_type;
  436. u8 reserved;
  437. } __packed;
  438. struct wl1271_acx_bet_enable {
  439. struct acx_header header;
  440. u8 role_id;
  441. u8 enable;
  442. u8 max_consecutive;
  443. u8 padding[1];
  444. } __packed;
  445. #define ACX_IPV4_VERSION 4
  446. #define ACX_IPV6_VERSION 6
  447. #define ACX_IPV4_ADDR_SIZE 4
  448. /* bitmap of enabled arp_filter features */
  449. #define ACX_ARP_FILTER_ARP_FILTERING BIT(0)
  450. #define ACX_ARP_FILTER_AUTO_ARP BIT(1)
  451. struct wl1271_acx_arp_filter {
  452. struct acx_header header;
  453. u8 role_id;
  454. u8 version; /* ACX_IPV4_VERSION, ACX_IPV6_VERSION */
  455. u8 enable; /* bitmap of enabled ARP filtering features */
  456. u8 padding[1];
  457. u8 address[16]; /* The configured device IP address - all ARP
  458. requests directed to this IP address will pass
  459. through. For IPv4, the first four bytes are
  460. used. */
  461. } __packed;
  462. struct wl1271_acx_pm_config {
  463. struct acx_header header;
  464. __le32 host_clk_settling_time;
  465. u8 host_fast_wakeup_support;
  466. u8 padding[3];
  467. } __packed;
  468. struct wl1271_acx_keep_alive_mode {
  469. struct acx_header header;
  470. u8 role_id;
  471. u8 enabled;
  472. u8 padding[2];
  473. } __packed;
  474. enum {
  475. ACX_KEEP_ALIVE_NO_TX = 0,
  476. ACX_KEEP_ALIVE_PERIOD_ONLY
  477. };
  478. enum {
  479. ACX_KEEP_ALIVE_TPL_INVALID = 0,
  480. ACX_KEEP_ALIVE_TPL_VALID
  481. };
  482. struct wl1271_acx_keep_alive_config {
  483. struct acx_header header;
  484. u8 role_id;
  485. u8 index;
  486. u8 tpl_validation;
  487. u8 trigger;
  488. __le32 period;
  489. } __packed;
  490. /* TODO: maybe this needs to be moved somewhere else? */
  491. #define HOST_IF_CFG_RX_FIFO_ENABLE BIT(0)
  492. #define HOST_IF_CFG_TX_EXTRA_BLKS_SWAP BIT(1)
  493. #define HOST_IF_CFG_TX_PAD_TO_SDIO_BLK BIT(3)
  494. #define HOST_IF_CFG_RX_PAD_TO_SDIO_BLK BIT(4)
  495. #define HOST_IF_CFG_ADD_RX_ALIGNMENT BIT(6)
  496. enum {
  497. WL1271_ACX_TRIG_TYPE_LEVEL = 0,
  498. WL1271_ACX_TRIG_TYPE_EDGE,
  499. };
  500. enum {
  501. WL1271_ACX_TRIG_DIR_LOW = 0,
  502. WL1271_ACX_TRIG_DIR_HIGH,
  503. WL1271_ACX_TRIG_DIR_BIDIR,
  504. };
  505. enum {
  506. WL1271_ACX_TRIG_ENABLE = 1,
  507. WL1271_ACX_TRIG_DISABLE,
  508. };
  509. enum {
  510. WL1271_ACX_TRIG_METRIC_RSSI_BEACON = 0,
  511. WL1271_ACX_TRIG_METRIC_RSSI_DATA,
  512. WL1271_ACX_TRIG_METRIC_SNR_BEACON,
  513. WL1271_ACX_TRIG_METRIC_SNR_DATA,
  514. };
  515. enum {
  516. WL1271_ACX_TRIG_IDX_RSSI = 0,
  517. WL1271_ACX_TRIG_COUNT = 8,
  518. };
  519. struct wl1271_acx_rssi_snr_trigger {
  520. struct acx_header header;
  521. u8 role_id;
  522. u8 metric;
  523. u8 type;
  524. u8 dir;
  525. __le16 threshold;
  526. __le16 pacing; /* 0 - 60000 ms */
  527. u8 hysteresis;
  528. u8 index;
  529. u8 enable;
  530. u8 padding[1];
  531. };
  532. struct wl1271_acx_rssi_snr_avg_weights {
  533. struct acx_header header;
  534. u8 role_id;
  535. u8 padding[3];
  536. u8 rssi_beacon;
  537. u8 rssi_data;
  538. u8 snr_beacon;
  539. u8 snr_data;
  540. };
  541. /* special capability bit (not employed by the 802.11n spec) */
  542. #define WL12XX_HT_CAP_HT_OPERATION BIT(16)
  543. /*
  544. * ACX_PEER_HT_CAP
  545. * Configure HT capabilities - declare the capabilities of the peer
  546. * we are connected to.
  547. */
  548. struct wl1271_acx_ht_capabilities {
  549. struct acx_header header;
  550. /* bitmask of capability bits supported by the peer */
  551. __le32 ht_capabilites;
  552. /* Indicates to which link these capabilities apply. */
  553. u8 hlid;
  554. /*
  555. * This the maximum A-MPDU length supported by the AP. The FW may not
  556. * exceed this length when sending A-MPDUs
  557. */
  558. u8 ampdu_max_length;
  559. /* This is the minimal spacing required when sending A-MPDUs to the AP*/
  560. u8 ampdu_min_spacing;
  561. u8 padding;
  562. } __packed;
  563. /*
  564. * ACX_HT_BSS_OPERATION
  565. * Configure HT capabilities - AP rules for behavior in the BSS.
  566. */
  567. struct wl1271_acx_ht_information {
  568. struct acx_header header;
  569. u8 role_id;
  570. /* Values: 0 - RIFS not allowed, 1 - RIFS allowed */
  571. u8 rifs_mode;
  572. /* Values: 0 - 3 like in spec */
  573. u8 ht_protection;
  574. /* Values: 0 - GF protection not required, 1 - GF protection required */
  575. u8 gf_protection;
  576. /*Values: 0 - TX Burst limit not required, 1 - TX Burst Limit required*/
  577. u8 ht_tx_burst_limit;
  578. /*
  579. * Values: 0 - Dual CTS protection not required,
  580. * 1 - Dual CTS Protection required
  581. * Note: When this value is set to 1 FW will protect all TXOP with RTS
  582. * frame and will not use CTS-to-self regardless of the value of the
  583. * ACX_CTS_PROTECTION information element
  584. */
  585. u8 dual_cts_protection;
  586. u8 padding[2];
  587. } __packed;
  588. struct wl1271_acx_ba_initiator_policy {
  589. struct acx_header header;
  590. /* Specifies role Id, Range 0-7, 0xFF means ANY role. */
  591. u8 role_id;
  592. /*
  593. * Per TID setting for allowing TX BA. Set a bit to 1 to allow
  594. * TX BA sessions for the corresponding TID.
  595. */
  596. u8 tid_bitmap;
  597. /* Windows size in number of packets */
  598. u8 win_size;
  599. u8 padding1[1];
  600. /* As initiator inactivity timeout in time units(TU) of 1024us */
  601. u16 inactivity_timeout;
  602. u8 padding[2];
  603. } __packed;
  604. struct wl1271_acx_ba_receiver_setup {
  605. struct acx_header header;
  606. /* Specifies link id, range 0-31 */
  607. u8 hlid;
  608. u8 tid;
  609. u8 enable;
  610. /* Windows size in number of packets */
  611. u8 win_size;
  612. /* BA session starting sequence number. RANGE 0-FFF */
  613. u16 ssn;
  614. u8 padding[2];
  615. } __packed;
  616. struct wl12xx_acx_fw_tsf_information {
  617. struct acx_header header;
  618. u8 role_id;
  619. u8 padding1[3];
  620. __le32 current_tsf_high;
  621. __le32 current_tsf_low;
  622. __le32 last_bttt_high;
  623. __le32 last_tbtt_low;
  624. u8 last_dtim_count;
  625. u8 padding2[3];
  626. } __packed;
  627. struct wl1271_acx_ps_rx_streaming {
  628. struct acx_header header;
  629. u8 role_id;
  630. u8 tid;
  631. u8 enable;
  632. /* interval between triggers (10-100 msec) */
  633. u8 period;
  634. /* timeout before first trigger (0-200 msec) */
  635. u8 timeout;
  636. u8 padding[3];
  637. } __packed;
  638. struct wl1271_acx_ap_max_tx_retry {
  639. struct acx_header header;
  640. u8 role_id;
  641. u8 padding_1;
  642. /*
  643. * the number of frames transmission failures before
  644. * issuing the aging event.
  645. */
  646. __le16 max_tx_retry;
  647. } __packed;
  648. struct wl1271_acx_config_ps {
  649. struct acx_header header;
  650. u8 exit_retries;
  651. u8 enter_retries;
  652. u8 padding[2];
  653. __le32 null_data_rate;
  654. } __packed;
  655. struct wl1271_acx_inconnection_sta {
  656. struct acx_header header;
  657. u8 addr[ETH_ALEN];
  658. u8 padding1[2];
  659. } __packed;
  660. /*
  661. * ACX_FM_COEX_CFG
  662. * set the FM co-existence parameters.
  663. */
  664. struct wl1271_acx_fm_coex {
  665. struct acx_header header;
  666. /* enable(1) / disable(0) the FM Coex feature */
  667. u8 enable;
  668. /*
  669. * Swallow period used in COEX PLL swallowing mechanism.
  670. * 0xFF = use FW default
  671. */
  672. u8 swallow_period;
  673. /*
  674. * The N divider used in COEX PLL swallowing mechanism for Fref of
  675. * 38.4/19.2 Mhz. 0xFF = use FW default
  676. */
  677. u8 n_divider_fref_set_1;
  678. /*
  679. * The N divider used in COEX PLL swallowing mechanism for Fref of
  680. * 26/52 Mhz. 0xFF = use FW default
  681. */
  682. u8 n_divider_fref_set_2;
  683. /*
  684. * The M divider used in COEX PLL swallowing mechanism for Fref of
  685. * 38.4/19.2 Mhz. 0xFFFF = use FW default
  686. */
  687. __le16 m_divider_fref_set_1;
  688. /*
  689. * The M divider used in COEX PLL swallowing mechanism for Fref of
  690. * 26/52 Mhz. 0xFFFF = use FW default
  691. */
  692. __le16 m_divider_fref_set_2;
  693. /*
  694. * The time duration in uSec required for COEX PLL to stabilize.
  695. * 0xFFFFFFFF = use FW default
  696. */
  697. __le32 coex_pll_stabilization_time;
  698. /*
  699. * The time duration in uSec required for LDO to stabilize.
  700. * 0xFFFFFFFF = use FW default
  701. */
  702. __le16 ldo_stabilization_time;
  703. /*
  704. * The disturbed frequency band margin around the disturbed frequency
  705. * center (single sided).
  706. * For example, if 2 is configured, the following channels will be
  707. * considered disturbed channel:
  708. * 80 +- 0.1 MHz, 91 +- 0.1 MHz, 98 +- 0.1 MHz, 102 +- 0.1 MH
  709. * 0xFF = use FW default
  710. */
  711. u8 fm_disturbed_band_margin;
  712. /*
  713. * The swallow clock difference of the swallowing mechanism.
  714. * 0xFF = use FW default
  715. */
  716. u8 swallow_clk_diff;
  717. } __packed;
  718. #define ACX_RATE_MGMT_ALL_PARAMS 0xff
  719. struct wl12xx_acx_set_rate_mgmt_params {
  720. struct acx_header header;
  721. u8 index; /* 0xff to configure all params */
  722. u8 padding1;
  723. __le16 rate_retry_score;
  724. __le16 per_add;
  725. __le16 per_th1;
  726. __le16 per_th2;
  727. __le16 max_per;
  728. u8 inverse_curiosity_factor;
  729. u8 tx_fail_low_th;
  730. u8 tx_fail_high_th;
  731. u8 per_alpha_shift;
  732. u8 per_add_shift;
  733. u8 per_beta1_shift;
  734. u8 per_beta2_shift;
  735. u8 rate_check_up;
  736. u8 rate_check_down;
  737. u8 rate_retry_policy[ACX_RATE_MGMT_NUM_OF_RATES];
  738. u8 padding2[2];
  739. } __packed;
  740. struct wl12xx_acx_config_hangover {
  741. struct acx_header header;
  742. __le32 recover_time;
  743. u8 hangover_period;
  744. u8 dynamic_mode;
  745. u8 early_termination_mode;
  746. u8 max_period;
  747. u8 min_period;
  748. u8 increase_delta;
  749. u8 decrease_delta;
  750. u8 quiet_time;
  751. u8 increase_time;
  752. u8 window_size;
  753. u8 padding[2];
  754. } __packed;
  755. struct acx_default_rx_filter {
  756. struct acx_header header;
  757. u8 enable;
  758. /* action of type FILTER_XXX */
  759. u8 default_action;
  760. u8 pad[2];
  761. } __packed;
  762. struct acx_rx_filter_cfg {
  763. struct acx_header header;
  764. u8 enable;
  765. /* 0 - WL1271_MAX_RX_FILTERS-1 */
  766. u8 index;
  767. u8 action;
  768. u8 num_fields;
  769. u8 fields[0];
  770. } __packed;
  771. struct acx_roaming_stats {
  772. struct acx_header header;
  773. u8 role_id;
  774. u8 pad[3];
  775. u32 missed_beacons;
  776. u8 snr_data;
  777. u8 snr_bacon;
  778. s8 rssi_data;
  779. s8 rssi_beacon;
  780. } __packed;
  781. enum {
  782. ACX_WAKE_UP_CONDITIONS = 0x0000,
  783. ACX_MEM_CFG = 0x0001,
  784. ACX_SLOT = 0x0002,
  785. ACX_AC_CFG = 0x0003,
  786. ACX_MEM_MAP = 0x0004,
  787. ACX_AID = 0x0005,
  788. ACX_MEDIUM_USAGE = 0x0006,
  789. ACX_STATISTICS = 0x0007,
  790. ACX_PWR_CONSUMPTION_STATISTICS = 0x0008,
  791. ACX_TID_CFG = 0x0009,
  792. ACX_PS_RX_STREAMING = 0x000A,
  793. ACX_BEACON_FILTER_OPT = 0x000B,
  794. ACX_NOISE_HIST = 0x000C,
  795. ACX_HDK_VERSION = 0x000D,
  796. ACX_PD_THRESHOLD = 0x000E,
  797. ACX_TX_CONFIG_OPT = 0x000F,
  798. ACX_CCA_THRESHOLD = 0x0010,
  799. ACX_EVENT_MBOX_MASK = 0x0011,
  800. ACX_CONN_MONIT_PARAMS = 0x0012,
  801. ACX_DISABLE_BROADCASTS = 0x0013,
  802. ACX_BCN_DTIM_OPTIONS = 0x0014,
  803. ACX_SG_ENABLE = 0x0015,
  804. ACX_SG_CFG = 0x0016,
  805. ACX_FM_COEX_CFG = 0x0017,
  806. ACX_BEACON_FILTER_TABLE = 0x0018,
  807. ACX_ARP_IP_FILTER = 0x0019,
  808. ACX_ROAMING_STATISTICS_TBL = 0x001A,
  809. ACX_RATE_POLICY = 0x001B,
  810. ACX_CTS_PROTECTION = 0x001C,
  811. ACX_SLEEP_AUTH = 0x001D,
  812. ACX_PREAMBLE_TYPE = 0x001E,
  813. ACX_ERROR_CNT = 0x001F,
  814. ACX_IBSS_FILTER = 0x0020,
  815. ACX_SERVICE_PERIOD_TIMEOUT = 0x0021,
  816. ACX_TSF_INFO = 0x0022,
  817. ACX_CONFIG_PS_WMM = 0x0023,
  818. ACX_ENABLE_RX_DATA_FILTER = 0x0024,
  819. ACX_SET_RX_DATA_FILTER = 0x0025,
  820. ACX_GET_DATA_FILTER_STATISTICS = 0x0026,
  821. ACX_RX_CONFIG_OPT = 0x0027,
  822. ACX_FRAG_CFG = 0x0028,
  823. ACX_BET_ENABLE = 0x0029,
  824. ACX_RSSI_SNR_TRIGGER = 0x002A,
  825. ACX_RSSI_SNR_WEIGHTS = 0x002B,
  826. ACX_KEEP_ALIVE_MODE = 0x002C,
  827. ACX_SET_KEEP_ALIVE_CONFIG = 0x002D,
  828. ACX_BA_SESSION_INIT_POLICY = 0x002E,
  829. ACX_BA_SESSION_RX_SETUP = 0x002F,
  830. ACX_PEER_HT_CAP = 0x0030,
  831. ACX_HT_BSS_OPERATION = 0x0031,
  832. ACX_COEX_ACTIVITY = 0x0032,
  833. ACX_BURST_MODE = 0x0033,
  834. ACX_SET_RATE_MGMT_PARAMS = 0x0034,
  835. ACX_GET_RATE_MGMT_PARAMS = 0x0035,
  836. ACX_SET_RATE_ADAPT_PARAMS = 0x0036,
  837. ACX_SET_DCO_ITRIM_PARAMS = 0x0037,
  838. ACX_GEN_FW_CMD = 0x0038,
  839. ACX_HOST_IF_CFG_BITMAP = 0x0039,
  840. ACX_MAX_TX_FAILURE = 0x003A,
  841. ACX_UPDATE_INCONNECTION_STA_LIST = 0x003B,
  842. DOT11_RX_MSDU_LIFE_TIME = 0x003C,
  843. DOT11_CUR_TX_PWR = 0x003D,
  844. DOT11_RTS_THRESHOLD = 0x003E,
  845. DOT11_GROUP_ADDRESS_TBL = 0x003F,
  846. ACX_PM_CONFIG = 0x0040,
  847. ACX_CONFIG_PS = 0x0041,
  848. ACX_CONFIG_HANGOVER = 0x0042,
  849. ACX_FEATURE_CFG = 0x0043,
  850. ACX_PROTECTION_CFG = 0x0044,
  851. };
  852. int wl1271_acx_wake_up_conditions(struct wl1271 *wl,
  853. struct wl12xx_vif *wlvif,
  854. u8 wake_up_event, u8 listen_interval);
  855. int wl1271_acx_sleep_auth(struct wl1271 *wl, u8 sleep_auth);
  856. int wl1271_acx_tx_power(struct wl1271 *wl, struct wl12xx_vif *wlvif,
  857. int power);
  858. int wl1271_acx_feature_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif);
  859. int wl1271_acx_mem_map(struct wl1271 *wl,
  860. struct acx_header *mem_map, size_t len);
  861. int wl1271_acx_rx_msdu_life_time(struct wl1271 *wl);
  862. int wl1271_acx_slot(struct wl1271 *wl, struct wl12xx_vif *wlvif,
  863. enum acx_slot_type slot_time);
  864. int wl1271_acx_group_address_tbl(struct wl1271 *wl, struct wl12xx_vif *wlvif,
  865. bool enable, void *mc_list, u32 mc_list_len);
  866. int wl1271_acx_service_period_timeout(struct wl1271 *wl,
  867. struct wl12xx_vif *wlvif);
  868. int wl1271_acx_rts_threshold(struct wl1271 *wl, struct wl12xx_vif *wlvif,
  869. u32 rts_threshold);
  870. int wl1271_acx_dco_itrim_params(struct wl1271 *wl);
  871. int wl1271_acx_beacon_filter_opt(struct wl1271 *wl, struct wl12xx_vif *wlvif,
  872. bool enable_filter);
  873. int wl1271_acx_beacon_filter_table(struct wl1271 *wl,
  874. struct wl12xx_vif *wlvif);
  875. int wl1271_acx_conn_monit_params(struct wl1271 *wl, struct wl12xx_vif *wlvif,
  876. bool enable);
  877. int wl1271_acx_sg_enable(struct wl1271 *wl, bool enable);
  878. int wl12xx_acx_sg_cfg(struct wl1271 *wl);
  879. int wl1271_acx_cca_threshold(struct wl1271 *wl);
  880. int wl1271_acx_bcn_dtim_options(struct wl1271 *wl, struct wl12xx_vif *wlvif);
  881. int wl1271_acx_aid(struct wl1271 *wl, struct wl12xx_vif *wlvif, u16 aid);
  882. int wl1271_acx_event_mbox_mask(struct wl1271 *wl, u32 event_mask);
  883. int wl1271_acx_set_preamble(struct wl1271 *wl, struct wl12xx_vif *wlvif,
  884. enum acx_preamble_type preamble);
  885. int wl1271_acx_cts_protect(struct wl1271 *wl, struct wl12xx_vif *wlvif,
  886. enum acx_ctsprotect_type ctsprotect);
  887. int wl1271_acx_statistics(struct wl1271 *wl, void *stats);
  888. int wl1271_acx_sta_rate_policies(struct wl1271 *wl, struct wl12xx_vif *wlvif);
  889. int wl1271_acx_ap_rate_policy(struct wl1271 *wl, struct conf_tx_rate_class *c,
  890. u8 idx);
  891. int wl1271_acx_ac_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif,
  892. u8 ac, u8 cw_min, u16 cw_max, u8 aifsn, u16 txop);
  893. int wl1271_acx_tid_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif,
  894. u8 queue_id, u8 channel_type,
  895. u8 tsid, u8 ps_scheme, u8 ack_policy,
  896. u32 apsd_conf0, u32 apsd_conf1);
  897. int wl1271_acx_frag_threshold(struct wl1271 *wl, u32 frag_threshold);
  898. int wl1271_acx_tx_config_options(struct wl1271 *wl);
  899. int wl12xx_acx_mem_cfg(struct wl1271 *wl);
  900. int wl1271_acx_init_mem_config(struct wl1271 *wl);
  901. int wl1271_acx_init_rx_interrupt(struct wl1271 *wl);
  902. int wl1271_acx_smart_reflex(struct wl1271 *wl);
  903. int wl1271_acx_bet_enable(struct wl1271 *wl, struct wl12xx_vif *wlvif,
  904. bool enable);
  905. int wl1271_acx_arp_ip_filter(struct wl1271 *wl, struct wl12xx_vif *wlvif,
  906. u8 enable, __be32 address);
  907. int wl1271_acx_pm_config(struct wl1271 *wl);
  908. int wl1271_acx_keep_alive_mode(struct wl1271 *wl, struct wl12xx_vif *vif,
  909. bool enable);
  910. int wl1271_acx_keep_alive_config(struct wl1271 *wl, struct wl12xx_vif *wlvif,
  911. u8 index, u8 tpl_valid);
  912. int wl1271_acx_rssi_snr_trigger(struct wl1271 *wl, struct wl12xx_vif *wlvif,
  913. bool enable, s16 thold, u8 hyst);
  914. int wl1271_acx_rssi_snr_avg_weights(struct wl1271 *wl,
  915. struct wl12xx_vif *wlvif);
  916. int wl1271_acx_set_ht_capabilities(struct wl1271 *wl,
  917. struct ieee80211_sta_ht_cap *ht_cap,
  918. bool allow_ht_operation, u8 hlid);
  919. int wl1271_acx_set_ht_information(struct wl1271 *wl,
  920. struct wl12xx_vif *wlvif,
  921. u16 ht_operation_mode);
  922. int wl12xx_acx_set_ba_initiator_policy(struct wl1271 *wl,
  923. struct wl12xx_vif *wlvif);
  924. int wl12xx_acx_set_ba_receiver_session(struct wl1271 *wl, u8 tid_index,
  925. u16 ssn, bool enable, u8 peer_hlid);
  926. int wl12xx_acx_tsf_info(struct wl1271 *wl, struct wl12xx_vif *wlvif,
  927. u64 *mactime);
  928. int wl1271_acx_ps_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif,
  929. bool enable);
  930. int wl1271_acx_ap_max_tx_retry(struct wl1271 *wl, struct wl12xx_vif *wlvif);
  931. int wl12xx_acx_config_ps(struct wl1271 *wl, struct wl12xx_vif *wlvif);
  932. int wl1271_acx_set_inconnection_sta(struct wl1271 *wl, u8 *addr);
  933. int wl1271_acx_fm_coex(struct wl1271 *wl);
  934. int wl12xx_acx_set_rate_mgmt_params(struct wl1271 *wl);
  935. int wl12xx_acx_config_hangover(struct wl1271 *wl);
  936. int wlcore_acx_average_rssi(struct wl1271 *wl, struct wl12xx_vif *wlvif,
  937. s8 *avg_rssi);
  938. #ifdef CONFIG_PM
  939. int wl1271_acx_default_rx_filter_enable(struct wl1271 *wl, bool enable,
  940. enum rx_filter_action action);
  941. int wl1271_acx_set_rx_filter(struct wl1271 *wl, u8 index, bool enable,
  942. struct wl12xx_rx_filter *filter);
  943. #endif /* CONFIG_PM */
  944. #endif /* __WL1271_ACX_H__ */