1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #ifndef _BRCM_TYPES_H_
18 #define _BRCM_TYPES_H_
19
20 #include <linux/types.h>
21 #include <linux/io.h>
22
23 #define WL_CHAN_FREQ_RANGE_2G 0
24 #define WL_CHAN_FREQ_RANGE_5GL 1
25 #define WL_CHAN_FREQ_RANGE_5GM 2
26 #define WL_CHAN_FREQ_RANGE_5GH 3
27
28
29
30
31 #define BFL_PACTRL 0x00000002
32
33 #define BFL_NOPLLDOWN 0x00000020
34
35 #define BFL_FEM 0x00000800
36
37 #define BFL_EXTLNA 0x00001000
38
39 #define BFL_NOPA 0x00010000
40
41 #define BFL_BUCKBOOST 0x00200000
42
43 #define BFL_FEM_BT 0x00400000
44
45 #define BFL_NOCBUCK 0x00800000
46
47 #define BFL_PALDO 0x02000000
48
49 #define BFL_EXTLNA_5GHz 0x10000000
50
51
52
53
54 #define BFL2_RXBB_INT_REG_DIS 0x00000001
55
56 #define BFL2_APLL_WAR 0x00000002
57
58 #define BFL2_TXPWRCTRL_EN 0x00000004
59
60 #define BFL2_2X4_DIV 0x00000008
61
62 #define BFL2_5G_PWRGAIN 0x00000010
63
64 #define BFL2_PCIEWAR_OVR 0x00000020
65 #define BFL2_LEGACY 0x00000080
66
67 #define BFL2_SKWRKFEM_BRD 0x00000100
68
69 #define BFL2_SPUR_WAR 0x00000200
70
71 #define BFL2_GPLL_WAR 0x00000400
72
73 #define BFL2_SINGLEANT_CCK 0x00001000
74
75 #define BFL2_2G_SPUR_WAR 0x00002000
76
77 #define BFL2_GPLL_WAR2 0x00010000
78 #define BFL2_IPALVLSHIFT_3P3 0x00020000
79
80 #define BFL2_INTERNDET_TXIQCAL 0x00040000
81
82
83 #define BFL2_XTALBUFOUTEN 0x00080000
84
85
86
87
88
89
90
91 #define BOARD_GPIO_PACTRL 0x200
92 #define BOARD_GPIO_12 0x1000
93 #define BOARD_GPIO_13 0x2000
94
95
96 #define D11CONF 0x0fffffb0
97
98
99
100 #define NCONF 0x000001ff
101
102
103
104
105
106
107
108
109
110
111
112 #define LCNCONF 0x00000007
113
114
115
116
117
118 #define SSLPNCONF 0x0000000f
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133 #define CONF_HAS(config, val) ((config) & (1 << (val)))
134 #define CONF_MSK(config, mask) ((config) & (mask))
135 #define MSK_RANGE(low, hi) ((1 << ((hi)+1)) - (1 << (low)))
136 #define CONF_RANGE(config, low, hi) (CONF_MSK(config, MSK_RANGE(low, high)))
137
138 #define CONF_IS(config, val) ((config) == (1 << (val)))
139 #define CONF_GE(config, val) ((config) & (0-(1 << (val))))
140 #define CONF_GT(config, val) ((config) & (0-2*(1 << (val))))
141 #define CONF_LT(config, val) ((config) & ((1 << (val))-1))
142 #define CONF_LE(config, val) ((config) & (2*(1 << (val))-1))
143
144
145
146 #define NCONF_HAS(val) CONF_HAS(NCONF, val)
147 #define NCONF_MSK(mask) CONF_MSK(NCONF, mask)
148 #define NCONF_IS(val) CONF_IS(NCONF, val)
149 #define NCONF_GE(val) CONF_GE(NCONF, val)
150 #define NCONF_GT(val) CONF_GT(NCONF, val)
151 #define NCONF_LT(val) CONF_LT(NCONF, val)
152 #define NCONF_LE(val) CONF_LE(NCONF, val)
153
154 #define LCNCONF_HAS(val) CONF_HAS(LCNCONF, val)
155 #define LCNCONF_MSK(mask) CONF_MSK(LCNCONF, mask)
156 #define LCNCONF_IS(val) CONF_IS(LCNCONF, val)
157 #define LCNCONF_GE(val) CONF_GE(LCNCONF, val)
158 #define LCNCONF_GT(val) CONF_GT(LCNCONF, val)
159 #define LCNCONF_LT(val) CONF_LT(LCNCONF, val)
160 #define LCNCONF_LE(val) CONF_LE(LCNCONF, val)
161
162 #define D11CONF_HAS(val) CONF_HAS(D11CONF, val)
163 #define D11CONF_MSK(mask) CONF_MSK(D11CONF, mask)
164 #define D11CONF_IS(val) CONF_IS(D11CONF, val)
165 #define D11CONF_GE(val) CONF_GE(D11CONF, val)
166 #define D11CONF_GT(val) CONF_GT(D11CONF, val)
167 #define D11CONF_LT(val) CONF_LT(D11CONF, val)
168 #define D11CONF_LE(val) CONF_LE(D11CONF, val)
169
170 #define PHYCONF_HAS(val) CONF_HAS(PHYTYPE, val)
171 #define PHYCONF_IS(val) CONF_IS(PHYTYPE, val)
172
173 #define NREV_IS(var, val) \
174 (NCONF_HAS(val) && (NCONF_IS(val) || ((var) == (val))))
175
176 #define NREV_GE(var, val) \
177 (NCONF_GE(val) && (!NCONF_LT(val) || ((var) >= (val))))
178
179 #define NREV_GT(var, val) \
180 (NCONF_GT(val) && (!NCONF_LE(val) || ((var) > (val))))
181
182 #define NREV_LT(var, val) \
183 (NCONF_LT(val) && (!NCONF_GE(val) || ((var) < (val))))
184
185 #define NREV_LE(var, val) \
186 (NCONF_LE(val) && (!NCONF_GT(val) || ((var) <= (val))))
187
188 #define LCNREV_IS(var, val) \
189 (LCNCONF_HAS(val) && (LCNCONF_IS(val) || ((var) == (val))))
190
191 #define LCNREV_GE(var, val) \
192 (LCNCONF_GE(val) && (!LCNCONF_LT(val) || ((var) >= (val))))
193
194 #define LCNREV_GT(var, val) \
195 (LCNCONF_GT(val) && (!LCNCONF_LE(val) || ((var) > (val))))
196
197 #define LCNREV_LT(var, val) \
198 (LCNCONF_LT(val) && (!LCNCONF_GE(val) || ((var) < (val))))
199
200 #define LCNREV_LE(var, val) \
201 (LCNCONF_LE(val) && (!LCNCONF_GT(val) || ((var) <= (val))))
202
203 #define D11REV_IS(var, val) \
204 (D11CONF_HAS(val) && (D11CONF_IS(val) || ((var) == (val))))
205
206 #define D11REV_GE(var, val) \
207 (D11CONF_GE(val) && (!D11CONF_LT(val) || ((var) >= (val))))
208
209 #define D11REV_GT(var, val) \
210 (D11CONF_GT(val) && (!D11CONF_LE(val) || ((var) > (val))))
211
212 #define D11REV_LT(var, val) \
213 (D11CONF_LT(val) && (!D11CONF_GE(val) || ((var) < (val))))
214
215 #define D11REV_LE(var, val) \
216 (D11CONF_LE(val) && (!D11CONF_GT(val) || ((var) <= (val))))
217
218 #define PHYTYPE_IS(var, val)\
219 (PHYCONF_HAS(val) && (PHYCONF_IS(val) || ((var) == (val))))
220
221
222
223 #define _PHYCONF_N (1 << PHY_TYPE_N)
224 #define _PHYCONF_LCN (1 << PHY_TYPE_LCN)
225 #define _PHYCONF_SSLPN (1 << PHY_TYPE_SSN)
226
227 #define PHYTYPE (_PHYCONF_N | _PHYCONF_LCN | _PHYCONF_SSLPN)
228
229
230 #define PHYTYPE_11N_CAP(phytype) \
231 (PHYTYPE_IS(phytype, PHY_TYPE_N) || \
232 PHYTYPE_IS(phytype, PHY_TYPE_LCN) || \
233 PHYTYPE_IS(phytype, PHY_TYPE_SSN))
234
235
236 #define BRCMS_ISNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_N)
237 #define BRCMS_ISLCNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_LCN)
238 #define BRCMS_ISSSLPNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_SSN)
239
240 #define BRCMS_PHY_11N_CAP(band) PHYTYPE_11N_CAP((band)->phytype)
241
242
243
244
245
246
247 #define BCMMSG(dev, fmt, args...) \
248 do { \
249 if (brcm_msg_level & BRCM_DL_INFO) \
250 wiphy_err(dev, "%s: " fmt, __func__, ##args); \
251 } while (0)
252
253 #ifdef CONFIG_BCM47XX
254
255
256
257
258
259 #define bcma_wflush16(c, o, v) \
260 ({ bcma_write16(c, o, v); (void)bcma_read16(c, o); })
261 #else
262 #define bcma_wflush16(c, o, v) bcma_write16(c, o, v)
263 #endif
264
265
266
267
268 #define mboolset(mb, bit) ((mb) |= (bit))
269
270 #define mboolclr(mb, bit) ((mb) &= ~(bit))
271
272 #define mboolisset(mb, bit) (((mb) & (bit)) != 0)
273 #define mboolmaskset(mb, mask, val) ((mb) = (((mb) & ~(mask)) | (val)))
274
275 #define CEIL(x, y) (((x) + ((y)-1)) / (y))
276
277
278 struct wiphy;
279 struct ieee80211_sta;
280 struct ieee80211_tx_queue_params;
281 struct brcms_info;
282 struct brcms_c_info;
283 struct brcms_hardware;
284 struct brcms_band;
285 struct dma_pub;
286 struct si_pub;
287 struct tx_status;
288 struct d11rxhdr;
289 struct txpwr_limits;
290
291
292 struct brcmu_iovar {
293 const char *name;
294 u16 varid;
295 u16 flags;
296 u16 type;
297 u16 minlen;
298 };
299
300
301 extern u32 brcm_msg_level;
302
303 #endif