1*b4c3e9b5SBjoern A. Zeeb /* 2*b4c3e9b5SBjoern A. Zeeb * Copyright (c) 2010 Broadcom Corporation 3*b4c3e9b5SBjoern A. Zeeb * 4*b4c3e9b5SBjoern A. Zeeb * Permission to use, copy, modify, and/or distribute this software for any 5*b4c3e9b5SBjoern A. Zeeb * purpose with or without fee is hereby granted, provided that the above 6*b4c3e9b5SBjoern A. Zeeb * copyright notice and this permission notice appear in all copies. 7*b4c3e9b5SBjoern A. Zeeb * 8*b4c3e9b5SBjoern A. Zeeb * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9*b4c3e9b5SBjoern A. Zeeb * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10*b4c3e9b5SBjoern A. Zeeb * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11*b4c3e9b5SBjoern A. Zeeb * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12*b4c3e9b5SBjoern A. Zeeb * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 13*b4c3e9b5SBjoern A. Zeeb * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 14*b4c3e9b5SBjoern A. Zeeb * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15*b4c3e9b5SBjoern A. Zeeb */ 16*b4c3e9b5SBjoern A. Zeeb 17*b4c3e9b5SBjoern A. Zeeb #ifndef _BRCM_MAIN_H_ 18*b4c3e9b5SBjoern A. Zeeb #define _BRCM_MAIN_H_ 19*b4c3e9b5SBjoern A. Zeeb 20*b4c3e9b5SBjoern A. Zeeb #include <linux/etherdevice.h> 21*b4c3e9b5SBjoern A. Zeeb 22*b4c3e9b5SBjoern A. Zeeb #include <brcmu_utils.h> 23*b4c3e9b5SBjoern A. Zeeb #include "types.h" 24*b4c3e9b5SBjoern A. Zeeb #include "d11.h" 25*b4c3e9b5SBjoern A. Zeeb #include "scb.h" 26*b4c3e9b5SBjoern A. Zeeb 27*b4c3e9b5SBjoern A. Zeeb #define INVCHANNEL 255 /* invalid channel */ 28*b4c3e9b5SBjoern A. Zeeb 29*b4c3e9b5SBjoern A. Zeeb /* max # brcms_c_module_register() calls */ 30*b4c3e9b5SBjoern A. Zeeb #define BRCMS_MAXMODULES 22 31*b4c3e9b5SBjoern A. Zeeb 32*b4c3e9b5SBjoern A. Zeeb #define SEQNUM_SHIFT 4 33*b4c3e9b5SBjoern A. Zeeb #define SEQNUM_MAX 0x1000 34*b4c3e9b5SBjoern A. Zeeb 35*b4c3e9b5SBjoern A. Zeeb #define NTXRATE 64 /* # tx MPDUs rate is reported for */ 36*b4c3e9b5SBjoern A. Zeeb 37*b4c3e9b5SBjoern A. Zeeb /* Maximum wait time for a MAC suspend */ 38*b4c3e9b5SBjoern A. Zeeb /* uS: 83mS is max packet time (64KB ampdu @ 6Mbps) */ 39*b4c3e9b5SBjoern A. Zeeb #define BRCMS_MAX_MAC_SUSPEND 83000 40*b4c3e9b5SBjoern A. Zeeb 41*b4c3e9b5SBjoern A. Zeeb /* responses for probe requests older that this are tossed, zero to disable */ 42*b4c3e9b5SBjoern A. Zeeb #define BRCMS_PRB_RESP_TIMEOUT 0 /* Disable probe response timeout */ 43*b4c3e9b5SBjoern A. Zeeb 44*b4c3e9b5SBjoern A. Zeeb /* transmit buffer max headroom for protocol headers */ 45*b4c3e9b5SBjoern A. Zeeb #define TXOFF (D11_TXH_LEN + D11_PHY_HDR_LEN) 46*b4c3e9b5SBjoern A. Zeeb 47*b4c3e9b5SBjoern A. Zeeb /* Macros for doing definition and get/set of bitfields 48*b4c3e9b5SBjoern A. Zeeb * Usage example, e.g. a three-bit field (bits 4-6): 49*b4c3e9b5SBjoern A. Zeeb * #define <NAME>_M BITFIELD_MASK(3) 50*b4c3e9b5SBjoern A. Zeeb * #define <NAME>_S 4 51*b4c3e9b5SBjoern A. Zeeb * ... 52*b4c3e9b5SBjoern A. Zeeb * regval = R_REG(osh, ®s->regfoo); 53*b4c3e9b5SBjoern A. Zeeb * field = GFIELD(regval, <NAME>); 54*b4c3e9b5SBjoern A. Zeeb * regval = SFIELD(regval, <NAME>, 1); 55*b4c3e9b5SBjoern A. Zeeb * W_REG(osh, ®s->regfoo, regval); 56*b4c3e9b5SBjoern A. Zeeb */ 57*b4c3e9b5SBjoern A. Zeeb #define BITFIELD_MASK(width) \ 58*b4c3e9b5SBjoern A. Zeeb (((unsigned)1 << (width)) - 1) 59*b4c3e9b5SBjoern A. Zeeb #define GFIELD(val, field) \ 60*b4c3e9b5SBjoern A. Zeeb (((val) >> field ## _S) & field ## _M) 61*b4c3e9b5SBjoern A. Zeeb #define SFIELD(val, field, bits) \ 62*b4c3e9b5SBjoern A. Zeeb (((val) & (~(field ## _M << field ## _S))) | \ 63*b4c3e9b5SBjoern A. Zeeb ((unsigned)(bits) << field ## _S)) 64*b4c3e9b5SBjoern A. Zeeb 65*b4c3e9b5SBjoern A. Zeeb #define SW_TIMER_MAC_STAT_UPD 30 /* periodic MAC stats update */ 66*b4c3e9b5SBjoern A. Zeeb 67*b4c3e9b5SBjoern A. Zeeb /* max # supported core revisions (0 .. MAXCOREREV - 1) */ 68*b4c3e9b5SBjoern A. Zeeb #define MAXCOREREV 28 69*b4c3e9b5SBjoern A. Zeeb 70*b4c3e9b5SBjoern A. Zeeb /* Double check that unsupported cores are not enabled */ 71*b4c3e9b5SBjoern A. Zeeb #if CONF_MSK(D11CONF, 0x4f) || CONF_GE(D11CONF, MAXCOREREV) 72*b4c3e9b5SBjoern A. Zeeb #error "Configuration for D11CONF includes unsupported versions." 73*b4c3e9b5SBjoern A. Zeeb #endif /* Bad versions */ 74*b4c3e9b5SBjoern A. Zeeb 75*b4c3e9b5SBjoern A. Zeeb /* values for shortslot_override */ 76*b4c3e9b5SBjoern A. Zeeb #define BRCMS_SHORTSLOT_AUTO -1 /* Driver will manage Shortslot setting */ 77*b4c3e9b5SBjoern A. Zeeb #define BRCMS_SHORTSLOT_OFF 0 /* Turn off short slot */ 78*b4c3e9b5SBjoern A. Zeeb #define BRCMS_SHORTSLOT_ON 1 /* Turn on short slot */ 79*b4c3e9b5SBjoern A. Zeeb 80*b4c3e9b5SBjoern A. Zeeb /* value for short/long and mixmode/greenfield preamble */ 81*b4c3e9b5SBjoern A. Zeeb #define BRCMS_LONG_PREAMBLE (0) 82*b4c3e9b5SBjoern A. Zeeb #define BRCMS_SHORT_PREAMBLE (1 << 0) 83*b4c3e9b5SBjoern A. Zeeb #define BRCMS_GF_PREAMBLE (1 << 1) 84*b4c3e9b5SBjoern A. Zeeb #define BRCMS_MM_PREAMBLE (1 << 2) 85*b4c3e9b5SBjoern A. Zeeb #define BRCMS_IS_MIMO_PREAMBLE(_pre) (((_pre) == BRCMS_GF_PREAMBLE) || \ 86*b4c3e9b5SBjoern A. Zeeb ((_pre) == BRCMS_MM_PREAMBLE)) 87*b4c3e9b5SBjoern A. Zeeb 88*b4c3e9b5SBjoern A. Zeeb /* TxFrameID */ 89*b4c3e9b5SBjoern A. Zeeb /* seq and frag bits: SEQNUM_SHIFT, FRAGNUM_MASK (802.11.h) */ 90*b4c3e9b5SBjoern A. Zeeb /* rate epoch bits: TXFID_RATE_SHIFT, TXFID_RATE_MASK ((wlc_rate.c) */ 91*b4c3e9b5SBjoern A. Zeeb #define TXFID_QUEUE_MASK 0x0007 /* Bits 0-2 */ 92*b4c3e9b5SBjoern A. Zeeb #define TXFID_SEQ_MASK 0x7FE0 /* Bits 5-15 */ 93*b4c3e9b5SBjoern A. Zeeb #define TXFID_SEQ_SHIFT 5 /* Number of bit shifts */ 94*b4c3e9b5SBjoern A. Zeeb #define TXFID_RATE_PROBE_MASK 0x8000 /* Bit 15 for rate probe */ 95*b4c3e9b5SBjoern A. Zeeb #define TXFID_RATE_MASK 0x0018 /* Mask for bits 3 and 4 */ 96*b4c3e9b5SBjoern A. Zeeb #define TXFID_RATE_SHIFT 3 /* Shift 3 bits for rate mask */ 97*b4c3e9b5SBjoern A. Zeeb 98*b4c3e9b5SBjoern A. Zeeb /* promote boardrev */ 99*b4c3e9b5SBjoern A. Zeeb #define BOARDREV_PROMOTABLE 0xFF /* from */ 100*b4c3e9b5SBjoern A. Zeeb #define BOARDREV_PROMOTED 1 /* to */ 101*b4c3e9b5SBjoern A. Zeeb 102*b4c3e9b5SBjoern A. Zeeb #define DATA_BLOCK_TX_SUPR (1 << 4) 103*b4c3e9b5SBjoern A. Zeeb 104*b4c3e9b5SBjoern A. Zeeb /* Ucode MCTL_WAKE override bits */ 105*b4c3e9b5SBjoern A. Zeeb #define BRCMS_WAKE_OVERRIDE_CLKCTL 0x01 106*b4c3e9b5SBjoern A. Zeeb #define BRCMS_WAKE_OVERRIDE_PHYREG 0x02 107*b4c3e9b5SBjoern A. Zeeb #define BRCMS_WAKE_OVERRIDE_MACSUSPEND 0x04 108*b4c3e9b5SBjoern A. Zeeb #define BRCMS_WAKE_OVERRIDE_TXFIFO 0x08 109*b4c3e9b5SBjoern A. Zeeb #define BRCMS_WAKE_OVERRIDE_FORCEFAST 0x10 110*b4c3e9b5SBjoern A. Zeeb 111*b4c3e9b5SBjoern A. Zeeb /* stuff pulled in from wlc.c */ 112*b4c3e9b5SBjoern A. Zeeb 113*b4c3e9b5SBjoern A. Zeeb /* Interrupt bit error summary. Don't include I_RU: we refill DMA at other 114*b4c3e9b5SBjoern A. Zeeb * times; and if we run out, constant I_RU interrupts may cause lockup. We 115*b4c3e9b5SBjoern A. Zeeb * will still get error counts from rx0ovfl. 116*b4c3e9b5SBjoern A. Zeeb */ 117*b4c3e9b5SBjoern A. Zeeb #define I_ERRORS (I_PC | I_PD | I_DE | I_RO | I_XU) 118*b4c3e9b5SBjoern A. Zeeb /* default software intmasks */ 119*b4c3e9b5SBjoern A. Zeeb #define DEF_RXINTMASK (I_RI) /* enable rx int on rxfifo only */ 120*b4c3e9b5SBjoern A. Zeeb #define DEF_MACINTMASK (MI_TXSTOP | MI_TBTT | MI_ATIMWINEND | MI_PMQ | \ 121*b4c3e9b5SBjoern A. Zeeb MI_PHYTXERR | MI_DMAINT | MI_TFS | MI_BG_NOISE | \ 122*b4c3e9b5SBjoern A. Zeeb MI_CCA | MI_TO | MI_GP0 | MI_RFDISABLE | MI_PWRUP) 123*b4c3e9b5SBjoern A. Zeeb 124*b4c3e9b5SBjoern A. Zeeb #define MAXTXPKTS 6 /* max # pkts pending */ 125*b4c3e9b5SBjoern A. Zeeb 126*b4c3e9b5SBjoern A. Zeeb /* frameburst */ 127*b4c3e9b5SBjoern A. Zeeb #define MAXTXFRAMEBURST 8 /* vanilla xpress mode: max frames/burst */ 128*b4c3e9b5SBjoern A. Zeeb #define MAXFRAMEBURST_TXOP 10000 /* Frameburst TXOP in usec */ 129*b4c3e9b5SBjoern A. Zeeb 130*b4c3e9b5SBjoern A. Zeeb #define NFIFO 6 /* # tx/rx fifopairs */ 131*b4c3e9b5SBjoern A. Zeeb 132*b4c3e9b5SBjoern A. Zeeb /* PLL requests */ 133*b4c3e9b5SBjoern A. Zeeb 134*b4c3e9b5SBjoern A. Zeeb /* pll is shared on old chips */ 135*b4c3e9b5SBjoern A. Zeeb #define BRCMS_PLLREQ_SHARED 0x1 136*b4c3e9b5SBjoern A. Zeeb /* hold pll for radio monitor register checking */ 137*b4c3e9b5SBjoern A. Zeeb #define BRCMS_PLLREQ_RADIO_MON 0x2 138*b4c3e9b5SBjoern A. Zeeb /* hold/release pll for some short operation */ 139*b4c3e9b5SBjoern A. Zeeb #define BRCMS_PLLREQ_FLIP 0x4 140*b4c3e9b5SBjoern A. Zeeb 141*b4c3e9b5SBjoern A. Zeeb #define CHANNEL_BANDUNIT(wlc, ch) \ 142*b4c3e9b5SBjoern A. Zeeb (((ch) <= CH_MAX_2G_CHANNEL) ? BAND_2G_INDEX : BAND_5G_INDEX) 143*b4c3e9b5SBjoern A. Zeeb 144*b4c3e9b5SBjoern A. Zeeb #define OTHERBANDUNIT(wlc) \ 145*b4c3e9b5SBjoern A. Zeeb ((uint)((wlc)->band->bandunit ? BAND_2G_INDEX : BAND_5G_INDEX)) 146*b4c3e9b5SBjoern A. Zeeb 147*b4c3e9b5SBjoern A. Zeeb /* 148*b4c3e9b5SBjoern A. Zeeb * 802.11 protection information 149*b4c3e9b5SBjoern A. Zeeb * 150*b4c3e9b5SBjoern A. Zeeb * _g: use g spec protection, driver internal. 151*b4c3e9b5SBjoern A. Zeeb * g_override: override for use of g spec protection. 152*b4c3e9b5SBjoern A. Zeeb * gmode_user: user config gmode, operating band->gmode is different. 153*b4c3e9b5SBjoern A. Zeeb * overlap: Overlap BSS/IBSS protection for both 11g and 11n. 154*b4c3e9b5SBjoern A. Zeeb * nmode_user: user config nmode, operating pub->nmode is different. 155*b4c3e9b5SBjoern A. Zeeb * n_cfg: use OFDM protection on MIMO frames. 156*b4c3e9b5SBjoern A. Zeeb * n_cfg_override: override for use of N protection. 157*b4c3e9b5SBjoern A. Zeeb * nongf: non-GF present protection. 158*b4c3e9b5SBjoern A. Zeeb * nongf_override: override for use of GF protection. 159*b4c3e9b5SBjoern A. Zeeb * n_pam_override: override for preamble: MM or GF. 160*b4c3e9b5SBjoern A. Zeeb * n_obss: indicated OBSS Non-HT STA present. 161*b4c3e9b5SBjoern A. Zeeb */ 162*b4c3e9b5SBjoern A. Zeeb struct brcms_protection { 163*b4c3e9b5SBjoern A. Zeeb bool _g; 164*b4c3e9b5SBjoern A. Zeeb s8 g_override; 165*b4c3e9b5SBjoern A. Zeeb u8 gmode_user; 166*b4c3e9b5SBjoern A. Zeeb s8 overlap; 167*b4c3e9b5SBjoern A. Zeeb s8 nmode_user; 168*b4c3e9b5SBjoern A. Zeeb s8 n_cfg; 169*b4c3e9b5SBjoern A. Zeeb s8 n_cfg_override; 170*b4c3e9b5SBjoern A. Zeeb bool nongf; 171*b4c3e9b5SBjoern A. Zeeb s8 nongf_override; 172*b4c3e9b5SBjoern A. Zeeb s8 n_pam_override; 173*b4c3e9b5SBjoern A. Zeeb bool n_obss; 174*b4c3e9b5SBjoern A. Zeeb }; 175*b4c3e9b5SBjoern A. Zeeb 176*b4c3e9b5SBjoern A. Zeeb /* 177*b4c3e9b5SBjoern A. Zeeb * anything affecting the single/dual streams/antenna operation 178*b4c3e9b5SBjoern A. Zeeb * 179*b4c3e9b5SBjoern A. Zeeb * hw_txchain: HW txchain bitmap cfg. 180*b4c3e9b5SBjoern A. Zeeb * txchain: txchain bitmap being used. 181*b4c3e9b5SBjoern A. Zeeb * txstreams: number of txchains being used. 182*b4c3e9b5SBjoern A. Zeeb * hw_rxchain: HW rxchain bitmap cfg. 183*b4c3e9b5SBjoern A. Zeeb * rxchain: rxchain bitmap being used. 184*b4c3e9b5SBjoern A. Zeeb * rxstreams: number of rxchains being used. 185*b4c3e9b5SBjoern A. Zeeb * ant_rx_ovr: rx antenna override. 186*b4c3e9b5SBjoern A. Zeeb * txant: userTx antenna setting. 187*b4c3e9b5SBjoern A. Zeeb * phytxant: phyTx antenna setting in txheader. 188*b4c3e9b5SBjoern A. Zeeb * ss_opmode: singlestream Operational mode, 0:siso; 1:cdd. 189*b4c3e9b5SBjoern A. Zeeb * ss_algosel_auto: if true, use wlc->stf->ss_algo_channel; 190*b4c3e9b5SBjoern A. Zeeb * else use wlc->band->stf->ss_mode_band. 191*b4c3e9b5SBjoern A. Zeeb * ss_algo_channel: ss based on per-channel algo: 0: SISO, 1: CDD 2: STBC. 192*b4c3e9b5SBjoern A. Zeeb * rxchain_restore_delay: delay time to restore default rxchain. 193*b4c3e9b5SBjoern A. Zeeb * ldpc: AUTO/ON/OFF ldpc cap supported. 194*b4c3e9b5SBjoern A. Zeeb * txcore[MAX_STREAMS_SUPPORTED + 1]: bitmap of selected core for each Nsts. 195*b4c3e9b5SBjoern A. Zeeb * spatial_policy: 196*b4c3e9b5SBjoern A. Zeeb */ 197*b4c3e9b5SBjoern A. Zeeb struct brcms_stf { 198*b4c3e9b5SBjoern A. Zeeb u8 hw_txchain; 199*b4c3e9b5SBjoern A. Zeeb u8 txchain; 200*b4c3e9b5SBjoern A. Zeeb u8 txstreams; 201*b4c3e9b5SBjoern A. Zeeb u8 hw_rxchain; 202*b4c3e9b5SBjoern A. Zeeb u8 rxchain; 203*b4c3e9b5SBjoern A. Zeeb u8 rxstreams; 204*b4c3e9b5SBjoern A. Zeeb u8 ant_rx_ovr; 205*b4c3e9b5SBjoern A. Zeeb s8 txant; 206*b4c3e9b5SBjoern A. Zeeb u16 phytxant; 207*b4c3e9b5SBjoern A. Zeeb u8 ss_opmode; 208*b4c3e9b5SBjoern A. Zeeb bool ss_algosel_auto; 209*b4c3e9b5SBjoern A. Zeeb u16 ss_algo_channel; 210*b4c3e9b5SBjoern A. Zeeb u8 rxchain_restore_delay; 211*b4c3e9b5SBjoern A. Zeeb s8 ldpc; 212*b4c3e9b5SBjoern A. Zeeb u8 txcore[MAX_STREAMS_SUPPORTED + 1]; 213*b4c3e9b5SBjoern A. Zeeb s8 spatial_policy; 214*b4c3e9b5SBjoern A. Zeeb }; 215*b4c3e9b5SBjoern A. Zeeb 216*b4c3e9b5SBjoern A. Zeeb #define BRCMS_STF_SS_STBC_TX(wlc, scb) \ 217*b4c3e9b5SBjoern A. Zeeb (((wlc)->stf->txstreams > 1) && (((wlc)->band->band_stf_stbc_tx == ON) \ 218*b4c3e9b5SBjoern A. Zeeb || (((scb)->flags & SCB_STBCCAP) && \ 219*b4c3e9b5SBjoern A. Zeeb (wlc)->band->band_stf_stbc_tx == AUTO && \ 220*b4c3e9b5SBjoern A. Zeeb isset(&((wlc)->stf->ss_algo_channel), PHY_TXC1_MODE_STBC)))) 221*b4c3e9b5SBjoern A. Zeeb 222*b4c3e9b5SBjoern A. Zeeb #define BRCMS_STBC_CAP_PHY(wlc) (BRCMS_ISNPHY(wlc->band) && \ 223*b4c3e9b5SBjoern A. Zeeb NREV_GE(wlc->band->phyrev, 3)) 224*b4c3e9b5SBjoern A. Zeeb 225*b4c3e9b5SBjoern A. Zeeb #define BRCMS_SGI_CAP_PHY(wlc) ((BRCMS_ISNPHY(wlc->band) && \ 226*b4c3e9b5SBjoern A. Zeeb NREV_GE(wlc->band->phyrev, 3)) || \ 227*b4c3e9b5SBjoern A. Zeeb BRCMS_ISLCNPHY(wlc->band)) 228*b4c3e9b5SBjoern A. Zeeb 229*b4c3e9b5SBjoern A. Zeeb #define BRCMS_CHAN_PHYTYPE(x) (((x) & RXS_CHAN_PHYTYPE_MASK) \ 230*b4c3e9b5SBjoern A. Zeeb >> RXS_CHAN_PHYTYPE_SHIFT) 231*b4c3e9b5SBjoern A. Zeeb #define BRCMS_CHAN_CHANNEL(x) (((x) & RXS_CHAN_ID_MASK) \ 232*b4c3e9b5SBjoern A. Zeeb >> RXS_CHAN_ID_SHIFT) 233*b4c3e9b5SBjoern A. Zeeb 234*b4c3e9b5SBjoern A. Zeeb /* 235*b4c3e9b5SBjoern A. Zeeb * core state (mac) 236*b4c3e9b5SBjoern A. Zeeb */ 237*b4c3e9b5SBjoern A. Zeeb struct brcms_core { 238*b4c3e9b5SBjoern A. Zeeb uint coreidx; /* # sb enumerated core */ 239*b4c3e9b5SBjoern A. Zeeb 240*b4c3e9b5SBjoern A. Zeeb /* fifo */ 241*b4c3e9b5SBjoern A. Zeeb uint *txavail[NFIFO]; /* # tx descriptors available */ 242*b4c3e9b5SBjoern A. Zeeb 243*b4c3e9b5SBjoern A. Zeeb struct macstat *macstat_snapshot; /* mac hw prev read values */ 244*b4c3e9b5SBjoern A. Zeeb }; 245*b4c3e9b5SBjoern A. Zeeb 246*b4c3e9b5SBjoern A. Zeeb /* 247*b4c3e9b5SBjoern A. Zeeb * band state (phy+ana+radio) 248*b4c3e9b5SBjoern A. Zeeb */ 249*b4c3e9b5SBjoern A. Zeeb struct brcms_band { 250*b4c3e9b5SBjoern A. Zeeb int bandtype; /* BRCM_BAND_2G, BRCM_BAND_5G */ 251*b4c3e9b5SBjoern A. Zeeb uint bandunit; /* bandstate[] index */ 252*b4c3e9b5SBjoern A. Zeeb 253*b4c3e9b5SBjoern A. Zeeb u16 phytype; /* phytype */ 254*b4c3e9b5SBjoern A. Zeeb u16 phyrev; 255*b4c3e9b5SBjoern A. Zeeb u16 radioid; 256*b4c3e9b5SBjoern A. Zeeb u16 radiorev; 257*b4c3e9b5SBjoern A. Zeeb struct brcms_phy_pub *pi; /* pointer to phy specific information */ 258*b4c3e9b5SBjoern A. Zeeb bool abgphy_encore; 259*b4c3e9b5SBjoern A. Zeeb 260*b4c3e9b5SBjoern A. Zeeb u8 gmode; /* currently active gmode */ 261*b4c3e9b5SBjoern A. Zeeb 262*b4c3e9b5SBjoern A. Zeeb struct scb *hwrs_scb; /* permanent scb for hw rateset */ 263*b4c3e9b5SBjoern A. Zeeb 264*b4c3e9b5SBjoern A. Zeeb /* band-specific copy of default_bss.rateset */ 265*b4c3e9b5SBjoern A. Zeeb struct brcms_c_rateset defrateset; 266*b4c3e9b5SBjoern A. Zeeb 267*b4c3e9b5SBjoern A. Zeeb u8 band_stf_ss_mode; /* Configured STF type, 0:siso; 1:cdd */ 268*b4c3e9b5SBjoern A. Zeeb s8 band_stf_stbc_tx; /* STBC TX 0:off; 1:force on; -1:auto */ 269*b4c3e9b5SBjoern A. Zeeb /* rates supported by chip (phy-specific) */ 270*b4c3e9b5SBjoern A. Zeeb struct brcms_c_rateset hw_rateset; 271*b4c3e9b5SBjoern A. Zeeb u8 basic_rate[BRCM_MAXRATE + 1]; /* basic rates indexed by rate */ 272*b4c3e9b5SBjoern A. Zeeb bool mimo_cap_40; /* 40 MHz cap enabled on this band */ 273*b4c3e9b5SBjoern A. Zeeb s8 antgain; /* antenna gain from srom */ 274*b4c3e9b5SBjoern A. Zeeb 275*b4c3e9b5SBjoern A. Zeeb u16 CWmin; /* minimum size of contention window, in unit of aSlotTime */ 276*b4c3e9b5SBjoern A. Zeeb u16 CWmax; /* maximum size of contention window, in unit of aSlotTime */ 277*b4c3e9b5SBjoern A. Zeeb struct ieee80211_supported_band band; 278*b4c3e9b5SBjoern A. Zeeb }; 279*b4c3e9b5SBjoern A. Zeeb 280*b4c3e9b5SBjoern A. Zeeb /* module control blocks */ 281*b4c3e9b5SBjoern A. Zeeb struct modulecb { 282*b4c3e9b5SBjoern A. Zeeb /* module name : NULL indicates empty array member */ 283*b4c3e9b5SBjoern A. Zeeb char name[32]; 284*b4c3e9b5SBjoern A. Zeeb /* handle passed when handler 'doiovar' is called */ 285*b4c3e9b5SBjoern A. Zeeb struct brcms_info *hdl; 286*b4c3e9b5SBjoern A. Zeeb 287*b4c3e9b5SBjoern A. Zeeb int (*down_fn)(void *handle); /* down handler. Note: the int returned 288*b4c3e9b5SBjoern A. Zeeb * by the down function is a count of the 289*b4c3e9b5SBjoern A. Zeeb * number of timers that could not be 290*b4c3e9b5SBjoern A. Zeeb * freed. 291*b4c3e9b5SBjoern A. Zeeb */ 292*b4c3e9b5SBjoern A. Zeeb 293*b4c3e9b5SBjoern A. Zeeb }; 294*b4c3e9b5SBjoern A. Zeeb 295*b4c3e9b5SBjoern A. Zeeb struct brcms_hw_band { 296*b4c3e9b5SBjoern A. Zeeb int bandtype; /* BRCM_BAND_2G, BRCM_BAND_5G */ 297*b4c3e9b5SBjoern A. Zeeb uint bandunit; /* bandstate[] index */ 298*b4c3e9b5SBjoern A. Zeeb u16 mhfs[MHFMAX]; /* MHF array shadow */ 299*b4c3e9b5SBjoern A. Zeeb u8 bandhw_stf_ss_mode; /* HW configured STF type, 0:siso; 1:cdd */ 300*b4c3e9b5SBjoern A. Zeeb u16 CWmin; 301*b4c3e9b5SBjoern A. Zeeb u16 CWmax; 302*b4c3e9b5SBjoern A. Zeeb u32 core_flags; 303*b4c3e9b5SBjoern A. Zeeb 304*b4c3e9b5SBjoern A. Zeeb u16 phytype; /* phytype */ 305*b4c3e9b5SBjoern A. Zeeb u16 phyrev; 306*b4c3e9b5SBjoern A. Zeeb u16 radioid; 307*b4c3e9b5SBjoern A. Zeeb u16 radiorev; 308*b4c3e9b5SBjoern A. Zeeb struct brcms_phy_pub *pi; /* pointer to phy specific information */ 309*b4c3e9b5SBjoern A. Zeeb bool abgphy_encore; 310*b4c3e9b5SBjoern A. Zeeb }; 311*b4c3e9b5SBjoern A. Zeeb 312*b4c3e9b5SBjoern A. Zeeb struct brcms_hardware { 313*b4c3e9b5SBjoern A. Zeeb bool _piomode; /* true if pio mode */ 314*b4c3e9b5SBjoern A. Zeeb struct brcms_c_info *wlc; 315*b4c3e9b5SBjoern A. Zeeb 316*b4c3e9b5SBjoern A. Zeeb /* fifo */ 317*b4c3e9b5SBjoern A. Zeeb struct dma_pub *di[NFIFO]; /* dma handles, per fifo */ 318*b4c3e9b5SBjoern A. Zeeb 319*b4c3e9b5SBjoern A. Zeeb uint unit; /* device instance number */ 320*b4c3e9b5SBjoern A. Zeeb 321*b4c3e9b5SBjoern A. Zeeb /* version info */ 322*b4c3e9b5SBjoern A. Zeeb u16 vendorid; /* PCI vendor id */ 323*b4c3e9b5SBjoern A. Zeeb u16 deviceid; /* PCI device id */ 324*b4c3e9b5SBjoern A. Zeeb uint corerev; /* core revision */ 325*b4c3e9b5SBjoern A. Zeeb u8 sromrev; /* version # of the srom */ 326*b4c3e9b5SBjoern A. Zeeb u16 boardrev; /* version # of particular board */ 327*b4c3e9b5SBjoern A. Zeeb u32 boardflags; /* Board specific flags from srom */ 328*b4c3e9b5SBjoern A. Zeeb u32 boardflags2; /* More board flags if sromrev >= 4 */ 329*b4c3e9b5SBjoern A. Zeeb u32 machwcap; /* MAC capabilities */ 330*b4c3e9b5SBjoern A. Zeeb u32 machwcap_backup; /* backup of machwcap */ 331*b4c3e9b5SBjoern A. Zeeb 332*b4c3e9b5SBjoern A. Zeeb struct si_pub *sih; /* SI handle (cookie for siutils calls) */ 333*b4c3e9b5SBjoern A. Zeeb struct bcma_device *d11core; /* pointer to 802.11 core */ 334*b4c3e9b5SBjoern A. Zeeb struct phy_shim_info *physhim; /* phy shim layer handler */ 335*b4c3e9b5SBjoern A. Zeeb struct shared_phy *phy_sh; /* pointer to shared phy state */ 336*b4c3e9b5SBjoern A. Zeeb struct brcms_hw_band *band;/* pointer to active per-band state */ 337*b4c3e9b5SBjoern A. Zeeb /* band state per phy/radio */ 338*b4c3e9b5SBjoern A. Zeeb struct brcms_hw_band *bandstate[MAXBANDS]; 339*b4c3e9b5SBjoern A. Zeeb u16 bmac_phytxant; /* cache of high phytxant state */ 340*b4c3e9b5SBjoern A. Zeeb bool shortslot; /* currently using 11g ShortSlot timing */ 341*b4c3e9b5SBjoern A. Zeeb u16 SRL; /* 802.11 dot11ShortRetryLimit */ 342*b4c3e9b5SBjoern A. Zeeb u16 LRL; /* 802.11 dot11LongRetryLimit */ 343*b4c3e9b5SBjoern A. Zeeb u16 SFBL; /* Short Frame Rate Fallback Limit */ 344*b4c3e9b5SBjoern A. Zeeb u16 LFBL; /* Long Frame Rate Fallback Limit */ 345*b4c3e9b5SBjoern A. Zeeb 346*b4c3e9b5SBjoern A. Zeeb bool up; /* d11 hardware up and running */ 347*b4c3e9b5SBjoern A. Zeeb uint now; /* # elapsed seconds */ 348*b4c3e9b5SBjoern A. Zeeb uint _nbands; /* # bands supported */ 349*b4c3e9b5SBjoern A. Zeeb u16 chanspec; /* bmac chanspec shadow */ 350*b4c3e9b5SBjoern A. Zeeb 351*b4c3e9b5SBjoern A. Zeeb uint *txavail[NFIFO]; /* # tx descriptors available */ 352*b4c3e9b5SBjoern A. Zeeb const u16 *xmtfifo_sz; /* fifo size in 256B for each xmt fifo */ 353*b4c3e9b5SBjoern A. Zeeb 354*b4c3e9b5SBjoern A. Zeeb u32 pllreq; /* pll requests to keep PLL on */ 355*b4c3e9b5SBjoern A. Zeeb 356*b4c3e9b5SBjoern A. Zeeb u8 suspended_fifos; /* Which TX fifo to remain awake for */ 357*b4c3e9b5SBjoern A. Zeeb u32 maccontrol; /* Cached value of maccontrol */ 358*b4c3e9b5SBjoern A. Zeeb uint mac_suspend_depth; /* current depth of mac_suspend levels */ 359*b4c3e9b5SBjoern A. Zeeb u32 wake_override; /* bit flags to force MAC to WAKE mode */ 360*b4c3e9b5SBjoern A. Zeeb u32 mute_override; /* Prevent ucode from sending beacons */ 361*b4c3e9b5SBjoern A. Zeeb u8 etheraddr[ETH_ALEN]; /* currently configured ethernet address */ 362*b4c3e9b5SBjoern A. Zeeb bool noreset; /* true= do not reset hw, used by WLC_OUT */ 363*b4c3e9b5SBjoern A. Zeeb bool forcefastclk; /* true if h/w is forcing to use fast clk */ 364*b4c3e9b5SBjoern A. Zeeb bool clk; /* core is out of reset and has clock */ 365*b4c3e9b5SBjoern A. Zeeb bool sbclk; /* sb has clock */ 366*b4c3e9b5SBjoern A. Zeeb bool phyclk; /* phy is out of reset and has clock */ 367*b4c3e9b5SBjoern A. Zeeb 368*b4c3e9b5SBjoern A. Zeeb bool ucode_loaded; /* true after ucode downloaded */ 369*b4c3e9b5SBjoern A. Zeeb 370*b4c3e9b5SBjoern A. Zeeb 371*b4c3e9b5SBjoern A. Zeeb u8 hw_stf_ss_opmode; /* STF single stream operation mode */ 372*b4c3e9b5SBjoern A. Zeeb u8 antsel_type; /* Type of boardlevel mimo antenna switch-logic 373*b4c3e9b5SBjoern A. Zeeb * 0 = N/A, 1 = 2x4 board, 2 = 2x3 CB2 board 374*b4c3e9b5SBjoern A. Zeeb */ 375*b4c3e9b5SBjoern A. Zeeb u32 antsel_avail; /* 376*b4c3e9b5SBjoern A. Zeeb * put struct antsel_info here if more info is 377*b4c3e9b5SBjoern A. Zeeb * needed 378*b4c3e9b5SBjoern A. Zeeb */ 379*b4c3e9b5SBjoern A. Zeeb }; 380*b4c3e9b5SBjoern A. Zeeb 381*b4c3e9b5SBjoern A. Zeeb /* 382*b4c3e9b5SBjoern A. Zeeb * Principal common driver data structure. 383*b4c3e9b5SBjoern A. Zeeb * 384*b4c3e9b5SBjoern A. Zeeb * pub: pointer to driver public state. 385*b4c3e9b5SBjoern A. Zeeb * wl: pointer to specific private state. 386*b4c3e9b5SBjoern A. Zeeb * hw: HW related state. 387*b4c3e9b5SBjoern A. Zeeb * clkreq_override: setting for clkreq for PCIE : Auto, 0, 1. 388*b4c3e9b5SBjoern A. Zeeb * fastpwrup_dly: time in us needed to bring up d11 fast clock. 389*b4c3e9b5SBjoern A. Zeeb * macintstatus: bit channel between isr and dpc. 390*b4c3e9b5SBjoern A. Zeeb * macintmask: sw runtime master macintmask value. 391*b4c3e9b5SBjoern A. Zeeb * defmacintmask: default "on" macintmask value. 392*b4c3e9b5SBjoern A. Zeeb * clk: core is out of reset and has clock. 393*b4c3e9b5SBjoern A. Zeeb * core: pointer to active io core. 394*b4c3e9b5SBjoern A. Zeeb * band: pointer to active per-band state. 395*b4c3e9b5SBjoern A. Zeeb * corestate: per-core state (one per hw core). 396*b4c3e9b5SBjoern A. Zeeb * bandstate: per-band state (one per phy/radio). 397*b4c3e9b5SBjoern A. Zeeb * qvalid: DirFrmQValid and BcMcFrmQValid. 398*b4c3e9b5SBjoern A. Zeeb * ampdu: ampdu module handler. 399*b4c3e9b5SBjoern A. Zeeb * asi: antsel module handler. 400*b4c3e9b5SBjoern A. Zeeb * cmi: channel manager module handler. 401*b4c3e9b5SBjoern A. Zeeb * vendorid: PCI vendor id. 402*b4c3e9b5SBjoern A. Zeeb * deviceid: PCI device id. 403*b4c3e9b5SBjoern A. Zeeb * ucode_rev: microcode revision. 404*b4c3e9b5SBjoern A. Zeeb * machwcap: MAC capabilities, BMAC shadow. 405*b4c3e9b5SBjoern A. Zeeb * perm_etheraddr: original sprom local ethernet address. 406*b4c3e9b5SBjoern A. Zeeb * bandlocked: disable auto multi-band switching. 407*b4c3e9b5SBjoern A. Zeeb * bandinit_pending: track band init in auto band. 408*b4c3e9b5SBjoern A. Zeeb * radio_monitor: radio timer is running. 409*b4c3e9b5SBjoern A. Zeeb * going_down: down path intermediate variable. 410*b4c3e9b5SBjoern A. Zeeb * wdtimer: timer for watchdog routine. 411*b4c3e9b5SBjoern A. Zeeb * radio_timer: timer for hw radio button monitor routine. 412*b4c3e9b5SBjoern A. Zeeb * monitor: monitor (MPDU sniffing) mode. 413*b4c3e9b5SBjoern A. Zeeb * bcnmisc_monitor: bcns promisc mode override for monitor. 414*b4c3e9b5SBjoern A. Zeeb * _rifs: enable per-packet rifs. 415*b4c3e9b5SBjoern A. Zeeb * bcn_li_bcn: beacon listen interval in # beacons. 416*b4c3e9b5SBjoern A. Zeeb * bcn_li_dtim: beacon listen interval in # dtims. 417*b4c3e9b5SBjoern A. Zeeb * WDarmed: watchdog timer is armed. 418*b4c3e9b5SBjoern A. Zeeb * WDlast: last time wlc_watchdog() was called. 419*b4c3e9b5SBjoern A. Zeeb * edcf_txop[IEEE80211_NUM_ACS]: current txop for each ac. 420*b4c3e9b5SBjoern A. Zeeb * wme_retries: per-AC retry limits. 421*b4c3e9b5SBjoern A. Zeeb * bsscfg: set of BSS configurations, idx 0 is default and always valid. 422*b4c3e9b5SBjoern A. Zeeb * cfg: the primary bsscfg (can be AP or STA). 423*b4c3e9b5SBjoern A. Zeeb * modulecb: 424*b4c3e9b5SBjoern A. Zeeb * mimoft: SIGN or 11N. 425*b4c3e9b5SBjoern A. Zeeb * cck_40txbw: 11N, cck tx b/w override when in 40MHZ mode. 426*b4c3e9b5SBjoern A. Zeeb * ofdm_40txbw: 11N, ofdm tx b/w override when in 40MHZ mode. 427*b4c3e9b5SBjoern A. Zeeb * mimo_40txbw: 11N, mimo tx b/w override when in 40MHZ mode. 428*b4c3e9b5SBjoern A. Zeeb * default_bss: configured BSS parameters. 429*b4c3e9b5SBjoern A. Zeeb * mc_fid_counter: BC/MC FIFO frame ID counter. 430*b4c3e9b5SBjoern A. Zeeb * country_default: saved country for leaving 802.11d auto-country mode. 431*b4c3e9b5SBjoern A. Zeeb * autocountry_default: initial country for 802.11d auto-country mode. 432*b4c3e9b5SBjoern A. Zeeb * prb_resp_timeout: do not send prb resp if request older 433*b4c3e9b5SBjoern A. Zeeb * than this, 0 = disable. 434*b4c3e9b5SBjoern A. Zeeb * home_chanspec: shared home chanspec. 435*b4c3e9b5SBjoern A. Zeeb * chanspec: target operational channel. 436*b4c3e9b5SBjoern A. Zeeb * usr_fragthresh: user configured fragmentation threshold. 437*b4c3e9b5SBjoern A. Zeeb * fragthresh[NFIFO]: per-fifo fragmentation thresholds. 438*b4c3e9b5SBjoern A. Zeeb * RTSThresh: 802.11 dot11RTSThreshold. 439*b4c3e9b5SBjoern A. Zeeb * SRL: 802.11 dot11ShortRetryLimit. 440*b4c3e9b5SBjoern A. Zeeb * LRL: 802.11 dot11LongRetryLimit. 441*b4c3e9b5SBjoern A. Zeeb * SFBL: Short Frame Rate Fallback Limit. 442*b4c3e9b5SBjoern A. Zeeb * LFBL: Long Frame Rate Fallback Limit. 443*b4c3e9b5SBjoern A. Zeeb * shortslot: currently using 11g ShortSlot timing. 444*b4c3e9b5SBjoern A. Zeeb * shortslot_override: 11g ShortSlot override. 445*b4c3e9b5SBjoern A. Zeeb * include_legacy_erp: include Legacy ERP info elt ID 47 as well as g ID 42. 446*b4c3e9b5SBjoern A. Zeeb * PLCPHdr_override: 802.11b Preamble Type override. 447*b4c3e9b5SBjoern A. Zeeb * stf: 448*b4c3e9b5SBjoern A. Zeeb * bcn_rspec: save bcn ratespec purpose. 449*b4c3e9b5SBjoern A. Zeeb * tempsense_lasttime; 450*b4c3e9b5SBjoern A. Zeeb * tx_duty_cycle_ofdm: maximum allowed duty cycle for OFDM. 451*b4c3e9b5SBjoern A. Zeeb * tx_duty_cycle_cck: maximum allowed duty cycle for CCK. 452*b4c3e9b5SBjoern A. Zeeb * wiphy: 453*b4c3e9b5SBjoern A. Zeeb * pri_scb: primary Station Control Block 454*b4c3e9b5SBjoern A. Zeeb */ 455*b4c3e9b5SBjoern A. Zeeb struct brcms_c_info { 456*b4c3e9b5SBjoern A. Zeeb struct brcms_pub *pub; 457*b4c3e9b5SBjoern A. Zeeb struct brcms_info *wl; 458*b4c3e9b5SBjoern A. Zeeb struct brcms_hardware *hw; 459*b4c3e9b5SBjoern A. Zeeb 460*b4c3e9b5SBjoern A. Zeeb /* clock */ 461*b4c3e9b5SBjoern A. Zeeb u16 fastpwrup_dly; 462*b4c3e9b5SBjoern A. Zeeb 463*b4c3e9b5SBjoern A. Zeeb /* interrupt */ 464*b4c3e9b5SBjoern A. Zeeb u32 macintstatus; 465*b4c3e9b5SBjoern A. Zeeb u32 macintmask; 466*b4c3e9b5SBjoern A. Zeeb u32 defmacintmask; 467*b4c3e9b5SBjoern A. Zeeb 468*b4c3e9b5SBjoern A. Zeeb bool clk; 469*b4c3e9b5SBjoern A. Zeeb 470*b4c3e9b5SBjoern A. Zeeb /* multiband */ 471*b4c3e9b5SBjoern A. Zeeb struct brcms_core *core; 472*b4c3e9b5SBjoern A. Zeeb struct brcms_band *band; 473*b4c3e9b5SBjoern A. Zeeb struct brcms_core *corestate; 474*b4c3e9b5SBjoern A. Zeeb struct brcms_band *bandstate[MAXBANDS]; 475*b4c3e9b5SBjoern A. Zeeb 476*b4c3e9b5SBjoern A. Zeeb /* packet queue */ 477*b4c3e9b5SBjoern A. Zeeb uint qvalid; 478*b4c3e9b5SBjoern A. Zeeb 479*b4c3e9b5SBjoern A. Zeeb struct ampdu_info *ampdu; 480*b4c3e9b5SBjoern A. Zeeb struct antsel_info *asi; 481*b4c3e9b5SBjoern A. Zeeb struct brcms_cm_info *cmi; 482*b4c3e9b5SBjoern A. Zeeb 483*b4c3e9b5SBjoern A. Zeeb u16 vendorid; 484*b4c3e9b5SBjoern A. Zeeb u16 deviceid; 485*b4c3e9b5SBjoern A. Zeeb uint ucode_rev; 486*b4c3e9b5SBjoern A. Zeeb 487*b4c3e9b5SBjoern A. Zeeb u8 perm_etheraddr[ETH_ALEN]; 488*b4c3e9b5SBjoern A. Zeeb 489*b4c3e9b5SBjoern A. Zeeb bool bandlocked; 490*b4c3e9b5SBjoern A. Zeeb bool bandinit_pending; 491*b4c3e9b5SBjoern A. Zeeb 492*b4c3e9b5SBjoern A. Zeeb bool radio_monitor; 493*b4c3e9b5SBjoern A. Zeeb bool going_down; 494*b4c3e9b5SBjoern A. Zeeb 495*b4c3e9b5SBjoern A. Zeeb bool beacon_template_virgin; 496*b4c3e9b5SBjoern A. Zeeb 497*b4c3e9b5SBjoern A. Zeeb struct brcms_timer *wdtimer; 498*b4c3e9b5SBjoern A. Zeeb struct brcms_timer *radio_timer; 499*b4c3e9b5SBjoern A. Zeeb 500*b4c3e9b5SBjoern A. Zeeb /* promiscuous */ 501*b4c3e9b5SBjoern A. Zeeb uint filter_flags; 502*b4c3e9b5SBjoern A. Zeeb 503*b4c3e9b5SBjoern A. Zeeb /* driver feature */ 504*b4c3e9b5SBjoern A. Zeeb bool _rifs; 505*b4c3e9b5SBjoern A. Zeeb 506*b4c3e9b5SBjoern A. Zeeb /* AP-STA synchronization, power save */ 507*b4c3e9b5SBjoern A. Zeeb u8 bcn_li_bcn; 508*b4c3e9b5SBjoern A. Zeeb u8 bcn_li_dtim; 509*b4c3e9b5SBjoern A. Zeeb 510*b4c3e9b5SBjoern A. Zeeb bool WDarmed; 511*b4c3e9b5SBjoern A. Zeeb u32 WDlast; 512*b4c3e9b5SBjoern A. Zeeb 513*b4c3e9b5SBjoern A. Zeeb /* WME */ 514*b4c3e9b5SBjoern A. Zeeb u16 edcf_txop[IEEE80211_NUM_ACS]; 515*b4c3e9b5SBjoern A. Zeeb 516*b4c3e9b5SBjoern A. Zeeb u16 wme_retries[IEEE80211_NUM_ACS]; 517*b4c3e9b5SBjoern A. Zeeb 518*b4c3e9b5SBjoern A. Zeeb struct brcms_bss_cfg *bsscfg; 519*b4c3e9b5SBjoern A. Zeeb 520*b4c3e9b5SBjoern A. Zeeb struct modulecb *modulecb; 521*b4c3e9b5SBjoern A. Zeeb 522*b4c3e9b5SBjoern A. Zeeb u8 mimoft; 523*b4c3e9b5SBjoern A. Zeeb s8 cck_40txbw; 524*b4c3e9b5SBjoern A. Zeeb s8 ofdm_40txbw; 525*b4c3e9b5SBjoern A. Zeeb s8 mimo_40txbw; 526*b4c3e9b5SBjoern A. Zeeb 527*b4c3e9b5SBjoern A. Zeeb struct brcms_bss_info *default_bss; 528*b4c3e9b5SBjoern A. Zeeb 529*b4c3e9b5SBjoern A. Zeeb u16 mc_fid_counter; 530*b4c3e9b5SBjoern A. Zeeb 531*b4c3e9b5SBjoern A. Zeeb char country_default[BRCM_CNTRY_BUF_SZ]; 532*b4c3e9b5SBjoern A. Zeeb char autocountry_default[BRCM_CNTRY_BUF_SZ]; 533*b4c3e9b5SBjoern A. Zeeb u16 prb_resp_timeout; 534*b4c3e9b5SBjoern A. Zeeb 535*b4c3e9b5SBjoern A. Zeeb u16 home_chanspec; 536*b4c3e9b5SBjoern A. Zeeb 537*b4c3e9b5SBjoern A. Zeeb /* PHY parameters */ 538*b4c3e9b5SBjoern A. Zeeb u16 chanspec; 539*b4c3e9b5SBjoern A. Zeeb u16 usr_fragthresh; 540*b4c3e9b5SBjoern A. Zeeb u16 fragthresh[NFIFO]; 541*b4c3e9b5SBjoern A. Zeeb u16 RTSThresh; 542*b4c3e9b5SBjoern A. Zeeb u16 SRL; 543*b4c3e9b5SBjoern A. Zeeb u16 LRL; 544*b4c3e9b5SBjoern A. Zeeb u16 SFBL; 545*b4c3e9b5SBjoern A. Zeeb u16 LFBL; 546*b4c3e9b5SBjoern A. Zeeb 547*b4c3e9b5SBjoern A. Zeeb /* network config */ 548*b4c3e9b5SBjoern A. Zeeb bool shortslot; 549*b4c3e9b5SBjoern A. Zeeb s8 shortslot_override; 550*b4c3e9b5SBjoern A. Zeeb bool include_legacy_erp; 551*b4c3e9b5SBjoern A. Zeeb 552*b4c3e9b5SBjoern A. Zeeb struct brcms_protection *protection; 553*b4c3e9b5SBjoern A. Zeeb s8 PLCPHdr_override; 554*b4c3e9b5SBjoern A. Zeeb 555*b4c3e9b5SBjoern A. Zeeb struct brcms_stf *stf; 556*b4c3e9b5SBjoern A. Zeeb 557*b4c3e9b5SBjoern A. Zeeb u32 bcn_rspec; 558*b4c3e9b5SBjoern A. Zeeb 559*b4c3e9b5SBjoern A. Zeeb uint tempsense_lasttime; 560*b4c3e9b5SBjoern A. Zeeb 561*b4c3e9b5SBjoern A. Zeeb u16 tx_duty_cycle_ofdm; 562*b4c3e9b5SBjoern A. Zeeb u16 tx_duty_cycle_cck; 563*b4c3e9b5SBjoern A. Zeeb 564*b4c3e9b5SBjoern A. Zeeb struct wiphy *wiphy; 565*b4c3e9b5SBjoern A. Zeeb struct scb pri_scb; 566*b4c3e9b5SBjoern A. Zeeb struct ieee80211_vif *vif; 567*b4c3e9b5SBjoern A. Zeeb 568*b4c3e9b5SBjoern A. Zeeb struct sk_buff *beacon; 569*b4c3e9b5SBjoern A. Zeeb u16 beacon_tim_offset; 570*b4c3e9b5SBjoern A. Zeeb u16 beacon_dtim_period; 571*b4c3e9b5SBjoern A. Zeeb struct sk_buff *probe_resp; 572*b4c3e9b5SBjoern A. Zeeb }; 573*b4c3e9b5SBjoern A. Zeeb 574*b4c3e9b5SBjoern A. Zeeb /* antsel module specific state */ 575*b4c3e9b5SBjoern A. Zeeb struct antsel_info { 576*b4c3e9b5SBjoern A. Zeeb struct brcms_c_info *wlc; /* pointer to main wlc structure */ 577*b4c3e9b5SBjoern A. Zeeb struct brcms_pub *pub; /* pointer to public fn */ 578*b4c3e9b5SBjoern A. Zeeb u8 antsel_type; /* Type of boardlevel mimo antenna switch-logic 579*b4c3e9b5SBjoern A. Zeeb * 0 = N/A, 1 = 2x4 board, 2 = 2x3 CB2 board 580*b4c3e9b5SBjoern A. Zeeb */ 581*b4c3e9b5SBjoern A. Zeeb u8 antsel_antswitch; /* board level antenna switch type */ 582*b4c3e9b5SBjoern A. Zeeb bool antsel_avail; /* Ant selection availability (SROM based) */ 583*b4c3e9b5SBjoern A. Zeeb struct brcms_antselcfg antcfg_11n; /* antenna configuration */ 584*b4c3e9b5SBjoern A. Zeeb struct brcms_antselcfg antcfg_cur; /* current antenna config (auto) */ 585*b4c3e9b5SBjoern A. Zeeb }; 586*b4c3e9b5SBjoern A. Zeeb 587*b4c3e9b5SBjoern A. Zeeb enum brcms_bss_type { 588*b4c3e9b5SBjoern A. Zeeb BRCMS_TYPE_STATION, 589*b4c3e9b5SBjoern A. Zeeb BRCMS_TYPE_AP, 590*b4c3e9b5SBjoern A. Zeeb BRCMS_TYPE_ADHOC, 591*b4c3e9b5SBjoern A. Zeeb }; 592*b4c3e9b5SBjoern A. Zeeb 593*b4c3e9b5SBjoern A. Zeeb /* 594*b4c3e9b5SBjoern A. Zeeb * BSS configuration state 595*b4c3e9b5SBjoern A. Zeeb * 596*b4c3e9b5SBjoern A. Zeeb * wlc: wlc to which this bsscfg belongs to. 597*b4c3e9b5SBjoern A. Zeeb * type: interface type 598*b4c3e9b5SBjoern A. Zeeb * SSID_len: the length of SSID 599*b4c3e9b5SBjoern A. Zeeb * SSID: SSID string 600*b4c3e9b5SBjoern A. Zeeb * 601*b4c3e9b5SBjoern A. Zeeb * 602*b4c3e9b5SBjoern A. Zeeb * BSSID: BSSID (associated) 603*b4c3e9b5SBjoern A. Zeeb * cur_etheraddr: h/w address 604*b4c3e9b5SBjoern A. Zeeb * flags: BSSCFG flags; see below 605*b4c3e9b5SBjoern A. Zeeb * 606*b4c3e9b5SBjoern A. Zeeb * current_bss: BSS parameters in ASSOCIATED state 607*b4c3e9b5SBjoern A. Zeeb * 608*b4c3e9b5SBjoern A. Zeeb * 609*b4c3e9b5SBjoern A. Zeeb * ID: 'unique' ID of this bsscfg, assigned at bsscfg allocation 610*b4c3e9b5SBjoern A. Zeeb */ 611*b4c3e9b5SBjoern A. Zeeb struct brcms_bss_cfg { 612*b4c3e9b5SBjoern A. Zeeb struct brcms_c_info *wlc; 613*b4c3e9b5SBjoern A. Zeeb enum brcms_bss_type type; 614*b4c3e9b5SBjoern A. Zeeb u8 SSID_len; 615*b4c3e9b5SBjoern A. Zeeb u8 SSID[IEEE80211_MAX_SSID_LEN]; 616*b4c3e9b5SBjoern A. Zeeb u8 BSSID[ETH_ALEN]; 617*b4c3e9b5SBjoern A. Zeeb struct brcms_bss_info *current_bss; 618*b4c3e9b5SBjoern A. Zeeb }; 619*b4c3e9b5SBjoern A. Zeeb 620*b4c3e9b5SBjoern A. Zeeb int brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, struct sk_buff *p); 621*b4c3e9b5SBjoern A. Zeeb int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo, 622*b4c3e9b5SBjoern A. Zeeb uint *blocks); 623*b4c3e9b5SBjoern A. Zeeb 624*b4c3e9b5SBjoern A. Zeeb int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config); 625*b4c3e9b5SBjoern A. Zeeb void brcms_c_mac_promisc(struct brcms_c_info *wlc, uint filter_flags); 626*b4c3e9b5SBjoern A. Zeeb u16 brcms_c_calc_lsig_len(struct brcms_c_info *wlc, u32 ratespec, uint mac_len); 627*b4c3e9b5SBjoern A. Zeeb u32 brcms_c_rspec_to_rts_rspec(struct brcms_c_info *wlc, u32 rspec, 628*b4c3e9b5SBjoern A. Zeeb bool use_rspec, u16 mimo_ctlchbw); 629*b4c3e9b5SBjoern A. Zeeb u16 brcms_c_compute_rtscts_dur(struct brcms_c_info *wlc, bool cts_only, 630*b4c3e9b5SBjoern A. Zeeb u32 rts_rate, u32 frame_rate, 631*b4c3e9b5SBjoern A. Zeeb u8 rts_preamble_type, u8 frame_preamble_type, 632*b4c3e9b5SBjoern A. Zeeb uint frame_len, bool ba); 633*b4c3e9b5SBjoern A. Zeeb void brcms_c_inval_dma_pkts(struct brcms_hardware *hw, 634*b4c3e9b5SBjoern A. Zeeb struct ieee80211_sta *sta, void (*dma_callback_fn)); 635*b4c3e9b5SBjoern A. Zeeb void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend); 636*b4c3e9b5SBjoern A. Zeeb int brcms_c_set_nmode(struct brcms_c_info *wlc); 637*b4c3e9b5SBjoern A. Zeeb void brcms_c_beacon_phytxctl_txant_upd(struct brcms_c_info *wlc, u32 bcn_rate); 638*b4c3e9b5SBjoern A. Zeeb void brcms_b_antsel_type_set(struct brcms_hardware *wlc_hw, u8 antsel_type); 639*b4c3e9b5SBjoern A. Zeeb void brcms_b_set_chanspec(struct brcms_hardware *wlc_hw, u16 chanspec, 640*b4c3e9b5SBjoern A. Zeeb bool mute, struct txpwr_limits *txpwr); 641*b4c3e9b5SBjoern A. Zeeb void brcms_b_write_shm(struct brcms_hardware *wlc_hw, uint offset, u16 v); 642*b4c3e9b5SBjoern A. Zeeb u16 brcms_b_read_shm(struct brcms_hardware *wlc_hw, uint offset); 643*b4c3e9b5SBjoern A. Zeeb void brcms_b_mhf(struct brcms_hardware *wlc_hw, u8 idx, u16 mask, u16 val, 644*b4c3e9b5SBjoern A. Zeeb int bands); 645*b4c3e9b5SBjoern A. Zeeb void brcms_b_corereset(struct brcms_hardware *wlc_hw, u32 flags); 646*b4c3e9b5SBjoern A. Zeeb void brcms_b_mctrl(struct brcms_hardware *wlc_hw, u32 mask, u32 val); 647*b4c3e9b5SBjoern A. Zeeb void brcms_b_phy_reset(struct brcms_hardware *wlc_hw); 648*b4c3e9b5SBjoern A. Zeeb void brcms_b_bw_set(struct brcms_hardware *wlc_hw, u16 bw); 649*b4c3e9b5SBjoern A. Zeeb void brcms_b_core_phypll_reset(struct brcms_hardware *wlc_hw); 650*b4c3e9b5SBjoern A. Zeeb void brcms_c_ucode_wake_override_set(struct brcms_hardware *wlc_hw, 651*b4c3e9b5SBjoern A. Zeeb u32 override_bit); 652*b4c3e9b5SBjoern A. Zeeb void brcms_c_ucode_wake_override_clear(struct brcms_hardware *wlc_hw, 653*b4c3e9b5SBjoern A. Zeeb u32 override_bit); 654*b4c3e9b5SBjoern A. Zeeb void brcms_b_write_template_ram(struct brcms_hardware *wlc_hw, int offset, 655*b4c3e9b5SBjoern A. Zeeb int len, void *buf); 656*b4c3e9b5SBjoern A. Zeeb u16 brcms_b_rate_shm_offset(struct brcms_hardware *wlc_hw, u8 rate); 657*b4c3e9b5SBjoern A. Zeeb void brcms_b_copyto_objmem(struct brcms_hardware *wlc_hw, uint offset, 658*b4c3e9b5SBjoern A. Zeeb const void *buf, int len, u32 sel); 659*b4c3e9b5SBjoern A. Zeeb void brcms_b_copyfrom_objmem(struct brcms_hardware *wlc_hw, uint offset, 660*b4c3e9b5SBjoern A. Zeeb void *buf, int len, u32 sel); 661*b4c3e9b5SBjoern A. Zeeb void brcms_b_switch_macfreq(struct brcms_hardware *wlc_hw, u8 spurmode); 662*b4c3e9b5SBjoern A. Zeeb u16 brcms_b_get_txant(struct brcms_hardware *wlc_hw); 663*b4c3e9b5SBjoern A. Zeeb void brcms_b_phyclk_fgc(struct brcms_hardware *wlc_hw, bool clk); 664*b4c3e9b5SBjoern A. Zeeb void brcms_b_macphyclk_set(struct brcms_hardware *wlc_hw, bool clk); 665*b4c3e9b5SBjoern A. Zeeb void brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on); 666*b4c3e9b5SBjoern A. Zeeb void brcms_b_txant_set(struct brcms_hardware *wlc_hw, u16 phytxant); 667*b4c3e9b5SBjoern A. Zeeb void brcms_b_band_stf_ss_set(struct brcms_hardware *wlc_hw, u8 stf_mode); 668*b4c3e9b5SBjoern A. Zeeb void brcms_c_init_scb(struct scb *scb); 669*b4c3e9b5SBjoern A. Zeeb 670*b4c3e9b5SBjoern A. Zeeb #endif /* _BRCM_MAIN_H_ */ 671