wl1271_acx.h 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085
  1. /*
  2. * This file is part of wl1271
  3. *
  4. * Copyright (C) 1998-2009 Texas Instruments. All rights reserved.
  5. * Copyright (C) 2008-2009 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 __WL1271_ACX_H__
  25. #define __WL1271_ACX_H__
  26. #include "wl1271.h"
  27. #include "wl1271_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 meassge on MBOX #A */
  46. #define WL1271_ACX_INTR_TRACE_A BIT(7)
  47. /* Trace meassge on MBOX #B */
  48. #define WL1271_ACX_INTR_TRACE_B BIT(8)
  49. #define WL1271_ACX_INTR_ALL 0xFFFFFFFF
  50. #define WL1271_ACX_ALL_EVENTS_VECTOR (WL1271_ACX_INTR_WATCHDOG | \
  51. WL1271_ACX_INTR_INIT_COMPLETE | \
  52. WL1271_ACX_INTR_EVENT_A | \
  53. WL1271_ACX_INTR_EVENT_B | \
  54. WL1271_ACX_INTR_CMD_COMPLETE | \
  55. WL1271_ACX_INTR_HW_AVAILABLE | \
  56. WL1271_ACX_INTR_DATA)
  57. #define WL1271_INTR_MASK (WL1271_ACX_INTR_EVENT_A | \
  58. WL1271_ACX_INTR_EVENT_B | \
  59. WL1271_ACX_INTR_HW_AVAILABLE | \
  60. WL1271_ACX_INTR_DATA)
  61. /* Target's information element */
  62. struct acx_header {
  63. struct wl1271_cmd_header cmd;
  64. /* acx (or information element) header */
  65. __le16 id;
  66. /* payload length (not including headers */
  67. __le16 len;
  68. } __attribute__ ((packed));
  69. struct acx_error_counter {
  70. struct acx_header header;
  71. /* The number of PLCP errors since the last time this */
  72. /* information element was interrogated. This field is */
  73. /* automatically cleared when it is interrogated.*/
  74. __le32 PLCP_error;
  75. /* The number of FCS errors since the last time this */
  76. /* information element was interrogated. This field is */
  77. /* automatically cleared when it is interrogated.*/
  78. __le32 FCS_error;
  79. /* The number of MPDUs without PLCP header errors received*/
  80. /* since the last time this information element was interrogated. */
  81. /* This field is automatically cleared when it is interrogated.*/
  82. __le32 valid_frame;
  83. /* the number of missed sequence numbers in the squentially */
  84. /* values of frames seq numbers */
  85. __le32 seq_num_miss;
  86. } __attribute__ ((packed));
  87. struct acx_revision {
  88. struct acx_header header;
  89. /*
  90. * The WiLink firmware version, an ASCII string x.x.x.x,
  91. * that uniquely identifies the current firmware.
  92. * The left most digit is incremented each time a
  93. * significant change is made to the firmware, such as
  94. * code redesign or new platform support.
  95. * The second digit is incremented when major enhancements
  96. * are added or major fixes are made.
  97. * The third digit is incremented for each GA release.
  98. * The fourth digit is incremented for each build.
  99. * The first two digits identify a firmware release version,
  100. * in other words, a unique set of features.
  101. * The first three digits identify a GA release.
  102. */
  103. char fw_version[20];
  104. /*
  105. * This 4 byte field specifies the WiLink hardware version.
  106. * bits 0 - 15: Reserved.
  107. * bits 16 - 23: Version ID - The WiLink version ID
  108. * (1 = first spin, 2 = second spin, and so on).
  109. * bits 24 - 31: Chip ID - The WiLink chip ID.
  110. */
  111. __le32 hw_version;
  112. } __attribute__ ((packed));
  113. enum wl1271_psm_mode {
  114. /* Active mode */
  115. WL1271_PSM_CAM = 0,
  116. /* Power save mode */
  117. WL1271_PSM_PS = 1,
  118. /* Extreme low power */
  119. WL1271_PSM_ELP = 2,
  120. };
  121. struct acx_sleep_auth {
  122. struct acx_header header;
  123. /* The sleep level authorization of the device. */
  124. /* 0 - Always active*/
  125. /* 1 - Power down mode: light / fast sleep*/
  126. /* 2 - ELP mode: Deep / Max sleep*/
  127. u8 sleep_auth;
  128. u8 padding[3];
  129. } __attribute__ ((packed));
  130. enum {
  131. HOSTIF_PCI_MASTER_HOST_INDIRECT,
  132. HOSTIF_PCI_MASTER_HOST_DIRECT,
  133. HOSTIF_SLAVE,
  134. HOSTIF_PKT_RING,
  135. HOSTIF_DONTCARE = 0xFF
  136. };
  137. #define DEFAULT_UCAST_PRIORITY 0
  138. #define DEFAULT_RX_Q_PRIORITY 0
  139. #define DEFAULT_NUM_STATIONS 1
  140. #define DEFAULT_RXQ_PRIORITY 0 /* low 0 .. 15 high */
  141. #define DEFAULT_RXQ_TYPE 0x07 /* All frames, Data/Ctrl/Mgmt */
  142. #define TRACE_BUFFER_MAX_SIZE 256
  143. #define DP_RX_PACKET_RING_CHUNK_SIZE 1600
  144. #define DP_TX_PACKET_RING_CHUNK_SIZE 1600
  145. #define DP_RX_PACKET_RING_CHUNK_NUM 2
  146. #define DP_TX_PACKET_RING_CHUNK_NUM 2
  147. #define DP_TX_COMPLETE_TIME_OUT 20
  148. #define TX_MSDU_LIFETIME_MIN 0
  149. #define TX_MSDU_LIFETIME_MAX 3000
  150. #define TX_MSDU_LIFETIME_DEF 512
  151. #define RX_MSDU_LIFETIME_MIN 0
  152. #define RX_MSDU_LIFETIME_MAX 0xFFFFFFFF
  153. #define RX_MSDU_LIFETIME_DEF 512000
  154. struct acx_rx_msdu_lifetime {
  155. struct acx_header header;
  156. /*
  157. * The maximum amount of time, in TU, before the
  158. * firmware discards the MSDU.
  159. */
  160. __le32 lifetime;
  161. } __attribute__ ((packed));
  162. /*
  163. * RX Config Options Table
  164. * Bit Definition
  165. * === ==========
  166. * 31:14 Reserved
  167. * 13 Copy RX Status - when set, write three receive status words
  168. * to top of rx'd MPDUs.
  169. * When cleared, do not write three status words (added rev 1.5)
  170. * 12 Reserved
  171. * 11 RX Complete upon FCS error - when set, give rx complete
  172. * interrupt for FCS errors, after the rx filtering, e.g. unicast
  173. * frames not to us with FCS error will not generate an interrupt.
  174. * 10 SSID Filter Enable - When set, the WiLink discards all beacon,
  175. * probe request, and probe response frames with an SSID that does
  176. * not match the SSID specified by the host in the START/JOIN
  177. * command.
  178. * When clear, the WiLink receives frames with any SSID.
  179. * 9 Broadcast Filter Enable - When set, the WiLink discards all
  180. * broadcast frames. When clear, the WiLink receives all received
  181. * broadcast frames.
  182. * 8:6 Reserved
  183. * 5 BSSID Filter Enable - When set, the WiLink discards any frames
  184. * with a BSSID that does not match the BSSID specified by the
  185. * host.
  186. * When clear, the WiLink receives frames from any BSSID.
  187. * 4 MAC Addr Filter - When set, the WiLink discards any frames
  188. * with a destination address that does not match the MAC address
  189. * of the adaptor.
  190. * When clear, the WiLink receives frames destined to any MAC
  191. * address.
  192. * 3 Promiscuous - When set, the WiLink receives all valid frames
  193. * (i.e., all frames that pass the FCS check).
  194. * When clear, only frames that pass the other filters specified
  195. * are received.
  196. * 2 FCS - When set, the WiLink includes the FCS with the received
  197. * frame.
  198. * When cleared, the FCS is discarded.
  199. * 1 PLCP header - When set, write all data from baseband to frame
  200. * buffer including PHY header.
  201. * 0 Reserved - Always equal to 0.
  202. *
  203. * RX Filter Options Table
  204. * Bit Definition
  205. * === ==========
  206. * 31:12 Reserved - Always equal to 0.
  207. * 11 Association - When set, the WiLink receives all association
  208. * related frames (association request/response, reassocation
  209. * request/response, and disassociation). When clear, these frames
  210. * are discarded.
  211. * 10 Auth/De auth - When set, the WiLink receives all authentication
  212. * and de-authentication frames. When clear, these frames are
  213. * discarded.
  214. * 9 Beacon - When set, the WiLink receives all beacon frames.
  215. * When clear, these frames are discarded.
  216. * 8 Contention Free - When set, the WiLink receives all contention
  217. * free frames.
  218. * When clear, these frames are discarded.
  219. * 7 Control - When set, the WiLink receives all control frames.
  220. * When clear, these frames are discarded.
  221. * 6 Data - When set, the WiLink receives all data frames.
  222. * When clear, these frames are discarded.
  223. * 5 FCS Error - When set, the WiLink receives frames that have FCS
  224. * errors.
  225. * When clear, these frames are discarded.
  226. * 4 Management - When set, the WiLink receives all management
  227. * frames.
  228. * When clear, these frames are discarded.
  229. * 3 Probe Request - When set, the WiLink receives all probe request
  230. * frames.
  231. * When clear, these frames are discarded.
  232. * 2 Probe Response - When set, the WiLink receives all probe
  233. * response frames.
  234. * When clear, these frames are discarded.
  235. * 1 RTS/CTS/ACK - When set, the WiLink receives all RTS, CTS and ACK
  236. * frames.
  237. * When clear, these frames are discarded.
  238. * 0 Rsvd Type/Sub Type - When set, the WiLink receives all frames
  239. * that have reserved frame types and sub types as defined by the
  240. * 802.11 specification.
  241. * When clear, these frames are discarded.
  242. */
  243. struct acx_rx_config {
  244. struct acx_header header;
  245. __le32 config_options;
  246. __le32 filter_options;
  247. } __attribute__ ((packed));
  248. struct acx_packet_detection {
  249. struct acx_header header;
  250. __le32 threshold;
  251. } __attribute__ ((packed));
  252. enum acx_slot_type {
  253. SLOT_TIME_LONG = 0,
  254. SLOT_TIME_SHORT = 1,
  255. DEFAULT_SLOT_TIME = SLOT_TIME_SHORT,
  256. MAX_SLOT_TIMES = 0xFF
  257. };
  258. #define STATION_WONE_INDEX 0
  259. struct acx_slot {
  260. struct acx_header header;
  261. u8 wone_index; /* Reserved */
  262. u8 slot_time;
  263. u8 reserved[6];
  264. } __attribute__ ((packed));
  265. #define ACX_MC_ADDRESS_GROUP_MAX (8)
  266. #define ADDRESS_GROUP_MAX_LEN (ETH_ALEN * ACX_MC_ADDRESS_GROUP_MAX)
  267. struct acx_dot11_grp_addr_tbl {
  268. struct acx_header header;
  269. u8 enabled;
  270. u8 num_groups;
  271. u8 pad[2];
  272. u8 mac_table[ADDRESS_GROUP_MAX_LEN];
  273. } __attribute__ ((packed));
  274. struct acx_rx_timeout {
  275. struct acx_header header;
  276. __le16 ps_poll_timeout;
  277. __le16 upsd_timeout;
  278. } __attribute__ ((packed));
  279. struct acx_rts_threshold {
  280. struct acx_header header;
  281. __le16 threshold;
  282. u8 pad[2];
  283. } __attribute__ ((packed));
  284. struct acx_beacon_filter_option {
  285. struct acx_header header;
  286. u8 enable;
  287. /*
  288. * The number of beacons without the unicast TIM
  289. * bit set that the firmware buffers before
  290. * signaling the host about ready frames.
  291. * When set to 0 and the filter is enabled, beacons
  292. * without the unicast TIM bit set are dropped.
  293. */
  294. u8 max_num_beacons;
  295. u8 pad[2];
  296. } __attribute__ ((packed));
  297. /*
  298. * ACXBeaconFilterEntry (not 221)
  299. * Byte Offset Size (Bytes) Definition
  300. * =========== ============ ==========
  301. * 0 1 IE identifier
  302. * 1 1 Treatment bit mask
  303. *
  304. * ACXBeaconFilterEntry (221)
  305. * Byte Offset Size (Bytes) Definition
  306. * =========== ============ ==========
  307. * 0 1 IE identifier
  308. * 1 1 Treatment bit mask
  309. * 2 3 OUI
  310. * 5 1 Type
  311. * 6 2 Version
  312. *
  313. *
  314. * Treatment bit mask - The information element handling:
  315. * bit 0 - The information element is compared and transferred
  316. * in case of change.
  317. * bit 1 - The information element is transferred to the host
  318. * with each appearance or disappearance.
  319. * Note that both bits can be set at the same time.
  320. */
  321. #define BEACON_FILTER_TABLE_MAX_IE_NUM (32)
  322. #define BEACON_FILTER_TABLE_MAX_VENDOR_SPECIFIC_IE_NUM (6)
  323. #define BEACON_FILTER_TABLE_IE_ENTRY_SIZE (2)
  324. #define BEACON_FILTER_TABLE_EXTRA_VENDOR_SPECIFIC_IE_SIZE (6)
  325. #define BEACON_FILTER_TABLE_MAX_SIZE ((BEACON_FILTER_TABLE_MAX_IE_NUM * \
  326. BEACON_FILTER_TABLE_IE_ENTRY_SIZE) + \
  327. (BEACON_FILTER_TABLE_MAX_VENDOR_SPECIFIC_IE_NUM * \
  328. BEACON_FILTER_TABLE_EXTRA_VENDOR_SPECIFIC_IE_SIZE))
  329. struct acx_beacon_filter_ie_table {
  330. struct acx_header header;
  331. u8 num_ie;
  332. u8 table[BEACON_FILTER_TABLE_MAX_SIZE];
  333. u8 pad[3];
  334. } __attribute__ ((packed));
  335. struct acx_conn_monit_params {
  336. struct acx_header header;
  337. __le32 synch_fail_thold; /* number of beacons missed */
  338. __le32 bss_lose_timeout; /* number of TU's from synch fail */
  339. } __attribute__ ((packed));
  340. enum {
  341. SG_ENABLE = 0,
  342. SG_DISABLE,
  343. SG_SENSE_NO_ACTIVITY,
  344. SG_SENSE_ACTIVE
  345. };
  346. struct acx_bt_wlan_coex {
  347. struct acx_header header;
  348. /*
  349. * 0 -> PTA enabled
  350. * 1 -> PTA disabled
  351. * 2 -> sense no active mode, i.e.
  352. * an interrupt is sent upon
  353. * BT activity.
  354. * 3 -> PTA is switched on in response
  355. * to the interrupt sending.
  356. */
  357. u8 enable;
  358. u8 pad[3];
  359. } __attribute__ ((packed));
  360. struct acx_smart_reflex_state {
  361. struct acx_header header;
  362. u8 enable;
  363. u8 padding[3];
  364. } __attribute__ ((packed));
  365. struct smart_reflex_err_table {
  366. u8 len;
  367. s8 upper_limit;
  368. s8 values[14];
  369. } __attribute__ ((packed));
  370. struct acx_smart_reflex_config_params {
  371. struct acx_header header;
  372. struct smart_reflex_err_table error_table[3];
  373. } __attribute__ ((packed));
  374. #define PTA_ANTENNA_TYPE_DEF (0)
  375. #define PTA_BT_HP_MAXTIME_DEF (2000)
  376. #define PTA_WLAN_HP_MAX_TIME_DEF (5000)
  377. #define PTA_SENSE_DISABLE_TIMER_DEF (1350)
  378. #define PTA_PROTECTIVE_RX_TIME_DEF (1500)
  379. #define PTA_PROTECTIVE_TX_TIME_DEF (1500)
  380. #define PTA_TIMEOUT_NEXT_BT_LP_PACKET_DEF (3000)
  381. #define PTA_SIGNALING_TYPE_DEF (1)
  382. #define PTA_AFH_LEVERAGE_ON_DEF (0)
  383. #define PTA_NUMBER_QUIET_CYCLE_DEF (0)
  384. #define PTA_MAX_NUM_CTS_DEF (3)
  385. #define PTA_NUMBER_OF_WLAN_PACKETS_DEF (2)
  386. #define PTA_NUMBER_OF_BT_PACKETS_DEF (2)
  387. #define PTA_PROTECTIVE_RX_TIME_FAST_DEF (1500)
  388. #define PTA_PROTECTIVE_TX_TIME_FAST_DEF (3000)
  389. #define PTA_CYCLE_TIME_FAST_DEF (8700)
  390. #define PTA_RX_FOR_AVALANCHE_DEF (5)
  391. #define PTA_ELP_HP_DEF (0)
  392. #define PTA_ANTI_STARVE_PERIOD_DEF (500)
  393. #define PTA_ANTI_STARVE_NUM_CYCLE_DEF (4)
  394. #define PTA_ALLOW_PA_SD_DEF (1)
  395. #define PTA_TIME_BEFORE_BEACON_DEF (6300)
  396. #define PTA_HPDM_MAX_TIME_DEF (1600)
  397. #define PTA_TIME_OUT_NEXT_WLAN_DEF (2550)
  398. #define PTA_AUTO_MODE_NO_CTS_DEF (0)
  399. #define PTA_BT_HP_RESPECTED_DEF (3)
  400. #define PTA_WLAN_RX_MIN_RATE_DEF (24)
  401. #define PTA_ACK_MODE_DEF (1)
  402. struct acx_bt_wlan_coex_param {
  403. struct acx_header header;
  404. __le32 per_threshold;
  405. __le32 max_scan_compensation_time;
  406. __le16 nfs_sample_interval;
  407. u8 load_ratio;
  408. u8 auto_ps_mode;
  409. u8 probe_req_compensation;
  410. u8 scan_window_compensation;
  411. u8 antenna_config;
  412. u8 beacon_miss_threshold;
  413. __le32 rate_adaptation_threshold;
  414. s8 rate_adaptation_snr;
  415. u8 padding[3];
  416. } __attribute__ ((packed));
  417. struct acx_energy_detection {
  418. struct acx_header header;
  419. /* The RX Clear Channel Assessment threshold in the PHY */
  420. __le16 rx_cca_threshold;
  421. u8 tx_energy_detection;
  422. u8 pad;
  423. } __attribute__ ((packed));
  424. struct acx_beacon_broadcast {
  425. struct acx_header header;
  426. __le16 beacon_rx_timeout;
  427. __le16 broadcast_timeout;
  428. /* Enables receiving of broadcast packets in PS mode */
  429. u8 rx_broadcast_in_ps;
  430. /* Consecutive PS Poll failures before updating the host */
  431. u8 ps_poll_threshold;
  432. u8 pad[2];
  433. } __attribute__ ((packed));
  434. struct acx_event_mask {
  435. struct acx_header header;
  436. __le32 event_mask;
  437. __le32 high_event_mask; /* Unused */
  438. } __attribute__ ((packed));
  439. #define CFG_RX_FCS BIT(2)
  440. #define CFG_RX_ALL_GOOD BIT(3)
  441. #define CFG_UNI_FILTER_EN BIT(4)
  442. #define CFG_BSSID_FILTER_EN BIT(5)
  443. #define CFG_MC_FILTER_EN BIT(6)
  444. #define CFG_MC_ADDR0_EN BIT(7)
  445. #define CFG_MC_ADDR1_EN BIT(8)
  446. #define CFG_BC_REJECT_EN BIT(9)
  447. #define CFG_SSID_FILTER_EN BIT(10)
  448. #define CFG_RX_INT_FCS_ERROR BIT(11)
  449. #define CFG_RX_INT_ENCRYPTED BIT(12)
  450. #define CFG_RX_WR_RX_STATUS BIT(13)
  451. #define CFG_RX_FILTER_NULTI BIT(14)
  452. #define CFG_RX_RESERVE BIT(15)
  453. #define CFG_RX_TIMESTAMP_TSF BIT(16)
  454. #define CFG_RX_RSV_EN BIT(0)
  455. #define CFG_RX_RCTS_ACK BIT(1)
  456. #define CFG_RX_PRSP_EN BIT(2)
  457. #define CFG_RX_PREQ_EN BIT(3)
  458. #define CFG_RX_MGMT_EN BIT(4)
  459. #define CFG_RX_FCS_ERROR BIT(5)
  460. #define CFG_RX_DATA_EN BIT(6)
  461. #define CFG_RX_CTL_EN BIT(7)
  462. #define CFG_RX_CF_EN BIT(8)
  463. #define CFG_RX_BCN_EN BIT(9)
  464. #define CFG_RX_AUTH_EN BIT(10)
  465. #define CFG_RX_ASSOC_EN BIT(11)
  466. #define SCAN_PASSIVE BIT(0)
  467. #define SCAN_5GHZ_BAND BIT(1)
  468. #define SCAN_TRIGGERED BIT(2)
  469. #define SCAN_PRIORITY_HIGH BIT(3)
  470. /* When set, disable HW encryption */
  471. #define DF_ENCRYPTION_DISABLE 0x01
  472. #define DF_SNIFF_MODE_ENABLE 0x80
  473. struct acx_feature_config {
  474. struct acx_header header;
  475. __le32 options;
  476. __le32 data_flow_options;
  477. } __attribute__ ((packed));
  478. struct acx_current_tx_power {
  479. struct acx_header header;
  480. u8 current_tx_power;
  481. u8 padding[3];
  482. } __attribute__ ((packed));
  483. struct acx_wake_up_condition {
  484. struct acx_header header;
  485. u8 wake_up_event; /* Only one bit can be set */
  486. u8 listen_interval;
  487. u8 pad[2];
  488. } __attribute__ ((packed));
  489. struct acx_aid {
  490. struct acx_header header;
  491. /*
  492. * To be set when associated with an AP.
  493. */
  494. __le16 aid;
  495. u8 pad[2];
  496. } __attribute__ ((packed));
  497. enum acx_preamble_type {
  498. ACX_PREAMBLE_LONG = 0,
  499. ACX_PREAMBLE_SHORT = 1
  500. };
  501. struct acx_preamble {
  502. struct acx_header header;
  503. /*
  504. * When set, the WiLink transmits the frames with a short preamble and
  505. * when cleared, the WiLink transmits the frames with a long preamble.
  506. */
  507. u8 preamble;
  508. u8 padding[3];
  509. } __attribute__ ((packed));
  510. enum acx_ctsprotect_type {
  511. CTSPROTECT_DISABLE = 0,
  512. CTSPROTECT_ENABLE = 1
  513. };
  514. struct acx_ctsprotect {
  515. struct acx_header header;
  516. u8 ctsprotect;
  517. u8 padding[3];
  518. } __attribute__ ((packed));
  519. struct acx_tx_statistics {
  520. __le32 internal_desc_overflow;
  521. } __attribute__ ((packed));
  522. struct acx_rx_statistics {
  523. __le32 out_of_mem;
  524. __le32 hdr_overflow;
  525. __le32 hw_stuck;
  526. __le32 dropped;
  527. __le32 fcs_err;
  528. __le32 xfr_hint_trig;
  529. __le32 path_reset;
  530. __le32 reset_counter;
  531. } __attribute__ ((packed));
  532. struct acx_dma_statistics {
  533. __le32 rx_requested;
  534. __le32 rx_errors;
  535. __le32 tx_requested;
  536. __le32 tx_errors;
  537. } __attribute__ ((packed));
  538. struct acx_isr_statistics {
  539. /* host command complete */
  540. __le32 cmd_cmplt;
  541. /* fiqisr() */
  542. __le32 fiqs;
  543. /* (INT_STS_ND & INT_TRIG_RX_HEADER) */
  544. __le32 rx_headers;
  545. /* (INT_STS_ND & INT_TRIG_RX_CMPLT) */
  546. __le32 rx_completes;
  547. /* (INT_STS_ND & INT_TRIG_NO_RX_BUF) */
  548. __le32 rx_mem_overflow;
  549. /* (INT_STS_ND & INT_TRIG_S_RX_RDY) */
  550. __le32 rx_rdys;
  551. /* irqisr() */
  552. __le32 irqs;
  553. /* (INT_STS_ND & INT_TRIG_TX_PROC) */
  554. __le32 tx_procs;
  555. /* (INT_STS_ND & INT_TRIG_DECRYPT_DONE) */
  556. __le32 decrypt_done;
  557. /* (INT_STS_ND & INT_TRIG_DMA0) */
  558. __le32 dma0_done;
  559. /* (INT_STS_ND & INT_TRIG_DMA1) */
  560. __le32 dma1_done;
  561. /* (INT_STS_ND & INT_TRIG_TX_EXC_CMPLT) */
  562. __le32 tx_exch_complete;
  563. /* (INT_STS_ND & INT_TRIG_COMMAND) */
  564. __le32 commands;
  565. /* (INT_STS_ND & INT_TRIG_RX_PROC) */
  566. __le32 rx_procs;
  567. /* (INT_STS_ND & INT_TRIG_PM_802) */
  568. __le32 hw_pm_mode_changes;
  569. /* (INT_STS_ND & INT_TRIG_ACKNOWLEDGE) */
  570. __le32 host_acknowledges;
  571. /* (INT_STS_ND & INT_TRIG_PM_PCI) */
  572. __le32 pci_pm;
  573. /* (INT_STS_ND & INT_TRIG_ACM_WAKEUP) */
  574. __le32 wakeups;
  575. /* (INT_STS_ND & INT_TRIG_LOW_RSSI) */
  576. __le32 low_rssi;
  577. } __attribute__ ((packed));
  578. struct acx_wep_statistics {
  579. /* WEP address keys configured */
  580. __le32 addr_key_count;
  581. /* default keys configured */
  582. __le32 default_key_count;
  583. __le32 reserved;
  584. /* number of times that WEP key not found on lookup */
  585. __le32 key_not_found;
  586. /* number of times that WEP key decryption failed */
  587. __le32 decrypt_fail;
  588. /* WEP packets decrypted */
  589. __le32 packets;
  590. /* WEP decrypt interrupts */
  591. __le32 interrupt;
  592. } __attribute__ ((packed));
  593. #define ACX_MISSED_BEACONS_SPREAD 10
  594. struct acx_pwr_statistics {
  595. /* the amount of enters into power save mode (both PD & ELP) */
  596. __le32 ps_enter;
  597. /* the amount of enters into ELP mode */
  598. __le32 elp_enter;
  599. /* the amount of missing beacon interrupts to the host */
  600. __le32 missing_bcns;
  601. /* the amount of wake on host-access times */
  602. __le32 wake_on_host;
  603. /* the amount of wake on timer-expire */
  604. __le32 wake_on_timer_exp;
  605. /* the number of packets that were transmitted with PS bit set */
  606. __le32 tx_with_ps;
  607. /* the number of packets that were transmitted with PS bit clear */
  608. __le32 tx_without_ps;
  609. /* the number of received beacons */
  610. __le32 rcvd_beacons;
  611. /* the number of entering into PowerOn (power save off) */
  612. __le32 power_save_off;
  613. /* the number of entries into power save mode */
  614. __le16 enable_ps;
  615. /*
  616. * the number of exits from power save, not including failed PS
  617. * transitions
  618. */
  619. __le16 disable_ps;
  620. /*
  621. * the number of times the TSF counter was adjusted because
  622. * of drift
  623. */
  624. __le32 fix_tsf_ps;
  625. /* Gives statistics about the spread continuous missed beacons.
  626. * The 16 LSB are dedicated for the PS mode.
  627. * The 16 MSB are dedicated for the PS mode.
  628. * cont_miss_bcns_spread[0] - single missed beacon.
  629. * cont_miss_bcns_spread[1] - two continuous missed beacons.
  630. * cont_miss_bcns_spread[2] - three continuous missed beacons.
  631. * ...
  632. * cont_miss_bcns_spread[9] - ten and more continuous missed beacons.
  633. */
  634. __le32 cont_miss_bcns_spread[ACX_MISSED_BEACONS_SPREAD];
  635. /* the number of beacons in awake mode */
  636. __le32 rcvd_awake_beacons;
  637. } __attribute__ ((packed));
  638. struct acx_mic_statistics {
  639. __le32 rx_pkts;
  640. __le32 calc_failure;
  641. } __attribute__ ((packed));
  642. struct acx_aes_statistics {
  643. __le32 encrypt_fail;
  644. __le32 decrypt_fail;
  645. __le32 encrypt_packets;
  646. __le32 decrypt_packets;
  647. __le32 encrypt_interrupt;
  648. __le32 decrypt_interrupt;
  649. } __attribute__ ((packed));
  650. struct acx_event_statistics {
  651. __le32 heart_beat;
  652. __le32 calibration;
  653. __le32 rx_mismatch;
  654. __le32 rx_mem_empty;
  655. __le32 rx_pool;
  656. __le32 oom_late;
  657. __le32 phy_transmit_error;
  658. __le32 tx_stuck;
  659. } __attribute__ ((packed));
  660. struct acx_ps_statistics {
  661. __le32 pspoll_timeouts;
  662. __le32 upsd_timeouts;
  663. __le32 upsd_max_sptime;
  664. __le32 upsd_max_apturn;
  665. __le32 pspoll_max_apturn;
  666. __le32 pspoll_utilization;
  667. __le32 upsd_utilization;
  668. } __attribute__ ((packed));
  669. struct acx_rxpipe_statistics {
  670. __le32 rx_prep_beacon_drop;
  671. __le32 descr_host_int_trig_rx_data;
  672. __le32 beacon_buffer_thres_host_int_trig_rx_data;
  673. __le32 missed_beacon_host_int_trig_rx_data;
  674. __le32 tx_xfr_host_int_trig_rx_data;
  675. } __attribute__ ((packed));
  676. struct acx_statistics {
  677. struct acx_header header;
  678. struct acx_tx_statistics tx;
  679. struct acx_rx_statistics rx;
  680. struct acx_dma_statistics dma;
  681. struct acx_isr_statistics isr;
  682. struct acx_wep_statistics wep;
  683. struct acx_pwr_statistics pwr;
  684. struct acx_aes_statistics aes;
  685. struct acx_mic_statistics mic;
  686. struct acx_event_statistics event;
  687. struct acx_ps_statistics ps;
  688. struct acx_rxpipe_statistics rxpipe;
  689. } __attribute__ ((packed));
  690. struct acx_rate_class {
  691. __le32 enabled_rates;
  692. u8 short_retry_limit;
  693. u8 long_retry_limit;
  694. u8 aflags;
  695. u8 reserved;
  696. };
  697. struct acx_rate_policy {
  698. struct acx_header header;
  699. __le32 rate_class_cnt;
  700. struct acx_rate_class rate_class[CONF_TX_MAX_RATE_CLASSES];
  701. } __attribute__ ((packed));
  702. struct acx_ac_cfg {
  703. struct acx_header header;
  704. u8 ac;
  705. u8 cw_min;
  706. __le16 cw_max;
  707. u8 aifsn;
  708. u8 reserved;
  709. __le16 tx_op_limit;
  710. } __attribute__ ((packed));
  711. struct acx_tid_config {
  712. struct acx_header header;
  713. u8 queue_id;
  714. u8 channel_type;
  715. u8 tsid;
  716. u8 ps_scheme;
  717. u8 ack_policy;
  718. u8 padding[3];
  719. __le32 apsd_conf[2];
  720. } __attribute__ ((packed));
  721. struct acx_frag_threshold {
  722. struct acx_header header;
  723. __le16 frag_threshold;
  724. u8 padding[2];
  725. } __attribute__ ((packed));
  726. struct acx_tx_config_options {
  727. struct acx_header header;
  728. __le16 tx_compl_timeout; /* msec */
  729. __le16 tx_compl_threshold; /* number of packets */
  730. } __attribute__ ((packed));
  731. #define ACX_RX_MEM_BLOCKS 64
  732. #define ACX_TX_MIN_MEM_BLOCKS 64
  733. #define ACX_TX_DESCRIPTORS 32
  734. #define ACX_NUM_SSID_PROFILES 1
  735. struct wl1271_acx_config_memory {
  736. struct acx_header header;
  737. u8 rx_mem_block_num;
  738. u8 tx_min_mem_block_num;
  739. u8 num_stations;
  740. u8 num_ssid_profiles;
  741. __le32 total_tx_descriptors;
  742. } __attribute__ ((packed));
  743. struct wl1271_acx_mem_map {
  744. struct acx_header header;
  745. __le32 code_start;
  746. __le32 code_end;
  747. __le32 wep_defkey_start;
  748. __le32 wep_defkey_end;
  749. __le32 sta_table_start;
  750. __le32 sta_table_end;
  751. __le32 packet_template_start;
  752. __le32 packet_template_end;
  753. /* Address of the TX result interface (control block) */
  754. __le32 tx_result;
  755. __le32 tx_result_queue_start;
  756. __le32 queue_memory_start;
  757. __le32 queue_memory_end;
  758. __le32 packet_memory_pool_start;
  759. __le32 packet_memory_pool_end;
  760. __le32 debug_buffer1_start;
  761. __le32 debug_buffer1_end;
  762. __le32 debug_buffer2_start;
  763. __le32 debug_buffer2_end;
  764. /* Number of blocks FW allocated for TX packets */
  765. __le32 num_tx_mem_blocks;
  766. /* Number of blocks FW allocated for RX packets */
  767. __le32 num_rx_mem_blocks;
  768. /* the following 4 fields are valid in SLAVE mode only */
  769. u8 *tx_cbuf;
  770. u8 *rx_cbuf;
  771. __le32 rx_ctrl;
  772. __le32 tx_ctrl;
  773. } __attribute__ ((packed));
  774. struct wl1271_acx_rx_config_opt {
  775. struct acx_header header;
  776. __le16 mblk_threshold;
  777. __le16 threshold;
  778. __le16 timeout;
  779. u8 queue_type;
  780. u8 reserved;
  781. } __attribute__ ((packed));
  782. struct wl1271_acx_bet_enable {
  783. struct acx_header header;
  784. u8 enable;
  785. u8 max_consecutive;
  786. u8 padding[2];
  787. } __attribute__ ((packed));
  788. #define ACX_IPV4_VERSION 4
  789. #define ACX_IPV6_VERSION 6
  790. #define ACX_IPV4_ADDR_SIZE 4
  791. struct wl1271_acx_arp_filter {
  792. struct acx_header header;
  793. u8 version; /* ACX_IPV4_VERSION, ACX_IPV6_VERSION */
  794. u8 enable; /* 1 to enable ARP filtering, 0 to disable */
  795. u8 padding[2];
  796. u8 address[16]; /* The configured device IP address - all ARP
  797. requests directed to this IP address will pass
  798. through. For IPv4, the first four bytes are
  799. used. */
  800. } __attribute__((packed));
  801. enum {
  802. ACX_WAKE_UP_CONDITIONS = 0x0002,
  803. ACX_MEM_CFG = 0x0003,
  804. ACX_SLOT = 0x0004,
  805. ACX_AC_CFG = 0x0007,
  806. ACX_MEM_MAP = 0x0008,
  807. ACX_AID = 0x000A,
  808. /* ACX_FW_REV is missing in the ref driver, but seems to work */
  809. ACX_FW_REV = 0x000D,
  810. ACX_MEDIUM_USAGE = 0x000F,
  811. ACX_RX_CFG = 0x0010,
  812. ACX_TX_QUEUE_CFG = 0x0011, /* FIXME: only used by wl1251 */
  813. ACX_STATISTICS = 0x0013, /* Debug API */
  814. ACX_PWR_CONSUMPTION_STATISTICS = 0x0014,
  815. ACX_FEATURE_CFG = 0x0015,
  816. ACX_TID_CFG = 0x001A,
  817. ACX_PS_RX_STREAMING = 0x001B,
  818. ACX_BEACON_FILTER_OPT = 0x001F,
  819. ACX_NOISE_HIST = 0x0021,
  820. ACX_HDK_VERSION = 0x0022, /* ??? */
  821. ACX_PD_THRESHOLD = 0x0023,
  822. ACX_TX_CONFIG_OPT = 0x0024,
  823. ACX_CCA_THRESHOLD = 0x0025,
  824. ACX_EVENT_MBOX_MASK = 0x0026,
  825. ACX_CONN_MONIT_PARAMS = 0x002D,
  826. ACX_CONS_TX_FAILURE = 0x002F,
  827. ACX_BCN_DTIM_OPTIONS = 0x0031,
  828. ACX_SG_ENABLE = 0x0032,
  829. ACX_SG_CFG = 0x0033,
  830. ACX_BEACON_FILTER_TABLE = 0x0038,
  831. ACX_ARP_IP_FILTER = 0x0039,
  832. ACX_ROAMING_STATISTICS_TBL = 0x003B,
  833. ACX_RATE_POLICY = 0x003D,
  834. ACX_CTS_PROTECTION = 0x003E,
  835. ACX_SLEEP_AUTH = 0x003F,
  836. ACX_PREAMBLE_TYPE = 0x0040,
  837. ACX_ERROR_CNT = 0x0041,
  838. ACX_IBSS_FILTER = 0x0044,
  839. ACX_SERVICE_PERIOD_TIMEOUT = 0x0045,
  840. ACX_TSF_INFO = 0x0046,
  841. ACX_CONFIG_PS_WMM = 0x0049,
  842. ACX_ENABLE_RX_DATA_FILTER = 0x004A,
  843. ACX_SET_RX_DATA_FILTER = 0x004B,
  844. ACX_GET_DATA_FILTER_STATISTICS = 0x004C,
  845. ACX_RX_CONFIG_OPT = 0x004E,
  846. ACX_FRAG_CFG = 0x004F,
  847. ACX_BET_ENABLE = 0x0050,
  848. ACX_RSSI_SNR_TRIGGER = 0x0051,
  849. ACX_RSSI_SNR_WEIGHTS = 0x0051,
  850. ACX_KEEP_ALIVE_MODE = 0x0052,
  851. ACX_SET_KEEP_ALIVE_CONFIG = 0x0054,
  852. ACX_BA_SESSION_RESPONDER_POLICY = 0x0055,
  853. ACX_BA_SESSION_INITIATOR_POLICY = 0x0056,
  854. ACX_PEER_HT_CAP = 0x0057,
  855. ACX_HT_BSS_OPERATION = 0x0058,
  856. ACX_COEX_ACTIVITY = 0x0059,
  857. ACX_SET_SMART_REFLEX_DEBUG = 0x005A,
  858. ACX_SET_SMART_REFLEX_STATE = 0x005B,
  859. ACX_SET_SMART_REFLEX_PARAMS = 0x005F,
  860. DOT11_RX_MSDU_LIFE_TIME = 0x1004,
  861. DOT11_CUR_TX_PWR = 0x100D,
  862. DOT11_RX_DOT11_MODE = 0x1012,
  863. DOT11_RTS_THRESHOLD = 0x1013,
  864. DOT11_GROUP_ADDRESS_TBL = 0x1014,
  865. MAX_DOT11_IE = DOT11_GROUP_ADDRESS_TBL,
  866. MAX_IE = 0xFFFF
  867. };
  868. int wl1271_acx_wake_up_conditions(struct wl1271 *wl);
  869. int wl1271_acx_sleep_auth(struct wl1271 *wl, u8 sleep_auth);
  870. int wl1271_acx_fw_version(struct wl1271 *wl, char *buf, size_t len);
  871. int wl1271_acx_tx_power(struct wl1271 *wl, int power);
  872. int wl1271_acx_feature_cfg(struct wl1271 *wl);
  873. int wl1271_acx_mem_map(struct wl1271 *wl,
  874. struct acx_header *mem_map, size_t len);
  875. int wl1271_acx_rx_msdu_life_time(struct wl1271 *wl);
  876. int wl1271_acx_rx_config(struct wl1271 *wl, u32 config, u32 filter);
  877. int wl1271_acx_pd_threshold(struct wl1271 *wl);
  878. int wl1271_acx_slot(struct wl1271 *wl, enum acx_slot_type slot_time);
  879. int wl1271_acx_group_address_tbl(struct wl1271 *wl, bool enable,
  880. void *mc_list, u32 mc_list_len);
  881. int wl1271_acx_service_period_timeout(struct wl1271 *wl);
  882. int wl1271_acx_rts_threshold(struct wl1271 *wl, u16 rts_threshold);
  883. int wl1271_acx_beacon_filter_opt(struct wl1271 *wl, bool enable_filter);
  884. int wl1271_acx_beacon_filter_table(struct wl1271 *wl);
  885. int wl1271_acx_conn_monit_params(struct wl1271 *wl);
  886. int wl1271_acx_sg_enable(struct wl1271 *wl);
  887. int wl1271_acx_sg_cfg(struct wl1271 *wl);
  888. int wl1271_acx_cca_threshold(struct wl1271 *wl);
  889. int wl1271_acx_bcn_dtim_options(struct wl1271 *wl);
  890. int wl1271_acx_aid(struct wl1271 *wl, u16 aid);
  891. int wl1271_acx_event_mbox_mask(struct wl1271 *wl, u32 event_mask);
  892. int wl1271_acx_set_preamble(struct wl1271 *wl, enum acx_preamble_type preamble);
  893. int wl1271_acx_cts_protect(struct wl1271 *wl,
  894. enum acx_ctsprotect_type ctsprotect);
  895. int wl1271_acx_statistics(struct wl1271 *wl, struct acx_statistics *stats);
  896. int wl1271_acx_rate_policies(struct wl1271 *wl, u32 enabled_rates);
  897. int wl1271_acx_ac_cfg(struct wl1271 *wl);
  898. int wl1271_acx_tid_cfg(struct wl1271 *wl);
  899. int wl1271_acx_frag_threshold(struct wl1271 *wl);
  900. int wl1271_acx_tx_config_options(struct wl1271 *wl);
  901. int wl1271_acx_mem_cfg(struct wl1271 *wl);
  902. int wl1271_acx_init_mem_config(struct wl1271 *wl);
  903. int wl1271_acx_init_rx_interrupt(struct wl1271 *wl);
  904. int wl1271_acx_smart_reflex(struct wl1271 *wl);
  905. int wl1271_acx_bet_enable(struct wl1271 *wl, bool enable);
  906. int wl1271_acx_arp_ip_filter(struct wl1271 *wl, bool enable, u8 *address,
  907. u8 version);
  908. #endif /* __WL1271_ACX_H__ */