blob: f0038ad7d7bf7438a244001416f86615d87284de [file] [log] [blame]
Arend van Spriel5b435de2011-10-05 13:19:03 +02001/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _BRCM_PUB_H_
18#define _BRCM_PUB_H_
19
Arend van Sprielb63337a2011-12-08 15:06:47 -080020#include <linux/bcma/bcma.h>
Arend van Spriel5b435de2011-10-05 13:19:03 +020021#include <brcmu_wifi.h>
22#include "types.h"
23#include "defs.h"
24
25enum brcms_srom_id {
26 BRCMS_SROM_NULL,
27 BRCMS_SROM_CONT,
28 BRCMS_SROM_AA2G,
29 BRCMS_SROM_AA5G,
30 BRCMS_SROM_AG0,
31 BRCMS_SROM_AG1,
32 BRCMS_SROM_AG2,
33 BRCMS_SROM_AG3,
34 BRCMS_SROM_ANTSWCTL2G,
35 BRCMS_SROM_ANTSWCTL5G,
36 BRCMS_SROM_ANTSWITCH,
37 BRCMS_SROM_BOARDFLAGS2,
38 BRCMS_SROM_BOARDFLAGS,
39 BRCMS_SROM_BOARDNUM,
40 BRCMS_SROM_BOARDREV,
41 BRCMS_SROM_BOARDTYPE,
42 BRCMS_SROM_BW40PO,
43 BRCMS_SROM_BWDUPPO,
44 BRCMS_SROM_BXA2G,
45 BRCMS_SROM_BXA5G,
46 BRCMS_SROM_CC,
47 BRCMS_SROM_CCK2GPO,
48 BRCMS_SROM_CCKBW202GPO,
49 BRCMS_SROM_CCKBW20UL2GPO,
50 BRCMS_SROM_CCODE,
51 BRCMS_SROM_CDDPO,
52 BRCMS_SROM_DEVID,
53 BRCMS_SROM_ET1MACADDR,
54 BRCMS_SROM_EXTPAGAIN2G,
55 BRCMS_SROM_EXTPAGAIN5G,
56 BRCMS_SROM_FREQOFFSET_CORR,
57 BRCMS_SROM_HW_IQCAL_EN,
58 BRCMS_SROM_IL0MACADDR,
59 BRCMS_SROM_IQCAL_SWP_DIS,
60 BRCMS_SROM_LEDBH0,
61 BRCMS_SROM_LEDBH1,
62 BRCMS_SROM_LEDBH2,
63 BRCMS_SROM_LEDBH3,
64 BRCMS_SROM_LEDDC,
65 BRCMS_SROM_LEGOFDM40DUPPO,
66 BRCMS_SROM_LEGOFDMBW202GPO,
67 BRCMS_SROM_LEGOFDMBW205GHPO,
68 BRCMS_SROM_LEGOFDMBW205GLPO,
69 BRCMS_SROM_LEGOFDMBW205GMPO,
70 BRCMS_SROM_LEGOFDMBW20UL2GPO,
71 BRCMS_SROM_LEGOFDMBW20UL5GHPO,
72 BRCMS_SROM_LEGOFDMBW20UL5GLPO,
73 BRCMS_SROM_LEGOFDMBW20UL5GMPO,
74 BRCMS_SROM_MACADDR,
75 BRCMS_SROM_MCS2GPO0,
76 BRCMS_SROM_MCS2GPO1,
77 BRCMS_SROM_MCS2GPO2,
78 BRCMS_SROM_MCS2GPO3,
79 BRCMS_SROM_MCS2GPO4,
80 BRCMS_SROM_MCS2GPO5,
81 BRCMS_SROM_MCS2GPO6,
82 BRCMS_SROM_MCS2GPO7,
83 BRCMS_SROM_MCS32PO,
84 BRCMS_SROM_MCS5GHPO0,
85 BRCMS_SROM_MCS5GHPO1,
86 BRCMS_SROM_MCS5GHPO2,
87 BRCMS_SROM_MCS5GHPO3,
88 BRCMS_SROM_MCS5GHPO4,
89 BRCMS_SROM_MCS5GHPO5,
90 BRCMS_SROM_MCS5GHPO6,
91 BRCMS_SROM_MCS5GHPO7,
92 BRCMS_SROM_MCS5GLPO0,
93 BRCMS_SROM_MCS5GLPO1,
94 BRCMS_SROM_MCS5GLPO2,
95 BRCMS_SROM_MCS5GLPO3,
96 BRCMS_SROM_MCS5GLPO4,
97 BRCMS_SROM_MCS5GLPO5,
98 BRCMS_SROM_MCS5GLPO6,
99 BRCMS_SROM_MCS5GLPO7,
100 BRCMS_SROM_MCS5GPO0,
101 BRCMS_SROM_MCS5GPO1,
102 BRCMS_SROM_MCS5GPO2,
103 BRCMS_SROM_MCS5GPO3,
104 BRCMS_SROM_MCS5GPO4,
105 BRCMS_SROM_MCS5GPO5,
106 BRCMS_SROM_MCS5GPO6,
107 BRCMS_SROM_MCS5GPO7,
108 BRCMS_SROM_MCSBW202GPO,
109 BRCMS_SROM_MCSBW205GHPO,
110 BRCMS_SROM_MCSBW205GLPO,
111 BRCMS_SROM_MCSBW205GMPO,
112 BRCMS_SROM_MCSBW20UL2GPO,
113 BRCMS_SROM_MCSBW20UL5GHPO,
114 BRCMS_SROM_MCSBW20UL5GLPO,
115 BRCMS_SROM_MCSBW20UL5GMPO,
116 BRCMS_SROM_MCSBW402GPO,
117 BRCMS_SROM_MCSBW405GHPO,
118 BRCMS_SROM_MCSBW405GLPO,
119 BRCMS_SROM_MCSBW405GMPO,
120 BRCMS_SROM_MEASPOWER,
121 BRCMS_SROM_OFDM2GPO,
122 BRCMS_SROM_OFDM5GHPO,
123 BRCMS_SROM_OFDM5GLPO,
124 BRCMS_SROM_OFDM5GPO,
125 BRCMS_SROM_OPO,
126 BRCMS_SROM_PA0B0,
127 BRCMS_SROM_PA0B1,
128 BRCMS_SROM_PA0B2,
129 BRCMS_SROM_PA0ITSSIT,
130 BRCMS_SROM_PA0MAXPWR,
131 BRCMS_SROM_PA1B0,
132 BRCMS_SROM_PA1B1,
133 BRCMS_SROM_PA1B2,
134 BRCMS_SROM_PA1HIB0,
135 BRCMS_SROM_PA1HIB1,
136 BRCMS_SROM_PA1HIB2,
137 BRCMS_SROM_PA1HIMAXPWR,
138 BRCMS_SROM_PA1ITSSIT,
139 BRCMS_SROM_PA1LOB0,
140 BRCMS_SROM_PA1LOB1,
141 BRCMS_SROM_PA1LOB2,
142 BRCMS_SROM_PA1LOMAXPWR,
143 BRCMS_SROM_PA1MAXPWR,
144 BRCMS_SROM_PDETRANGE2G,
145 BRCMS_SROM_PDETRANGE5G,
146 BRCMS_SROM_PHYCAL_TEMPDELTA,
147 BRCMS_SROM_RAWTEMPSENSE,
148 BRCMS_SROM_REGREV,
149 BRCMS_SROM_REV,
150 BRCMS_SROM_RSSISAV2G,
151 BRCMS_SROM_RSSISAV5G,
152 BRCMS_SROM_RSSISMC2G,
153 BRCMS_SROM_RSSISMC5G,
154 BRCMS_SROM_RSSISMF2G,
155 BRCMS_SROM_RSSISMF5G,
156 BRCMS_SROM_RXCHAIN,
157 BRCMS_SROM_RXPO2G,
158 BRCMS_SROM_RXPO5G,
159 BRCMS_SROM_STBCPO,
160 BRCMS_SROM_TEMPCORRX,
161 BRCMS_SROM_TEMPOFFSET,
162 BRCMS_SROM_TEMPSENSE_OPTION,
163 BRCMS_SROM_TEMPSENSE_SLOPE,
164 BRCMS_SROM_TEMPTHRESH,
165 BRCMS_SROM_TRI2G,
166 BRCMS_SROM_TRI5GH,
167 BRCMS_SROM_TRI5GL,
168 BRCMS_SROM_TRI5G,
169 BRCMS_SROM_TRISO2G,
170 BRCMS_SROM_TRISO5G,
171 BRCMS_SROM_TSSIPOS2G,
172 BRCMS_SROM_TSSIPOS5G,
173 BRCMS_SROM_TXCHAIN,
Arend van Spriel5b435de2011-10-05 13:19:03 +0200174 /*
175 * per-path identifiers (see srom.c)
176 */
177 BRCMS_SROM_ITT2GA0,
178 BRCMS_SROM_ITT2GA1,
179 BRCMS_SROM_ITT2GA2,
180 BRCMS_SROM_ITT2GA3,
181 BRCMS_SROM_ITT5GA0,
182 BRCMS_SROM_ITT5GA1,
183 BRCMS_SROM_ITT5GA2,
184 BRCMS_SROM_ITT5GA3,
185 BRCMS_SROM_MAXP2GA0,
186 BRCMS_SROM_MAXP2GA1,
187 BRCMS_SROM_MAXP2GA2,
188 BRCMS_SROM_MAXP2GA3,
189 BRCMS_SROM_MAXP5GA0,
190 BRCMS_SROM_MAXP5GA1,
191 BRCMS_SROM_MAXP5GA2,
192 BRCMS_SROM_MAXP5GA3,
193 BRCMS_SROM_MAXP5GHA0,
194 BRCMS_SROM_MAXP5GHA1,
195 BRCMS_SROM_MAXP5GHA2,
196 BRCMS_SROM_MAXP5GHA3,
197 BRCMS_SROM_MAXP5GLA0,
198 BRCMS_SROM_MAXP5GLA1,
199 BRCMS_SROM_MAXP5GLA2,
200 BRCMS_SROM_MAXP5GLA3,
201 BRCMS_SROM_PA2GW0A0,
202 BRCMS_SROM_PA2GW0A1,
203 BRCMS_SROM_PA2GW0A2,
204 BRCMS_SROM_PA2GW0A3,
205 BRCMS_SROM_PA2GW1A0,
206 BRCMS_SROM_PA2GW1A1,
207 BRCMS_SROM_PA2GW1A2,
208 BRCMS_SROM_PA2GW1A3,
209 BRCMS_SROM_PA2GW2A0,
210 BRCMS_SROM_PA2GW2A1,
211 BRCMS_SROM_PA2GW2A2,
212 BRCMS_SROM_PA2GW2A3,
Arend van Spriel5b435de2011-10-05 13:19:03 +0200213 BRCMS_SROM_PA5GHW0A0,
214 BRCMS_SROM_PA5GHW0A1,
215 BRCMS_SROM_PA5GHW0A2,
216 BRCMS_SROM_PA5GHW0A3,
217 BRCMS_SROM_PA5GHW1A0,
218 BRCMS_SROM_PA5GHW1A1,
219 BRCMS_SROM_PA5GHW1A2,
220 BRCMS_SROM_PA5GHW1A3,
221 BRCMS_SROM_PA5GHW2A0,
222 BRCMS_SROM_PA5GHW2A1,
223 BRCMS_SROM_PA5GHW2A2,
224 BRCMS_SROM_PA5GHW2A3,
Arend van Spriel5b435de2011-10-05 13:19:03 +0200225 BRCMS_SROM_PA5GLW0A0,
226 BRCMS_SROM_PA5GLW0A1,
227 BRCMS_SROM_PA5GLW0A2,
228 BRCMS_SROM_PA5GLW0A3,
229 BRCMS_SROM_PA5GLW1A0,
230 BRCMS_SROM_PA5GLW1A1,
231 BRCMS_SROM_PA5GLW1A2,
232 BRCMS_SROM_PA5GLW1A3,
233 BRCMS_SROM_PA5GLW2A0,
234 BRCMS_SROM_PA5GLW2A1,
235 BRCMS_SROM_PA5GLW2A2,
236 BRCMS_SROM_PA5GLW2A3,
Arend van Spriel5b435de2011-10-05 13:19:03 +0200237 BRCMS_SROM_PA5GW0A0,
238 BRCMS_SROM_PA5GW0A1,
239 BRCMS_SROM_PA5GW0A2,
240 BRCMS_SROM_PA5GW0A3,
241 BRCMS_SROM_PA5GW1A0,
242 BRCMS_SROM_PA5GW1A1,
243 BRCMS_SROM_PA5GW1A2,
244 BRCMS_SROM_PA5GW1A3,
245 BRCMS_SROM_PA5GW2A0,
246 BRCMS_SROM_PA5GW2A1,
247 BRCMS_SROM_PA5GW2A2,
248 BRCMS_SROM_PA5GW2A3,
Arend van Spriel5b435de2011-10-05 13:19:03 +0200249};
250
251#define BRCMS_NUMRATES 16 /* max # of rates in a rateset */
Arend van Spriel5b435de2011-10-05 13:19:03 +0200252
253/* phy types */
254#define PHY_TYPE_A 0 /* Phy type A */
255#define PHY_TYPE_G 2 /* Phy type G */
256#define PHY_TYPE_N 4 /* Phy type N */
257#define PHY_TYPE_LP 5 /* Phy type Low Power A/B/G */
258#define PHY_TYPE_SSN 6 /* Phy type Single Stream N */
259#define PHY_TYPE_LCN 8 /* Phy type Single Stream N */
260#define PHY_TYPE_LCNXN 9 /* Phy type 2-stream N */
261#define PHY_TYPE_HT 7 /* Phy type 3-Stream N */
262
263/* bw */
264#define BRCMS_10_MHZ 10 /* 10Mhz nphy channel bandwidth */
265#define BRCMS_20_MHZ 20 /* 20Mhz nphy channel bandwidth */
266#define BRCMS_40_MHZ 40 /* 40Mhz nphy channel bandwidth */
267
268#define BRCMS_RSSI_MINVAL -200 /* Low value, e.g. for forcing roam */
269#define BRCMS_RSSI_NO_SIGNAL -91 /* NDIS RSSI link quality cutoffs */
270#define BRCMS_RSSI_VERY_LOW -80 /* Very low quality cutoffs */
271#define BRCMS_RSSI_LOW -70 /* Low quality cutoffs */
272#define BRCMS_RSSI_GOOD -68 /* Good quality cutoffs */
273#define BRCMS_RSSI_VERY_GOOD -58 /* Very good quality cutoffs */
274#define BRCMS_RSSI_EXCELLENT -57 /* Excellent quality cutoffs */
275
276/* a large TX Power as an init value to factor out of min() calculations,
277 * keep low enough to fit in an s8, units are .25 dBm
278 */
279#define BRCMS_TXPWR_MAX (127) /* ~32 dBm = 1,500 mW */
280
281/* rate related definitions */
282#define BRCMS_RATE_FLAG 0x80 /* Flag to indicate it is a basic rate */
283#define BRCMS_RATE_MASK 0x7f /* Rate value mask w/o basic rate flag */
284
285/* legacy rx Antenna diversity for SISO rates */
286#define ANT_RX_DIV_FORCE_0 0 /* Use antenna 0 */
287#define ANT_RX_DIV_FORCE_1 1 /* Use antenna 1 */
288#define ANT_RX_DIV_START_1 2 /* Choose starting with 1 */
289#define ANT_RX_DIV_START_0 3 /* Choose starting with 0 */
290#define ANT_RX_DIV_ENABLE 3 /* APHY bbConfig Enable RX Diversity */
291/* default antdiv setting */
292#define ANT_RX_DIV_DEF ANT_RX_DIV_START_0
293
294/* legacy rx Antenna diversity for SISO rates */
295/* Tx on antenna 0, "legacy term Main" */
296#define ANT_TX_FORCE_0 0
297/* Tx on antenna 1, "legacy term Aux" */
298#define ANT_TX_FORCE_1 1
299/* Tx on phy's last good Rx antenna */
300#define ANT_TX_LAST_RX 3
301/* driver's default tx antenna setting */
302#define ANT_TX_DEF 3
303
304/* Tx Chain values */
305/* def bitmap of txchain */
306#define TXCHAIN_DEF 0x1
307/* default bitmap of tx chains for nphy */
308#define TXCHAIN_DEF_NPHY 0x3
309/* default bitmap of tx chains for nphy */
310#define TXCHAIN_DEF_HTPHY 0x7
311/* def bitmap of rxchain */
312#define RXCHAIN_DEF 0x1
313/* default bitmap of rx chains for nphy */
314#define RXCHAIN_DEF_NPHY 0x3
315/* default bitmap of rx chains for nphy */
316#define RXCHAIN_DEF_HTPHY 0x7
317/* no antenna switch */
318#define ANTSWITCH_NONE 0
319/* antenna switch on 4321CB2, 2of3 */
320#define ANTSWITCH_TYPE_1 1
321/* antenna switch on 4321MPCI, 2of3 */
322#define ANTSWITCH_TYPE_2 2
323/* antenna switch on 4322, 2of3 */
324#define ANTSWITCH_TYPE_3 3
325
326#define RXBUFSZ PKTBUFSZ
327
328#define MAX_STREAMS_SUPPORTED 4 /* max number of streams supported */
329
330struct brcm_rateset {
331 /* # rates in this set */
332 u32 count;
333 /* rates in 500kbps units w/hi bit set if basic */
334 u8 rates[WL_NUMRATES];
335};
336
337struct brcms_c_rateset {
338 uint count; /* number of rates in rates[] */
339 /* rates in 500kbps units w/hi bit set if basic */
340 u8 rates[BRCMS_NUMRATES];
341 u8 htphy_membership; /* HT PHY Membership */
342 u8 mcs[MCSSET_LEN]; /* supported mcs index bit map */
343};
344
345/* All the HT-specific default advertised capabilities (including AMPDU)
346 * should be grouped here at one place
347 */
348#define AMPDU_DEF_MPDU_DENSITY 6 /* default mpdu density (110 ==> 4us) */
349
350/* wlc internal bss_info */
351struct brcms_bss_info {
352 u8 BSSID[ETH_ALEN]; /* network BSSID */
353 u16 flags; /* flags for internal attributes */
354 u8 SSID_len; /* the length of SSID */
355 u8 SSID[32]; /* SSID string */
356 s16 RSSI; /* receive signal strength (in dBm) */
357 s16 SNR; /* receive signal SNR in dB */
358 u16 beacon_period; /* units are Kusec */
359 u16 chanspec; /* Channel num, bw, ctrl_sb and band */
360 struct brcms_c_rateset rateset; /* supported rates */
361};
362
363#define MAC80211_PROMISC_BCNS (1 << 0)
364#define MAC80211_SCAN (1 << 1)
365
366/*
367 * Public portion of common driver state structure.
368 * The wlc handle points at this.
369 */
370struct brcms_pub {
371 struct brcms_c_info *wlc;
372 struct ieee80211_hw *ieee_hw;
373 struct scb_ampdu *global_ampdu;
374 uint mac80211_state;
375 uint unit; /* device instance number */
376 uint corerev; /* core revision */
377 struct si_pub *sih; /* SI handle (cookie for siutils calls) */
378 bool up; /* interface up and running */
379 bool hw_off; /* HW is off */
380 bool hw_up; /* one time hw up/down */
381 bool _piomode; /* true if pio mode */
382 uint _nbands; /* # bands supported */
383 uint now; /* # elapsed seconds */
384
Arend van Spriel5b435de2011-10-05 13:19:03 +0200385 bool delayed_down; /* down delayed */
386 bool associated; /* true:part of [I]BSS, false: not */
387 /* (union of stas_associated, aps_associated) */
388 bool _ampdu; /* ampdu enabled or not */
389 u8 _n_enab; /* bitmap of 11N + HT support */
390
391 u8 cur_etheraddr[ETH_ALEN]; /* our local ethernet address */
392
393 int bcmerror; /* last bcm error */
394
395 u32 radio_disabled; /* bit vector for radio disabled reasons */
396
397 u16 boardrev; /* version # of particular board */
398 u8 sromrev; /* version # of the srom */
399 char srom_ccode[BRCM_CNTRY_BUF_SZ]; /* Country Code in SROM */
400 u32 boardflags; /* Board specific flags from srom */
401 u32 boardflags2; /* More board flags if sromrev >= 4 */
402 bool phy_11ncapable; /* the PHY/HW is capable of 802.11N */
403
404 struct wl_cnt *_cnt; /* low-level counters in driver */
405};
406
407enum wlc_par_id {
408 IOV_MPC = 1,
409 IOV_RTSTHRESH,
410 IOV_QTXPOWER,
411 IOV_BCN_LI_BCN /* Beacon listen interval in # of beacons */
412};
413
414/***********************************************
415 * Feature-related macros to optimize out code *
416 * *********************************************
417 */
418
419#define ENAB_1x1 0x01
420#define ENAB_2x2 0x02
421#define ENAB_3x3 0x04
422#define ENAB_4x4 0x08
423#define SUPPORT_11N (ENAB_1x1|ENAB_2x2)
424#define SUPPORT_HT (ENAB_1x1|ENAB_2x2|ENAB_3x3)
425
426/* WL11N Support */
427#define AMPDU_AGG_HOST 1
428
429/* pri is priority encoded in the packet. This maps the Packet priority to
430 * enqueue precedence as defined in wlc_prec_map
431 */
432extern const u8 wlc_prio2prec_map[];
433#define BRCMS_PRIO_TO_PREC(pri) wlc_prio2prec_map[(pri) & 7]
434
435#define BRCMS_PREC_COUNT 16 /* Max precedence level implemented */
436
437/* Mask to describe all precedence levels */
438#define BRCMS_PREC_BMP_ALL MAXBITVAL(BRCMS_PREC_COUNT)
439
440/*
441 * This maps priority to one precedence higher - Used by PS-Poll response
442 * packets to simulate enqueue-at-head operation, but still maintain the
443 * order on the queue
444 */
445#define BRCMS_PRIO_TO_HI_PREC(pri) min(BRCMS_PRIO_TO_PREC(pri) + 1,\
446 BRCMS_PREC_COUNT - 1)
447
448/* Define a bitmap of precedences comprised by each AC */
449#define BRCMS_PREC_BMP_AC_BE (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_BE)) | \
450 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_BE)) | \
451 NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_EE)) | \
452 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_EE)))
453#define BRCMS_PREC_BMP_AC_BK (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_BK)) | \
454 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_BK)) | \
455 NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_NONE)) | \
456 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_NONE)))
457#define BRCMS_PREC_BMP_AC_VI (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_CL)) | \
458 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_CL)) | \
459 NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_VI)) | \
460 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_VI)))
461#define BRCMS_PREC_BMP_AC_VO (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_VO)) | \
462 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_VO)) | \
463 NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_NC)) | \
464 NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_NC)))
465
466/* network protection config */
467#define BRCMS_PROT_G_SPEC 1 /* SPEC g protection */
468#define BRCMS_PROT_G_OVR 2 /* SPEC g prot override */
469#define BRCMS_PROT_G_USER 3 /* gmode specified by user */
470#define BRCMS_PROT_OVERLAP 4 /* overlap */
471#define BRCMS_PROT_N_USER 10 /* nmode specified by user */
472#define BRCMS_PROT_N_CFG 11 /* n protection */
473#define BRCMS_PROT_N_CFG_OVR 12 /* n protection override */
474#define BRCMS_PROT_N_NONGF 13 /* non-GF protection */
475#define BRCMS_PROT_N_NONGF_OVR 14 /* non-GF protection override */
476#define BRCMS_PROT_N_PAM_OVR 15 /* n preamble override */
477#define BRCMS_PROT_N_OBSS 16 /* non-HT OBSS present */
478
479/*
480 * 54g modes (basic bits may still be overridden)
481 *
482 * GMODE_LEGACY_B
483 * Rateset: 1b, 2b, 5.5, 11
484 * Preamble: Long
485 * Shortslot: Off
486 * GMODE_AUTO
487 * Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54
488 * Extended Rateset: 6, 9, 12, 48
489 * Preamble: Long
490 * Shortslot: Auto
491 * GMODE_ONLY
492 * Rateset: 1b, 2b, 5.5b, 11b, 18, 24b, 36, 54
493 * Extended Rateset: 6b, 9, 12b, 48
494 * Preamble: Short required
495 * Shortslot: Auto
496 * GMODE_B_DEFERRED
497 * Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54
498 * Extended Rateset: 6, 9, 12, 48
499 * Preamble: Long
500 * Shortslot: On
501 * GMODE_PERFORMANCE
502 * Rateset: 1b, 2b, 5.5b, 6b, 9, 11b, 12b, 18, 24b, 36, 48, 54
503 * Preamble: Short required
504 * Shortslot: On and required
505 * GMODE_LRS
506 * Rateset: 1b, 2b, 5.5b, 11b
507 * Extended Rateset: 6, 9, 12, 18, 24, 36, 48, 54
508 * Preamble: Long
509 * Shortslot: Auto
510 */
511#define GMODE_LEGACY_B 0
512#define GMODE_AUTO 1
513#define GMODE_ONLY 2
514#define GMODE_B_DEFERRED 3
515#define GMODE_PERFORMANCE 4
516#define GMODE_LRS 5
517#define GMODE_MAX 6
518
519/* MCS values greater than this enable multiple streams */
520#define HIGHEST_SINGLE_STREAM_MCS 7
521
522#define MAXBANDS 2 /* Maximum #of bands */
523
524/* max number of antenna configurations */
525#define ANT_SELCFG_MAX 4
526
527struct brcms_antselcfg {
528 u8 ant_config[ANT_SELCFG_MAX]; /* antenna configuration */
529 u8 num_antcfg; /* number of available antenna configurations */
530};
531
532/* common functions for every port */
Alwin Beukers94bdc2a2011-10-12 20:51:13 +0200533extern struct brcms_c_info *
Arend van Sprielb63337a2011-12-08 15:06:47 -0800534brcms_c_attach(struct brcms_info *wl, struct bcma_device *core, uint unit,
535 bool piomode, uint *perr);
Arend van Spriel5b435de2011-10-05 13:19:03 +0200536extern uint brcms_c_detach(struct brcms_c_info *wlc);
537extern int brcms_c_up(struct brcms_c_info *wlc);
538extern uint brcms_c_down(struct brcms_c_info *wlc);
539
540extern bool brcms_c_chipmatch(u16 vendor, u16 device);
Roland Vossendc460122011-10-21 16:16:28 +0200541extern void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx);
Arend van Spriel5b435de2011-10-05 13:19:03 +0200542extern void brcms_c_reset(struct brcms_c_info *wlc);
543
544extern void brcms_c_intrson(struct brcms_c_info *wlc);
545extern u32 brcms_c_intrsoff(struct brcms_c_info *wlc);
546extern void brcms_c_intrsrestore(struct brcms_c_info *wlc, u32 macintmask);
547extern bool brcms_c_intrsupd(struct brcms_c_info *wlc);
548extern bool brcms_c_isr(struct brcms_c_info *wlc, bool *wantdpc);
549extern bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded);
550extern void brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc,
551 struct sk_buff *sdu,
552 struct ieee80211_hw *hw);
553extern bool brcms_c_aggregatable(struct brcms_c_info *wlc, u8 tid);
Arend van Spriel5b435de2011-10-05 13:19:03 +0200554extern void brcms_c_protection_upd(struct brcms_c_info *wlc, uint idx,
555 int val);
556extern int brcms_c_get_header_len(void);
Arend van Spriel5b435de2011-10-05 13:19:03 +0200557extern void brcms_c_set_addrmatch(struct brcms_c_info *wlc,
558 int match_reg_offset,
559 const u8 *addr);
560extern void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci,
561 const struct ieee80211_tx_queue_params *arg,
562 bool suspend);
563extern struct brcms_pub *brcms_c_pub(struct brcms_c_info *wlc);
Arend van Spriel5b435de2011-10-05 13:19:03 +0200564extern void brcms_c_ampdu_flush(struct brcms_c_info *wlc,
565 struct ieee80211_sta *sta, u16 tid);
566extern void brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid,
567 u8 ba_wsize, uint max_rx_ampdu_bytes);
568extern char *getvar(struct si_pub *sih, enum brcms_srom_id id);
569extern int getintvar(struct si_pub *sih, enum brcms_srom_id id);
Arend van Spriel5b435de2011-10-05 13:19:03 +0200570extern int brcms_c_module_register(struct brcms_pub *pub,
571 const char *name, struct brcms_info *hdl,
572 int (*down_fn)(void *handle));
573extern int brcms_c_module_unregister(struct brcms_pub *pub, const char *name,
574 struct brcms_info *hdl);
575extern void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc);
576extern void brcms_c_enable_mac(struct brcms_c_info *wlc);
577extern void brcms_c_associate_upd(struct brcms_c_info *wlc, bool state);
578extern void brcms_c_scan_start(struct brcms_c_info *wlc);
579extern void brcms_c_scan_stop(struct brcms_c_info *wlc);
580extern int brcms_c_get_curband(struct brcms_c_info *wlc);
581extern void brcms_c_wait_for_tx_completion(struct brcms_c_info *wlc,
582 bool drop);
Alwin Beukers94bdc2a2011-10-12 20:51:13 +0200583extern int brcms_c_set_channel(struct brcms_c_info *wlc, u16 channel);
584extern int brcms_c_set_rate_limit(struct brcms_c_info *wlc, u16 srl, u16 lrl);
585extern void brcms_c_get_current_rateset(struct brcms_c_info *wlc,
Arend van Spriel5b435de2011-10-05 13:19:03 +0200586 struct brcm_rateset *currs);
Alwin Beukers94bdc2a2011-10-12 20:51:13 +0200587extern int brcms_c_set_rateset(struct brcms_c_info *wlc,
588 struct brcm_rateset *rs);
589extern int brcms_c_set_beacon_period(struct brcms_c_info *wlc, u16 period);
590extern u16 brcms_c_get_phy_type(struct brcms_c_info *wlc, int phyidx);
591extern void brcms_c_set_shortslot_override(struct brcms_c_info *wlc,
Arend van Spriel5b435de2011-10-05 13:19:03 +0200592 s8 sslot_override);
Alwin Beukers94bdc2a2011-10-12 20:51:13 +0200593extern void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc,
594 u8 interval);
595extern int brcms_c_set_tx_power(struct brcms_c_info *wlc, int txpwr);
596extern int brcms_c_get_tx_power(struct brcms_c_info *wlc);
Arend van Spriel5b435de2011-10-05 13:19:03 +0200597extern bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc);
Roland Vossendc460122011-10-21 16:16:28 +0200598extern void brcms_c_mute(struct brcms_c_info *wlc, bool on);
Arend van Spriel5b435de2011-10-05 13:19:03 +0200599
600#endif /* _BRCM_PUB_H_ */