blob: 654d072bdc284346b6428eedf85bb035d03f40ca [file] [log] [blame]
Forest Bond5449c682009-04-25 10:30:44 -04001/*
2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
Jim Lieb612822f2009-08-12 14:54:03 -070019 *
Forest Bond5449c682009-04-25 10:30:44 -040020 * File: baseband.c
21 *
22 * Purpose: Implement functions to access baseband
23 *
24 * Author: Kyle Hsu
25 *
26 * Date: Aug.22, 2002
27 *
28 * Functions:
29 * BBuGetFrameTime - Calculate data frame transmitting time
Sakshi Bansal527ef702015-01-08 22:07:41 +053030 * BBvCaculateParameter - Caculate PhyLength, PhyService and Phy Signal
31 * parameter for baseband Tx
Justin P. Mattock623b2b32012-08-20 08:43:14 -070032 * BBbReadEmbedded - Embedded read baseband register via MAC
33 * BBbWriteEmbedded - Embedded write baseband register via MAC
Forest Bond5449c682009-04-25 10:30:44 -040034 * BBbVT3253Init - VIA VT3253 baseband chip init code
Forest Bond5449c682009-04-25 10:30:44 -040035 *
36 * Revision History:
37 * 06-10-2003 Bryan YC Fan: Re-write codes to support VT3253 spec.
38 * 08-07-2003 Bryan YC Fan: Add MAXIM2827/2825 and RFMD2959 support.
Kathryn Hampton5150d012016-03-15 18:16:24 -070039 * 08-26-2003 Kyle Hsu : Modify BBuGetFrameTime() and
40 * BBvCalculateParameter().
41 * cancel the setting of MAC_REG_SOFTPWRCTL on
42 * BBbVT3253Init().
Forest Bond5449c682009-04-25 10:30:44 -040043 * Add the comments.
44 * 09-01-2003 Bryan YC Fan: RF & BB tables updated.
45 * Modified BBvLoopbackOn & BBvLoopbackOff().
Jim Lieb612822f2009-08-12 14:54:03 -070046 *
47 *
Forest Bond5449c682009-04-25 10:30:44 -040048 */
49
Forest Bond5449c682009-04-25 10:30:44 -040050#include "tmacro.h"
Forest Bond5449c682009-04-25 10:30:44 -040051#include "mac.h"
Forest Bond5449c682009-04-25 10:30:44 -040052#include "baseband.h"
Forest Bond5449c682009-04-25 10:30:44 -040053#include "srom.h"
Forest Bond5449c682009-04-25 10:30:44 -040054#include "rf.h"
Forest Bond5449c682009-04-25 10:30:44 -040055
Forest Bond5449c682009-04-25 10:30:44 -040056/*--------------------- Static Classes ----------------------------*/
57
58/*--------------------- Static Variables --------------------------*/
Jim Lieb612822f2009-08-12 14:54:03 -070059
Forest Bond5449c682009-04-25 10:30:44 -040060/*--------------------- Static Functions --------------------------*/
61
62/*--------------------- Export Variables --------------------------*/
63
64/*--------------------- Static Definitions -------------------------*/
65
66/*--------------------- Static Classes ----------------------------*/
67
68/*--------------------- Static Variables --------------------------*/
69
Forest Bond5449c682009-04-25 10:30:44 -040070#define CB_VT3253_INIT_FOR_RFMD 446
Claudiu Beznea6c5f37d2016-03-14 21:55:20 +020071static const unsigned char byVT3253InitTab_RFMD[CB_VT3253_INIT_FOR_RFMD][2] = {
Joe Perches37529362013-03-18 10:44:38 -070072 {0x00, 0x30},
73 {0x01, 0x00},
74 {0x02, 0x00},
75 {0x03, 0x00},
76 {0x04, 0x00},
77 {0x05, 0x00},
78 {0x06, 0x00},
79 {0x07, 0x00},
80 {0x08, 0x70},
81 {0x09, 0x45},
82 {0x0a, 0x2a},
83 {0x0b, 0x76},
84 {0x0c, 0x00},
85 {0x0d, 0x01},
86 {0x0e, 0x80},
87 {0x0f, 0x00},
88 {0x10, 0x00},
89 {0x11, 0x00},
90 {0x12, 0x00},
91 {0x13, 0x00},
92 {0x14, 0x00},
93 {0x15, 0x00},
94 {0x16, 0x00},
95 {0x17, 0x00},
96 {0x18, 0x00},
97 {0x19, 0x00},
98 {0x1a, 0x00},
99 {0x1b, 0x9d},
100 {0x1c, 0x05},
101 {0x1d, 0x00},
102 {0x1e, 0x00},
103 {0x1f, 0x00},
104 {0x20, 0x00},
105 {0x21, 0x00},
106 {0x22, 0x00},
107 {0x23, 0x00},
108 {0x24, 0x00},
109 {0x25, 0x4a},
110 {0x26, 0x00},
111 {0x27, 0x00},
112 {0x28, 0x00},
113 {0x29, 0x00},
114 {0x2a, 0x00},
115 {0x2b, 0x00},
116 {0x2c, 0x00},
117 {0x2d, 0xa8},
118 {0x2e, 0x1a},
119 {0x2f, 0x0c},
120 {0x30, 0x26},
121 {0x31, 0x5b},
122 {0x32, 0x00},
123 {0x33, 0x00},
124 {0x34, 0x00},
125 {0x35, 0x00},
126 {0x36, 0xaa},
127 {0x37, 0xaa},
128 {0x38, 0xff},
129 {0x39, 0xff},
130 {0x3a, 0x00},
131 {0x3b, 0x00},
132 {0x3c, 0x00},
133 {0x3d, 0x0d},
134 {0x3e, 0x51},
135 {0x3f, 0x04},
136 {0x40, 0x00},
137 {0x41, 0x08},
138 {0x42, 0x00},
139 {0x43, 0x08},
140 {0x44, 0x06},
141 {0x45, 0x14},
142 {0x46, 0x05},
143 {0x47, 0x08},
144 {0x48, 0x00},
145 {0x49, 0x00},
146 {0x4a, 0x00},
147 {0x4b, 0x00},
148 {0x4c, 0x09},
149 {0x4d, 0x80},
150 {0x4e, 0x00},
151 {0x4f, 0xc5},
152 {0x50, 0x14},
153 {0x51, 0x19},
154 {0x52, 0x00},
155 {0x53, 0x00},
156 {0x54, 0x00},
157 {0x55, 0x00},
158 {0x56, 0x00},
159 {0x57, 0x00},
160 {0x58, 0x00},
161 {0x59, 0xb0},
162 {0x5a, 0x00},
163 {0x5b, 0x00},
164 {0x5c, 0x00},
165 {0x5d, 0x00},
166 {0x5e, 0x00},
167 {0x5f, 0x00},
168 {0x60, 0x44},
169 {0x61, 0x04},
170 {0x62, 0x00},
171 {0x63, 0x00},
172 {0x64, 0x00},
173 {0x65, 0x00},
174 {0x66, 0x04},
175 {0x67, 0xb7},
176 {0x68, 0x00},
177 {0x69, 0x00},
178 {0x6a, 0x00},
179 {0x6b, 0x00},
180 {0x6c, 0x00},
181 {0x6d, 0x03},
182 {0x6e, 0x01},
183 {0x6f, 0x00},
184 {0x70, 0x00},
185 {0x71, 0x00},
186 {0x72, 0x00},
187 {0x73, 0x00},
188 {0x74, 0x00},
189 {0x75, 0x00},
190 {0x76, 0x00},
191 {0x77, 0x00},
192 {0x78, 0x00},
193 {0x79, 0x00},
194 {0x7a, 0x00},
195 {0x7b, 0x00},
196 {0x7c, 0x00},
197 {0x7d, 0x00},
198 {0x7e, 0x00},
199 {0x7f, 0x00},
200 {0x80, 0x0b},
201 {0x81, 0x00},
202 {0x82, 0x3c},
203 {0x83, 0x00},
204 {0x84, 0x00},
205 {0x85, 0x00},
206 {0x86, 0x00},
207 {0x87, 0x00},
208 {0x88, 0x08},
209 {0x89, 0x00},
210 {0x8a, 0x08},
211 {0x8b, 0xa6},
212 {0x8c, 0x84},
213 {0x8d, 0x47},
214 {0x8e, 0xbb},
215 {0x8f, 0x02},
216 {0x90, 0x21},
217 {0x91, 0x0c},
218 {0x92, 0x04},
219 {0x93, 0x22},
220 {0x94, 0x00},
221 {0x95, 0x00},
222 {0x96, 0x00},
223 {0x97, 0xeb},
224 {0x98, 0x00},
225 {0x99, 0x00},
226 {0x9a, 0x00},
227 {0x9b, 0x00},
228 {0x9c, 0x00},
229 {0x9d, 0x00},
230 {0x9e, 0x00},
231 {0x9f, 0x00},
232 {0xa0, 0x00},
233 {0xa1, 0x00},
234 {0xa2, 0x00},
235 {0xa3, 0x00},
236 {0xa4, 0x00},
237 {0xa5, 0x00},
238 {0xa6, 0x10},
239 {0xa7, 0x04},
240 {0xa8, 0x10},
241 {0xa9, 0x00},
242 {0xaa, 0x8f},
243 {0xab, 0x00},
244 {0xac, 0x00},
245 {0xad, 0x00},
246 {0xae, 0x00},
247 {0xaf, 0x80},
248 {0xb0, 0x38},
249 {0xb1, 0x00},
250 {0xb2, 0x00},
251 {0xb3, 0x00},
252 {0xb4, 0xee},
253 {0xb5, 0xff},
254 {0xb6, 0x10},
255 {0xb7, 0x00},
256 {0xb8, 0x00},
257 {0xb9, 0x00},
258 {0xba, 0x00},
259 {0xbb, 0x03},
260 {0xbc, 0x00},
261 {0xbd, 0x00},
262 {0xbe, 0x00},
263 {0xbf, 0x00},
264 {0xc0, 0x10},
265 {0xc1, 0x10},
266 {0xc2, 0x18},
267 {0xc3, 0x20},
268 {0xc4, 0x10},
269 {0xc5, 0x00},
270 {0xc6, 0x22},
271 {0xc7, 0x14},
272 {0xc8, 0x0f},
273 {0xc9, 0x08},
274 {0xca, 0xa4},
275 {0xcb, 0xa7},
276 {0xcc, 0x3c},
277 {0xcd, 0x10},
278 {0xce, 0x20},
279 {0xcf, 0x00},
280 {0xd0, 0x00},
281 {0xd1, 0x10},
282 {0xd2, 0x00},
283 {0xd3, 0x00},
284 {0xd4, 0x10},
285 {0xd5, 0x33},
286 {0xd6, 0x70},
287 {0xd7, 0x01},
288 {0xd8, 0x00},
289 {0xd9, 0x00},
290 {0xda, 0x00},
291 {0xdb, 0x00},
292 {0xdc, 0x00},
293 {0xdd, 0x00},
294 {0xde, 0x00},
295 {0xdf, 0x00},
296 {0xe0, 0x00},
297 {0xe1, 0x00},
298 {0xe2, 0xcc},
299 {0xe3, 0x04},
300 {0xe4, 0x08},
301 {0xe5, 0x10},
302 {0xe6, 0x00},
303 {0xe7, 0x0e},
304 {0xe8, 0x88},
305 {0xe9, 0xd4},
306 {0xea, 0x05},
307 {0xeb, 0xf0},
308 {0xec, 0x79},
309 {0xed, 0x0f},
310 {0xee, 0x04},
311 {0xef, 0x04},
312 {0xf0, 0x00},
313 {0xf1, 0x00},
314 {0xf2, 0x00},
315 {0xf3, 0x00},
316 {0xf4, 0x00},
317 {0xf5, 0x00},
318 {0xf6, 0x00},
319 {0xf7, 0x00},
320 {0xf8, 0x00},
321 {0xf9, 0x00},
322 {0xF0, 0x00},
323 {0xF1, 0xF8},
324 {0xF0, 0x80},
325 {0xF0, 0x00},
326 {0xF1, 0xF4},
327 {0xF0, 0x81},
328 {0xF0, 0x01},
329 {0xF1, 0xF0},
330 {0xF0, 0x82},
331 {0xF0, 0x02},
332 {0xF1, 0xEC},
333 {0xF0, 0x83},
334 {0xF0, 0x03},
335 {0xF1, 0xE8},
336 {0xF0, 0x84},
337 {0xF0, 0x04},
338 {0xF1, 0xE4},
339 {0xF0, 0x85},
340 {0xF0, 0x05},
341 {0xF1, 0xE0},
342 {0xF0, 0x86},
343 {0xF0, 0x06},
344 {0xF1, 0xDC},
345 {0xF0, 0x87},
346 {0xF0, 0x07},
347 {0xF1, 0xD8},
348 {0xF0, 0x88},
349 {0xF0, 0x08},
350 {0xF1, 0xD4},
351 {0xF0, 0x89},
352 {0xF0, 0x09},
353 {0xF1, 0xD0},
354 {0xF0, 0x8A},
355 {0xF0, 0x0A},
356 {0xF1, 0xCC},
357 {0xF0, 0x8B},
358 {0xF0, 0x0B},
359 {0xF1, 0xC8},
360 {0xF0, 0x8C},
361 {0xF0, 0x0C},
362 {0xF1, 0xC4},
363 {0xF0, 0x8D},
364 {0xF0, 0x0D},
365 {0xF1, 0xC0},
366 {0xF0, 0x8E},
367 {0xF0, 0x0E},
368 {0xF1, 0xBC},
369 {0xF0, 0x8F},
370 {0xF0, 0x0F},
371 {0xF1, 0xB8},
372 {0xF0, 0x90},
373 {0xF0, 0x10},
374 {0xF1, 0xB4},
375 {0xF0, 0x91},
376 {0xF0, 0x11},
377 {0xF1, 0xB0},
378 {0xF0, 0x92},
379 {0xF0, 0x12},
380 {0xF1, 0xAC},
381 {0xF0, 0x93},
382 {0xF0, 0x13},
383 {0xF1, 0xA8},
384 {0xF0, 0x94},
385 {0xF0, 0x14},
386 {0xF1, 0xA4},
387 {0xF0, 0x95},
388 {0xF0, 0x15},
389 {0xF1, 0xA0},
390 {0xF0, 0x96},
391 {0xF0, 0x16},
392 {0xF1, 0x9C},
393 {0xF0, 0x97},
394 {0xF0, 0x17},
395 {0xF1, 0x98},
396 {0xF0, 0x98},
397 {0xF0, 0x18},
398 {0xF1, 0x94},
399 {0xF0, 0x99},
400 {0xF0, 0x19},
401 {0xF1, 0x90},
402 {0xF0, 0x9A},
403 {0xF0, 0x1A},
404 {0xF1, 0x8C},
405 {0xF0, 0x9B},
406 {0xF0, 0x1B},
407 {0xF1, 0x88},
408 {0xF0, 0x9C},
409 {0xF0, 0x1C},
410 {0xF1, 0x84},
411 {0xF0, 0x9D},
412 {0xF0, 0x1D},
413 {0xF1, 0x80},
414 {0xF0, 0x9E},
415 {0xF0, 0x1E},
416 {0xF1, 0x7C},
417 {0xF0, 0x9F},
418 {0xF0, 0x1F},
419 {0xF1, 0x78},
420 {0xF0, 0xA0},
421 {0xF0, 0x20},
422 {0xF1, 0x74},
423 {0xF0, 0xA1},
424 {0xF0, 0x21},
425 {0xF1, 0x70},
426 {0xF0, 0xA2},
427 {0xF0, 0x22},
428 {0xF1, 0x6C},
429 {0xF0, 0xA3},
430 {0xF0, 0x23},
431 {0xF1, 0x68},
432 {0xF0, 0xA4},
433 {0xF0, 0x24},
434 {0xF1, 0x64},
435 {0xF0, 0xA5},
436 {0xF0, 0x25},
437 {0xF1, 0x60},
438 {0xF0, 0xA6},
439 {0xF0, 0x26},
440 {0xF1, 0x5C},
441 {0xF0, 0xA7},
442 {0xF0, 0x27},
443 {0xF1, 0x58},
444 {0xF0, 0xA8},
445 {0xF0, 0x28},
446 {0xF1, 0x54},
447 {0xF0, 0xA9},
448 {0xF0, 0x29},
449 {0xF1, 0x50},
450 {0xF0, 0xAA},
451 {0xF0, 0x2A},
452 {0xF1, 0x4C},
453 {0xF0, 0xAB},
454 {0xF0, 0x2B},
455 {0xF1, 0x48},
456 {0xF0, 0xAC},
457 {0xF0, 0x2C},
458 {0xF1, 0x44},
459 {0xF0, 0xAD},
460 {0xF0, 0x2D},
461 {0xF1, 0x40},
462 {0xF0, 0xAE},
463 {0xF0, 0x2E},
464 {0xF1, 0x3C},
465 {0xF0, 0xAF},
466 {0xF0, 0x2F},
467 {0xF1, 0x38},
468 {0xF0, 0xB0},
469 {0xF0, 0x30},
470 {0xF1, 0x34},
471 {0xF0, 0xB1},
472 {0xF0, 0x31},
473 {0xF1, 0x30},
474 {0xF0, 0xB2},
475 {0xF0, 0x32},
476 {0xF1, 0x2C},
477 {0xF0, 0xB3},
478 {0xF0, 0x33},
479 {0xF1, 0x28},
480 {0xF0, 0xB4},
481 {0xF0, 0x34},
482 {0xF1, 0x24},
483 {0xF0, 0xB5},
484 {0xF0, 0x35},
485 {0xF1, 0x20},
486 {0xF0, 0xB6},
487 {0xF0, 0x36},
488 {0xF1, 0x1C},
489 {0xF0, 0xB7},
490 {0xF0, 0x37},
491 {0xF1, 0x18},
492 {0xF0, 0xB8},
493 {0xF0, 0x38},
494 {0xF1, 0x14},
495 {0xF0, 0xB9},
496 {0xF0, 0x39},
497 {0xF1, 0x10},
498 {0xF0, 0xBA},
499 {0xF0, 0x3A},
500 {0xF1, 0x0C},
501 {0xF0, 0xBB},
502 {0xF0, 0x3B},
503 {0xF1, 0x08},
504 {0xF0, 0x00},
505 {0xF0, 0x3C},
506 {0xF1, 0x04},
507 {0xF0, 0xBD},
508 {0xF0, 0x3D},
509 {0xF1, 0x00},
510 {0xF0, 0xBE},
511 {0xF0, 0x3E},
512 {0xF1, 0x00},
513 {0xF0, 0xBF},
514 {0xF0, 0x3F},
515 {0xF1, 0x00},
516 {0xF0, 0xC0},
517 {0xF0, 0x00},
Forest Bond5449c682009-04-25 10:30:44 -0400518};
519
520#define CB_VT3253B0_INIT_FOR_RFMD 256
Claudiu Beznea6c5f37d2016-03-14 21:55:20 +0200521static const unsigned char byVT3253B0_RFMD[CB_VT3253B0_INIT_FOR_RFMD][2] = {
Joe Perches37529362013-03-18 10:44:38 -0700522 {0x00, 0x31},
523 {0x01, 0x00},
524 {0x02, 0x00},
525 {0x03, 0x00},
526 {0x04, 0x00},
527 {0x05, 0x81},
528 {0x06, 0x00},
529 {0x07, 0x00},
530 {0x08, 0x38},
531 {0x09, 0x45},
532 {0x0a, 0x2a},
533 {0x0b, 0x76},
534 {0x0c, 0x00},
535 {0x0d, 0x00},
536 {0x0e, 0x80},
537 {0x0f, 0x00},
538 {0x10, 0x00},
539 {0x11, 0x00},
540 {0x12, 0x00},
541 {0x13, 0x00},
542 {0x14, 0x00},
543 {0x15, 0x00},
544 {0x16, 0x00},
545 {0x17, 0x00},
546 {0x18, 0x00},
547 {0x19, 0x00},
548 {0x1a, 0x00},
549 {0x1b, 0x8e},
550 {0x1c, 0x06},
551 {0x1d, 0x00},
552 {0x1e, 0x00},
553 {0x1f, 0x00},
554 {0x20, 0x00},
555 {0x21, 0x00},
556 {0x22, 0x00},
557 {0x23, 0x00},
558 {0x24, 0x00},
559 {0x25, 0x4a},
560 {0x26, 0x00},
561 {0x27, 0x00},
562 {0x28, 0x00},
563 {0x29, 0x00},
564 {0x2a, 0x00},
565 {0x2b, 0x00},
566 {0x2c, 0x00},
567 {0x2d, 0x34},
568 {0x2e, 0x18},
569 {0x2f, 0x0c},
570 {0x30, 0x26},
571 {0x31, 0x5b},
572 {0x32, 0x00},
573 {0x33, 0x00},
574 {0x34, 0x00},
575 {0x35, 0x00},
576 {0x36, 0xaa},
577 {0x37, 0xaa},
578 {0x38, 0xff},
579 {0x39, 0xff},
580 {0x3a, 0xf8},
581 {0x3b, 0x00},
582 {0x3c, 0x00},
583 {0x3d, 0x09},
584 {0x3e, 0x0d},
585 {0x3f, 0x04},
586 {0x40, 0x00},
587 {0x41, 0x08},
588 {0x42, 0x00},
589 {0x43, 0x08},
590 {0x44, 0x08},
591 {0x45, 0x14},
592 {0x46, 0x05},
593 {0x47, 0x08},
594 {0x48, 0x00},
595 {0x49, 0x00},
596 {0x4a, 0x00},
597 {0x4b, 0x00},
598 {0x4c, 0x09},
599 {0x4d, 0x80},
600 {0x4e, 0x00},
601 {0x4f, 0xc5},
602 {0x50, 0x14},
603 {0x51, 0x19},
604 {0x52, 0x00},
605 {0x53, 0x00},
606 {0x54, 0x00},
607 {0x55, 0x00},
608 {0x56, 0x00},
609 {0x57, 0x00},
610 {0x58, 0x00},
611 {0x59, 0xb0},
612 {0x5a, 0x00},
613 {0x5b, 0x00},
614 {0x5c, 0x00},
615 {0x5d, 0x00},
616 {0x5e, 0x00},
617 {0x5f, 0x00},
618 {0x60, 0x39},
619 {0x61, 0x83},
620 {0x62, 0x00},
621 {0x63, 0x00},
622 {0x64, 0x00},
623 {0x65, 0x00},
624 {0x66, 0xc0},
625 {0x67, 0x49},
626 {0x68, 0x00},
627 {0x69, 0x00},
628 {0x6a, 0x00},
629 {0x6b, 0x00},
630 {0x6c, 0x00},
631 {0x6d, 0x03},
632 {0x6e, 0x01},
633 {0x6f, 0x00},
634 {0x70, 0x00},
635 {0x71, 0x00},
636 {0x72, 0x00},
637 {0x73, 0x00},
638 {0x74, 0x00},
639 {0x75, 0x00},
640 {0x76, 0x00},
641 {0x77, 0x00},
642 {0x78, 0x00},
643 {0x79, 0x00},
644 {0x7a, 0x00},
645 {0x7b, 0x00},
646 {0x7c, 0x00},
647 {0x7d, 0x00},
648 {0x7e, 0x00},
649 {0x7f, 0x00},
650 {0x80, 0x89},
651 {0x81, 0x00},
652 {0x82, 0x0e},
653 {0x83, 0x00},
654 {0x84, 0x00},
655 {0x85, 0x00},
656 {0x86, 0x00},
657 {0x87, 0x00},
658 {0x88, 0x08},
659 {0x89, 0x00},
660 {0x8a, 0x0e},
661 {0x8b, 0xa7},
662 {0x8c, 0x88},
663 {0x8d, 0x47},
664 {0x8e, 0xaa},
665 {0x8f, 0x02},
666 {0x90, 0x23},
667 {0x91, 0x0c},
668 {0x92, 0x06},
669 {0x93, 0x08},
670 {0x94, 0x00},
671 {0x95, 0x00},
672 {0x96, 0x00},
673 {0x97, 0xeb},
674 {0x98, 0x00},
675 {0x99, 0x00},
676 {0x9a, 0x00},
677 {0x9b, 0x00},
678 {0x9c, 0x00},
679 {0x9d, 0x00},
680 {0x9e, 0x00},
681 {0x9f, 0x00},
682 {0xa0, 0x00},
683 {0xa1, 0x00},
684 {0xa2, 0x00},
685 {0xa3, 0xcd},
686 {0xa4, 0x07},
687 {0xa5, 0x33},
688 {0xa6, 0x18},
689 {0xa7, 0x00},
690 {0xa8, 0x18},
691 {0xa9, 0x00},
692 {0xaa, 0x28},
693 {0xab, 0x00},
694 {0xac, 0x00},
695 {0xad, 0x00},
696 {0xae, 0x00},
697 {0xaf, 0x18},
698 {0xb0, 0x38},
699 {0xb1, 0x30},
700 {0xb2, 0x00},
701 {0xb3, 0x00},
702 {0xb4, 0x00},
703 {0xb5, 0x00},
704 {0xb6, 0x84},
705 {0xb7, 0xfd},
706 {0xb8, 0x00},
707 {0xb9, 0x00},
708 {0xba, 0x00},
709 {0xbb, 0x03},
710 {0xbc, 0x00},
711 {0xbd, 0x00},
712 {0xbe, 0x00},
713 {0xbf, 0x00},
714 {0xc0, 0x10},
715 {0xc1, 0x20},
716 {0xc2, 0x18},
717 {0xc3, 0x20},
718 {0xc4, 0x10},
719 {0xc5, 0x2c},
720 {0xc6, 0x1e},
721 {0xc7, 0x10},
722 {0xc8, 0x12},
723 {0xc9, 0x01},
724 {0xca, 0x6f},
725 {0xcb, 0xa7},
726 {0xcc, 0x3c},
727 {0xcd, 0x10},
728 {0xce, 0x00},
729 {0xcf, 0x22},
730 {0xd0, 0x00},
731 {0xd1, 0x10},
732 {0xd2, 0x00},
733 {0xd3, 0x00},
734 {0xd4, 0x10},
735 {0xd5, 0x33},
736 {0xd6, 0x80},
737 {0xd7, 0x21},
738 {0xd8, 0x00},
739 {0xd9, 0x00},
740 {0xda, 0x00},
741 {0xdb, 0x00},
742 {0xdc, 0x00},
743 {0xdd, 0x00},
744 {0xde, 0x00},
745 {0xdf, 0x00},
746 {0xe0, 0x00},
747 {0xe1, 0xB3},
748 {0xe2, 0x00},
749 {0xe3, 0x00},
750 {0xe4, 0x00},
751 {0xe5, 0x10},
752 {0xe6, 0x00},
753 {0xe7, 0x18},
754 {0xe8, 0x08},
755 {0xe9, 0xd4},
756 {0xea, 0x00},
757 {0xeb, 0xff},
758 {0xec, 0x79},
759 {0xed, 0x10},
760 {0xee, 0x30},
761 {0xef, 0x02},
762 {0xf0, 0x00},
763 {0xf1, 0x09},
764 {0xf2, 0x00},
765 {0xf3, 0x00},
766 {0xf4, 0x00},
767 {0xf5, 0x00},
768 {0xf6, 0x00},
769 {0xf7, 0x00},
770 {0xf8, 0x00},
771 {0xf9, 0x00},
772 {0xfa, 0x00},
773 {0xfb, 0x00},
774 {0xfc, 0x00},
775 {0xfd, 0x00},
776 {0xfe, 0x00},
777 {0xff, 0x00},
Forest Bond5449c682009-04-25 10:30:44 -0400778};
779
780#define CB_VT3253B0_AGC_FOR_RFMD2959 195
James A Shackleford15974dc2014-06-01 23:06:57 -0400781/* For RFMD2959 */
Kathryn Hampton5150d012016-03-15 18:16:24 -0700782static
783unsigned char byVT3253B0_AGC4_RFMD2959[CB_VT3253B0_AGC_FOR_RFMD2959][2] = {
Joe Perches37529362013-03-18 10:44:38 -0700784 {0xF0, 0x00},
785 {0xF1, 0x3E},
786 {0xF0, 0x80},
787 {0xF0, 0x00},
788 {0xF1, 0x3E},
789 {0xF0, 0x81},
790 {0xF0, 0x01},
791 {0xF1, 0x3E},
792 {0xF0, 0x82},
793 {0xF0, 0x02},
794 {0xF1, 0x3E},
795 {0xF0, 0x83},
796 {0xF0, 0x03},
797 {0xF1, 0x3B},
798 {0xF0, 0x84},
799 {0xF0, 0x04},
800 {0xF1, 0x39},
801 {0xF0, 0x85},
802 {0xF0, 0x05},
803 {0xF1, 0x38},
804 {0xF0, 0x86},
805 {0xF0, 0x06},
806 {0xF1, 0x37},
807 {0xF0, 0x87},
808 {0xF0, 0x07},
809 {0xF1, 0x36},
810 {0xF0, 0x88},
811 {0xF0, 0x08},
812 {0xF1, 0x35},
813 {0xF0, 0x89},
814 {0xF0, 0x09},
815 {0xF1, 0x35},
816 {0xF0, 0x8A},
817 {0xF0, 0x0A},
818 {0xF1, 0x34},
819 {0xF0, 0x8B},
820 {0xF0, 0x0B},
821 {0xF1, 0x34},
822 {0xF0, 0x8C},
823 {0xF0, 0x0C},
824 {0xF1, 0x33},
825 {0xF0, 0x8D},
826 {0xF0, 0x0D},
827 {0xF1, 0x32},
828 {0xF0, 0x8E},
829 {0xF0, 0x0E},
830 {0xF1, 0x31},
831 {0xF0, 0x8F},
832 {0xF0, 0x0F},
833 {0xF1, 0x30},
834 {0xF0, 0x90},
835 {0xF0, 0x10},
836 {0xF1, 0x2F},
837 {0xF0, 0x91},
838 {0xF0, 0x11},
839 {0xF1, 0x2F},
840 {0xF0, 0x92},
841 {0xF0, 0x12},
842 {0xF1, 0x2E},
843 {0xF0, 0x93},
844 {0xF0, 0x13},
845 {0xF1, 0x2D},
846 {0xF0, 0x94},
847 {0xF0, 0x14},
848 {0xF1, 0x2C},
849 {0xF0, 0x95},
850 {0xF0, 0x15},
851 {0xF1, 0x2B},
852 {0xF0, 0x96},
853 {0xF0, 0x16},
854 {0xF1, 0x2B},
855 {0xF0, 0x97},
856 {0xF0, 0x17},
857 {0xF1, 0x2A},
858 {0xF0, 0x98},
859 {0xF0, 0x18},
860 {0xF1, 0x29},
861 {0xF0, 0x99},
862 {0xF0, 0x19},
863 {0xF1, 0x28},
864 {0xF0, 0x9A},
865 {0xF0, 0x1A},
866 {0xF1, 0x27},
867 {0xF0, 0x9B},
868 {0xF0, 0x1B},
869 {0xF1, 0x26},
870 {0xF0, 0x9C},
871 {0xF0, 0x1C},
872 {0xF1, 0x25},
873 {0xF0, 0x9D},
874 {0xF0, 0x1D},
875 {0xF1, 0x24},
876 {0xF0, 0x9E},
877 {0xF0, 0x1E},
878 {0xF1, 0x24},
879 {0xF0, 0x9F},
880 {0xF0, 0x1F},
881 {0xF1, 0x23},
882 {0xF0, 0xA0},
883 {0xF0, 0x20},
884 {0xF1, 0x22},
885 {0xF0, 0xA1},
886 {0xF0, 0x21},
887 {0xF1, 0x21},
888 {0xF0, 0xA2},
889 {0xF0, 0x22},
890 {0xF1, 0x20},
891 {0xF0, 0xA3},
892 {0xF0, 0x23},
893 {0xF1, 0x20},
894 {0xF0, 0xA4},
895 {0xF0, 0x24},
896 {0xF1, 0x1F},
897 {0xF0, 0xA5},
898 {0xF0, 0x25},
899 {0xF1, 0x1E},
900 {0xF0, 0xA6},
901 {0xF0, 0x26},
902 {0xF1, 0x1D},
903 {0xF0, 0xA7},
904 {0xF0, 0x27},
905 {0xF1, 0x1C},
906 {0xF0, 0xA8},
907 {0xF0, 0x28},
908 {0xF1, 0x1B},
909 {0xF0, 0xA9},
910 {0xF0, 0x29},
911 {0xF1, 0x1B},
912 {0xF0, 0xAA},
913 {0xF0, 0x2A},
914 {0xF1, 0x1A},
915 {0xF0, 0xAB},
916 {0xF0, 0x2B},
917 {0xF1, 0x1A},
918 {0xF0, 0xAC},
919 {0xF0, 0x2C},
920 {0xF1, 0x19},
921 {0xF0, 0xAD},
922 {0xF0, 0x2D},
923 {0xF1, 0x18},
924 {0xF0, 0xAE},
925 {0xF0, 0x2E},
926 {0xF1, 0x17},
927 {0xF0, 0xAF},
928 {0xF0, 0x2F},
929 {0xF1, 0x16},
930 {0xF0, 0xB0},
931 {0xF0, 0x30},
932 {0xF1, 0x15},
933 {0xF0, 0xB1},
934 {0xF0, 0x31},
935 {0xF1, 0x15},
936 {0xF0, 0xB2},
937 {0xF0, 0x32},
938 {0xF1, 0x15},
939 {0xF0, 0xB3},
940 {0xF0, 0x33},
941 {0xF1, 0x14},
942 {0xF0, 0xB4},
943 {0xF0, 0x34},
944 {0xF1, 0x13},
945 {0xF0, 0xB5},
946 {0xF0, 0x35},
947 {0xF1, 0x12},
948 {0xF0, 0xB6},
949 {0xF0, 0x36},
950 {0xF1, 0x11},
951 {0xF0, 0xB7},
952 {0xF0, 0x37},
953 {0xF1, 0x10},
954 {0xF0, 0xB8},
955 {0xF0, 0x38},
956 {0xF1, 0x0F},
957 {0xF0, 0xB9},
958 {0xF0, 0x39},
959 {0xF1, 0x0E},
960 {0xF0, 0xBA},
961 {0xF0, 0x3A},
962 {0xF1, 0x0D},
963 {0xF0, 0xBB},
964 {0xF0, 0x3B},
965 {0xF1, 0x0C},
966 {0xF0, 0xBC},
967 {0xF0, 0x3C},
968 {0xF1, 0x0B},
969 {0xF0, 0xBD},
970 {0xF0, 0x3D},
971 {0xF1, 0x0B},
972 {0xF0, 0xBE},
973 {0xF0, 0x3E},
974 {0xF1, 0x0A},
975 {0xF0, 0xBF},
976 {0xF0, 0x3F},
977 {0xF1, 0x09},
978 {0xF0, 0x00},
Forest Bond5449c682009-04-25 10:30:44 -0400979};
980
981#define CB_VT3253B0_INIT_FOR_AIROHA2230 256
James A Shackleford15974dc2014-06-01 23:06:57 -0400982/* For AIROHA */
Kathryn Hampton5150d012016-03-15 18:16:24 -0700983static
984unsigned char byVT3253B0_AIROHA2230[CB_VT3253B0_INIT_FOR_AIROHA2230][2] = {
Joe Perches37529362013-03-18 10:44:38 -0700985 {0x00, 0x31},
986 {0x01, 0x00},
987 {0x02, 0x00},
988 {0x03, 0x00},
989 {0x04, 0x00},
990 {0x05, 0x80},
991 {0x06, 0x00},
992 {0x07, 0x00},
993 {0x08, 0x70},
994 {0x09, 0x41},
995 {0x0a, 0x2A},
996 {0x0b, 0x76},
997 {0x0c, 0x00},
998 {0x0d, 0x00},
999 {0x0e, 0x80},
1000 {0x0f, 0x00},
1001 {0x10, 0x00},
1002 {0x11, 0x00},
1003 {0x12, 0x00},
1004 {0x13, 0x00},
1005 {0x14, 0x00},
1006 {0x15, 0x00},
1007 {0x16, 0x00},
1008 {0x17, 0x00},
1009 {0x18, 0x00},
1010 {0x19, 0x00},
1011 {0x1a, 0x00},
1012 {0x1b, 0x8f},
1013 {0x1c, 0x09},
1014 {0x1d, 0x00},
1015 {0x1e, 0x00},
1016 {0x1f, 0x00},
1017 {0x20, 0x00},
1018 {0x21, 0x00},
1019 {0x22, 0x00},
1020 {0x23, 0x00},
1021 {0x24, 0x00},
1022 {0x25, 0x4a},
1023 {0x26, 0x00},
1024 {0x27, 0x00},
1025 {0x28, 0x00},
1026 {0x29, 0x00},
1027 {0x2a, 0x00},
1028 {0x2b, 0x00},
1029 {0x2c, 0x00},
1030 {0x2d, 0x4a},
1031 {0x2e, 0x00},
1032 {0x2f, 0x0a},
1033 {0x30, 0x26},
1034 {0x31, 0x5b},
1035 {0x32, 0x00},
1036 {0x33, 0x00},
1037 {0x34, 0x00},
1038 {0x35, 0x00},
1039 {0x36, 0xaa},
1040 {0x37, 0xaa},
1041 {0x38, 0xff},
1042 {0x39, 0xff},
1043 {0x3a, 0x79},
1044 {0x3b, 0x00},
1045 {0x3c, 0x00},
1046 {0x3d, 0x0b},
1047 {0x3e, 0x48},
1048 {0x3f, 0x04},
1049 {0x40, 0x00},
1050 {0x41, 0x08},
1051 {0x42, 0x00},
1052 {0x43, 0x08},
1053 {0x44, 0x08},
1054 {0x45, 0x14},
1055 {0x46, 0x05},
1056 {0x47, 0x09},
1057 {0x48, 0x00},
1058 {0x49, 0x00},
1059 {0x4a, 0x00},
1060 {0x4b, 0x00},
1061 {0x4c, 0x09},
1062 {0x4d, 0x73},
1063 {0x4e, 0x00},
1064 {0x4f, 0xc5},
1065 {0x50, 0x15},
1066 {0x51, 0x19},
1067 {0x52, 0x00},
1068 {0x53, 0x00},
1069 {0x54, 0x00},
1070 {0x55, 0x00},
1071 {0x56, 0x00},
1072 {0x57, 0x00},
1073 {0x58, 0x00},
1074 {0x59, 0xb0},
1075 {0x5a, 0x00},
1076 {0x5b, 0x00},
1077 {0x5c, 0x00},
1078 {0x5d, 0x00},
1079 {0x5e, 0x00},
1080 {0x5f, 0x00},
1081 {0x60, 0xe4},
1082 {0x61, 0x80},
1083 {0x62, 0x00},
1084 {0x63, 0x00},
1085 {0x64, 0x00},
1086 {0x65, 0x00},
1087 {0x66, 0x98},
1088 {0x67, 0x0a},
1089 {0x68, 0x00},
1090 {0x69, 0x00},
1091 {0x6a, 0x00},
1092 {0x6b, 0x00},
James A Shackleford15974dc2014-06-01 23:06:57 -04001093 {0x6c, 0x00}, /* RobertYu:20050125, request by JJSue */
Joe Perches37529362013-03-18 10:44:38 -07001094 {0x6d, 0x03},
1095 {0x6e, 0x01},
1096 {0x6f, 0x00},
1097 {0x70, 0x00},
1098 {0x71, 0x00},
1099 {0x72, 0x00},
1100 {0x73, 0x00},
1101 {0x74, 0x00},
1102 {0x75, 0x00},
1103 {0x76, 0x00},
1104 {0x77, 0x00},
1105 {0x78, 0x00},
1106 {0x79, 0x00},
1107 {0x7a, 0x00},
1108 {0x7b, 0x00},
1109 {0x7c, 0x00},
1110 {0x7d, 0x00},
1111 {0x7e, 0x00},
1112 {0x7f, 0x00},
1113 {0x80, 0x8c},
1114 {0x81, 0x01},
1115 {0x82, 0x09},
1116 {0x83, 0x00},
1117 {0x84, 0x00},
1118 {0x85, 0x00},
1119 {0x86, 0x00},
1120 {0x87, 0x00},
1121 {0x88, 0x08},
1122 {0x89, 0x00},
1123 {0x8a, 0x0f},
1124 {0x8b, 0xb7},
1125 {0x8c, 0x88},
1126 {0x8d, 0x47},
1127 {0x8e, 0xaa},
1128 {0x8f, 0x02},
1129 {0x90, 0x22},
1130 {0x91, 0x00},
1131 {0x92, 0x00},
1132 {0x93, 0x00},
1133 {0x94, 0x00},
1134 {0x95, 0x00},
1135 {0x96, 0x00},
1136 {0x97, 0xeb},
1137 {0x98, 0x00},
1138 {0x99, 0x00},
1139 {0x9a, 0x00},
1140 {0x9b, 0x00},
1141 {0x9c, 0x00},
1142 {0x9d, 0x00},
1143 {0x9e, 0x00},
1144 {0x9f, 0x01},
1145 {0xa0, 0x00},
1146 {0xa1, 0x00},
1147 {0xa2, 0x00},
1148 {0xa3, 0x00},
1149 {0xa4, 0x00},
1150 {0xa5, 0x00},
1151 {0xa6, 0x10},
1152 {0xa7, 0x00},
1153 {0xa8, 0x18},
1154 {0xa9, 0x00},
1155 {0xaa, 0x00},
1156 {0xab, 0x00},
1157 {0xac, 0x00},
1158 {0xad, 0x00},
1159 {0xae, 0x00},
1160 {0xaf, 0x18},
1161 {0xb0, 0x38},
1162 {0xb1, 0x30},
1163 {0xb2, 0x00},
1164 {0xb3, 0x00},
1165 {0xb4, 0xff},
1166 {0xb5, 0x0f},
1167 {0xb6, 0xe4},
1168 {0xb7, 0xe2},
1169 {0xb8, 0x00},
1170 {0xb9, 0x00},
1171 {0xba, 0x00},
1172 {0xbb, 0x03},
1173 {0xbc, 0x01},
1174 {0xbd, 0x00},
1175 {0xbe, 0x00},
1176 {0xbf, 0x00},
1177 {0xc0, 0x18},
1178 {0xc1, 0x20},
1179 {0xc2, 0x07},
1180 {0xc3, 0x18},
1181 {0xc4, 0xff},
1182 {0xc5, 0x2c},
1183 {0xc6, 0x0c},
1184 {0xc7, 0x0a},
1185 {0xc8, 0x0e},
1186 {0xc9, 0x01},
1187 {0xca, 0x68},
1188 {0xcb, 0xa7},
1189 {0xcc, 0x3c},
1190 {0xcd, 0x10},
1191 {0xce, 0x00},
1192 {0xcf, 0x25},
1193 {0xd0, 0x40},
1194 {0xd1, 0x12},
1195 {0xd2, 0x00},
1196 {0xd3, 0x00},
1197 {0xd4, 0x10},
1198 {0xd5, 0x28},
1199 {0xd6, 0x80},
1200 {0xd7, 0x2A},
1201 {0xd8, 0x00},
1202 {0xd9, 0x00},
1203 {0xda, 0x00},
1204 {0xdb, 0x00},
1205 {0xdc, 0x00},
1206 {0xdd, 0x00},
1207 {0xde, 0x00},
1208 {0xdf, 0x00},
1209 {0xe0, 0x00},
1210 {0xe1, 0xB3},
1211 {0xe2, 0x00},
1212 {0xe3, 0x00},
1213 {0xe4, 0x00},
1214 {0xe5, 0x10},
1215 {0xe6, 0x00},
1216 {0xe7, 0x1C},
1217 {0xe8, 0x00},
1218 {0xe9, 0xf4},
1219 {0xea, 0x00},
1220 {0xeb, 0xff},
1221 {0xec, 0x79},
1222 {0xed, 0x20},
1223 {0xee, 0x30},
1224 {0xef, 0x01},
1225 {0xf0, 0x00},
1226 {0xf1, 0x3e},
1227 {0xf2, 0x00},
1228 {0xf3, 0x00},
1229 {0xf4, 0x00},
1230 {0xf5, 0x00},
1231 {0xf6, 0x00},
1232 {0xf7, 0x00},
1233 {0xf8, 0x00},
1234 {0xf9, 0x00},
1235 {0xfa, 0x00},
1236 {0xfb, 0x00},
1237 {0xfc, 0x00},
1238 {0xfd, 0x00},
1239 {0xfe, 0x00},
1240 {0xff, 0x00},
Forest Bond5449c682009-04-25 10:30:44 -04001241};
1242
Forest Bond5449c682009-04-25 10:30:44 -04001243#define CB_VT3253B0_INIT_FOR_UW2451 256
James A Shackleford15974dc2014-06-01 23:06:57 -04001244/* For UW2451 */
Guillaume Clement9e4c5c22014-07-22 22:08:28 +02001245static unsigned char byVT3253B0_UW2451[CB_VT3253B0_INIT_FOR_UW2451][2] = {
Joe Perches37529362013-03-18 10:44:38 -07001246 {0x00, 0x31},
1247 {0x01, 0x00},
1248 {0x02, 0x00},
1249 {0x03, 0x00},
1250 {0x04, 0x00},
1251 {0x05, 0x81},
1252 {0x06, 0x00},
1253 {0x07, 0x00},
1254 {0x08, 0x38},
1255 {0x09, 0x45},
1256 {0x0a, 0x28},
1257 {0x0b, 0x76},
1258 {0x0c, 0x00},
1259 {0x0d, 0x00},
1260 {0x0e, 0x80},
1261 {0x0f, 0x00},
1262 {0x10, 0x00},
1263 {0x11, 0x00},
1264 {0x12, 0x00},
1265 {0x13, 0x00},
1266 {0x14, 0x00},
1267 {0x15, 0x00},
1268 {0x16, 0x00},
1269 {0x17, 0x00},
1270 {0x18, 0x00},
1271 {0x19, 0x00},
1272 {0x1a, 0x00},
1273 {0x1b, 0x8f},
1274 {0x1c, 0x0f},
1275 {0x1d, 0x00},
1276 {0x1e, 0x00},
1277 {0x1f, 0x00},
1278 {0x20, 0x00},
1279 {0x21, 0x00},
1280 {0x22, 0x00},
1281 {0x23, 0x00},
1282 {0x24, 0x00},
1283 {0x25, 0x4a},
1284 {0x26, 0x00},
1285 {0x27, 0x00},
1286 {0x28, 0x00},
1287 {0x29, 0x00},
1288 {0x2a, 0x00},
1289 {0x2b, 0x00},
1290 {0x2c, 0x00},
1291 {0x2d, 0x18},
1292 {0x2e, 0x00},
1293 {0x2f, 0x0a},
1294 {0x30, 0x26},
1295 {0x31, 0x5b},
1296 {0x32, 0x00},
1297 {0x33, 0x00},
1298 {0x34, 0x00},
1299 {0x35, 0x00},
1300 {0x36, 0xaa},
1301 {0x37, 0xaa},
1302 {0x38, 0xff},
1303 {0x39, 0xff},
1304 {0x3a, 0x00},
1305 {0x3b, 0x00},
1306 {0x3c, 0x00},
1307 {0x3d, 0x03},
1308 {0x3e, 0x1d},
1309 {0x3f, 0x04},
1310 {0x40, 0x00},
1311 {0x41, 0x08},
1312 {0x42, 0x00},
1313 {0x43, 0x08},
1314 {0x44, 0x08},
1315 {0x45, 0x14},
1316 {0x46, 0x05},
1317 {0x47, 0x09},
1318 {0x48, 0x00},
1319 {0x49, 0x00},
1320 {0x4a, 0x00},
1321 {0x4b, 0x00},
1322 {0x4c, 0x09},
1323 {0x4d, 0x90},
1324 {0x4e, 0x00},
1325 {0x4f, 0xc5},
1326 {0x50, 0x15},
1327 {0x51, 0x19},
1328 {0x52, 0x00},
1329 {0x53, 0x00},
1330 {0x54, 0x00},
1331 {0x55, 0x00},
1332 {0x56, 0x00},
1333 {0x57, 0x00},
1334 {0x58, 0x00},
1335 {0x59, 0xb0},
1336 {0x5a, 0x00},
1337 {0x5b, 0x00},
1338 {0x5c, 0x00},
1339 {0x5d, 0x00},
1340 {0x5e, 0x00},
1341 {0x5f, 0x00},
1342 {0x60, 0xb3},
1343 {0x61, 0x81},
1344 {0x62, 0x00},
1345 {0x63, 0x00},
1346 {0x64, 0x00},
1347 {0x65, 0x00},
1348 {0x66, 0x57},
1349 {0x67, 0x6c},
1350 {0x68, 0x00},
1351 {0x69, 0x00},
1352 {0x6a, 0x00},
1353 {0x6b, 0x00},
James A Shackleford15974dc2014-06-01 23:06:57 -04001354 {0x6c, 0x00}, /* RobertYu:20050125, request by JJSue */
Joe Perches37529362013-03-18 10:44:38 -07001355 {0x6d, 0x03},
1356 {0x6e, 0x01},
1357 {0x6f, 0x00},
1358 {0x70, 0x00},
1359 {0x71, 0x00},
1360 {0x72, 0x00},
1361 {0x73, 0x00},
1362 {0x74, 0x00},
1363 {0x75, 0x00},
1364 {0x76, 0x00},
1365 {0x77, 0x00},
1366 {0x78, 0x00},
1367 {0x79, 0x00},
1368 {0x7a, 0x00},
1369 {0x7b, 0x00},
1370 {0x7c, 0x00},
1371 {0x7d, 0x00},
1372 {0x7e, 0x00},
1373 {0x7f, 0x00},
1374 {0x80, 0x8c},
1375 {0x81, 0x00},
1376 {0x82, 0x0e},
1377 {0x83, 0x00},
1378 {0x84, 0x00},
1379 {0x85, 0x00},
1380 {0x86, 0x00},
1381 {0x87, 0x00},
1382 {0x88, 0x08},
1383 {0x89, 0x00},
1384 {0x8a, 0x0e},
1385 {0x8b, 0xa7},
1386 {0x8c, 0x88},
1387 {0x8d, 0x47},
1388 {0x8e, 0xaa},
1389 {0x8f, 0x02},
1390 {0x90, 0x00},
1391 {0x91, 0x00},
1392 {0x92, 0x00},
1393 {0x93, 0x00},
1394 {0x94, 0x00},
1395 {0x95, 0x00},
1396 {0x96, 0x00},
1397 {0x97, 0xe3},
1398 {0x98, 0x00},
1399 {0x99, 0x00},
1400 {0x9a, 0x00},
1401 {0x9b, 0x00},
1402 {0x9c, 0x00},
1403 {0x9d, 0x00},
1404 {0x9e, 0x00},
1405 {0x9f, 0x00},
1406 {0xa0, 0x00},
1407 {0xa1, 0x00},
1408 {0xa2, 0x00},
1409 {0xa3, 0x00},
1410 {0xa4, 0x00},
1411 {0xa5, 0x00},
1412 {0xa6, 0x10},
1413 {0xa7, 0x00},
1414 {0xa8, 0x18},
1415 {0xa9, 0x00},
1416 {0xaa, 0x00},
1417 {0xab, 0x00},
1418 {0xac, 0x00},
1419 {0xad, 0x00},
1420 {0xae, 0x00},
1421 {0xaf, 0x18},
1422 {0xb0, 0x18},
1423 {0xb1, 0x30},
1424 {0xb2, 0x00},
1425 {0xb3, 0x00},
1426 {0xb4, 0x00},
1427 {0xb5, 0x00},
1428 {0xb6, 0x00},
1429 {0xb7, 0x00},
1430 {0xb8, 0x00},
1431 {0xb9, 0x00},
1432 {0xba, 0x00},
1433 {0xbb, 0x03},
1434 {0xbc, 0x01},
1435 {0xbd, 0x00},
1436 {0xbe, 0x00},
1437 {0xbf, 0x00},
1438 {0xc0, 0x10},
1439 {0xc1, 0x20},
1440 {0xc2, 0x00},
1441 {0xc3, 0x20},
1442 {0xc4, 0x00},
1443 {0xc5, 0x2c},
1444 {0xc6, 0x1c},
1445 {0xc7, 0x10},
1446 {0xc8, 0x10},
1447 {0xc9, 0x01},
1448 {0xca, 0x68},
1449 {0xcb, 0xa7},
1450 {0xcc, 0x3c},
1451 {0xcd, 0x09},
1452 {0xce, 0x00},
1453 {0xcf, 0x20},
1454 {0xd0, 0x40},
1455 {0xd1, 0x10},
1456 {0xd2, 0x00},
1457 {0xd3, 0x00},
1458 {0xd4, 0x20},
1459 {0xd5, 0x28},
1460 {0xd6, 0xa0},
1461 {0xd7, 0x2a},
1462 {0xd8, 0x00},
1463 {0xd9, 0x00},
1464 {0xda, 0x00},
1465 {0xdb, 0x00},
1466 {0xdc, 0x00},
1467 {0xdd, 0x00},
1468 {0xde, 0x00},
1469 {0xdf, 0x00},
1470 {0xe0, 0x00},
1471 {0xe1, 0xd3},
1472 {0xe2, 0xc0},
1473 {0xe3, 0x00},
1474 {0xe4, 0x00},
1475 {0xe5, 0x10},
1476 {0xe6, 0x00},
1477 {0xe7, 0x12},
1478 {0xe8, 0x12},
1479 {0xe9, 0x34},
1480 {0xea, 0x00},
1481 {0xeb, 0xff},
1482 {0xec, 0x79},
1483 {0xed, 0x20},
1484 {0xee, 0x30},
1485 {0xef, 0x01},
1486 {0xf0, 0x00},
1487 {0xf1, 0x3e},
1488 {0xf2, 0x00},
1489 {0xf3, 0x00},
1490 {0xf4, 0x00},
1491 {0xf5, 0x00},
1492 {0xf6, 0x00},
1493 {0xf7, 0x00},
1494 {0xf8, 0x00},
1495 {0xf9, 0x00},
1496 {0xfa, 0x00},
1497 {0xfb, 0x00},
1498 {0xfc, 0x00},
1499 {0xfd, 0x00},
1500 {0xfe, 0x00},
1501 {0xff, 0x00},
Forest Bond5449c682009-04-25 10:30:44 -04001502};
1503
1504#define CB_VT3253B0_AGC 193
James A Shackleford15974dc2014-06-01 23:06:57 -04001505/* For AIROHA */
Guillaume Clement9e4c5c22014-07-22 22:08:28 +02001506static unsigned char byVT3253B0_AGC[CB_VT3253B0_AGC][2] = {
Joe Perches37529362013-03-18 10:44:38 -07001507 {0xF0, 0x00},
1508 {0xF1, 0x00},
1509 {0xF0, 0x80},
1510 {0xF0, 0x01},
1511 {0xF1, 0x00},
1512 {0xF0, 0x81},
1513 {0xF0, 0x02},
1514 {0xF1, 0x02},
1515 {0xF0, 0x82},
1516 {0xF0, 0x03},
1517 {0xF1, 0x04},
1518 {0xF0, 0x83},
1519 {0xF0, 0x03},
1520 {0xF1, 0x04},
1521 {0xF0, 0x84},
1522 {0xF0, 0x04},
1523 {0xF1, 0x06},
1524 {0xF0, 0x85},
1525 {0xF0, 0x05},
1526 {0xF1, 0x06},
1527 {0xF0, 0x86},
1528 {0xF0, 0x06},
1529 {0xF1, 0x06},
1530 {0xF0, 0x87},
1531 {0xF0, 0x07},
1532 {0xF1, 0x08},
1533 {0xF0, 0x88},
1534 {0xF0, 0x08},
1535 {0xF1, 0x08},
1536 {0xF0, 0x89},
1537 {0xF0, 0x09},
1538 {0xF1, 0x0A},
1539 {0xF0, 0x8A},
1540 {0xF0, 0x0A},
1541 {0xF1, 0x0A},
1542 {0xF0, 0x8B},
1543 {0xF0, 0x0B},
1544 {0xF1, 0x0C},
1545 {0xF0, 0x8C},
1546 {0xF0, 0x0C},
1547 {0xF1, 0x0C},
1548 {0xF0, 0x8D},
1549 {0xF0, 0x0D},
1550 {0xF1, 0x0E},
1551 {0xF0, 0x8E},
1552 {0xF0, 0x0E},
1553 {0xF1, 0x0E},
1554 {0xF0, 0x8F},
1555 {0xF0, 0x0F},
1556 {0xF1, 0x10},
1557 {0xF0, 0x90},
1558 {0xF0, 0x10},
1559 {0xF1, 0x10},
1560 {0xF0, 0x91},
1561 {0xF0, 0x11},
1562 {0xF1, 0x12},
1563 {0xF0, 0x92},
1564 {0xF0, 0x12},
1565 {0xF1, 0x12},
1566 {0xF0, 0x93},
1567 {0xF0, 0x13},
1568 {0xF1, 0x14},
1569 {0xF0, 0x94},
1570 {0xF0, 0x14},
1571 {0xF1, 0x14},
1572 {0xF0, 0x95},
1573 {0xF0, 0x15},
1574 {0xF1, 0x16},
1575 {0xF0, 0x96},
1576 {0xF0, 0x16},
1577 {0xF1, 0x16},
1578 {0xF0, 0x97},
1579 {0xF0, 0x17},
1580 {0xF1, 0x18},
1581 {0xF0, 0x98},
1582 {0xF0, 0x18},
1583 {0xF1, 0x18},
1584 {0xF0, 0x99},
1585 {0xF0, 0x19},
1586 {0xF1, 0x1A},
1587 {0xF0, 0x9A},
1588 {0xF0, 0x1A},
1589 {0xF1, 0x1A},
1590 {0xF0, 0x9B},
1591 {0xF0, 0x1B},
1592 {0xF1, 0x1C},
1593 {0xF0, 0x9C},
1594 {0xF0, 0x1C},
1595 {0xF1, 0x1C},
1596 {0xF0, 0x9D},
1597 {0xF0, 0x1D},
1598 {0xF1, 0x1E},
1599 {0xF0, 0x9E},
1600 {0xF0, 0x1E},
1601 {0xF1, 0x1E},
1602 {0xF0, 0x9F},
1603 {0xF0, 0x1F},
1604 {0xF1, 0x20},
1605 {0xF0, 0xA0},
1606 {0xF0, 0x20},
1607 {0xF1, 0x20},
1608 {0xF0, 0xA1},
1609 {0xF0, 0x21},
1610 {0xF1, 0x22},
1611 {0xF0, 0xA2},
1612 {0xF0, 0x22},
1613 {0xF1, 0x22},
1614 {0xF0, 0xA3},
1615 {0xF0, 0x23},
1616 {0xF1, 0x24},
1617 {0xF0, 0xA4},
1618 {0xF0, 0x24},
1619 {0xF1, 0x24},
1620 {0xF0, 0xA5},
1621 {0xF0, 0x25},
1622 {0xF1, 0x26},
1623 {0xF0, 0xA6},
1624 {0xF0, 0x26},
1625 {0xF1, 0x26},
1626 {0xF0, 0xA7},
1627 {0xF0, 0x27},
1628 {0xF1, 0x28},
1629 {0xF0, 0xA8},
1630 {0xF0, 0x28},
1631 {0xF1, 0x28},
1632 {0xF0, 0xA9},
1633 {0xF0, 0x29},
1634 {0xF1, 0x2A},
1635 {0xF0, 0xAA},
1636 {0xF0, 0x2A},
1637 {0xF1, 0x2A},
1638 {0xF0, 0xAB},
1639 {0xF0, 0x2B},
1640 {0xF1, 0x2C},
1641 {0xF0, 0xAC},
1642 {0xF0, 0x2C},
1643 {0xF1, 0x2C},
1644 {0xF0, 0xAD},
1645 {0xF0, 0x2D},
1646 {0xF1, 0x2E},
1647 {0xF0, 0xAE},
1648 {0xF0, 0x2E},
1649 {0xF1, 0x2E},
1650 {0xF0, 0xAF},
1651 {0xF0, 0x2F},
1652 {0xF1, 0x30},
1653 {0xF0, 0xB0},
1654 {0xF0, 0x30},
1655 {0xF1, 0x30},
1656 {0xF0, 0xB1},
1657 {0xF0, 0x31},
1658 {0xF1, 0x32},
1659 {0xF0, 0xB2},
1660 {0xF0, 0x32},
1661 {0xF1, 0x32},
1662 {0xF0, 0xB3},
1663 {0xF0, 0x33},
1664 {0xF1, 0x34},
1665 {0xF0, 0xB4},
1666 {0xF0, 0x34},
1667 {0xF1, 0x34},
1668 {0xF0, 0xB5},
1669 {0xF0, 0x35},
1670 {0xF1, 0x36},
1671 {0xF0, 0xB6},
1672 {0xF0, 0x36},
1673 {0xF1, 0x36},
1674 {0xF0, 0xB7},
1675 {0xF0, 0x37},
1676 {0xF1, 0x38},
1677 {0xF0, 0xB8},
1678 {0xF0, 0x38},
1679 {0xF1, 0x38},
1680 {0xF0, 0xB9},
1681 {0xF0, 0x39},
1682 {0xF1, 0x3A},
1683 {0xF0, 0xBA},
1684 {0xF0, 0x3A},
1685 {0xF1, 0x3A},
1686 {0xF0, 0xBB},
1687 {0xF0, 0x3B},
1688 {0xF1, 0x3C},
1689 {0xF0, 0xBC},
1690 {0xF0, 0x3C},
1691 {0xF1, 0x3C},
1692 {0xF0, 0xBD},
1693 {0xF0, 0x3D},
1694 {0xF1, 0x3E},
1695 {0xF0, 0xBE},
1696 {0xF0, 0x3E},
1697 {0xF1, 0x3E},
1698 {0xF0, 0xBF},
1699 {0xF0, 0x00},
Forest Bond5449c682009-04-25 10:30:44 -04001700};
1701
Tapasweni Pathak78fc8482014-09-22 14:51:09 +05301702static const unsigned short awcFrameTime[MAX_RATE] = {
1703 10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216
1704};
Forest Bond5449c682009-04-25 10:30:44 -04001705
Forest Bond5449c682009-04-25 10:30:44 -04001706/*--------------------- Export Variables --------------------------*/
1707/*
1708 * Description: Calculate data frame transmitting time
1709 *
1710 * Parameters:
1711 * In:
1712 * byPreambleType - Preamble Type
1713 * byPktType - PK_TYPE_11A, PK_TYPE_11B, PK_TYPE_11GB, PK_TYPE_11GA
1714 * cbFrameLength - Baseband Type
1715 * wRate - Tx Rate
1716 * Out:
1717 *
1718 * Return Value: FrameTime
1719 *
1720 */
Charles Clémentb6e95cd2010-06-02 09:52:01 -07001721unsigned int
Joe Perches37529362013-03-18 10:44:38 -07001722BBuGetFrameTime(
1723 unsigned char byPreambleType,
1724 unsigned char byPktType,
1725 unsigned int cbFrameLength,
1726 unsigned short wRate
1727)
Forest Bond5449c682009-04-25 10:30:44 -04001728{
Joe Perches37529362013-03-18 10:44:38 -07001729 unsigned int uFrameTime;
1730 unsigned int uPreamble;
1731 unsigned int uTmp;
1732 unsigned int uRateIdx = (unsigned int) wRate;
1733 unsigned int uRate = 0;
Forest Bond5449c682009-04-25 10:30:44 -04001734
Malcolm Priestley217ed3a2015-07-22 19:16:33 +01001735 if (uRateIdx > RATE_54M)
Joe Perches37529362013-03-18 10:44:38 -07001736 return 0;
Forest Bond5449c682009-04-25 10:30:44 -04001737
Joe Perches37529362013-03-18 10:44:38 -07001738 uRate = (unsigned int)awcFrameTime[uRateIdx];
Forest Bond5449c682009-04-25 10:30:44 -04001739
James A Shackleford15974dc2014-06-01 23:06:57 -04001740 if (uRateIdx <= 3) { /* CCK mode */
1741 if (byPreambleType == 1) /* Short */
Joe Perches37529362013-03-18 10:44:38 -07001742 uPreamble = 96;
Guido Martínezbc5cf652014-04-19 16:45:00 -03001743 else
Joe Perches37529362013-03-18 10:44:38 -07001744 uPreamble = 192;
Guido Martínezbc5cf652014-04-19 16:45:00 -03001745
James A Shackleford15974dc2014-06-01 23:06:57 -04001746 uFrameTime = (cbFrameLength * 80) / uRate; /* ????? */
Joe Perches37529362013-03-18 10:44:38 -07001747 uTmp = (uFrameTime * uRate) / 80;
Guido Martínezbc5cf652014-04-19 16:45:00 -03001748 if (cbFrameLength != uTmp)
Joe Perches37529362013-03-18 10:44:38 -07001749 uFrameTime++;
Forest Bond5449c682009-04-25 10:30:44 -04001750
Joe Perchesa4ef27a2013-03-18 20:55:38 -07001751 return uPreamble + uFrameTime;
Joe Perches37529362013-03-18 10:44:38 -07001752 }
Dilek Uzulmez14cd1df2014-10-08 15:46:53 +03001753 uFrameTime = (cbFrameLength * 8 + 22) / uRate; /* ???????? */
1754 uTmp = ((uFrameTime * uRate) - 22) / 8;
1755 if (cbFrameLength != uTmp)
1756 uFrameTime++;
1757
1758 uFrameTime = uFrameTime * 4; /* ??????? */
1759 if (byPktType != PK_TYPE_11A)
1760 uFrameTime += 6; /* ?????? */
1761
1762 return 20 + uFrameTime; /* ?????? */
Forest Bond5449c682009-04-25 10:30:44 -04001763}
1764
1765/*
Justin P. Mattock7664ec82012-08-20 08:43:15 -07001766 * Description: Calculate Length, Service, and Signal fields of Phy for Tx
Forest Bond5449c682009-04-25 10:30:44 -04001767 *
1768 * Parameters:
1769 * In:
Malcolm Priestley10c17442014-08-20 22:30:28 +01001770 * priv - Device Structure
1771 * frame_length - Tx Frame Length
1772 * tx_rate - Tx Rate
Forest Bond5449c682009-04-25 10:30:44 -04001773 * Out:
Malcolm Priestley10c17442014-08-20 22:30:28 +01001774 * struct vnt_phy_field *phy
1775 * - pointer to Phy Length field
1776 * - pointer to Phy Service field
1777 * - pointer to Phy Signal field
Forest Bond5449c682009-04-25 10:30:44 -04001778 *
1779 * Return Value: none
1780 *
1781 */
Malcolm Priestley10c17442014-08-20 22:30:28 +01001782void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length,
1783 u16 tx_rate, u8 pkt_type, struct vnt_phy_field *phy)
1784{
1785 u32 bit_count;
1786 u32 count = 0;
1787 u32 tmp;
1788 int ext_bit;
1789 u8 preamble_type = priv->byPreambleType;
1790
1791 bit_count = frame_length * 8;
1792 ext_bit = false;
1793
1794 switch (tx_rate) {
1795 case RATE_1M:
1796 count = bit_count;
1797
1798 phy->signal = 0x00;
1799
1800 break;
1801 case RATE_2M:
1802 count = bit_count / 2;
1803
1804 if (preamble_type == 1)
1805 phy->signal = 0x09;
1806 else
1807 phy->signal = 0x01;
1808
1809 break;
1810 case RATE_5M:
1811 count = (bit_count * 10) / 55;
1812 tmp = (count * 55) / 10;
1813
1814 if (tmp != bit_count)
1815 count++;
1816
1817 if (preamble_type == 1)
1818 phy->signal = 0x0a;
1819 else
1820 phy->signal = 0x02;
1821
1822 break;
1823 case RATE_11M:
1824 count = bit_count / 11;
1825 tmp = count * 11;
1826
1827 if (tmp != bit_count) {
1828 count++;
1829
1830 if ((bit_count - tmp) <= 3)
1831 ext_bit = true;
1832 }
1833
1834 if (preamble_type == 1)
1835 phy->signal = 0x0b;
1836 else
1837 phy->signal = 0x03;
1838
1839 break;
1840 case RATE_6M:
1841 if (pkt_type == PK_TYPE_11A)
1842 phy->signal = 0x9b;
1843 else
1844 phy->signal = 0x8b;
1845
1846 break;
1847 case RATE_9M:
1848 if (pkt_type == PK_TYPE_11A)
1849 phy->signal = 0x9f;
1850 else
1851 phy->signal = 0x8f;
1852
1853 break;
1854 case RATE_12M:
1855 if (pkt_type == PK_TYPE_11A)
1856 phy->signal = 0x9a;
1857 else
1858 phy->signal = 0x8a;
1859
1860 break;
1861 case RATE_18M:
1862 if (pkt_type == PK_TYPE_11A)
1863 phy->signal = 0x9e;
1864 else
1865 phy->signal = 0x8e;
1866
1867 break;
1868 case RATE_24M:
1869 if (pkt_type == PK_TYPE_11A)
1870 phy->signal = 0x99;
1871 else
1872 phy->signal = 0x89;
1873
1874 break;
1875 case RATE_36M:
1876 if (pkt_type == PK_TYPE_11A)
1877 phy->signal = 0x9d;
1878 else
1879 phy->signal = 0x8d;
1880
1881 break;
1882 case RATE_48M:
1883 if (pkt_type == PK_TYPE_11A)
1884 phy->signal = 0x98;
1885 else
1886 phy->signal = 0x88;
1887
1888 break;
1889 case RATE_54M:
1890 if (pkt_type == PK_TYPE_11A)
1891 phy->signal = 0x9c;
1892 else
1893 phy->signal = 0x8c;
1894 break;
1895 default:
1896 if (pkt_type == PK_TYPE_11A)
1897 phy->signal = 0x9c;
1898 else
1899 phy->signal = 0x8c;
1900 break;
1901 }
1902
1903 if (pkt_type == PK_TYPE_11B) {
1904 phy->service = 0x00;
1905 if (ext_bit)
1906 phy->service |= 0x80;
1907 phy->len = cpu_to_le16((u16)count);
1908 } else {
1909 phy->service = 0x00;
1910 phy->len = cpu_to_le16((u16)frame_length);
1911 }
1912}
1913
Forest Bond5449c682009-04-25 10:30:44 -04001914/*
Justin P. Mattock789d1ae2012-08-20 08:43:13 -07001915 * Description: Read a byte from BASEBAND, by embedded programming
Forest Bond5449c682009-04-25 10:30:44 -04001916 *
1917 * Parameters:
1918 * In:
1919 * dwIoBase - I/O base address
1920 * byBBAddr - address of register in Baseband
1921 * Out:
1922 * pbyData - data read
1923 *
Charles Clément5a5a2a62010-08-01 17:15:49 +02001924 * Return Value: true if succeeded; false if failed.
Forest Bond5449c682009-04-25 10:30:44 -04001925 *
1926 */
Malcolm Priestley8e8a9f52014-11-06 20:02:04 +00001927bool BBbReadEmbedded(struct vnt_private *priv,
1928 unsigned char byBBAddr, unsigned char *pbyData)
Forest Bond5449c682009-04-25 10:30:44 -04001929{
Malcolm Priestley8e8a9f52014-11-06 20:02:04 +00001930 void __iomem *dwIoBase = priv->PortOffset;
Joe Perches37529362013-03-18 10:44:38 -07001931 unsigned short ww;
1932 unsigned char byValue;
Forest Bond5449c682009-04-25 10:30:44 -04001933
James A Shackleford15974dc2014-06-01 23:06:57 -04001934 /* BB reg offset */
Joe Perches37529362013-03-18 10:44:38 -07001935 VNSvOutPortB(dwIoBase + MAC_REG_BBREGADR, byBBAddr);
Forest Bond5449c682009-04-25 10:30:44 -04001936
James A Shackleford15974dc2014-06-01 23:06:57 -04001937 /* turn on REGR */
Joe Perches37529362013-03-18 10:44:38 -07001938 MACvRegBitsOn(dwIoBase, MAC_REG_BBREGCTL, BBREGCTL_REGR);
James A Shackleford15974dc2014-06-01 23:06:57 -04001939 /* W_MAX_TIMEOUT is the timeout period */
Joe Perches37529362013-03-18 10:44:38 -07001940 for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
1941 VNSvInPortB(dwIoBase + MAC_REG_BBREGCTL, &byValue);
1942 if (byValue & BBREGCTL_DONE)
1943 break;
1944 }
Forest Bond5449c682009-04-25 10:30:44 -04001945
James A Shackleford15974dc2014-06-01 23:06:57 -04001946 /* get BB data */
Joe Perches37529362013-03-18 10:44:38 -07001947 VNSvInPortB(dwIoBase + MAC_REG_BBREGDATA, pbyData);
Forest Bond5449c682009-04-25 10:30:44 -04001948
Joe Perches37529362013-03-18 10:44:38 -07001949 if (ww == W_MAX_TIMEOUT) {
Joe Perches48caf5a2014-08-17 09:17:04 -07001950 pr_debug(" DBG_PORT80(0x30)\n");
Joe Perches37529362013-03-18 10:44:38 -07001951 return false;
1952 }
1953 return true;
Forest Bond5449c682009-04-25 10:30:44 -04001954}
1955
Forest Bond5449c682009-04-25 10:30:44 -04001956/*
Justin P. Mattock789d1ae2012-08-20 08:43:13 -07001957 * Description: Write a Byte to BASEBAND, by embedded programming
Forest Bond5449c682009-04-25 10:30:44 -04001958 *
1959 * Parameters:
1960 * In:
1961 * dwIoBase - I/O base address
1962 * byBBAddr - address of register in Baseband
1963 * byData - data to write
1964 * Out:
1965 * none
1966 *
Charles Clément5a5a2a62010-08-01 17:15:49 +02001967 * Return Value: true if succeeded; false if failed.
Forest Bond5449c682009-04-25 10:30:44 -04001968 *
1969 */
Malcolm Priestley377f5bc2014-11-06 20:02:03 +00001970bool BBbWriteEmbedded(struct vnt_private *priv,
1971 unsigned char byBBAddr, unsigned char byData)
Forest Bond5449c682009-04-25 10:30:44 -04001972{
Malcolm Priestley377f5bc2014-11-06 20:02:03 +00001973 void __iomem *dwIoBase = priv->PortOffset;
Joe Perches37529362013-03-18 10:44:38 -07001974 unsigned short ww;
1975 unsigned char byValue;
Forest Bond5449c682009-04-25 10:30:44 -04001976
James A Shackleford15974dc2014-06-01 23:06:57 -04001977 /* BB reg offset */
Joe Perches37529362013-03-18 10:44:38 -07001978 VNSvOutPortB(dwIoBase + MAC_REG_BBREGADR, byBBAddr);
James A Shackleford15974dc2014-06-01 23:06:57 -04001979 /* set BB data */
Joe Perches37529362013-03-18 10:44:38 -07001980 VNSvOutPortB(dwIoBase + MAC_REG_BBREGDATA, byData);
Forest Bond5449c682009-04-25 10:30:44 -04001981
James A Shackleford15974dc2014-06-01 23:06:57 -04001982 /* turn on BBREGCTL_REGW */
Joe Perches37529362013-03-18 10:44:38 -07001983 MACvRegBitsOn(dwIoBase, MAC_REG_BBREGCTL, BBREGCTL_REGW);
James A Shackleford15974dc2014-06-01 23:06:57 -04001984 /* W_MAX_TIMEOUT is the timeout period */
Joe Perches37529362013-03-18 10:44:38 -07001985 for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
1986 VNSvInPortB(dwIoBase + MAC_REG_BBREGCTL, &byValue);
1987 if (byValue & BBREGCTL_DONE)
1988 break;
1989 }
Forest Bond5449c682009-04-25 10:30:44 -04001990
Joe Perches37529362013-03-18 10:44:38 -07001991 if (ww == W_MAX_TIMEOUT) {
Joe Perches48caf5a2014-08-17 09:17:04 -07001992 pr_debug(" DBG_PORT80(0x31)\n");
Joe Perches37529362013-03-18 10:44:38 -07001993 return false;
1994 }
1995 return true;
Forest Bond5449c682009-04-25 10:30:44 -04001996}
1997
Forest Bond5449c682009-04-25 10:30:44 -04001998/*
Forest Bond5449c682009-04-25 10:30:44 -04001999 * Description: VIA VT3253 Baseband chip init function
2000 *
2001 * Parameters:
2002 * In:
2003 * dwIoBase - I/O base address
2004 * byRevId - Revision ID
2005 * byRFType - RF type
2006 * Out:
2007 * none
2008 *
Charles Clément5a5a2a62010-08-01 17:15:49 +02002009 * Return Value: true if succeeded; false if failed.
Forest Bond5449c682009-04-25 10:30:44 -04002010 *
2011 */
2012
Malcolm Priestley85144082014-11-05 21:08:59 +00002013bool BBbVT3253Init(struct vnt_private *priv)
Forest Bond5449c682009-04-25 10:30:44 -04002014{
Joe Perches37529362013-03-18 10:44:38 -07002015 bool bResult = true;
2016 int ii;
Malcolm Priestley85144082014-11-05 21:08:59 +00002017 void __iomem *dwIoBase = priv->PortOffset;
2018 unsigned char byRFType = priv->byRFType;
2019 unsigned char byLocalID = priv->byLocalID;
Forest Bond5449c682009-04-25 10:30:44 -04002020
Joe Perches37529362013-03-18 10:44:38 -07002021 if (byRFType == RF_RFMD2959) {
2022 if (byLocalID <= REV_ID_VT3253_A1) {
Guido Martínezbc5cf652014-04-19 16:45:00 -03002023 for (ii = 0; ii < CB_VT3253_INIT_FOR_RFMD; ii++)
Himani Agrawal5b4ac542015-03-09 19:39:50 +05302024 bResult &= BBbWriteEmbedded(priv,
2025 byVT3253InitTab_RFMD[ii][0],
2026 byVT3253InitTab_RFMD[ii][1]);
Guido Martínezbc5cf652014-04-19 16:45:00 -03002027
Joe Perches37529362013-03-18 10:44:38 -07002028 } else {
Guido Martínezbc5cf652014-04-19 16:45:00 -03002029 for (ii = 0; ii < CB_VT3253B0_INIT_FOR_RFMD; ii++)
Himani Agrawal5b4ac542015-03-09 19:39:50 +05302030 bResult &= BBbWriteEmbedded(priv,
2031 byVT3253B0_RFMD[ii][0],
2032 byVT3253B0_RFMD[ii][1]);
Guido Martínezbc5cf652014-04-19 16:45:00 -03002033
2034 for (ii = 0; ii < CB_VT3253B0_AGC_FOR_RFMD2959; ii++)
Himani Agrawal5b4ac542015-03-09 19:39:50 +05302035 bResult &= BBbWriteEmbedded(priv,
2036 byVT3253B0_AGC4_RFMD2959[ii][0],
2037 byVT3253B0_AGC4_RFMD2959[ii][1]);
Guido Martínezbc5cf652014-04-19 16:45:00 -03002038
Joe Perches37529362013-03-18 10:44:38 -07002039 VNSvOutPortD(dwIoBase + MAC_REG_ITRTMSET, 0x23);
Malcolm Priestley837a38f2014-10-29 17:44:02 +00002040 MACvRegBitsOn(dwIoBase, MAC_REG_PAPEDELAY, BIT(0));
Joe Perches37529362013-03-18 10:44:38 -07002041 }
Malcolm Priestley85144082014-11-05 21:08:59 +00002042 priv->abyBBVGA[0] = 0x18;
2043 priv->abyBBVGA[1] = 0x0A;
2044 priv->abyBBVGA[2] = 0x0;
2045 priv->abyBBVGA[3] = 0x0;
2046 priv->ldBmThreshold[0] = -70;
2047 priv->ldBmThreshold[1] = -50;
2048 priv->ldBmThreshold[2] = 0;
2049 priv->ldBmThreshold[3] = 0;
Joe Perches37529362013-03-18 10:44:38 -07002050 } else if ((byRFType == RF_AIROHA) || (byRFType == RF_AL2230S)) {
Guido Martínezbc5cf652014-04-19 16:45:00 -03002051 for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++)
Himani Agrawal5b4ac542015-03-09 19:39:50 +05302052 bResult &= BBbWriteEmbedded(priv,
2053 byVT3253B0_AIROHA2230[ii][0],
2054 byVT3253B0_AIROHA2230[ii][1]);
Guido Martínezbc5cf652014-04-19 16:45:00 -03002055
2056 for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
Himani Agrawal5b4ac542015-03-09 19:39:50 +05302057 bResult &= BBbWriteEmbedded(priv,
2058 byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
Guido Martínezbc5cf652014-04-19 16:45:00 -03002059
Malcolm Priestley85144082014-11-05 21:08:59 +00002060 priv->abyBBVGA[0] = 0x1C;
2061 priv->abyBBVGA[1] = 0x10;
2062 priv->abyBBVGA[2] = 0x0;
2063 priv->abyBBVGA[3] = 0x0;
2064 priv->ldBmThreshold[0] = -70;
2065 priv->ldBmThreshold[1] = -48;
2066 priv->ldBmThreshold[2] = 0;
2067 priv->ldBmThreshold[3] = 0;
Joe Perches37529362013-03-18 10:44:38 -07002068 } else if (byRFType == RF_UW2451) {
Guido Martínezbc5cf652014-04-19 16:45:00 -03002069 for (ii = 0; ii < CB_VT3253B0_INIT_FOR_UW2451; ii++)
Himani Agrawal5b4ac542015-03-09 19:39:50 +05302070 bResult &= BBbWriteEmbedded(priv,
2071 byVT3253B0_UW2451[ii][0],
2072 byVT3253B0_UW2451[ii][1]);
Guido Martínezbc5cf652014-04-19 16:45:00 -03002073
2074 for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
Himani Agrawal5b4ac542015-03-09 19:39:50 +05302075 bResult &= BBbWriteEmbedded(priv,
2076 byVT3253B0_AGC[ii][0],
2077 byVT3253B0_AGC[ii][1]);
Guido Martínezbc5cf652014-04-19 16:45:00 -03002078
Joe Perches37529362013-03-18 10:44:38 -07002079 VNSvOutPortB(dwIoBase + MAC_REG_ITRTMSET, 0x23);
Malcolm Priestley837a38f2014-10-29 17:44:02 +00002080 MACvRegBitsOn(dwIoBase, MAC_REG_PAPEDELAY, BIT(0));
Forest Bond5449c682009-04-25 10:30:44 -04002081
Malcolm Priestley85144082014-11-05 21:08:59 +00002082 priv->abyBBVGA[0] = 0x14;
2083 priv->abyBBVGA[1] = 0x0A;
2084 priv->abyBBVGA[2] = 0x0;
2085 priv->abyBBVGA[3] = 0x0;
2086 priv->ldBmThreshold[0] = -60;
2087 priv->ldBmThreshold[1] = -50;
2088 priv->ldBmThreshold[2] = 0;
2089 priv->ldBmThreshold[3] = 0;
Joe Perches37529362013-03-18 10:44:38 -07002090 } else if (byRFType == RF_UW2452) {
Guido Martínezbc5cf652014-04-19 16:45:00 -03002091 for (ii = 0; ii < CB_VT3253B0_INIT_FOR_UW2451; ii++)
Himani Agrawal5b4ac542015-03-09 19:39:50 +05302092 bResult &= BBbWriteEmbedded(priv,
2093 byVT3253B0_UW2451[ii][0],
2094 byVT3253B0_UW2451[ii][1]);
Guido Martínezbc5cf652014-04-19 16:45:00 -03002095
Arjun Krishna Babu5f7a9422015-09-30 18:24:22 +05302096 /* Init ANT B select,
2097 * TX Config CR09 = 0x61->0x45,
2098 * 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted)
2099 */
2100
James A Shackleford15974dc2014-06-01 23:06:57 -04002101 /*bResult &= BBbWriteEmbedded(dwIoBase,0x09,0x41);*/
Arjun Krishna Babu5f7a9422015-09-30 18:24:22 +05302102
2103 /* Init ANT B select,
2104 * RX Config CR10 = 0x28->0x2A,
2105 * 0x2A->0x28(VC1/VC2 define,
2106 * make the ANT_A, ANT_B inverted)
2107 */
2108
James A Shackleford15974dc2014-06-01 23:06:57 -04002109 /*bResult &= BBbWriteEmbedded(dwIoBase,0x0a,0x28);*/
2110 /* Select VC1/VC2, CR215 = 0x02->0x06 */
Malcolm Priestley377f5bc2014-11-06 20:02:03 +00002111 bResult &= BBbWriteEmbedded(priv, 0xd7, 0x06);
Forest Bond5449c682009-04-25 10:30:44 -04002112
James A Shackleford15974dc2014-06-01 23:06:57 -04002113 /* {{RobertYu:20050125, request by Jack */
Malcolm Priestley377f5bc2014-11-06 20:02:03 +00002114 bResult &= BBbWriteEmbedded(priv, 0x90, 0x20);
2115 bResult &= BBbWriteEmbedded(priv, 0x97, 0xeb);
James A Shackleford15974dc2014-06-01 23:06:57 -04002116 /* }} */
Forest Bond5449c682009-04-25 10:30:44 -04002117
James A Shackleford15974dc2014-06-01 23:06:57 -04002118 /* {{RobertYu:20050221, request by Jack */
Malcolm Priestley377f5bc2014-11-06 20:02:03 +00002119 bResult &= BBbWriteEmbedded(priv, 0xa6, 0x00);
2120 bResult &= BBbWriteEmbedded(priv, 0xa8, 0x30);
James A Shackleford15974dc2014-06-01 23:06:57 -04002121 /* }} */
Malcolm Priestley377f5bc2014-11-06 20:02:03 +00002122 bResult &= BBbWriteEmbedded(priv, 0xb0, 0x58);
Forest Bond5449c682009-04-25 10:30:44 -04002123
Guido Martínezbc5cf652014-04-19 16:45:00 -03002124 for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
Himani Agrawal5b4ac542015-03-09 19:39:50 +05302125 bResult &= BBbWriteEmbedded(priv,
2126 byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
Forest Bond5449c682009-04-25 10:30:44 -04002127
Malcolm Priestley85144082014-11-05 21:08:59 +00002128 priv->abyBBVGA[0] = 0x14;
2129 priv->abyBBVGA[1] = 0x0A;
2130 priv->abyBBVGA[2] = 0x0;
2131 priv->abyBBVGA[3] = 0x0;
2132 priv->ldBmThreshold[0] = -60;
2133 priv->ldBmThreshold[1] = -50;
2134 priv->ldBmThreshold[2] = 0;
2135 priv->ldBmThreshold[3] = 0;
James A Shackleford15974dc2014-06-01 23:06:57 -04002136 /* }} RobertYu */
Forest Bond5449c682009-04-25 10:30:44 -04002137
Joe Perches37529362013-03-18 10:44:38 -07002138 } else if (byRFType == RF_VT3226) {
Guido Martínezbc5cf652014-04-19 16:45:00 -03002139 for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++)
Himani Agrawal5b4ac542015-03-09 19:39:50 +05302140 bResult &= BBbWriteEmbedded(priv,
2141 byVT3253B0_AIROHA2230[ii][0],
2142 byVT3253B0_AIROHA2230[ii][1]);
Guido Martínezbc5cf652014-04-19 16:45:00 -03002143
2144 for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
Himani Agrawal5b4ac542015-03-09 19:39:50 +05302145 bResult &= BBbWriteEmbedded(priv,
2146 byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
Guido Martínezbc5cf652014-04-19 16:45:00 -03002147
Malcolm Priestley85144082014-11-05 21:08:59 +00002148 priv->abyBBVGA[0] = 0x1C;
2149 priv->abyBBVGA[1] = 0x10;
2150 priv->abyBBVGA[2] = 0x0;
2151 priv->abyBBVGA[3] = 0x0;
2152 priv->ldBmThreshold[0] = -70;
2153 priv->ldBmThreshold[1] = -48;
2154 priv->ldBmThreshold[2] = 0;
2155 priv->ldBmThreshold[3] = 0;
James A Shackleford15974dc2014-06-01 23:06:57 -04002156 /* Fix VT3226 DFC system timing issue */
Joe Perches37529362013-03-18 10:44:38 -07002157 MACvSetRFLE_LatchBase(dwIoBase);
James A Shackleford15974dc2014-06-01 23:06:57 -04002158 /* {{ RobertYu: 20050104 */
Joe Perches37529362013-03-18 10:44:38 -07002159 } else if (byRFType == RF_AIROHA7230) {
Guido Martínezbc5cf652014-04-19 16:45:00 -03002160 for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++)
Himani Agrawal5b4ac542015-03-09 19:39:50 +05302161 bResult &= BBbWriteEmbedded(priv,
2162 byVT3253B0_AIROHA2230[ii][0],
2163 byVT3253B0_AIROHA2230[ii][1]);
Guido Martínezbc5cf652014-04-19 16:45:00 -03002164
Forest Bond5449c682009-04-25 10:30:44 -04002165
James A Shackleford15974dc2014-06-01 23:06:57 -04002166 /* {{ RobertYu:20050223, request by JerryChung */
Kathryn Hampton5150d012016-03-15 18:16:24 -07002167 /* Init ANT B select,TX Config CR09 = 0x61->0x45,
2168 * 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted)
2169 */
James A Shackleford15974dc2014-06-01 23:06:57 -04002170 /*bResult &= BBbWriteEmbedded(dwIoBase,0x09,0x41);*/
Kathryn Hampton5150d012016-03-15 18:16:24 -07002171 /* Init ANT B select,RX Config CR10 = 0x28->0x2A,
2172 * 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted)
2173 */
James A Shackleford15974dc2014-06-01 23:06:57 -04002174 /*bResult &= BBbWriteEmbedded(dwIoBase,0x0a,0x28);*/
2175 /* Select VC1/VC2, CR215 = 0x02->0x06 */
Eddie Kovskya307d1d2014-12-20 22:27:55 -07002176 bResult &= BBbWriteEmbedded(priv, 0xd7, 0x06);
James A Shackleford15974dc2014-06-01 23:06:57 -04002177 /* }} */
Forest Bond5449c682009-04-25 10:30:44 -04002178
Guido Martínezbc5cf652014-04-19 16:45:00 -03002179 for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
Himani Agrawal5b4ac542015-03-09 19:39:50 +05302180 bResult &= BBbWriteEmbedded(priv,
2181 byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
Guido Martínezbc5cf652014-04-19 16:45:00 -03002182
Malcolm Priestley85144082014-11-05 21:08:59 +00002183 priv->abyBBVGA[0] = 0x1C;
2184 priv->abyBBVGA[1] = 0x10;
2185 priv->abyBBVGA[2] = 0x0;
2186 priv->abyBBVGA[3] = 0x0;
2187 priv->ldBmThreshold[0] = -70;
2188 priv->ldBmThreshold[1] = -48;
2189 priv->ldBmThreshold[2] = 0;
2190 priv->ldBmThreshold[3] = 0;
James A Shackleford15974dc2014-06-01 23:06:57 -04002191 /* }} RobertYu */
Joe Perches37529362013-03-18 10:44:38 -07002192 } else {
James A Shackleford15974dc2014-06-01 23:06:57 -04002193 /* No VGA Table now */
Malcolm Priestley85144082014-11-05 21:08:59 +00002194 priv->bUpdateBBVGA = false;
2195 priv->abyBBVGA[0] = 0x1C;
Joe Perches37529362013-03-18 10:44:38 -07002196 }
Forest Bond5449c682009-04-25 10:30:44 -04002197
Joe Perches37529362013-03-18 10:44:38 -07002198 if (byLocalID > REV_ID_VT3253_A1) {
Malcolm Priestley377f5bc2014-11-06 20:02:03 +00002199 BBbWriteEmbedded(priv, 0x04, 0x7F);
2200 BBbWriteEmbedded(priv, 0x0D, 0x01);
Joe Perches37529362013-03-18 10:44:38 -07002201 }
Forest Bond5449c682009-04-25 10:30:44 -04002202
Joe Perches37529362013-03-18 10:44:38 -07002203 return bResult;
Forest Bond5449c682009-04-25 10:30:44 -04002204}
2205
Forest Bond5449c682009-04-25 10:30:44 -04002206/*
Forest Bond5449c682009-04-25 10:30:44 -04002207 * Description: Set ShortSlotTime mode
2208 *
2209 * Parameters:
2210 * In:
Malcolm Priestley85144082014-11-05 21:08:59 +00002211 * priv - Device Structure
Forest Bond5449c682009-04-25 10:30:44 -04002212 * Out:
2213 * none
2214 *
2215 * Return Value: none
2216 *
2217 */
Charles Clément6b35b7b2010-05-07 12:30:19 -07002218void
Malcolm Priestley85144082014-11-05 21:08:59 +00002219BBvSetShortSlotTime(struct vnt_private *priv)
Forest Bond5449c682009-04-25 10:30:44 -04002220{
Joe Perches37529362013-03-18 10:44:38 -07002221 unsigned char byBBRxConf = 0;
2222 unsigned char byBBVGA = 0;
Forest Bond5449c682009-04-25 10:30:44 -04002223
Malcolm Priestley8e8a9f52014-11-06 20:02:04 +00002224 BBbReadEmbedded(priv, 0x0A, &byBBRxConf); /* CR10 */
Forest Bond5449c682009-04-25 10:30:44 -04002225
Malcolm Priestley85144082014-11-05 21:08:59 +00002226 if (priv->bShortSlotTime)
James A Shackleford15974dc2014-06-01 23:06:57 -04002227 byBBRxConf &= 0xDF; /* 1101 1111 */
Guido Martínezbc5cf652014-04-19 16:45:00 -03002228 else
James A Shackleford15974dc2014-06-01 23:06:57 -04002229 byBBRxConf |= 0x20; /* 0010 0000 */
Forest Bond5449c682009-04-25 10:30:44 -04002230
James A Shackleford15974dc2014-06-01 23:06:57 -04002231 /* patch for 3253B0 Baseband with Cardbus module */
Malcolm Priestley8e8a9f52014-11-06 20:02:04 +00002232 BBbReadEmbedded(priv, 0xE7, &byBBVGA);
Malcolm Priestley85144082014-11-05 21:08:59 +00002233 if (byBBVGA == priv->abyBBVGA[0])
James A Shackleford15974dc2014-06-01 23:06:57 -04002234 byBBRxConf |= 0x20; /* 0010 0000 */
Forest Bond5449c682009-04-25 10:30:44 -04002235
Malcolm Priestley377f5bc2014-11-06 20:02:03 +00002236 BBbWriteEmbedded(priv, 0x0A, byBBRxConf); /* CR10 */
Forest Bond5449c682009-04-25 10:30:44 -04002237}
2238
Malcolm Priestley85144082014-11-05 21:08:59 +00002239void BBvSetVGAGainOffset(struct vnt_private *priv, unsigned char byData)
Forest Bond5449c682009-04-25 10:30:44 -04002240{
Joe Perches37529362013-03-18 10:44:38 -07002241 unsigned char byBBRxConf = 0;
Forest Bond5449c682009-04-25 10:30:44 -04002242
Malcolm Priestley377f5bc2014-11-06 20:02:03 +00002243 BBbWriteEmbedded(priv, 0xE7, byData);
Forest Bond5449c682009-04-25 10:30:44 -04002244
Malcolm Priestley8e8a9f52014-11-06 20:02:04 +00002245 BBbReadEmbedded(priv, 0x0A, &byBBRxConf); /* CR10 */
James A Shackleford15974dc2014-06-01 23:06:57 -04002246 /* patch for 3253B0 Baseband with Cardbus module */
Malcolm Priestley85144082014-11-05 21:08:59 +00002247 if (byData == priv->abyBBVGA[0])
James A Shackleford15974dc2014-06-01 23:06:57 -04002248 byBBRxConf |= 0x20; /* 0010 0000 */
Malcolm Priestley85144082014-11-05 21:08:59 +00002249 else if (priv->bShortSlotTime)
James A Shackleford15974dc2014-06-01 23:06:57 -04002250 byBBRxConf &= 0xDF; /* 1101 1111 */
Archana kumari5c36d5a2013-10-24 23:59:47 +05302251 else
James A Shackleford15974dc2014-06-01 23:06:57 -04002252 byBBRxConf |= 0x20; /* 0010 0000 */
Malcolm Priestley85144082014-11-05 21:08:59 +00002253 priv->byBBVGACurrent = byData;
Malcolm Priestley377f5bc2014-11-06 20:02:03 +00002254 BBbWriteEmbedded(priv, 0x0A, byBBRxConf); /* CR10 */
Forest Bond5449c682009-04-25 10:30:44 -04002255}
2256
Forest Bond5449c682009-04-25 10:30:44 -04002257/*
2258 * Description: Baseband SoftwareReset
2259 *
2260 * Parameters:
2261 * In:
2262 * dwIoBase - I/O base address
2263 * Out:
2264 * none
2265 *
2266 * Return Value: none
2267 *
2268 */
Charles Clément6b35b7b2010-05-07 12:30:19 -07002269void
Malcolm Priestleya5f0eef2014-11-06 20:02:01 +00002270BBvSoftwareReset(struct vnt_private *priv)
Forest Bond5449c682009-04-25 10:30:44 -04002271{
Malcolm Priestley377f5bc2014-11-06 20:02:03 +00002272 BBbWriteEmbedded(priv, 0x50, 0x40);
2273 BBbWriteEmbedded(priv, 0x50, 0);
2274 BBbWriteEmbedded(priv, 0x9C, 0x01);
2275 BBbWriteEmbedded(priv, 0x9C, 0);
Forest Bond5449c682009-04-25 10:30:44 -04002276}
2277
2278/*
2279 * Description: Baseband Power Save Mode ON
2280 *
2281 * Parameters:
2282 * In:
2283 * dwIoBase - I/O base address
2284 * Out:
2285 * none
2286 *
2287 * Return Value: none
2288 *
2289 */
Charles Clément6b35b7b2010-05-07 12:30:19 -07002290void
Malcolm Priestley78b3c1f2014-11-06 20:02:02 +00002291BBvPowerSaveModeON(struct vnt_private *priv)
Forest Bond5449c682009-04-25 10:30:44 -04002292{
Joe Perches37529362013-03-18 10:44:38 -07002293 unsigned char byOrgData;
Forest Bond5449c682009-04-25 10:30:44 -04002294
Malcolm Priestley8e8a9f52014-11-06 20:02:04 +00002295 BBbReadEmbedded(priv, 0x0D, &byOrgData);
Malcolm Priestley837a38f2014-10-29 17:44:02 +00002296 byOrgData |= BIT(0);
Malcolm Priestley377f5bc2014-11-06 20:02:03 +00002297 BBbWriteEmbedded(priv, 0x0D, byOrgData);
Forest Bond5449c682009-04-25 10:30:44 -04002298}
2299
2300/*
2301 * Description: Baseband Power Save Mode OFF
2302 *
2303 * Parameters:
2304 * In:
2305 * dwIoBase - I/O base address
2306 * Out:
2307 * none
2308 *
2309 * Return Value: none
2310 *
2311 */
Charles Clément6b35b7b2010-05-07 12:30:19 -07002312void
Malcolm Priestley78b3c1f2014-11-06 20:02:02 +00002313BBvPowerSaveModeOFF(struct vnt_private *priv)
Forest Bond5449c682009-04-25 10:30:44 -04002314{
Joe Perches37529362013-03-18 10:44:38 -07002315 unsigned char byOrgData;
Forest Bond5449c682009-04-25 10:30:44 -04002316
Malcolm Priestley8e8a9f52014-11-06 20:02:04 +00002317 BBbReadEmbedded(priv, 0x0D, &byOrgData);
Malcolm Priestley837a38f2014-10-29 17:44:02 +00002318 byOrgData &= ~(BIT(0));
Malcolm Priestley377f5bc2014-11-06 20:02:03 +00002319 BBbWriteEmbedded(priv, 0x0D, byOrgData);
Forest Bond5449c682009-04-25 10:30:44 -04002320}
2321
2322/*
2323 * Description: Set Tx Antenna mode
2324 *
2325 * Parameters:
2326 * In:
Malcolm Priestley85144082014-11-05 21:08:59 +00002327 * priv - Device Structure
Forest Bond5449c682009-04-25 10:30:44 -04002328 * byAntennaMode - Antenna Mode
2329 * Out:
2330 * none
2331 *
2332 * Return Value: none
2333 *
2334 */
2335
Charles Clément6b35b7b2010-05-07 12:30:19 -07002336void
Malcolm Priestleya5f0eef2014-11-06 20:02:01 +00002337BBvSetTxAntennaMode(struct vnt_private *priv, unsigned char byAntennaMode)
Forest Bond5449c682009-04-25 10:30:44 -04002338{
Joe Perches37529362013-03-18 10:44:38 -07002339 unsigned char byBBTxConf;
Forest Bond5449c682009-04-25 10:30:44 -04002340
Malcolm Priestley8e8a9f52014-11-06 20:02:04 +00002341 BBbReadEmbedded(priv, 0x09, &byBBTxConf); /* CR09 */
Joe Perches37529362013-03-18 10:44:38 -07002342 if (byAntennaMode == ANT_DIVERSITY) {
James A Shackleford15974dc2014-06-01 23:06:57 -04002343 /* bit 1 is diversity */
Joe Perches37529362013-03-18 10:44:38 -07002344 byBBTxConf |= 0x02;
2345 } else if (byAntennaMode == ANT_A) {
James A Shackleford15974dc2014-06-01 23:06:57 -04002346 /* bit 2 is ANTSEL */
2347 byBBTxConf &= 0xF9; /* 1111 1001 */
Joe Perches37529362013-03-18 10:44:38 -07002348 } else if (byAntennaMode == ANT_B) {
James A Shackleford15974dc2014-06-01 23:06:57 -04002349 byBBTxConf &= 0xFD; /* 1111 1101 */
Joe Perches37529362013-03-18 10:44:38 -07002350 byBBTxConf |= 0x04;
2351 }
Malcolm Priestley377f5bc2014-11-06 20:02:03 +00002352 BBbWriteEmbedded(priv, 0x09, byBBTxConf); /* CR09 */
Forest Bond5449c682009-04-25 10:30:44 -04002353}
2354
Forest Bond5449c682009-04-25 10:30:44 -04002355/*
2356 * Description: Set Rx Antenna mode
2357 *
2358 * Parameters:
2359 * In:
Malcolm Priestley85144082014-11-05 21:08:59 +00002360 * priv - Device Structure
Forest Bond5449c682009-04-25 10:30:44 -04002361 * byAntennaMode - Antenna Mode
2362 * Out:
2363 * none
2364 *
2365 * Return Value: none
2366 *
2367 */
2368
Charles Clément6b35b7b2010-05-07 12:30:19 -07002369void
Malcolm Priestleya5f0eef2014-11-06 20:02:01 +00002370BBvSetRxAntennaMode(struct vnt_private *priv, unsigned char byAntennaMode)
Forest Bond5449c682009-04-25 10:30:44 -04002371{
Joe Perches37529362013-03-18 10:44:38 -07002372 unsigned char byBBRxConf;
Forest Bond5449c682009-04-25 10:30:44 -04002373
Malcolm Priestley8e8a9f52014-11-06 20:02:04 +00002374 BBbReadEmbedded(priv, 0x0A, &byBBRxConf); /* CR10 */
Joe Perches37529362013-03-18 10:44:38 -07002375 if (byAntennaMode == ANT_DIVERSITY) {
2376 byBBRxConf |= 0x01;
Forest Bond5449c682009-04-25 10:30:44 -04002377
Joe Perches37529362013-03-18 10:44:38 -07002378 } else if (byAntennaMode == ANT_A) {
James A Shackleford15974dc2014-06-01 23:06:57 -04002379 byBBRxConf &= 0xFC; /* 1111 1100 */
Joe Perches37529362013-03-18 10:44:38 -07002380 } else if (byAntennaMode == ANT_B) {
James A Shackleford15974dc2014-06-01 23:06:57 -04002381 byBBRxConf &= 0xFE; /* 1111 1110 */
Joe Perches37529362013-03-18 10:44:38 -07002382 byBBRxConf |= 0x02;
2383 }
Malcolm Priestley377f5bc2014-11-06 20:02:03 +00002384 BBbWriteEmbedded(priv, 0x0A, byBBRxConf); /* CR10 */
Forest Bond5449c682009-04-25 10:30:44 -04002385}
2386
Forest Bond5449c682009-04-25 10:30:44 -04002387/*
2388 * Description: BBvSetDeepSleep
2389 *
2390 * Parameters:
2391 * In:
Malcolm Priestley85144082014-11-05 21:08:59 +00002392 * priv - Device Structure
Forest Bond5449c682009-04-25 10:30:44 -04002393 * Out:
2394 * none
2395 *
2396 * Return Value: none
2397 *
2398 */
Charles Clément6b35b7b2010-05-07 12:30:19 -07002399void
Malcolm Priestleya5f0eef2014-11-06 20:02:01 +00002400BBvSetDeepSleep(struct vnt_private *priv, unsigned char byLocalID)
Forest Bond5449c682009-04-25 10:30:44 -04002401{
Malcolm Priestley377f5bc2014-11-06 20:02:03 +00002402 BBbWriteEmbedded(priv, 0x0C, 0x17); /* CR12 */
2403 BBbWriteEmbedded(priv, 0x0D, 0xB9); /* CR13 */
Forest Bond5449c682009-04-25 10:30:44 -04002404}
2405
Charles Clément6b35b7b2010-05-07 12:30:19 -07002406void
Malcolm Priestleya5f0eef2014-11-06 20:02:01 +00002407BBvExitDeepSleep(struct vnt_private *priv, unsigned char byLocalID)
Forest Bond5449c682009-04-25 10:30:44 -04002408{
Malcolm Priestley377f5bc2014-11-06 20:02:03 +00002409 BBbWriteEmbedded(priv, 0x0C, 0x00); /* CR12 */
2410 BBbWriteEmbedded(priv, 0x0D, 0x01); /* CR13 */
Forest Bond5449c682009-04-25 10:30:44 -04002411}