xref: /freebsd/sys/contrib/dev/broadcom/brcm80211/brcmsmac/pub.h (revision b4c3e9b5b09c829b4135aff738bd2893ed052377)
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_PUB_H_
18*b4c3e9b5SBjoern A. Zeeb #define _BRCM_PUB_H_
19*b4c3e9b5SBjoern A. Zeeb 
20*b4c3e9b5SBjoern A. Zeeb #include <linux/bcma/bcma.h>
21*b4c3e9b5SBjoern A. Zeeb #include <brcmu_wifi.h>
22*b4c3e9b5SBjoern A. Zeeb #include "types.h"
23*b4c3e9b5SBjoern A. Zeeb #include "defs.h"
24*b4c3e9b5SBjoern A. Zeeb 
25*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_NUMRATES	16	/* max # of rates in a rateset */
26*b4c3e9b5SBjoern A. Zeeb 
27*b4c3e9b5SBjoern A. Zeeb /* phy types */
28*b4c3e9b5SBjoern A. Zeeb #define	PHY_TYPE_A	0	/* Phy type A */
29*b4c3e9b5SBjoern A. Zeeb #define	PHY_TYPE_G	2	/* Phy type G */
30*b4c3e9b5SBjoern A. Zeeb #define	PHY_TYPE_N	4	/* Phy type N */
31*b4c3e9b5SBjoern A. Zeeb #define	PHY_TYPE_LP	5	/* Phy type Low Power A/B/G */
32*b4c3e9b5SBjoern A. Zeeb #define	PHY_TYPE_SSN	6	/* Phy type Single Stream N */
33*b4c3e9b5SBjoern A. Zeeb #define	PHY_TYPE_LCN	8	/* Phy type Single Stream N */
34*b4c3e9b5SBjoern A. Zeeb #define	PHY_TYPE_LCNXN	9	/* Phy type 2-stream N */
35*b4c3e9b5SBjoern A. Zeeb #define	PHY_TYPE_HT	7	/* Phy type 3-Stream N */
36*b4c3e9b5SBjoern A. Zeeb 
37*b4c3e9b5SBjoern A. Zeeb /* bw */
38*b4c3e9b5SBjoern A. Zeeb #define BRCMS_10_MHZ	10	/* 10Mhz nphy channel bandwidth */
39*b4c3e9b5SBjoern A. Zeeb #define BRCMS_20_MHZ	20	/* 20Mhz nphy channel bandwidth */
40*b4c3e9b5SBjoern A. Zeeb #define BRCMS_40_MHZ	40	/* 40Mhz nphy channel bandwidth */
41*b4c3e9b5SBjoern A. Zeeb 
42*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_RSSI_MINVAL	-200	/* Low value, e.g. for forcing roam */
43*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_RSSI_NO_SIGNAL	-91	/* NDIS RSSI link quality cutoffs */
44*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_RSSI_VERY_LOW	-80	/* Very low quality cutoffs */
45*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_RSSI_LOW		-70	/* Low quality cutoffs */
46*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_RSSI_GOOD		-68	/* Good quality cutoffs */
47*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_RSSI_VERY_GOOD	-58	/* Very good quality cutoffs */
48*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_RSSI_EXCELLENT	-57	/* Excellent quality cutoffs */
49*b4c3e9b5SBjoern A. Zeeb 
50*b4c3e9b5SBjoern A. Zeeb /* a large TX Power as an init value to factor out of min() calculations,
51*b4c3e9b5SBjoern A. Zeeb  * keep low enough to fit in an s8, units are .25 dBm
52*b4c3e9b5SBjoern A. Zeeb  */
53*b4c3e9b5SBjoern A. Zeeb #define BRCMS_TXPWR_MAX		(127)	/* ~32 dBm = 1,500 mW */
54*b4c3e9b5SBjoern A. Zeeb 
55*b4c3e9b5SBjoern A. Zeeb /* rate related definitions */
56*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_RATE_FLAG	0x80	/* Flag to indicate it is a basic rate */
57*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_RATE_MASK	0x7f	/* Rate value mask w/o basic rate flag */
58*b4c3e9b5SBjoern A. Zeeb 
59*b4c3e9b5SBjoern A. Zeeb /* legacy rx Antenna diversity for SISO rates */
60*b4c3e9b5SBjoern A. Zeeb #define	ANT_RX_DIV_FORCE_0	0	/* Use antenna 0 */
61*b4c3e9b5SBjoern A. Zeeb #define	ANT_RX_DIV_FORCE_1	1	/* Use antenna 1 */
62*b4c3e9b5SBjoern A. Zeeb #define	ANT_RX_DIV_START_1	2	/* Choose starting with 1 */
63*b4c3e9b5SBjoern A. Zeeb #define	ANT_RX_DIV_START_0	3	/* Choose starting with 0 */
64*b4c3e9b5SBjoern A. Zeeb #define	ANT_RX_DIV_ENABLE	3	/* APHY bbConfig Enable RX Diversity */
65*b4c3e9b5SBjoern A. Zeeb /* default antdiv setting */
66*b4c3e9b5SBjoern A. Zeeb #define ANT_RX_DIV_DEF		ANT_RX_DIV_START_0
67*b4c3e9b5SBjoern A. Zeeb 
68*b4c3e9b5SBjoern A. Zeeb /* legacy rx Antenna diversity for SISO rates */
69*b4c3e9b5SBjoern A. Zeeb /* Tx on antenna 0, "legacy term Main" */
70*b4c3e9b5SBjoern A. Zeeb #define ANT_TX_FORCE_0		0
71*b4c3e9b5SBjoern A. Zeeb /* Tx on antenna 1, "legacy term Aux" */
72*b4c3e9b5SBjoern A. Zeeb #define ANT_TX_FORCE_1		1
73*b4c3e9b5SBjoern A. Zeeb /* Tx on phy's last good Rx antenna */
74*b4c3e9b5SBjoern A. Zeeb #define ANT_TX_LAST_RX		3
75*b4c3e9b5SBjoern A. Zeeb /* driver's default tx antenna setting */
76*b4c3e9b5SBjoern A. Zeeb #define ANT_TX_DEF		3
77*b4c3e9b5SBjoern A. Zeeb 
78*b4c3e9b5SBjoern A. Zeeb /* Tx Chain values */
79*b4c3e9b5SBjoern A. Zeeb /* def bitmap of txchain */
80*b4c3e9b5SBjoern A. Zeeb #define TXCHAIN_DEF		0x1
81*b4c3e9b5SBjoern A. Zeeb /* default bitmap of tx chains for nphy */
82*b4c3e9b5SBjoern A. Zeeb #define TXCHAIN_DEF_NPHY	0x3
83*b4c3e9b5SBjoern A. Zeeb /* default bitmap of tx chains for nphy */
84*b4c3e9b5SBjoern A. Zeeb #define TXCHAIN_DEF_HTPHY	0x7
85*b4c3e9b5SBjoern A. Zeeb /* def bitmap of rxchain */
86*b4c3e9b5SBjoern A. Zeeb #define RXCHAIN_DEF		0x1
87*b4c3e9b5SBjoern A. Zeeb /* default bitmap of rx chains for nphy */
88*b4c3e9b5SBjoern A. Zeeb #define RXCHAIN_DEF_NPHY	0x3
89*b4c3e9b5SBjoern A. Zeeb /* default bitmap of rx chains for nphy */
90*b4c3e9b5SBjoern A. Zeeb #define RXCHAIN_DEF_HTPHY	0x7
91*b4c3e9b5SBjoern A. Zeeb /* no antenna switch */
92*b4c3e9b5SBjoern A. Zeeb #define ANTSWITCH_NONE		0
93*b4c3e9b5SBjoern A. Zeeb /* antenna switch on 4321CB2, 2of3 */
94*b4c3e9b5SBjoern A. Zeeb #define ANTSWITCH_TYPE_1	1
95*b4c3e9b5SBjoern A. Zeeb /* antenna switch on 4321MPCI, 2of3 */
96*b4c3e9b5SBjoern A. Zeeb #define ANTSWITCH_TYPE_2	2
97*b4c3e9b5SBjoern A. Zeeb /* antenna switch on 4322, 2of3 */
98*b4c3e9b5SBjoern A. Zeeb #define ANTSWITCH_TYPE_3	3
99*b4c3e9b5SBjoern A. Zeeb 
100*b4c3e9b5SBjoern A. Zeeb #define RXBUFSZ		PKTBUFSZ
101*b4c3e9b5SBjoern A. Zeeb 
102*b4c3e9b5SBjoern A. Zeeb #define MAX_STREAMS_SUPPORTED	4	/* max number of streams supported */
103*b4c3e9b5SBjoern A. Zeeb 
104*b4c3e9b5SBjoern A. Zeeb struct brcm_rateset {
105*b4c3e9b5SBjoern A. Zeeb 	/* # rates in this set */
106*b4c3e9b5SBjoern A. Zeeb 	u32 count;
107*b4c3e9b5SBjoern A. Zeeb 	/* rates in 500kbps units w/hi bit set if basic */
108*b4c3e9b5SBjoern A. Zeeb 	u8 rates[WL_NUMRATES];
109*b4c3e9b5SBjoern A. Zeeb };
110*b4c3e9b5SBjoern A. Zeeb 
111*b4c3e9b5SBjoern A. Zeeb struct brcms_c_rateset {
112*b4c3e9b5SBjoern A. Zeeb 	uint count;		/* number of rates in rates[] */
113*b4c3e9b5SBjoern A. Zeeb 	 /* rates in 500kbps units w/hi bit set if basic */
114*b4c3e9b5SBjoern A. Zeeb 	u8 rates[BRCMS_NUMRATES];
115*b4c3e9b5SBjoern A. Zeeb 	u8 htphy_membership;	/* HT PHY Membership */
116*b4c3e9b5SBjoern A. Zeeb 	u8 mcs[MCSSET_LEN];	/* supported mcs index bit map */
117*b4c3e9b5SBjoern A. Zeeb };
118*b4c3e9b5SBjoern A. Zeeb 
119*b4c3e9b5SBjoern A. Zeeb /* All the HT-specific default advertised capabilities (including AMPDU)
120*b4c3e9b5SBjoern A. Zeeb  * should be grouped here at one place
121*b4c3e9b5SBjoern A. Zeeb  */
122*b4c3e9b5SBjoern A. Zeeb #define AMPDU_DEF_MPDU_DENSITY	6	/* default mpdu density (110 ==> 4us) */
123*b4c3e9b5SBjoern A. Zeeb 
124*b4c3e9b5SBjoern A. Zeeb /* wlc internal bss_info */
125*b4c3e9b5SBjoern A. Zeeb struct brcms_bss_info {
126*b4c3e9b5SBjoern A. Zeeb 	u8 BSSID[ETH_ALEN];	/* network BSSID */
127*b4c3e9b5SBjoern A. Zeeb 	u16 flags;		/* flags for internal attributes */
128*b4c3e9b5SBjoern A. Zeeb 	u8 SSID_len;		/* the length of SSID */
129*b4c3e9b5SBjoern A. Zeeb 	u8 SSID[32];		/* SSID string */
130*b4c3e9b5SBjoern A. Zeeb 	s16 RSSI;		/* receive signal strength (in dBm) */
131*b4c3e9b5SBjoern A. Zeeb 	s16 SNR;		/* receive signal SNR in dB */
132*b4c3e9b5SBjoern A. Zeeb 	u16 beacon_period;	/* units are Kusec */
133*b4c3e9b5SBjoern A. Zeeb 	u16 chanspec;	/* Channel num, bw, ctrl_sb and band */
134*b4c3e9b5SBjoern A. Zeeb 	struct brcms_c_rateset rateset;	/* supported rates */
135*b4c3e9b5SBjoern A. Zeeb };
136*b4c3e9b5SBjoern A. Zeeb 
137*b4c3e9b5SBjoern A. Zeeb #define MAC80211_PROMISC_BCNS	(1 << 0)
138*b4c3e9b5SBjoern A. Zeeb #define MAC80211_SCAN		(1 << 1)
139*b4c3e9b5SBjoern A. Zeeb 
140*b4c3e9b5SBjoern A. Zeeb /*
141*b4c3e9b5SBjoern A. Zeeb  * Public portion of common driver state structure.
142*b4c3e9b5SBjoern A. Zeeb  * The wlc handle points at this.
143*b4c3e9b5SBjoern A. Zeeb  */
144*b4c3e9b5SBjoern A. Zeeb struct brcms_pub {
145*b4c3e9b5SBjoern A. Zeeb 	struct brcms_c_info *wlc;
146*b4c3e9b5SBjoern A. Zeeb 	struct ieee80211_hw *ieee_hw;
147*b4c3e9b5SBjoern A. Zeeb 	struct scb_ampdu *global_ampdu;
148*b4c3e9b5SBjoern A. Zeeb 	uint mac80211_state;
149*b4c3e9b5SBjoern A. Zeeb 	uint unit;		/* device instance number */
150*b4c3e9b5SBjoern A. Zeeb 	uint corerev;		/* core revision */
151*b4c3e9b5SBjoern A. Zeeb 	struct si_pub *sih;	/* SI handle (cookie for siutils calls) */
152*b4c3e9b5SBjoern A. Zeeb 	bool up;		/* interface up and running */
153*b4c3e9b5SBjoern A. Zeeb 	bool hw_off;		/* HW is off */
154*b4c3e9b5SBjoern A. Zeeb 	bool hw_up;		/* one time hw up/down */
155*b4c3e9b5SBjoern A. Zeeb 	bool _piomode;		/* true if pio mode */
156*b4c3e9b5SBjoern A. Zeeb 	uint _nbands;		/* # bands supported */
157*b4c3e9b5SBjoern A. Zeeb 	uint now;		/* # elapsed seconds */
158*b4c3e9b5SBjoern A. Zeeb 
159*b4c3e9b5SBjoern A. Zeeb 	bool delayed_down;	/* down delayed */
160*b4c3e9b5SBjoern A. Zeeb 	bool associated;	/* true:part of [I]BSS, false: not */
161*b4c3e9b5SBjoern A. Zeeb 	/* (union of stas_associated, aps_associated) */
162*b4c3e9b5SBjoern A. Zeeb 	bool _ampdu;		/* ampdu enabled or not */
163*b4c3e9b5SBjoern A. Zeeb 	u8 _n_enab;		/* bitmap of 11N + HT support */
164*b4c3e9b5SBjoern A. Zeeb 
165*b4c3e9b5SBjoern A. Zeeb 	u8 cur_etheraddr[ETH_ALEN];	/* our local ethernet address */
166*b4c3e9b5SBjoern A. Zeeb 
167*b4c3e9b5SBjoern A. Zeeb 	u32 radio_disabled;	/* bit vector for radio disabled reasons */
168*b4c3e9b5SBjoern A. Zeeb 
169*b4c3e9b5SBjoern A. Zeeb 	u16 boardrev;	/* version # of particular board */
170*b4c3e9b5SBjoern A. Zeeb 	u8 sromrev;		/* version # of the srom */
171*b4c3e9b5SBjoern A. Zeeb 	char srom_ccode[BRCM_CNTRY_BUF_SZ];	/* Country Code in SROM */
172*b4c3e9b5SBjoern A. Zeeb 	u32 boardflags;	/* Board specific flags from srom */
173*b4c3e9b5SBjoern A. Zeeb 	u32 boardflags2;	/* More board flags if sromrev >= 4 */
174*b4c3e9b5SBjoern A. Zeeb 	bool phy_11ncapable;	/* the PHY/HW is capable of 802.11N */
175*b4c3e9b5SBjoern A. Zeeb 
176*b4c3e9b5SBjoern A. Zeeb 	struct wl_cnt *_cnt;	/* low-level counters in driver */
177*b4c3e9b5SBjoern A. Zeeb 	struct dentry *dbgfs_dir;
178*b4c3e9b5SBjoern A. Zeeb };
179*b4c3e9b5SBjoern A. Zeeb 
180*b4c3e9b5SBjoern A. Zeeb enum wlc_par_id {
181*b4c3e9b5SBjoern A. Zeeb 	IOV_MPC = 1,
182*b4c3e9b5SBjoern A. Zeeb 	IOV_RTSTHRESH,
183*b4c3e9b5SBjoern A. Zeeb 	IOV_QTXPOWER,
184*b4c3e9b5SBjoern A. Zeeb 	IOV_BCN_LI_BCN		/* Beacon listen interval in # of beacons */
185*b4c3e9b5SBjoern A. Zeeb };
186*b4c3e9b5SBjoern A. Zeeb 
187*b4c3e9b5SBjoern A. Zeeb /***********************************************
188*b4c3e9b5SBjoern A. Zeeb  * Feature-related macros to optimize out code *
189*b4c3e9b5SBjoern A. Zeeb  * *********************************************
190*b4c3e9b5SBjoern A. Zeeb  */
191*b4c3e9b5SBjoern A. Zeeb 
192*b4c3e9b5SBjoern A. Zeeb #define ENAB_1x1	0x01
193*b4c3e9b5SBjoern A. Zeeb #define ENAB_2x2	0x02
194*b4c3e9b5SBjoern A. Zeeb #define ENAB_3x3	0x04
195*b4c3e9b5SBjoern A. Zeeb #define ENAB_4x4	0x08
196*b4c3e9b5SBjoern A. Zeeb #define SUPPORT_11N	(ENAB_1x1|ENAB_2x2)
197*b4c3e9b5SBjoern A. Zeeb #define SUPPORT_HT	(ENAB_1x1|ENAB_2x2|ENAB_3x3)
198*b4c3e9b5SBjoern A. Zeeb 
199*b4c3e9b5SBjoern A. Zeeb /* WL11N Support */
200*b4c3e9b5SBjoern A. Zeeb #define AMPDU_AGG_HOST	1
201*b4c3e9b5SBjoern A. Zeeb 
202*b4c3e9b5SBjoern A. Zeeb /* network protection config */
203*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_PROT_G_SPEC		1	/* SPEC g protection */
204*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_PROT_G_OVR		2	/* SPEC g prot override */
205*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_PROT_G_USER		3	/* gmode specified by user */
206*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_PROT_OVERLAP	4	/* overlap */
207*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_PROT_N_USER		10	/* nmode specified by user */
208*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_PROT_N_CFG		11	/* n protection */
209*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_PROT_N_CFG_OVR	12	/* n protection override */
210*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_PROT_N_NONGF	13	/* non-GF protection */
211*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_PROT_N_NONGF_OVR	14	/* non-GF protection override */
212*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_PROT_N_PAM_OVR	15	/* n preamble override */
213*b4c3e9b5SBjoern A. Zeeb #define	BRCMS_PROT_N_OBSS		16	/* non-HT OBSS present */
214*b4c3e9b5SBjoern A. Zeeb 
215*b4c3e9b5SBjoern A. Zeeb /*
216*b4c3e9b5SBjoern A. Zeeb  * 54g modes (basic bits may still be overridden)
217*b4c3e9b5SBjoern A. Zeeb  *
218*b4c3e9b5SBjoern A. Zeeb  * GMODE_LEGACY_B
219*b4c3e9b5SBjoern A. Zeeb  *	Rateset: 1b, 2b, 5.5, 11
220*b4c3e9b5SBjoern A. Zeeb  *	Preamble: Long
221*b4c3e9b5SBjoern A. Zeeb  *	Shortslot: Off
222*b4c3e9b5SBjoern A. Zeeb  * GMODE_AUTO
223*b4c3e9b5SBjoern A. Zeeb  *	Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54
224*b4c3e9b5SBjoern A. Zeeb  *	Extended Rateset: 6, 9, 12, 48
225*b4c3e9b5SBjoern A. Zeeb  *	Preamble: Long
226*b4c3e9b5SBjoern A. Zeeb  *	Shortslot: Auto
227*b4c3e9b5SBjoern A. Zeeb  * GMODE_ONLY
228*b4c3e9b5SBjoern A. Zeeb  *	Rateset: 1b, 2b, 5.5b, 11b, 18, 24b, 36, 54
229*b4c3e9b5SBjoern A. Zeeb  *	Extended Rateset: 6b, 9, 12b, 48
230*b4c3e9b5SBjoern A. Zeeb  *	Preamble: Short required
231*b4c3e9b5SBjoern A. Zeeb  *	Shortslot: Auto
232*b4c3e9b5SBjoern A. Zeeb  * GMODE_B_DEFERRED
233*b4c3e9b5SBjoern A. Zeeb  *	Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54
234*b4c3e9b5SBjoern A. Zeeb  *	Extended Rateset: 6, 9, 12, 48
235*b4c3e9b5SBjoern A. Zeeb  *	Preamble: Long
236*b4c3e9b5SBjoern A. Zeeb  *	Shortslot: On
237*b4c3e9b5SBjoern A. Zeeb  * GMODE_PERFORMANCE
238*b4c3e9b5SBjoern A. Zeeb  *	Rateset: 1b, 2b, 5.5b, 6b, 9, 11b, 12b, 18, 24b, 36, 48, 54
239*b4c3e9b5SBjoern A. Zeeb  *	Preamble: Short required
240*b4c3e9b5SBjoern A. Zeeb  *	Shortslot: On and required
241*b4c3e9b5SBjoern A. Zeeb  * GMODE_LRS
242*b4c3e9b5SBjoern A. Zeeb  *	Rateset: 1b, 2b, 5.5b, 11b
243*b4c3e9b5SBjoern A. Zeeb  *	Extended Rateset: 6, 9, 12, 18, 24, 36, 48, 54
244*b4c3e9b5SBjoern A. Zeeb  *	Preamble: Long
245*b4c3e9b5SBjoern A. Zeeb  *	Shortslot: Auto
246*b4c3e9b5SBjoern A. Zeeb  */
247*b4c3e9b5SBjoern A. Zeeb #define GMODE_LEGACY_B		0
248*b4c3e9b5SBjoern A. Zeeb #define GMODE_AUTO		1
249*b4c3e9b5SBjoern A. Zeeb #define GMODE_ONLY		2
250*b4c3e9b5SBjoern A. Zeeb #define GMODE_B_DEFERRED	3
251*b4c3e9b5SBjoern A. Zeeb #define GMODE_PERFORMANCE	4
252*b4c3e9b5SBjoern A. Zeeb #define GMODE_LRS		5
253*b4c3e9b5SBjoern A. Zeeb #define GMODE_MAX		6
254*b4c3e9b5SBjoern A. Zeeb 
255*b4c3e9b5SBjoern A. Zeeb /* MCS values greater than this enable multiple streams */
256*b4c3e9b5SBjoern A. Zeeb #define HIGHEST_SINGLE_STREAM_MCS	7
257*b4c3e9b5SBjoern A. Zeeb 
258*b4c3e9b5SBjoern A. Zeeb #define	MAXBANDS		2	/* Maximum #of bands */
259*b4c3e9b5SBjoern A. Zeeb 
260*b4c3e9b5SBjoern A. Zeeb /* max number of antenna configurations */
261*b4c3e9b5SBjoern A. Zeeb #define ANT_SELCFG_MAX		4
262*b4c3e9b5SBjoern A. Zeeb 
263*b4c3e9b5SBjoern A. Zeeb struct brcms_antselcfg {
264*b4c3e9b5SBjoern A. Zeeb 	u8 ant_config[ANT_SELCFG_MAX];	/* antenna configuration */
265*b4c3e9b5SBjoern A. Zeeb 	u8 num_antcfg;	/* number of available antenna configurations */
266*b4c3e9b5SBjoern A. Zeeb };
267*b4c3e9b5SBjoern A. Zeeb 
268*b4c3e9b5SBjoern A. Zeeb /* common functions for every port */
269*b4c3e9b5SBjoern A. Zeeb struct brcms_c_info *brcms_c_attach(struct brcms_info *wl,
270*b4c3e9b5SBjoern A. Zeeb 				    struct bcma_device *core, uint unit,
271*b4c3e9b5SBjoern A. Zeeb 				    bool piomode, uint *perr);
272*b4c3e9b5SBjoern A. Zeeb uint brcms_c_detach(struct brcms_c_info *wlc);
273*b4c3e9b5SBjoern A. Zeeb int brcms_c_up(struct brcms_c_info *wlc);
274*b4c3e9b5SBjoern A. Zeeb uint brcms_c_down(struct brcms_c_info *wlc);
275*b4c3e9b5SBjoern A. Zeeb 
276*b4c3e9b5SBjoern A. Zeeb bool brcms_c_chipmatch(struct bcma_device *core);
277*b4c3e9b5SBjoern A. Zeeb void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx);
278*b4c3e9b5SBjoern A. Zeeb void brcms_c_reset(struct brcms_c_info *wlc);
279*b4c3e9b5SBjoern A. Zeeb 
280*b4c3e9b5SBjoern A. Zeeb void brcms_c_intrson(struct brcms_c_info *wlc);
281*b4c3e9b5SBjoern A. Zeeb u32 brcms_c_intrsoff(struct brcms_c_info *wlc);
282*b4c3e9b5SBjoern A. Zeeb void brcms_c_intrsrestore(struct brcms_c_info *wlc, u32 macintmask);
283*b4c3e9b5SBjoern A. Zeeb bool brcms_c_intrsupd(struct brcms_c_info *wlc);
284*b4c3e9b5SBjoern A. Zeeb bool brcms_c_isr(struct brcms_c_info *wlc);
285*b4c3e9b5SBjoern A. Zeeb bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded);
286*b4c3e9b5SBjoern A. Zeeb bool brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu,
287*b4c3e9b5SBjoern A. Zeeb 			      struct ieee80211_hw *hw);
288*b4c3e9b5SBjoern A. Zeeb bool brcms_c_aggregatable(struct brcms_c_info *wlc, u8 tid);
289*b4c3e9b5SBjoern A. Zeeb void brcms_c_protection_upd(struct brcms_c_info *wlc, uint idx, int val);
290*b4c3e9b5SBjoern A. Zeeb int brcms_c_get_header_len(void);
291*b4c3e9b5SBjoern A. Zeeb void brcms_c_set_addrmatch(struct brcms_c_info *wlc, int match_reg_offset,
292*b4c3e9b5SBjoern A. Zeeb 			   const u8 *addr);
293*b4c3e9b5SBjoern A. Zeeb void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci,
294*b4c3e9b5SBjoern A. Zeeb 			   const struct ieee80211_tx_queue_params *arg,
295*b4c3e9b5SBjoern A. Zeeb 			   bool suspend);
296*b4c3e9b5SBjoern A. Zeeb struct brcms_pub *brcms_c_pub(struct brcms_c_info *wlc);
297*b4c3e9b5SBjoern A. Zeeb void brcms_c_ampdu_flush(struct brcms_c_info *wlc, struct ieee80211_sta *sta,
298*b4c3e9b5SBjoern A. Zeeb 			 u16 tid);
299*b4c3e9b5SBjoern A. Zeeb void brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid,
300*b4c3e9b5SBjoern A. Zeeb 				  uint max_rx_ampdu_bytes);
301*b4c3e9b5SBjoern A. Zeeb int brcms_c_module_register(struct brcms_pub *pub, const char *name,
302*b4c3e9b5SBjoern A. Zeeb 			    struct brcms_info *hdl,
303*b4c3e9b5SBjoern A. Zeeb 			    int (*down_fn)(void *handle));
304*b4c3e9b5SBjoern A. Zeeb int brcms_c_module_unregister(struct brcms_pub *pub, const char *name,
305*b4c3e9b5SBjoern A. Zeeb 			      struct brcms_info *hdl);
306*b4c3e9b5SBjoern A. Zeeb void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc);
307*b4c3e9b5SBjoern A. Zeeb void brcms_c_enable_mac(struct brcms_c_info *wlc);
308*b4c3e9b5SBjoern A. Zeeb void brcms_c_associate_upd(struct brcms_c_info *wlc, bool state);
309*b4c3e9b5SBjoern A. Zeeb void brcms_c_scan_start(struct brcms_c_info *wlc);
310*b4c3e9b5SBjoern A. Zeeb void brcms_c_scan_stop(struct brcms_c_info *wlc);
311*b4c3e9b5SBjoern A. Zeeb int brcms_c_get_curband(struct brcms_c_info *wlc);
312*b4c3e9b5SBjoern A. Zeeb int brcms_c_set_channel(struct brcms_c_info *wlc, u16 channel);
313*b4c3e9b5SBjoern A. Zeeb int brcms_c_set_rate_limit(struct brcms_c_info *wlc, u16 srl, u16 lrl);
314*b4c3e9b5SBjoern A. Zeeb void brcms_c_get_current_rateset(struct brcms_c_info *wlc,
315*b4c3e9b5SBjoern A. Zeeb 				 struct brcm_rateset *currs);
316*b4c3e9b5SBjoern A. Zeeb int brcms_c_set_rateset(struct brcms_c_info *wlc, struct brcm_rateset *rs);
317*b4c3e9b5SBjoern A. Zeeb int brcms_c_set_beacon_period(struct brcms_c_info *wlc, u16 period);
318*b4c3e9b5SBjoern A. Zeeb u16 brcms_c_get_phy_type(struct brcms_c_info *wlc, int phyidx);
319*b4c3e9b5SBjoern A. Zeeb void brcms_c_set_shortslot_override(struct brcms_c_info *wlc,
320*b4c3e9b5SBjoern A. Zeeb 				    s8 sslot_override);
321*b4c3e9b5SBjoern A. Zeeb void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc, u8 interval);
322*b4c3e9b5SBjoern A. Zeeb u64 brcms_c_tsf_get(struct brcms_c_info *wlc);
323*b4c3e9b5SBjoern A. Zeeb void brcms_c_tsf_set(struct brcms_c_info *wlc, u64 tsf);
324*b4c3e9b5SBjoern A. Zeeb int brcms_c_set_tx_power(struct brcms_c_info *wlc, int txpwr);
325*b4c3e9b5SBjoern A. Zeeb int brcms_c_get_tx_power(struct brcms_c_info *wlc);
326*b4c3e9b5SBjoern A. Zeeb bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc);
327*b4c3e9b5SBjoern A. Zeeb void brcms_c_mute(struct brcms_c_info *wlc, bool on);
328*b4c3e9b5SBjoern A. Zeeb bool brcms_c_tx_flush_completed(struct brcms_c_info *wlc);
329*b4c3e9b5SBjoern A. Zeeb void brcms_c_start_station(struct brcms_c_info *wlc, u8 *addr);
330*b4c3e9b5SBjoern A. Zeeb void brcms_c_start_ap(struct brcms_c_info *wlc, u8 *addr, const u8 *bssid,
331*b4c3e9b5SBjoern A. Zeeb 		      u8 *ssid, size_t ssid_len);
332*b4c3e9b5SBjoern A. Zeeb void brcms_c_start_adhoc(struct brcms_c_info *wlc, u8 *addr);
333*b4c3e9b5SBjoern A. Zeeb void brcms_c_update_beacon(struct brcms_c_info *wlc);
334*b4c3e9b5SBjoern A. Zeeb void brcms_c_set_new_beacon(struct brcms_c_info *wlc, struct sk_buff *beacon,
335*b4c3e9b5SBjoern A. Zeeb 			    u16 tim_offset, u16 dtim_period);
336*b4c3e9b5SBjoern A. Zeeb void brcms_c_set_new_probe_resp(struct brcms_c_info *wlc,
337*b4c3e9b5SBjoern A. Zeeb 				struct sk_buff *probe_resp);
338*b4c3e9b5SBjoern A. Zeeb void brcms_c_enable_probe_resp(struct brcms_c_info *wlc, bool enable);
339*b4c3e9b5SBjoern A. Zeeb void brcms_c_set_ssid(struct brcms_c_info *wlc, u8 *ssid, size_t ssid_len);
340*b4c3e9b5SBjoern A. Zeeb 
341*b4c3e9b5SBjoern A. Zeeb #endif				/* _BRCM_PUB_H_ */
342