0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef _BRCM_PUB_H_
0018 #define _BRCM_PUB_H_
0019
0020 #include <linux/bcma/bcma.h>
0021 #include <brcmu_wifi.h>
0022 #include "types.h"
0023 #include "defs.h"
0024
0025 #define BRCMS_NUMRATES 16
0026
0027
0028 #define PHY_TYPE_A 0
0029 #define PHY_TYPE_G 2
0030 #define PHY_TYPE_N 4
0031 #define PHY_TYPE_LP 5
0032 #define PHY_TYPE_SSN 6
0033 #define PHY_TYPE_LCN 8
0034 #define PHY_TYPE_LCNXN 9
0035 #define PHY_TYPE_HT 7
0036
0037
0038 #define BRCMS_10_MHZ 10
0039 #define BRCMS_20_MHZ 20
0040 #define BRCMS_40_MHZ 40
0041
0042 #define BRCMS_RSSI_MINVAL -200
0043 #define BRCMS_RSSI_NO_SIGNAL -91
0044 #define BRCMS_RSSI_VERY_LOW -80
0045 #define BRCMS_RSSI_LOW -70
0046 #define BRCMS_RSSI_GOOD -68
0047 #define BRCMS_RSSI_VERY_GOOD -58
0048 #define BRCMS_RSSI_EXCELLENT -57
0049
0050
0051
0052
0053 #define BRCMS_TXPWR_MAX (127)
0054
0055
0056 #define BRCMS_RATE_FLAG 0x80
0057 #define BRCMS_RATE_MASK 0x7f
0058
0059
0060 #define ANT_RX_DIV_FORCE_0 0
0061 #define ANT_RX_DIV_FORCE_1 1
0062 #define ANT_RX_DIV_START_1 2
0063 #define ANT_RX_DIV_START_0 3
0064 #define ANT_RX_DIV_ENABLE 3
0065
0066 #define ANT_RX_DIV_DEF ANT_RX_DIV_START_0
0067
0068
0069
0070 #define ANT_TX_FORCE_0 0
0071
0072 #define ANT_TX_FORCE_1 1
0073
0074 #define ANT_TX_LAST_RX 3
0075
0076 #define ANT_TX_DEF 3
0077
0078
0079
0080 #define TXCHAIN_DEF 0x1
0081
0082 #define TXCHAIN_DEF_NPHY 0x3
0083
0084 #define TXCHAIN_DEF_HTPHY 0x7
0085
0086 #define RXCHAIN_DEF 0x1
0087
0088 #define RXCHAIN_DEF_NPHY 0x3
0089
0090 #define RXCHAIN_DEF_HTPHY 0x7
0091
0092 #define ANTSWITCH_NONE 0
0093
0094 #define ANTSWITCH_TYPE_1 1
0095
0096 #define ANTSWITCH_TYPE_2 2
0097
0098 #define ANTSWITCH_TYPE_3 3
0099
0100 #define RXBUFSZ PKTBUFSZ
0101
0102 #define MAX_STREAMS_SUPPORTED 4
0103
0104 struct brcm_rateset {
0105
0106 u32 count;
0107
0108 u8 rates[WL_NUMRATES];
0109 };
0110
0111 struct brcms_c_rateset {
0112 uint count;
0113
0114 u8 rates[BRCMS_NUMRATES];
0115 u8 htphy_membership;
0116 u8 mcs[MCSSET_LEN];
0117 };
0118
0119
0120
0121
0122 #define AMPDU_DEF_MPDU_DENSITY 6
0123
0124
0125 struct brcms_bss_info {
0126 u8 BSSID[ETH_ALEN];
0127 u16 flags;
0128 u8 SSID_len;
0129 u8 SSID[32];
0130 s16 RSSI;
0131 s16 SNR;
0132 u16 beacon_period;
0133 u16 chanspec;
0134 struct brcms_c_rateset rateset;
0135 };
0136
0137 #define MAC80211_PROMISC_BCNS (1 << 0)
0138 #define MAC80211_SCAN (1 << 1)
0139
0140
0141
0142
0143
0144 struct brcms_pub {
0145 struct brcms_c_info *wlc;
0146 struct ieee80211_hw *ieee_hw;
0147 struct scb_ampdu *global_ampdu;
0148 uint mac80211_state;
0149 uint unit;
0150 uint corerev;
0151 struct si_pub *sih;
0152 bool up;
0153 bool hw_off;
0154 bool hw_up;
0155 bool _piomode;
0156 uint _nbands;
0157 uint now;
0158
0159 bool delayed_down;
0160 bool associated;
0161
0162 bool _ampdu;
0163 u8 _n_enab;
0164
0165 u8 cur_etheraddr[ETH_ALEN];
0166
0167 u32 radio_disabled;
0168
0169 u16 boardrev;
0170 u8 sromrev;
0171 char srom_ccode[BRCM_CNTRY_BUF_SZ];
0172 u32 boardflags;
0173 u32 boardflags2;
0174 bool phy_11ncapable;
0175
0176 struct wl_cnt *_cnt;
0177 struct dentry *dbgfs_dir;
0178 };
0179
0180 enum wlc_par_id {
0181 IOV_MPC = 1,
0182 IOV_RTSTHRESH,
0183 IOV_QTXPOWER,
0184 IOV_BCN_LI_BCN
0185 };
0186
0187
0188
0189
0190
0191
0192 #define ENAB_1x1 0x01
0193 #define ENAB_2x2 0x02
0194 #define ENAB_3x3 0x04
0195 #define ENAB_4x4 0x08
0196 #define SUPPORT_11N (ENAB_1x1|ENAB_2x2)
0197 #define SUPPORT_HT (ENAB_1x1|ENAB_2x2|ENAB_3x3)
0198
0199
0200 #define AMPDU_AGG_HOST 1
0201
0202
0203 #define BRCMS_PROT_G_SPEC 1
0204 #define BRCMS_PROT_G_OVR 2
0205 #define BRCMS_PROT_G_USER 3
0206 #define BRCMS_PROT_OVERLAP 4
0207 #define BRCMS_PROT_N_USER 10
0208 #define BRCMS_PROT_N_CFG 11
0209 #define BRCMS_PROT_N_CFG_OVR 12
0210 #define BRCMS_PROT_N_NONGF 13
0211 #define BRCMS_PROT_N_NONGF_OVR 14
0212 #define BRCMS_PROT_N_PAM_OVR 15
0213 #define BRCMS_PROT_N_OBSS 16
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247 #define GMODE_LEGACY_B 0
0248 #define GMODE_AUTO 1
0249 #define GMODE_ONLY 2
0250 #define GMODE_B_DEFERRED 3
0251 #define GMODE_PERFORMANCE 4
0252 #define GMODE_LRS 5
0253 #define GMODE_MAX 6
0254
0255
0256 #define HIGHEST_SINGLE_STREAM_MCS 7
0257
0258 #define MAXBANDS 2
0259
0260
0261 #define ANT_SELCFG_MAX 4
0262
0263 struct brcms_antselcfg {
0264 u8 ant_config[ANT_SELCFG_MAX];
0265 u8 num_antcfg;
0266 };
0267
0268
0269 struct brcms_c_info *brcms_c_attach(struct brcms_info *wl,
0270 struct bcma_device *core, uint unit,
0271 bool piomode, uint *perr);
0272 uint brcms_c_detach(struct brcms_c_info *wlc);
0273 int brcms_c_up(struct brcms_c_info *wlc);
0274 uint brcms_c_down(struct brcms_c_info *wlc);
0275
0276 bool brcms_c_chipmatch(struct bcma_device *core);
0277 void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx);
0278 void brcms_c_reset(struct brcms_c_info *wlc);
0279
0280 void brcms_c_intrson(struct brcms_c_info *wlc);
0281 u32 brcms_c_intrsoff(struct brcms_c_info *wlc);
0282 void brcms_c_intrsrestore(struct brcms_c_info *wlc, u32 macintmask);
0283 bool brcms_c_intrsupd(struct brcms_c_info *wlc);
0284 bool brcms_c_isr(struct brcms_c_info *wlc);
0285 bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded);
0286 bool brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu,
0287 struct ieee80211_hw *hw);
0288 bool brcms_c_aggregatable(struct brcms_c_info *wlc, u8 tid);
0289 void brcms_c_protection_upd(struct brcms_c_info *wlc, uint idx, int val);
0290 int brcms_c_get_header_len(void);
0291 void brcms_c_set_addrmatch(struct brcms_c_info *wlc, int match_reg_offset,
0292 const u8 *addr);
0293 void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci,
0294 const struct ieee80211_tx_queue_params *arg,
0295 bool suspend);
0296 struct brcms_pub *brcms_c_pub(struct brcms_c_info *wlc);
0297 void brcms_c_ampdu_flush(struct brcms_c_info *wlc, struct ieee80211_sta *sta,
0298 u16 tid);
0299 void brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid,
0300 u8 ba_wsize, uint max_rx_ampdu_bytes);
0301 int brcms_c_module_register(struct brcms_pub *pub, const char *name,
0302 struct brcms_info *hdl,
0303 int (*down_fn)(void *handle));
0304 int brcms_c_module_unregister(struct brcms_pub *pub, const char *name,
0305 struct brcms_info *hdl);
0306 void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc);
0307 void brcms_c_enable_mac(struct brcms_c_info *wlc);
0308 void brcms_c_associate_upd(struct brcms_c_info *wlc, bool state);
0309 void brcms_c_scan_start(struct brcms_c_info *wlc);
0310 void brcms_c_scan_stop(struct brcms_c_info *wlc);
0311 int brcms_c_get_curband(struct brcms_c_info *wlc);
0312 int brcms_c_set_channel(struct brcms_c_info *wlc, u16 channel);
0313 int brcms_c_set_rate_limit(struct brcms_c_info *wlc, u16 srl, u16 lrl);
0314 void brcms_c_get_current_rateset(struct brcms_c_info *wlc,
0315 struct brcm_rateset *currs);
0316 int brcms_c_set_rateset(struct brcms_c_info *wlc, struct brcm_rateset *rs);
0317 int brcms_c_set_beacon_period(struct brcms_c_info *wlc, u16 period);
0318 u16 brcms_c_get_phy_type(struct brcms_c_info *wlc, int phyidx);
0319 void brcms_c_set_shortslot_override(struct brcms_c_info *wlc,
0320 s8 sslot_override);
0321 void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc, u8 interval);
0322 u64 brcms_c_tsf_get(struct brcms_c_info *wlc);
0323 void brcms_c_tsf_set(struct brcms_c_info *wlc, u64 tsf);
0324 int brcms_c_set_tx_power(struct brcms_c_info *wlc, int txpwr);
0325 int brcms_c_get_tx_power(struct brcms_c_info *wlc);
0326 bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc);
0327 void brcms_c_mute(struct brcms_c_info *wlc, bool on);
0328 bool brcms_c_tx_flush_completed(struct brcms_c_info *wlc);
0329 void brcms_c_start_station(struct brcms_c_info *wlc, u8 *addr);
0330 void brcms_c_start_ap(struct brcms_c_info *wlc, u8 *addr, const u8 *bssid,
0331 u8 *ssid, size_t ssid_len);
0332 void brcms_c_start_adhoc(struct brcms_c_info *wlc, u8 *addr);
0333 void brcms_c_update_beacon(struct brcms_c_info *wlc);
0334 void brcms_c_set_new_beacon(struct brcms_c_info *wlc, struct sk_buff *beacon,
0335 u16 tim_offset, u16 dtim_period);
0336 void brcms_c_set_new_probe_resp(struct brcms_c_info *wlc,
0337 struct sk_buff *probe_resp);
0338 void brcms_c_enable_probe_resp(struct brcms_c_info *wlc, bool enable);
0339 void brcms_c_set_ssid(struct brcms_c_info *wlc, u8 *ssid, size_t ssid_len);
0340
0341 #endif