~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/net/wireless/wl12xx/wl12xx.h

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
#define DRIVER_NAME "wl1271"
39
39
#define DRIVER_PREFIX DRIVER_NAME ": "
40
40
 
 
41
/*
 
42
 * FW versions support BA 11n
 
43
 * versions marks x.x.x.50-60.x
 
44
 */
 
45
#define WL12XX_BA_SUPPORT_FW_COST_VER2_START    50
 
46
#define WL12XX_BA_SUPPORT_FW_COST_VER2_END      60
 
47
 
41
48
enum {
42
49
        DEBUG_NONE      = 0,
43
50
        DEBUG_IRQ       = BIT(0),
57
64
        DEBUG_SDIO      = BIT(14),
58
65
        DEBUG_FILTERS   = BIT(15),
59
66
        DEBUG_ADHOC     = BIT(16),
 
67
        DEBUG_AP        = BIT(17),
 
68
        DEBUG_MASTER    = (DEBUG_ADHOC | DEBUG_AP),
60
69
        DEBUG_ALL       = ~0,
61
70
};
62
71
 
103
112
                                       true);                           \
104
113
        } while (0)
105
114
 
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)
109
118
 
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)
114
123
 
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
 
125
 
 
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 | \
 
129
                                  CFG_RX_ASSOC_EN)
 
130
 
 
131
 
 
132
 
 
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"
 
137
 
 
138
/*
 
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().
 
142
 */
 
143
#define WL12XX_NVS_NAME "ti-connectivity/wl1271-nvs.bin"
117
144
 
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
131
158
 
 
159
#define WL1271_AP_GLOBAL_HLID      0
 
160
#define WL1271_AP_BROADCAST_HLID   1
 
161
#define WL1271_AP_STA_HLID_START   2
 
162
 
 
163
/*
 
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.
 
171
 */
 
172
#define WL1271_PS_STA_MAX_BLOCKS  (2 * 9)
 
173
 
 
174
#define WL1271_AP_BSS_INDEX        0
 
175
#define WL1271_AP_DEF_INACTIV_SEC  300
 
176
#define WL1271_AP_DEF_BEACON_EXP   20
 
177
 
132
178
#define ACX_TX_DESCRIPTORS         32
133
179
 
134
180
#define WL1271_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
161
207
 
162
208
struct wl1271;
163
209
 
164
 
/* FIXME: I'm not sure about this structure name */
 
210
enum {
 
211
        FW_VER_CHIP,
 
212
        FW_VER_IF_TYPE,
 
213
        FW_VER_MAJOR,
 
214
        FW_VER_SUBTYPE,
 
215
        FW_VER_MINOR,
 
216
 
 
217
        NUM_FW_VER
 
218
};
 
219
 
 
220
#define FW_VER_CHIP_WL127X 6
 
221
#define FW_VER_CHIP_WL128X 7
 
222
 
 
223
#define FW_VER_IF_TYPE_STA 1
 
224
#define FW_VER_IF_TYPE_AP  2
 
225
 
 
226
#define FW_VER_MINOR_1_SPARE_STA_MIN 58
 
227
#define FW_VER_MINOR_1_SPARE_AP_MIN  47
 
228
 
165
229
struct wl1271_chip {
166
230
        u32 id;
167
 
        char fw_ver[21];
 
231
        char fw_ver_str[ETHTOOL_BUSINFO_LEN];
 
232
        unsigned int fw_ver[NUM_FW_VER];
168
233
};
169
234
 
170
235
struct wl1271_stats {
178
243
#define NUM_TX_QUEUES              4
179
244
#define NUM_RX_PKT_DESC            8
180
245
 
181
 
/* FW status registers */
182
 
struct wl1271_fw_status {
 
246
#define AP_MAX_STATIONS            5
 
247
 
 
248
/* Broadcast and Global links + links to stations */
 
249
#define AP_MAX_LINKS               (AP_MAX_STATIONS + 2)
 
250
 
 
251
/* FW status registers common for AP/STA */
 
252
struct wl1271_fw_common_status {
183
253
        __le32 intr;
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;
191
 
        __le32 padding[2];
192
 
} __packed;
 
261
} __packed;
 
262
 
 
263
/* FW status registers for AP */
 
264
struct wl1271_fw_ap_status {
 
265
        struct wl1271_fw_common_status common;
 
266
 
 
267
        /* Next fields valid only in AP FW */
 
268
 
 
269
        /*
 
270
         * A bitmap (where each bit represents a single HLID)
 
271
         * to indicate if the station is in PS mode.
 
272
         */
 
273
        __le32 link_ps_bitmap;
 
274
 
 
275
        /* Number of freed MBs per HLID */
 
276
        u8 tx_lnk_free_blks[AP_MAX_LINKS];
 
277
        u8 padding_1[1];
 
278
} __packed;
 
279
 
 
280
/* FW status registers for STA */
 
281
struct wl1271_fw_sta_status {
 
282
        struct wl1271_fw_common_status common;
 
283
 
 
284
        u8  tx_total;
 
285
        u8  reserved1;
 
286
        __le16 reserved2;
 
287
        /* Total structure size is 68 bytes */
 
288
        u32 padding;
 
289
} __packed;
 
290
 
 
291
struct wl1271_fw_full_status {
 
292
        union {
 
293
                struct wl1271_fw_common_status common;
 
294
                struct wl1271_fw_sta_status sta;
 
295
                struct wl1271_fw_ap_status ap;
 
296
        };
 
297
} __packed;
 
298
 
193
299
 
194
300
struct wl1271_rx_mem_pool_addr {
195
301
        u32 addr;
196
302
        u32 addr_extra;
197
303
};
198
304
 
 
305
#define WL1271_MAX_CHANNELS 64
199
306
struct wl1271_scan {
200
307
        struct cfg80211_scan_request *req;
201
 
        bool *scanned_ch;
 
308
        unsigned long scanned_ch[BITS_TO_LONGS(WL1271_MAX_CHANNELS)];
202
309
        bool failed;
203
310
        u8 state;
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);
 
327
};
 
328
 
 
329
#define MAX_NUM_KEYS 14
 
330
#define MAX_KEY_SIZE 32
 
331
 
 
332
struct wl1271_ap_key {
 
333
        u8 id;
 
334
        u8 key_type;
 
335
        u8 key_size;
 
336
        u8 key[MAX_KEY_SIZE];
 
337
        u8 hlid;
 
338
        u32 tx_seq_32;
 
339
        u16 tx_seq_16;
 
340
};
 
341
 
 
342
enum wl12xx_flags {
 
343
        WL1271_FLAG_STA_ASSOCIATED,
 
344
        WL1271_FLAG_JOINED,
 
345
        WL1271_FLAG_GPIO_POWER,
 
346
        WL1271_FLAG_TX_QUEUE_STOPPED,
 
347
        WL1271_FLAG_TX_PENDING,
 
348
        WL1271_FLAG_IN_ELP,
 
349
        WL1271_FLAG_ELP_REQUESTED,
 
350
        WL1271_FLAG_PSM,
 
351
        WL1271_FLAG_PSM_REQUESTED,
 
352
        WL1271_FLAG_IRQ_RUNNING,
 
353
        WL1271_FLAG_IDLE,
 
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,
 
362
};
 
363
 
 
364
struct wl1271_link {
 
365
        /* AP-mode - TX queue per AC in link */
 
366
        struct sk_buff_head tx_queue[NUM_TX_QUEUES];
 
367
 
 
368
        /* accounting for allocated / available TX blocks in FW */
 
369
        u8 allocated_blks;
 
370
        u8 prev_freed_blks;
 
371
 
 
372
        u8 addr[ETH_ALEN];
219
373
};
220
374
 
221
375
struct wl1271 {
236
390
        enum wl1271_state state;
237
391
        struct mutex mutex;
238
392
 
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;
255
394
 
256
395
        struct wl1271_partition_set part;
262
401
 
263
402
        u8 *fw;
264
403
        size_t fw_len;
265
 
        struct wl1271_nvs_file *nvs;
 
404
        u8 fw_bss_type;
 
405
        void *nvs;
266
406
        size_t nvs_len;
267
407
 
268
408
        s8 hw_pg_ver;
280
420
        /* Accounting for allocated / available TX blocks on HW */
281
421
        u32 tx_blocks_freed[NUM_TX_QUEUES];
282
422
        u32 tx_blocks_available;
 
423
        u32 tx_allocated_blocks;
283
424
        u32 tx_results_count;
284
425
 
285
426
        /* Transmitted TX packets counter for chipset interface */
295
436
        struct sk_buff_head tx_queue[NUM_TX_QUEUES];
296
437
        int tx_queue_count;
297
438
 
 
439
        /* Frames received, not handled yet by mac80211 */
 
440
        struct sk_buff_head deferred_rx_queue;
 
441
 
 
442
        /* Frames sent, not returned yet to mac80211 */
 
443
        struct sk_buff_head deferred_tx_queue;
 
444
 
298
445
        struct work_struct tx_work;
299
446
 
300
447
        /* Pending TX frames */
315
462
        /* Intermediate buffer, used for packet aggregation */
316
463
        u8 *aggr_buf;
317
464
 
318
 
        /* The target interrupt mask */
319
 
        struct work_struct irq_work;
 
465
        /* Reusable dummy packet template */
 
466
        struct sk_buff *dummy_packet;
 
467
 
 
468
        /* Network stack work  */
 
469
        struct work_struct netstack_work;
320
470
 
321
471
        /* Hardware recovery work */
322
472
        struct work_struct recovery_work;
331
481
        struct wl1271_scan scan;
332
482
        struct delayed_work scan_complete_work;
333
483
 
 
484
        bool sched_scanning;
 
485
 
334
486
        /* probe-req template for the current AP */
335
487
        struct sk_buff *probereq;
336
488
 
343
495
         *      bits 16-23 - 802.11n   MCS index mask
344
496
         * support only 1 stream, thus only 8 bits for the MCS rates (0-7).
345
497
         */
346
 
        u32 sta_rate_set;
347
498
        u32 basic_rate_set;
348
499
        u32 basic_rate;
349
500
        u32 rate_set;
362
513
        unsigned int rx_filter;
363
514
 
364
515
        struct completion *elp_compl;
 
516
        struct completion *ps_compl;
365
517
        struct delayed_work elp_work;
366
518
        struct delayed_work pspoll_work;
367
519
 
378
530
        int last_rssi_event;
379
531
 
380
532
        struct wl1271_stats stats;
381
 
        struct dentry *rootdir;
382
533
 
383
534
        __le32 buffer_32;
384
535
        u32 buffer_cmd;
385
536
        u32 buffer_busyword[WL1271_BUSY_WORD_CNT];
386
537
 
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;
389
540
 
390
541
        struct ieee80211_vif *vif;
400
551
 
401
552
        /* Most recently reported noise in dBm */
402
553
        s8 noise;
 
554
 
 
555
        /* map for HLIDs of associated stations - when operating in AP mode */
 
556
        unsigned long ap_hlid_map[BITS_TO_LONGS(AP_MAX_STATIONS)];
 
557
 
 
558
        /* recoreded keys for AP-mode - set here before AP startup */
 
559
        struct wl1271_ap_key *recorded_ap_keys[MAX_NUM_KEYS];
 
560
 
 
561
        /* bands supported by this instance of wl12xx */
 
562
        struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
 
563
 
 
564
        /* RX BA constraint value */
 
565
        bool ba_support;
 
566
        u8 ba_rx_bitmap;
 
567
 
 
568
        int tcxo_clock;
 
569
 
 
570
        /*
 
571
         * wowlan trigger was configured during suspend.
 
572
         * (currently, only "ANY" trigger is supported)
 
573
         */
 
574
        bool wow_enabled;
 
575
 
 
576
        /*
 
577
         * AP-mode - links indexed by HLID. The global and broadcast links
 
578
         * are always active.
 
579
         */
 
580
        struct wl1271_link links[AP_MAX_LINKS];
 
581
 
 
582
        /* the hlid of the link where the last transmitted skb came from */
 
583
        int last_tx_hlid;
 
584
 
 
585
        /* AP-mode - a bitmap of links currently in PS mode according to FW */
 
586
        u32 ap_fw_ps_map;
 
587
 
 
588
        /* AP-mode - a bitmap of links currently in PS mode in mac80211 */
 
589
        unsigned long ap_ps_map;
 
590
 
 
591
        /* Quirks of specific hardware revisions */
 
592
        unsigned int quirks;
 
593
 
 
594
        /* Platform limitations */
 
595
        unsigned int platform_quirks;
 
596
};
 
597
 
 
598
struct wl1271_station {
 
599
        u8 hlid;
403
600
};
404
601
 
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
416
613
 
 
614
#define WL1271_DEFERRED_QUEUE_LIMIT    64
 
615
 
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
425
624
 
 
625
/* Quirks */
 
626
 
 
627
/* Each RX/TX transaction requires an end-of-transaction transfer */
 
628
#define WL12XX_QUIRK_END_OF_TRANSACTION         BIT(0)
 
629
 
 
630
/*
 
631
 * Older firmwares use 2 spare TX blocks
 
632
 * (for STA < 6.1.3.50.58 or for AP < 6.2.0.0.47)
 
633
 */
 
634
#define WL12XX_QUIRK_USE_2_SPARE_BLOCKS         BIT(1)
 
635
 
 
636
/* WL128X requires aggregated packets to be aligned to the SDIO block size */
 
637
#define WL12XX_QUIRK_BLOCKSIZE_ALIGNMENT        BIT(2)
 
638
 
426
639
#endif