38
38
#define DRIVER_NAME "wl1271"
39
39
#define DRIVER_PREFIX DRIVER_NAME ": "
42
* FW versions support BA 11n
43
* versions marks x.x.x.50-60.x
45
#define WL12XX_BA_SUPPORT_FW_COST_VER2_START 50
46
#define WL12XX_BA_SUPPORT_FW_COST_VER2_END 60
43
50
DEBUG_IRQ = BIT(0),
106
#define WL1271_DEFAULT_RX_CONFIG (CFG_UNI_FILTER_EN | \
115
#define WL1271_DEFAULT_STA_RX_CONFIG (CFG_UNI_FILTER_EN | \
107
116
CFG_BSSID_FILTER_EN | \
108
117
CFG_MC_FILTER_EN)
110
#define WL1271_DEFAULT_RX_FILTER (CFG_RX_RCTS_ACK | CFG_RX_PRSP_EN | \
119
#define WL1271_DEFAULT_STA_RX_FILTER (CFG_RX_RCTS_ACK | CFG_RX_PRSP_EN | \
111
120
CFG_RX_MGMT_EN | CFG_RX_DATA_EN | \
112
121
CFG_RX_CTL_EN | CFG_RX_BCN_EN | \
113
122
CFG_RX_AUTH_EN | CFG_RX_ASSOC_EN)
115
#define WL1271_FW_NAME "ti-connectivity/wl1271-fw.bin"
116
#define WL1271_NVS_NAME "ti-connectivity/wl1271-nvs.bin"
124
#define WL1271_DEFAULT_AP_RX_CONFIG 0
126
#define WL1271_DEFAULT_AP_RX_FILTER (CFG_RX_RCTS_ACK | CFG_RX_PREQ_EN | \
127
CFG_RX_MGMT_EN | CFG_RX_DATA_EN | \
128
CFG_RX_CTL_EN | CFG_RX_AUTH_EN | \
133
#define WL1271_FW_NAME "ti-connectivity/wl1271-fw-2.bin"
134
#define WL128X_FW_NAME "ti-connectivity/wl128x-fw.bin"
135
#define WL127X_AP_FW_NAME "ti-connectivity/wl1271-fw-ap.bin"
136
#define WL128X_AP_FW_NAME "ti-connectivity/wl128x-fw-ap.bin"
139
* wl127x and wl128x are using the same NVS file name. However, the
140
* ini parameters between them are different. The driver validates
141
* the correct NVS size in wl1271_boot_upload_nvs().
143
#define WL12XX_NVS_NAME "ti-connectivity/wl1271-nvs.bin"
118
145
#define WL1271_TX_SECURITY_LO16(s) ((u16)((s) & 0xffff))
119
146
#define WL1271_TX_SECURITY_HI32(s) ((u32)(((s) >> 16) & 0xffffffff))
129
156
#define WL1271_DEFAULT_BEACON_INT 100
130
157
#define WL1271_DEFAULT_DTIM_PERIOD 1
159
#define WL1271_AP_GLOBAL_HLID 0
160
#define WL1271_AP_BROADCAST_HLID 1
161
#define WL1271_AP_STA_HLID_START 2
164
* When in AP-mode, we allow (at least) this number of mem-blocks
165
* to be transmitted to FW for a STA in PS-mode. Only when packets are
166
* present in the FW buffers it will wake the sleeping STA. We want to put
167
* enough packets for the driver to transmit all of its buffered data before
168
* the STA goes to sleep again. But we don't want to take too much mem-blocks
169
* as it might hurt the throughput of active STAs.
170
* The number of blocks (18) is enough for 2 large packets.
172
#define WL1271_PS_STA_MAX_BLOCKS (2 * 9)
174
#define WL1271_AP_BSS_INDEX 0
175
#define WL1271_AP_DEF_INACTIV_SEC 300
176
#define WL1271_AP_DEF_BEACON_EXP 20
132
178
#define ACX_TX_DESCRIPTORS 32
134
180
#define WL1271_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
164
/* FIXME: I'm not sure about this structure name */
220
#define FW_VER_CHIP_WL127X 6
221
#define FW_VER_CHIP_WL128X 7
223
#define FW_VER_IF_TYPE_STA 1
224
#define FW_VER_IF_TYPE_AP 2
226
#define FW_VER_MINOR_1_SPARE_STA_MIN 58
227
#define FW_VER_MINOR_1_SPARE_AP_MIN 47
165
229
struct wl1271_chip {
231
char fw_ver_str[ETHTOOL_BUSINFO_LEN];
232
unsigned int fw_ver[NUM_FW_VER];
170
235
struct wl1271_stats {
178
243
#define NUM_TX_QUEUES 4
179
244
#define NUM_RX_PKT_DESC 8
181
/* FW status registers */
182
struct wl1271_fw_status {
246
#define AP_MAX_STATIONS 5
248
/* Broadcast and Global links + links to stations */
249
#define AP_MAX_LINKS (AP_MAX_STATIONS + 2)
251
/* FW status registers common for AP/STA */
252
struct wl1271_fw_common_status {
184
254
u8 fw_rx_counter;
185
255
u8 drv_rx_counter;
188
258
__le32 rx_pkt_descs[NUM_RX_PKT_DESC];
189
259
__le32 tx_released_blks[NUM_TX_QUEUES];
190
260
__le32 fw_localtime;
263
/* FW status registers for AP */
264
struct wl1271_fw_ap_status {
265
struct wl1271_fw_common_status common;
267
/* Next fields valid only in AP FW */
270
* A bitmap (where each bit represents a single HLID)
271
* to indicate if the station is in PS mode.
273
__le32 link_ps_bitmap;
275
/* Number of freed MBs per HLID */
276
u8 tx_lnk_free_blks[AP_MAX_LINKS];
280
/* FW status registers for STA */
281
struct wl1271_fw_sta_status {
282
struct wl1271_fw_common_status common;
287
/* Total structure size is 68 bytes */
291
struct wl1271_fw_full_status {
293
struct wl1271_fw_common_status common;
294
struct wl1271_fw_sta_status sta;
295
struct wl1271_fw_ap_status ap;
194
300
struct wl1271_rx_mem_pool_addr {
305
#define WL1271_MAX_CHANNELS 64
199
306
struct wl1271_scan {
200
307
struct cfg80211_scan_request *req;
308
unsigned long scanned_ch[BITS_TO_LONGS(WL1271_MAX_CHANNELS)];
204
311
u8 ssid[IW_ESSID_MAX_SIZE+1];
216
323
struct device* (*dev)(struct wl1271 *wl);
217
324
void (*enable_irq)(struct wl1271 *wl);
218
325
void (*disable_irq)(struct wl1271 *wl);
326
void (*set_block_size) (struct wl1271 *wl, unsigned int blksz);
329
#define MAX_NUM_KEYS 14
330
#define MAX_KEY_SIZE 32
332
struct wl1271_ap_key {
336
u8 key[MAX_KEY_SIZE];
343
WL1271_FLAG_STA_ASSOCIATED,
345
WL1271_FLAG_GPIO_POWER,
346
WL1271_FLAG_TX_QUEUE_STOPPED,
347
WL1271_FLAG_TX_PENDING,
349
WL1271_FLAG_ELP_REQUESTED,
351
WL1271_FLAG_PSM_REQUESTED,
352
WL1271_FLAG_IRQ_RUNNING,
354
WL1271_FLAG_PSPOLL_FAILURE,
355
WL1271_FLAG_STA_STATE_SENT,
356
WL1271_FLAG_FW_TX_BUSY,
357
WL1271_FLAG_AP_STARTED,
358
WL1271_FLAG_IF_INITIALIZED,
359
WL1271_FLAG_DUMMY_PACKET_PENDING,
360
WL1271_FLAG_SUSPENDED,
361
WL1271_FLAG_PENDING_WORK,
365
/* AP-mode - TX queue per AC in link */
366
struct sk_buff_head tx_queue[NUM_TX_QUEUES];
368
/* accounting for allocated / available TX blocks in FW */
236
390
enum wl1271_state state;
237
391
struct mutex mutex;
239
#define WL1271_FLAG_STA_RATES_CHANGED (0)
240
#define WL1271_FLAG_STA_ASSOCIATED (1)
241
#define WL1271_FLAG_JOINED (2)
242
#define WL1271_FLAG_GPIO_POWER (3)
243
#define WL1271_FLAG_TX_QUEUE_STOPPED (4)
244
#define WL1271_FLAG_IN_ELP (5)
245
#define WL1271_FLAG_PSM (6)
246
#define WL1271_FLAG_PSM_REQUESTED (7)
247
#define WL1271_FLAG_IRQ_PENDING (8)
248
#define WL1271_FLAG_IRQ_RUNNING (9)
249
#define WL1271_FLAG_IDLE (10)
250
#define WL1271_FLAG_IDLE_REQUESTED (11)
251
#define WL1271_FLAG_PSPOLL_FAILURE (12)
252
#define WL1271_FLAG_STA_STATE_SENT (13)
253
#define WL1271_FLAG_FW_TX_BUSY (14)
254
393
unsigned long flags;
256
395
struct wl1271_partition_set part;
295
436
struct sk_buff_head tx_queue[NUM_TX_QUEUES];
296
437
int tx_queue_count;
439
/* Frames received, not handled yet by mac80211 */
440
struct sk_buff_head deferred_rx_queue;
442
/* Frames sent, not returned yet to mac80211 */
443
struct sk_buff_head deferred_tx_queue;
298
445
struct work_struct tx_work;
300
447
/* Pending TX frames */
315
462
/* Intermediate buffer, used for packet aggregation */
318
/* The target interrupt mask */
319
struct work_struct irq_work;
465
/* Reusable dummy packet template */
466
struct sk_buff *dummy_packet;
468
/* Network stack work */
469
struct work_struct netstack_work;
321
471
/* Hardware recovery work */
322
472
struct work_struct recovery_work;
378
530
int last_rssi_event;
380
532
struct wl1271_stats stats;
381
struct dentry *rootdir;
383
534
__le32 buffer_32;
385
536
u32 buffer_busyword[WL1271_BUSY_WORD_CNT];
387
struct wl1271_fw_status *fw_status;
538
struct wl1271_fw_full_status *fw_status;
388
539
struct wl1271_tx_hw_res_if *tx_res_if;
390
541
struct ieee80211_vif *vif;
401
552
/* Most recently reported noise in dBm */
555
/* map for HLIDs of associated stations - when operating in AP mode */
556
unsigned long ap_hlid_map[BITS_TO_LONGS(AP_MAX_STATIONS)];
558
/* recoreded keys for AP-mode - set here before AP startup */
559
struct wl1271_ap_key *recorded_ap_keys[MAX_NUM_KEYS];
561
/* bands supported by this instance of wl12xx */
562
struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
564
/* RX BA constraint value */
571
* wowlan trigger was configured during suspend.
572
* (currently, only "ANY" trigger is supported)
577
* AP-mode - links indexed by HLID. The global and broadcast links
580
struct wl1271_link links[AP_MAX_LINKS];
582
/* the hlid of the link where the last transmitted skb came from */
585
/* AP-mode - a bitmap of links currently in PS mode according to FW */
588
/* AP-mode - a bitmap of links currently in PS mode in mac80211 */
589
unsigned long ap_ps_map;
591
/* Quirks of specific hardware revisions */
594
/* Platform limitations */
595
unsigned int platform_quirks;
598
struct wl1271_station {
405
602
int wl1271_plt_start(struct wl1271 *wl);
414
611
#define WL1271_TX_QUEUE_LOW_WATERMARK 10
415
612
#define WL1271_TX_QUEUE_HIGH_WATERMARK 25
614
#define WL1271_DEFERRED_QUEUE_LIMIT 64
417
616
/* WL1271 needs a 200ms sleep after power on, and a 20ms sleep before power
418
617
on in case is has been shut down shortly before */
419
618
#define WL1271_PRE_POWER_ON_SLEEP 20 /* in milliseconds */
423
622
#define HW_BG_RATES_MASK 0xffff
424
623
#define HW_HT_RATES_OFFSET 16
627
/* Each RX/TX transaction requires an end-of-transaction transfer */
628
#define WL12XX_QUIRK_END_OF_TRANSACTION BIT(0)
631
* Older firmwares use 2 spare TX blocks
632
* (for STA < 6.1.3.50.58 or for AP < 6.2.0.0.47)
634
#define WL12XX_QUIRK_USE_2_SPARE_BLOCKS BIT(1)
636
/* WL128X requires aggregated packets to be aligned to the SDIO block size */
637
#define WL12XX_QUIRK_BLOCKSIZE_ALIGNMENT BIT(2)