1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17#ifndef _BRCM_PUB_H_
18#define _BRCM_PUB_H_
19
20#include <linux/bcma/bcma.h>
21#include <brcmu_wifi.h>
22#include "types.h"
23#include "defs.h"
24
25#define BRCMS_NUMRATES 16
26
27
28#define PHY_TYPE_A 0
29#define PHY_TYPE_G 2
30#define PHY_TYPE_N 4
31#define PHY_TYPE_LP 5
32#define PHY_TYPE_SSN 6
33#define PHY_TYPE_LCN 8
34#define PHY_TYPE_LCNXN 9
35#define PHY_TYPE_HT 7
36
37
38#define BRCMS_10_MHZ 10
39#define BRCMS_20_MHZ 20
40#define BRCMS_40_MHZ 40
41
42#define BRCMS_RSSI_MINVAL -200
43#define BRCMS_RSSI_NO_SIGNAL -91
44#define BRCMS_RSSI_VERY_LOW -80
45#define BRCMS_RSSI_LOW -70
46#define BRCMS_RSSI_GOOD -68
47#define BRCMS_RSSI_VERY_GOOD -58
48#define BRCMS_RSSI_EXCELLENT -57
49
50
51
52
53#define BRCMS_TXPWR_MAX (127)
54
55
56#define BRCMS_RATE_FLAG 0x80
57#define BRCMS_RATE_MASK 0x7f
58
59
60#define ANT_RX_DIV_FORCE_0 0
61#define ANT_RX_DIV_FORCE_1 1
62#define ANT_RX_DIV_START_1 2
63#define ANT_RX_DIV_START_0 3
64#define ANT_RX_DIV_ENABLE 3
65
66#define ANT_RX_DIV_DEF ANT_RX_DIV_START_0
67
68
69
70#define ANT_TX_FORCE_0 0
71
72#define ANT_TX_FORCE_1 1
73
74#define ANT_TX_LAST_RX 3
75
76#define ANT_TX_DEF 3
77
78
79
80#define TXCHAIN_DEF 0x1
81
82#define TXCHAIN_DEF_NPHY 0x3
83
84#define TXCHAIN_DEF_HTPHY 0x7
85
86#define RXCHAIN_DEF 0x1
87
88#define RXCHAIN_DEF_NPHY 0x3
89
90#define RXCHAIN_DEF_HTPHY 0x7
91
92#define ANTSWITCH_NONE 0
93
94#define ANTSWITCH_TYPE_1 1
95
96#define ANTSWITCH_TYPE_2 2
97
98#define ANTSWITCH_TYPE_3 3
99
100#define RXBUFSZ PKTBUFSZ
101
102#define MAX_STREAMS_SUPPORTED 4
103
104struct brcm_rateset {
105
106 u32 count;
107
108 u8 rates[WL_NUMRATES];
109};
110
111struct brcms_c_rateset {
112 uint count;
113
114 u8 rates[BRCMS_NUMRATES];
115 u8 htphy_membership;
116 u8 mcs[MCSSET_LEN];
117};
118
119
120
121
122#define AMPDU_DEF_MPDU_DENSITY 6
123
124
125struct brcms_bss_info {
126 u8 BSSID[ETH_ALEN];
127 u16 flags;
128 u8 SSID_len;
129 u8 SSID[32];
130 s16 RSSI;
131 s16 SNR;
132 u16 beacon_period;
133 u16 chanspec;
134 struct brcms_c_rateset rateset;
135};
136
137#define MAC80211_PROMISC_BCNS (1 << 0)
138#define MAC80211_SCAN (1 << 1)
139
140
141
142
143
144struct brcms_pub {
145 struct brcms_c_info *wlc;
146 struct ieee80211_hw *ieee_hw;
147 struct scb_ampdu *global_ampdu;
148 uint mac80211_state;
149 uint unit;
150 uint corerev;
151 struct si_pub *sih;
152 bool up;
153 bool hw_off;
154 bool hw_up;
155 bool _piomode;
156 uint _nbands;
157 uint now;
158
159 bool delayed_down;
160 bool associated;
161
162 bool _ampdu;
163 u8 _n_enab;
164
165 u8 cur_etheraddr[ETH_ALEN];
166
167 u32 radio_disabled;
168
169 u16 boardrev;
170 u8 sromrev;
171 char srom_ccode[BRCM_CNTRY_BUF_SZ];
172 u32 boardflags;
173 u32 boardflags2;
174 bool phy_11ncapable;
175
176 struct wl_cnt *_cnt;
177 struct dentry *dbgfs_dir;
178};
179
180enum wlc_par_id {
181 IOV_MPC = 1,
182 IOV_RTSTHRESH,
183 IOV_QTXPOWER,
184 IOV_BCN_LI_BCN
185};
186
187
188
189
190
191
192#define ENAB_1x1 0x01
193#define ENAB_2x2 0x02
194#define ENAB_3x3 0x04
195#define ENAB_4x4 0x08
196#define SUPPORT_11N (ENAB_1x1|ENAB_2x2)
197#define SUPPORT_HT (ENAB_1x1|ENAB_2x2|ENAB_3x3)
198
199
200#define AMPDU_AGG_HOST 1
201
202
203#define BRCMS_PROT_G_SPEC 1
204#define BRCMS_PROT_G_OVR 2
205#define BRCMS_PROT_G_USER 3
206#define BRCMS_PROT_OVERLAP 4
207#define BRCMS_PROT_N_USER 10
208#define BRCMS_PROT_N_CFG 11
209#define BRCMS_PROT_N_CFG_OVR 12
210#define BRCMS_PROT_N_NONGF 13
211#define BRCMS_PROT_N_NONGF_OVR 14
212#define BRCMS_PROT_N_PAM_OVR 15
213#define BRCMS_PROT_N_OBSS 16
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247#define GMODE_LEGACY_B 0
248#define GMODE_AUTO 1
249#define GMODE_ONLY 2
250#define GMODE_B_DEFERRED 3
251#define GMODE_PERFORMANCE 4
252#define GMODE_LRS 5
253#define GMODE_MAX 6
254
255
256#define HIGHEST_SINGLE_STREAM_MCS 7
257
258#define MAXBANDS 2
259
260
261#define ANT_SELCFG_MAX 4
262
263struct brcms_antselcfg {
264 u8 ant_config[ANT_SELCFG_MAX];
265 u8 num_antcfg;
266};
267
268
269extern struct brcms_c_info *
270brcms_c_attach(struct brcms_info *wl, struct bcma_device *core, uint unit,
271 bool piomode, uint *perr);
272extern uint brcms_c_detach(struct brcms_c_info *wlc);
273extern int brcms_c_up(struct brcms_c_info *wlc);
274extern uint brcms_c_down(struct brcms_c_info *wlc);
275
276extern bool brcms_c_chipmatch(struct bcma_device *core);
277extern void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx);
278extern void brcms_c_reset(struct brcms_c_info *wlc);
279
280extern void brcms_c_intrson(struct brcms_c_info *wlc);
281extern u32 brcms_c_intrsoff(struct brcms_c_info *wlc);
282extern void brcms_c_intrsrestore(struct brcms_c_info *wlc, u32 macintmask);
283extern bool brcms_c_intrsupd(struct brcms_c_info *wlc);
284extern bool brcms_c_isr(struct brcms_c_info *wlc);
285extern bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded);
286extern bool brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc,
287 struct sk_buff *sdu,
288 struct ieee80211_hw *hw);
289extern bool brcms_c_aggregatable(struct brcms_c_info *wlc, u8 tid);
290extern void brcms_c_protection_upd(struct brcms_c_info *wlc, uint idx,
291 int val);
292extern int brcms_c_get_header_len(void);
293extern void brcms_c_set_addrmatch(struct brcms_c_info *wlc,
294 int match_reg_offset,
295 const u8 *addr);
296extern void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci,
297 const struct ieee80211_tx_queue_params *arg,
298 bool suspend);
299extern struct brcms_pub *brcms_c_pub(struct brcms_c_info *wlc);
300extern void brcms_c_ampdu_flush(struct brcms_c_info *wlc,
301 struct ieee80211_sta *sta, u16 tid);
302extern void brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid,
303 u8 ba_wsize, uint max_rx_ampdu_bytes);
304extern int brcms_c_module_register(struct brcms_pub *pub,
305 const char *name, struct brcms_info *hdl,
306 int (*down_fn)(void *handle));
307extern int brcms_c_module_unregister(struct brcms_pub *pub, const char *name,
308 struct brcms_info *hdl);
309extern void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc);
310extern void brcms_c_enable_mac(struct brcms_c_info *wlc);
311extern void brcms_c_associate_upd(struct brcms_c_info *wlc, bool state);
312extern void brcms_c_scan_start(struct brcms_c_info *wlc);
313extern void brcms_c_scan_stop(struct brcms_c_info *wlc);
314extern int brcms_c_get_curband(struct brcms_c_info *wlc);
315extern int brcms_c_set_channel(struct brcms_c_info *wlc, u16 channel);
316extern int brcms_c_set_rate_limit(struct brcms_c_info *wlc, u16 srl, u16 lrl);
317extern void brcms_c_get_current_rateset(struct brcms_c_info *wlc,
318 struct brcm_rateset *currs);
319extern int brcms_c_set_rateset(struct brcms_c_info *wlc,
320 struct brcm_rateset *rs);
321extern int brcms_c_set_beacon_period(struct brcms_c_info *wlc, u16 period);
322extern u16 brcms_c_get_phy_type(struct brcms_c_info *wlc, int phyidx);
323extern void brcms_c_set_shortslot_override(struct brcms_c_info *wlc,
324 s8 sslot_override);
325extern void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc,
326 u8 interval);
327extern u64 brcms_c_tsf_get(struct brcms_c_info *wlc);
328extern void brcms_c_tsf_set(struct brcms_c_info *wlc, u64 tsf);
329extern int brcms_c_set_tx_power(struct brcms_c_info *wlc, int txpwr);
330extern int brcms_c_get_tx_power(struct brcms_c_info *wlc);
331extern bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc);
332extern void brcms_c_mute(struct brcms_c_info *wlc, bool on);
333extern bool brcms_c_tx_flush_completed(struct brcms_c_info *wlc);
334extern void brcms_c_start_station(struct brcms_c_info *wlc, u8 *addr);
335extern void brcms_c_start_ap(struct brcms_c_info *wlc, u8 *addr,
336 const u8 *bssid, u8 *ssid, size_t ssid_len);
337extern void brcms_c_start_adhoc(struct brcms_c_info *wlc, u8 *addr);
338extern void brcms_c_update_beacon(struct brcms_c_info *wlc);
339extern void brcms_c_set_new_beacon(struct brcms_c_info *wlc,
340 struct sk_buff *beacon, u16 tim_offset,
341 u16 dtim_period);
342extern void brcms_c_set_new_probe_resp(struct brcms_c_info *wlc,
343 struct sk_buff *probe_resp);
344extern void brcms_c_enable_probe_resp(struct brcms_c_info *wlc, bool enable);
345extern void brcms_c_set_ssid(struct brcms_c_info *wlc, u8 *ssid,
346 size_t ssid_len);
347
348#endif
349