1/*
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 *
19 *
20 * 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
30 *      BBvCaculateParameter   - Caculate PhyLength, PhyService and Phy Signal
31 *                               parameter for baseband Tx
32 *      BBbReadEmbedded         - Embedded read baseband register via MAC
33 *      BBbWriteEmbedded        - Embedded write baseband register via MAC
34 *      BBbVT3253Init          - VIA VT3253 baseband chip init code
35 *
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.
39 *      08-26-2003 Kyle Hsu    :  Modify BBuGetFrameTime() and BBvCalculateParameter().
40 *                                cancel the setting of MAC_REG_SOFTPWRCTL on BBbVT3253Init().
41 *                                Add the comments.
42 *      09-01-2003 Bryan YC Fan:  RF & BB tables updated.
43 *                                Modified BBvLoopbackOn & BBvLoopbackOff().
44 *
45 *
46 */
47
48#include "tmacro.h"
49#include "mac.h"
50#include "baseband.h"
51#include "srom.h"
52#include "rf.h"
53
54/*---------------------  Static Classes  ----------------------------*/
55
56/*---------------------  Static Variables  --------------------------*/
57
58/*---------------------  Static Functions  --------------------------*/
59
60/*---------------------  Export Variables  --------------------------*/
61
62/*---------------------  Static Definitions -------------------------*/
63
64/*---------------------  Static Classes  ----------------------------*/
65
66/*---------------------  Static Variables  --------------------------*/
67
68#define CB_VT3253_INIT_FOR_RFMD 446
69static unsigned char byVT3253InitTab_RFMD[CB_VT3253_INIT_FOR_RFMD][2] = {
70	{0x00, 0x30},
71	{0x01, 0x00},
72	{0x02, 0x00},
73	{0x03, 0x00},
74	{0x04, 0x00},
75	{0x05, 0x00},
76	{0x06, 0x00},
77	{0x07, 0x00},
78	{0x08, 0x70},
79	{0x09, 0x45},
80	{0x0a, 0x2a},
81	{0x0b, 0x76},
82	{0x0c, 0x00},
83	{0x0d, 0x01},
84	{0x0e, 0x80},
85	{0x0f, 0x00},
86	{0x10, 0x00},
87	{0x11, 0x00},
88	{0x12, 0x00},
89	{0x13, 0x00},
90	{0x14, 0x00},
91	{0x15, 0x00},
92	{0x16, 0x00},
93	{0x17, 0x00},
94	{0x18, 0x00},
95	{0x19, 0x00},
96	{0x1a, 0x00},
97	{0x1b, 0x9d},
98	{0x1c, 0x05},
99	{0x1d, 0x00},
100	{0x1e, 0x00},
101	{0x1f, 0x00},
102	{0x20, 0x00},
103	{0x21, 0x00},
104	{0x22, 0x00},
105	{0x23, 0x00},
106	{0x24, 0x00},
107	{0x25, 0x4a},
108	{0x26, 0x00},
109	{0x27, 0x00},
110	{0x28, 0x00},
111	{0x29, 0x00},
112	{0x2a, 0x00},
113	{0x2b, 0x00},
114	{0x2c, 0x00},
115	{0x2d, 0xa8},
116	{0x2e, 0x1a},
117	{0x2f, 0x0c},
118	{0x30, 0x26},
119	{0x31, 0x5b},
120	{0x32, 0x00},
121	{0x33, 0x00},
122	{0x34, 0x00},
123	{0x35, 0x00},
124	{0x36, 0xaa},
125	{0x37, 0xaa},
126	{0x38, 0xff},
127	{0x39, 0xff},
128	{0x3a, 0x00},
129	{0x3b, 0x00},
130	{0x3c, 0x00},
131	{0x3d, 0x0d},
132	{0x3e, 0x51},
133	{0x3f, 0x04},
134	{0x40, 0x00},
135	{0x41, 0x08},
136	{0x42, 0x00},
137	{0x43, 0x08},
138	{0x44, 0x06},
139	{0x45, 0x14},
140	{0x46, 0x05},
141	{0x47, 0x08},
142	{0x48, 0x00},
143	{0x49, 0x00},
144	{0x4a, 0x00},
145	{0x4b, 0x00},
146	{0x4c, 0x09},
147	{0x4d, 0x80},
148	{0x4e, 0x00},
149	{0x4f, 0xc5},
150	{0x50, 0x14},
151	{0x51, 0x19},
152	{0x52, 0x00},
153	{0x53, 0x00},
154	{0x54, 0x00},
155	{0x55, 0x00},
156	{0x56, 0x00},
157	{0x57, 0x00},
158	{0x58, 0x00},
159	{0x59, 0xb0},
160	{0x5a, 0x00},
161	{0x5b, 0x00},
162	{0x5c, 0x00},
163	{0x5d, 0x00},
164	{0x5e, 0x00},
165	{0x5f, 0x00},
166	{0x60, 0x44},
167	{0x61, 0x04},
168	{0x62, 0x00},
169	{0x63, 0x00},
170	{0x64, 0x00},
171	{0x65, 0x00},
172	{0x66, 0x04},
173	{0x67, 0xb7},
174	{0x68, 0x00},
175	{0x69, 0x00},
176	{0x6a, 0x00},
177	{0x6b, 0x00},
178	{0x6c, 0x00},
179	{0x6d, 0x03},
180	{0x6e, 0x01},
181	{0x6f, 0x00},
182	{0x70, 0x00},
183	{0x71, 0x00},
184	{0x72, 0x00},
185	{0x73, 0x00},
186	{0x74, 0x00},
187	{0x75, 0x00},
188	{0x76, 0x00},
189	{0x77, 0x00},
190	{0x78, 0x00},
191	{0x79, 0x00},
192	{0x7a, 0x00},
193	{0x7b, 0x00},
194	{0x7c, 0x00},
195	{0x7d, 0x00},
196	{0x7e, 0x00},
197	{0x7f, 0x00},
198	{0x80, 0x0b},
199	{0x81, 0x00},
200	{0x82, 0x3c},
201	{0x83, 0x00},
202	{0x84, 0x00},
203	{0x85, 0x00},
204	{0x86, 0x00},
205	{0x87, 0x00},
206	{0x88, 0x08},
207	{0x89, 0x00},
208	{0x8a, 0x08},
209	{0x8b, 0xa6},
210	{0x8c, 0x84},
211	{0x8d, 0x47},
212	{0x8e, 0xbb},
213	{0x8f, 0x02},
214	{0x90, 0x21},
215	{0x91, 0x0c},
216	{0x92, 0x04},
217	{0x93, 0x22},
218	{0x94, 0x00},
219	{0x95, 0x00},
220	{0x96, 0x00},
221	{0x97, 0xeb},
222	{0x98, 0x00},
223	{0x99, 0x00},
224	{0x9a, 0x00},
225	{0x9b, 0x00},
226	{0x9c, 0x00},
227	{0x9d, 0x00},
228	{0x9e, 0x00},
229	{0x9f, 0x00},
230	{0xa0, 0x00},
231	{0xa1, 0x00},
232	{0xa2, 0x00},
233	{0xa3, 0x00},
234	{0xa4, 0x00},
235	{0xa5, 0x00},
236	{0xa6, 0x10},
237	{0xa7, 0x04},
238	{0xa8, 0x10},
239	{0xa9, 0x00},
240	{0xaa, 0x8f},
241	{0xab, 0x00},
242	{0xac, 0x00},
243	{0xad, 0x00},
244	{0xae, 0x00},
245	{0xaf, 0x80},
246	{0xb0, 0x38},
247	{0xb1, 0x00},
248	{0xb2, 0x00},
249	{0xb3, 0x00},
250	{0xb4, 0xee},
251	{0xb5, 0xff},
252	{0xb6, 0x10},
253	{0xb7, 0x00},
254	{0xb8, 0x00},
255	{0xb9, 0x00},
256	{0xba, 0x00},
257	{0xbb, 0x03},
258	{0xbc, 0x00},
259	{0xbd, 0x00},
260	{0xbe, 0x00},
261	{0xbf, 0x00},
262	{0xc0, 0x10},
263	{0xc1, 0x10},
264	{0xc2, 0x18},
265	{0xc3, 0x20},
266	{0xc4, 0x10},
267	{0xc5, 0x00},
268	{0xc6, 0x22},
269	{0xc7, 0x14},
270	{0xc8, 0x0f},
271	{0xc9, 0x08},
272	{0xca, 0xa4},
273	{0xcb, 0xa7},
274	{0xcc, 0x3c},
275	{0xcd, 0x10},
276	{0xce, 0x20},
277	{0xcf, 0x00},
278	{0xd0, 0x00},
279	{0xd1, 0x10},
280	{0xd2, 0x00},
281	{0xd3, 0x00},
282	{0xd4, 0x10},
283	{0xd5, 0x33},
284	{0xd6, 0x70},
285	{0xd7, 0x01},
286	{0xd8, 0x00},
287	{0xd9, 0x00},
288	{0xda, 0x00},
289	{0xdb, 0x00},
290	{0xdc, 0x00},
291	{0xdd, 0x00},
292	{0xde, 0x00},
293	{0xdf, 0x00},
294	{0xe0, 0x00},
295	{0xe1, 0x00},
296	{0xe2, 0xcc},
297	{0xe3, 0x04},
298	{0xe4, 0x08},
299	{0xe5, 0x10},
300	{0xe6, 0x00},
301	{0xe7, 0x0e},
302	{0xe8, 0x88},
303	{0xe9, 0xd4},
304	{0xea, 0x05},
305	{0xeb, 0xf0},
306	{0xec, 0x79},
307	{0xed, 0x0f},
308	{0xee, 0x04},
309	{0xef, 0x04},
310	{0xf0, 0x00},
311	{0xf1, 0x00},
312	{0xf2, 0x00},
313	{0xf3, 0x00},
314	{0xf4, 0x00},
315	{0xf5, 0x00},
316	{0xf6, 0x00},
317	{0xf7, 0x00},
318	{0xf8, 0x00},
319	{0xf9, 0x00},
320	{0xF0, 0x00},
321	{0xF1, 0xF8},
322	{0xF0, 0x80},
323	{0xF0, 0x00},
324	{0xF1, 0xF4},
325	{0xF0, 0x81},
326	{0xF0, 0x01},
327	{0xF1, 0xF0},
328	{0xF0, 0x82},
329	{0xF0, 0x02},
330	{0xF1, 0xEC},
331	{0xF0, 0x83},
332	{0xF0, 0x03},
333	{0xF1, 0xE8},
334	{0xF0, 0x84},
335	{0xF0, 0x04},
336	{0xF1, 0xE4},
337	{0xF0, 0x85},
338	{0xF0, 0x05},
339	{0xF1, 0xE0},
340	{0xF0, 0x86},
341	{0xF0, 0x06},
342	{0xF1, 0xDC},
343	{0xF0, 0x87},
344	{0xF0, 0x07},
345	{0xF1, 0xD8},
346	{0xF0, 0x88},
347	{0xF0, 0x08},
348	{0xF1, 0xD4},
349	{0xF0, 0x89},
350	{0xF0, 0x09},
351	{0xF1, 0xD0},
352	{0xF0, 0x8A},
353	{0xF0, 0x0A},
354	{0xF1, 0xCC},
355	{0xF0, 0x8B},
356	{0xF0, 0x0B},
357	{0xF1, 0xC8},
358	{0xF0, 0x8C},
359	{0xF0, 0x0C},
360	{0xF1, 0xC4},
361	{0xF0, 0x8D},
362	{0xF0, 0x0D},
363	{0xF1, 0xC0},
364	{0xF0, 0x8E},
365	{0xF0, 0x0E},
366	{0xF1, 0xBC},
367	{0xF0, 0x8F},
368	{0xF0, 0x0F},
369	{0xF1, 0xB8},
370	{0xF0, 0x90},
371	{0xF0, 0x10},
372	{0xF1, 0xB4},
373	{0xF0, 0x91},
374	{0xF0, 0x11},
375	{0xF1, 0xB0},
376	{0xF0, 0x92},
377	{0xF0, 0x12},
378	{0xF1, 0xAC},
379	{0xF0, 0x93},
380	{0xF0, 0x13},
381	{0xF1, 0xA8},
382	{0xF0, 0x94},
383	{0xF0, 0x14},
384	{0xF1, 0xA4},
385	{0xF0, 0x95},
386	{0xF0, 0x15},
387	{0xF1, 0xA0},
388	{0xF0, 0x96},
389	{0xF0, 0x16},
390	{0xF1, 0x9C},
391	{0xF0, 0x97},
392	{0xF0, 0x17},
393	{0xF1, 0x98},
394	{0xF0, 0x98},
395	{0xF0, 0x18},
396	{0xF1, 0x94},
397	{0xF0, 0x99},
398	{0xF0, 0x19},
399	{0xF1, 0x90},
400	{0xF0, 0x9A},
401	{0xF0, 0x1A},
402	{0xF1, 0x8C},
403	{0xF0, 0x9B},
404	{0xF0, 0x1B},
405	{0xF1, 0x88},
406	{0xF0, 0x9C},
407	{0xF0, 0x1C},
408	{0xF1, 0x84},
409	{0xF0, 0x9D},
410	{0xF0, 0x1D},
411	{0xF1, 0x80},
412	{0xF0, 0x9E},
413	{0xF0, 0x1E},
414	{0xF1, 0x7C},
415	{0xF0, 0x9F},
416	{0xF0, 0x1F},
417	{0xF1, 0x78},
418	{0xF0, 0xA0},
419	{0xF0, 0x20},
420	{0xF1, 0x74},
421	{0xF0, 0xA1},
422	{0xF0, 0x21},
423	{0xF1, 0x70},
424	{0xF0, 0xA2},
425	{0xF0, 0x22},
426	{0xF1, 0x6C},
427	{0xF0, 0xA3},
428	{0xF0, 0x23},
429	{0xF1, 0x68},
430	{0xF0, 0xA4},
431	{0xF0, 0x24},
432	{0xF1, 0x64},
433	{0xF0, 0xA5},
434	{0xF0, 0x25},
435	{0xF1, 0x60},
436	{0xF0, 0xA6},
437	{0xF0, 0x26},
438	{0xF1, 0x5C},
439	{0xF0, 0xA7},
440	{0xF0, 0x27},
441	{0xF1, 0x58},
442	{0xF0, 0xA8},
443	{0xF0, 0x28},
444	{0xF1, 0x54},
445	{0xF0, 0xA9},
446	{0xF0, 0x29},
447	{0xF1, 0x50},
448	{0xF0, 0xAA},
449	{0xF0, 0x2A},
450	{0xF1, 0x4C},
451	{0xF0, 0xAB},
452	{0xF0, 0x2B},
453	{0xF1, 0x48},
454	{0xF0, 0xAC},
455	{0xF0, 0x2C},
456	{0xF1, 0x44},
457	{0xF0, 0xAD},
458	{0xF0, 0x2D},
459	{0xF1, 0x40},
460	{0xF0, 0xAE},
461	{0xF0, 0x2E},
462	{0xF1, 0x3C},
463	{0xF0, 0xAF},
464	{0xF0, 0x2F},
465	{0xF1, 0x38},
466	{0xF0, 0xB0},
467	{0xF0, 0x30},
468	{0xF1, 0x34},
469	{0xF0, 0xB1},
470	{0xF0, 0x31},
471	{0xF1, 0x30},
472	{0xF0, 0xB2},
473	{0xF0, 0x32},
474	{0xF1, 0x2C},
475	{0xF0, 0xB3},
476	{0xF0, 0x33},
477	{0xF1, 0x28},
478	{0xF0, 0xB4},
479	{0xF0, 0x34},
480	{0xF1, 0x24},
481	{0xF0, 0xB5},
482	{0xF0, 0x35},
483	{0xF1, 0x20},
484	{0xF0, 0xB6},
485	{0xF0, 0x36},
486	{0xF1, 0x1C},
487	{0xF0, 0xB7},
488	{0xF0, 0x37},
489	{0xF1, 0x18},
490	{0xF0, 0xB8},
491	{0xF0, 0x38},
492	{0xF1, 0x14},
493	{0xF0, 0xB9},
494	{0xF0, 0x39},
495	{0xF1, 0x10},
496	{0xF0, 0xBA},
497	{0xF0, 0x3A},
498	{0xF1, 0x0C},
499	{0xF0, 0xBB},
500	{0xF0, 0x3B},
501	{0xF1, 0x08},
502	{0xF0, 0x00},
503	{0xF0, 0x3C},
504	{0xF1, 0x04},
505	{0xF0, 0xBD},
506	{0xF0, 0x3D},
507	{0xF1, 0x00},
508	{0xF0, 0xBE},
509	{0xF0, 0x3E},
510	{0xF1, 0x00},
511	{0xF0, 0xBF},
512	{0xF0, 0x3F},
513	{0xF1, 0x00},
514	{0xF0, 0xC0},
515	{0xF0, 0x00},
516};
517
518#define CB_VT3253B0_INIT_FOR_RFMD 256
519static unsigned char byVT3253B0_RFMD[CB_VT3253B0_INIT_FOR_RFMD][2] = {
520	{0x00, 0x31},
521	{0x01, 0x00},
522	{0x02, 0x00},
523	{0x03, 0x00},
524	{0x04, 0x00},
525	{0x05, 0x81},
526	{0x06, 0x00},
527	{0x07, 0x00},
528	{0x08, 0x38},
529	{0x09, 0x45},
530	{0x0a, 0x2a},
531	{0x0b, 0x76},
532	{0x0c, 0x00},
533	{0x0d, 0x00},
534	{0x0e, 0x80},
535	{0x0f, 0x00},
536	{0x10, 0x00},
537	{0x11, 0x00},
538	{0x12, 0x00},
539	{0x13, 0x00},
540	{0x14, 0x00},
541	{0x15, 0x00},
542	{0x16, 0x00},
543	{0x17, 0x00},
544	{0x18, 0x00},
545	{0x19, 0x00},
546	{0x1a, 0x00},
547	{0x1b, 0x8e},
548	{0x1c, 0x06},
549	{0x1d, 0x00},
550	{0x1e, 0x00},
551	{0x1f, 0x00},
552	{0x20, 0x00},
553	{0x21, 0x00},
554	{0x22, 0x00},
555	{0x23, 0x00},
556	{0x24, 0x00},
557	{0x25, 0x4a},
558	{0x26, 0x00},
559	{0x27, 0x00},
560	{0x28, 0x00},
561	{0x29, 0x00},
562	{0x2a, 0x00},
563	{0x2b, 0x00},
564	{0x2c, 0x00},
565	{0x2d, 0x34},
566	{0x2e, 0x18},
567	{0x2f, 0x0c},
568	{0x30, 0x26},
569	{0x31, 0x5b},
570	{0x32, 0x00},
571	{0x33, 0x00},
572	{0x34, 0x00},
573	{0x35, 0x00},
574	{0x36, 0xaa},
575	{0x37, 0xaa},
576	{0x38, 0xff},
577	{0x39, 0xff},
578	{0x3a, 0xf8},
579	{0x3b, 0x00},
580	{0x3c, 0x00},
581	{0x3d, 0x09},
582	{0x3e, 0x0d},
583	{0x3f, 0x04},
584	{0x40, 0x00},
585	{0x41, 0x08},
586	{0x42, 0x00},
587	{0x43, 0x08},
588	{0x44, 0x08},
589	{0x45, 0x14},
590	{0x46, 0x05},
591	{0x47, 0x08},
592	{0x48, 0x00},
593	{0x49, 0x00},
594	{0x4a, 0x00},
595	{0x4b, 0x00},
596	{0x4c, 0x09},
597	{0x4d, 0x80},
598	{0x4e, 0x00},
599	{0x4f, 0xc5},
600	{0x50, 0x14},
601	{0x51, 0x19},
602	{0x52, 0x00},
603	{0x53, 0x00},
604	{0x54, 0x00},
605	{0x55, 0x00},
606	{0x56, 0x00},
607	{0x57, 0x00},
608	{0x58, 0x00},
609	{0x59, 0xb0},
610	{0x5a, 0x00},
611	{0x5b, 0x00},
612	{0x5c, 0x00},
613	{0x5d, 0x00},
614	{0x5e, 0x00},
615	{0x5f, 0x00},
616	{0x60, 0x39},
617	{0x61, 0x83},
618	{0x62, 0x00},
619	{0x63, 0x00},
620	{0x64, 0x00},
621	{0x65, 0x00},
622	{0x66, 0xc0},
623	{0x67, 0x49},
624	{0x68, 0x00},
625	{0x69, 0x00},
626	{0x6a, 0x00},
627	{0x6b, 0x00},
628	{0x6c, 0x00},
629	{0x6d, 0x03},
630	{0x6e, 0x01},
631	{0x6f, 0x00},
632	{0x70, 0x00},
633	{0x71, 0x00},
634	{0x72, 0x00},
635	{0x73, 0x00},
636	{0x74, 0x00},
637	{0x75, 0x00},
638	{0x76, 0x00},
639	{0x77, 0x00},
640	{0x78, 0x00},
641	{0x79, 0x00},
642	{0x7a, 0x00},
643	{0x7b, 0x00},
644	{0x7c, 0x00},
645	{0x7d, 0x00},
646	{0x7e, 0x00},
647	{0x7f, 0x00},
648	{0x80, 0x89},
649	{0x81, 0x00},
650	{0x82, 0x0e},
651	{0x83, 0x00},
652	{0x84, 0x00},
653	{0x85, 0x00},
654	{0x86, 0x00},
655	{0x87, 0x00},
656	{0x88, 0x08},
657	{0x89, 0x00},
658	{0x8a, 0x0e},
659	{0x8b, 0xa7},
660	{0x8c, 0x88},
661	{0x8d, 0x47},
662	{0x8e, 0xaa},
663	{0x8f, 0x02},
664	{0x90, 0x23},
665	{0x91, 0x0c},
666	{0x92, 0x06},
667	{0x93, 0x08},
668	{0x94, 0x00},
669	{0x95, 0x00},
670	{0x96, 0x00},
671	{0x97, 0xeb},
672	{0x98, 0x00},
673	{0x99, 0x00},
674	{0x9a, 0x00},
675	{0x9b, 0x00},
676	{0x9c, 0x00},
677	{0x9d, 0x00},
678	{0x9e, 0x00},
679	{0x9f, 0x00},
680	{0xa0, 0x00},
681	{0xa1, 0x00},
682	{0xa2, 0x00},
683	{0xa3, 0xcd},
684	{0xa4, 0x07},
685	{0xa5, 0x33},
686	{0xa6, 0x18},
687	{0xa7, 0x00},
688	{0xa8, 0x18},
689	{0xa9, 0x00},
690	{0xaa, 0x28},
691	{0xab, 0x00},
692	{0xac, 0x00},
693	{0xad, 0x00},
694	{0xae, 0x00},
695	{0xaf, 0x18},
696	{0xb0, 0x38},
697	{0xb1, 0x30},
698	{0xb2, 0x00},
699	{0xb3, 0x00},
700	{0xb4, 0x00},
701	{0xb5, 0x00},
702	{0xb6, 0x84},
703	{0xb7, 0xfd},
704	{0xb8, 0x00},
705	{0xb9, 0x00},
706	{0xba, 0x00},
707	{0xbb, 0x03},
708	{0xbc, 0x00},
709	{0xbd, 0x00},
710	{0xbe, 0x00},
711	{0xbf, 0x00},
712	{0xc0, 0x10},
713	{0xc1, 0x20},
714	{0xc2, 0x18},
715	{0xc3, 0x20},
716	{0xc4, 0x10},
717	{0xc5, 0x2c},
718	{0xc6, 0x1e},
719	{0xc7, 0x10},
720	{0xc8, 0x12},
721	{0xc9, 0x01},
722	{0xca, 0x6f},
723	{0xcb, 0xa7},
724	{0xcc, 0x3c},
725	{0xcd, 0x10},
726	{0xce, 0x00},
727	{0xcf, 0x22},
728	{0xd0, 0x00},
729	{0xd1, 0x10},
730	{0xd2, 0x00},
731	{0xd3, 0x00},
732	{0xd4, 0x10},
733	{0xd5, 0x33},
734	{0xd6, 0x80},
735	{0xd7, 0x21},
736	{0xd8, 0x00},
737	{0xd9, 0x00},
738	{0xda, 0x00},
739	{0xdb, 0x00},
740	{0xdc, 0x00},
741	{0xdd, 0x00},
742	{0xde, 0x00},
743	{0xdf, 0x00},
744	{0xe0, 0x00},
745	{0xe1, 0xB3},
746	{0xe2, 0x00},
747	{0xe3, 0x00},
748	{0xe4, 0x00},
749	{0xe5, 0x10},
750	{0xe6, 0x00},
751	{0xe7, 0x18},
752	{0xe8, 0x08},
753	{0xe9, 0xd4},
754	{0xea, 0x00},
755	{0xeb, 0xff},
756	{0xec, 0x79},
757	{0xed, 0x10},
758	{0xee, 0x30},
759	{0xef, 0x02},
760	{0xf0, 0x00},
761	{0xf1, 0x09},
762	{0xf2, 0x00},
763	{0xf3, 0x00},
764	{0xf4, 0x00},
765	{0xf5, 0x00},
766	{0xf6, 0x00},
767	{0xf7, 0x00},
768	{0xf8, 0x00},
769	{0xf9, 0x00},
770	{0xfa, 0x00},
771	{0xfb, 0x00},
772	{0xfc, 0x00},
773	{0xfd, 0x00},
774	{0xfe, 0x00},
775	{0xff, 0x00},
776};
777
778#define CB_VT3253B0_AGC_FOR_RFMD2959 195
779/* For RFMD2959 */
780static unsigned char byVT3253B0_AGC4_RFMD2959[CB_VT3253B0_AGC_FOR_RFMD2959][2] = {
781	{0xF0, 0x00},
782	{0xF1, 0x3E},
783	{0xF0, 0x80},
784	{0xF0, 0x00},
785	{0xF1, 0x3E},
786	{0xF0, 0x81},
787	{0xF0, 0x01},
788	{0xF1, 0x3E},
789	{0xF0, 0x82},
790	{0xF0, 0x02},
791	{0xF1, 0x3E},
792	{0xF0, 0x83},
793	{0xF0, 0x03},
794	{0xF1, 0x3B},
795	{0xF0, 0x84},
796	{0xF0, 0x04},
797	{0xF1, 0x39},
798	{0xF0, 0x85},
799	{0xF0, 0x05},
800	{0xF1, 0x38},
801	{0xF0, 0x86},
802	{0xF0, 0x06},
803	{0xF1, 0x37},
804	{0xF0, 0x87},
805	{0xF0, 0x07},
806	{0xF1, 0x36},
807	{0xF0, 0x88},
808	{0xF0, 0x08},
809	{0xF1, 0x35},
810	{0xF0, 0x89},
811	{0xF0, 0x09},
812	{0xF1, 0x35},
813	{0xF0, 0x8A},
814	{0xF0, 0x0A},
815	{0xF1, 0x34},
816	{0xF0, 0x8B},
817	{0xF0, 0x0B},
818	{0xF1, 0x34},
819	{0xF0, 0x8C},
820	{0xF0, 0x0C},
821	{0xF1, 0x33},
822	{0xF0, 0x8D},
823	{0xF0, 0x0D},
824	{0xF1, 0x32},
825	{0xF0, 0x8E},
826	{0xF0, 0x0E},
827	{0xF1, 0x31},
828	{0xF0, 0x8F},
829	{0xF0, 0x0F},
830	{0xF1, 0x30},
831	{0xF0, 0x90},
832	{0xF0, 0x10},
833	{0xF1, 0x2F},
834	{0xF0, 0x91},
835	{0xF0, 0x11},
836	{0xF1, 0x2F},
837	{0xF0, 0x92},
838	{0xF0, 0x12},
839	{0xF1, 0x2E},
840	{0xF0, 0x93},
841	{0xF0, 0x13},
842	{0xF1, 0x2D},
843	{0xF0, 0x94},
844	{0xF0, 0x14},
845	{0xF1, 0x2C},
846	{0xF0, 0x95},
847	{0xF0, 0x15},
848	{0xF1, 0x2B},
849	{0xF0, 0x96},
850	{0xF0, 0x16},
851	{0xF1, 0x2B},
852	{0xF0, 0x97},
853	{0xF0, 0x17},
854	{0xF1, 0x2A},
855	{0xF0, 0x98},
856	{0xF0, 0x18},
857	{0xF1, 0x29},
858	{0xF0, 0x99},
859	{0xF0, 0x19},
860	{0xF1, 0x28},
861	{0xF0, 0x9A},
862	{0xF0, 0x1A},
863	{0xF1, 0x27},
864	{0xF0, 0x9B},
865	{0xF0, 0x1B},
866	{0xF1, 0x26},
867	{0xF0, 0x9C},
868	{0xF0, 0x1C},
869	{0xF1, 0x25},
870	{0xF0, 0x9D},
871	{0xF0, 0x1D},
872	{0xF1, 0x24},
873	{0xF0, 0x9E},
874	{0xF0, 0x1E},
875	{0xF1, 0x24},
876	{0xF0, 0x9F},
877	{0xF0, 0x1F},
878	{0xF1, 0x23},
879	{0xF0, 0xA0},
880	{0xF0, 0x20},
881	{0xF1, 0x22},
882	{0xF0, 0xA1},
883	{0xF0, 0x21},
884	{0xF1, 0x21},
885	{0xF0, 0xA2},
886	{0xF0, 0x22},
887	{0xF1, 0x20},
888	{0xF0, 0xA3},
889	{0xF0, 0x23},
890	{0xF1, 0x20},
891	{0xF0, 0xA4},
892	{0xF0, 0x24},
893	{0xF1, 0x1F},
894	{0xF0, 0xA5},
895	{0xF0, 0x25},
896	{0xF1, 0x1E},
897	{0xF0, 0xA6},
898	{0xF0, 0x26},
899	{0xF1, 0x1D},
900	{0xF0, 0xA7},
901	{0xF0, 0x27},
902	{0xF1, 0x1C},
903	{0xF0, 0xA8},
904	{0xF0, 0x28},
905	{0xF1, 0x1B},
906	{0xF0, 0xA9},
907	{0xF0, 0x29},
908	{0xF1, 0x1B},
909	{0xF0, 0xAA},
910	{0xF0, 0x2A},
911	{0xF1, 0x1A},
912	{0xF0, 0xAB},
913	{0xF0, 0x2B},
914	{0xF1, 0x1A},
915	{0xF0, 0xAC},
916	{0xF0, 0x2C},
917	{0xF1, 0x19},
918	{0xF0, 0xAD},
919	{0xF0, 0x2D},
920	{0xF1, 0x18},
921	{0xF0, 0xAE},
922	{0xF0, 0x2E},
923	{0xF1, 0x17},
924	{0xF0, 0xAF},
925	{0xF0, 0x2F},
926	{0xF1, 0x16},
927	{0xF0, 0xB0},
928	{0xF0, 0x30},
929	{0xF1, 0x15},
930	{0xF0, 0xB1},
931	{0xF0, 0x31},
932	{0xF1, 0x15},
933	{0xF0, 0xB2},
934	{0xF0, 0x32},
935	{0xF1, 0x15},
936	{0xF0, 0xB3},
937	{0xF0, 0x33},
938	{0xF1, 0x14},
939	{0xF0, 0xB4},
940	{0xF0, 0x34},
941	{0xF1, 0x13},
942	{0xF0, 0xB5},
943	{0xF0, 0x35},
944	{0xF1, 0x12},
945	{0xF0, 0xB6},
946	{0xF0, 0x36},
947	{0xF1, 0x11},
948	{0xF0, 0xB7},
949	{0xF0, 0x37},
950	{0xF1, 0x10},
951	{0xF0, 0xB8},
952	{0xF0, 0x38},
953	{0xF1, 0x0F},
954	{0xF0, 0xB9},
955	{0xF0, 0x39},
956	{0xF1, 0x0E},
957	{0xF0, 0xBA},
958	{0xF0, 0x3A},
959	{0xF1, 0x0D},
960	{0xF0, 0xBB},
961	{0xF0, 0x3B},
962	{0xF1, 0x0C},
963	{0xF0, 0xBC},
964	{0xF0, 0x3C},
965	{0xF1, 0x0B},
966	{0xF0, 0xBD},
967	{0xF0, 0x3D},
968	{0xF1, 0x0B},
969	{0xF0, 0xBE},
970	{0xF0, 0x3E},
971	{0xF1, 0x0A},
972	{0xF0, 0xBF},
973	{0xF0, 0x3F},
974	{0xF1, 0x09},
975	{0xF0, 0x00},
976};
977
978#define CB_VT3253B0_INIT_FOR_AIROHA2230 256
979/* For AIROHA */
980static unsigned char byVT3253B0_AIROHA2230[CB_VT3253B0_INIT_FOR_AIROHA2230][2] = {
981	{0x00, 0x31},
982	{0x01, 0x00},
983	{0x02, 0x00},
984	{0x03, 0x00},
985	{0x04, 0x00},
986	{0x05, 0x80},
987	{0x06, 0x00},
988	{0x07, 0x00},
989	{0x08, 0x70},
990	{0x09, 0x41},
991	{0x0a, 0x2A},
992	{0x0b, 0x76},
993	{0x0c, 0x00},
994	{0x0d, 0x00},
995	{0x0e, 0x80},
996	{0x0f, 0x00},
997	{0x10, 0x00},
998	{0x11, 0x00},
999	{0x12, 0x00},
1000	{0x13, 0x00},
1001	{0x14, 0x00},
1002	{0x15, 0x00},
1003	{0x16, 0x00},
1004	{0x17, 0x00},
1005	{0x18, 0x00},
1006	{0x19, 0x00},
1007	{0x1a, 0x00},
1008	{0x1b, 0x8f},
1009	{0x1c, 0x09},
1010	{0x1d, 0x00},
1011	{0x1e, 0x00},
1012	{0x1f, 0x00},
1013	{0x20, 0x00},
1014	{0x21, 0x00},
1015	{0x22, 0x00},
1016	{0x23, 0x00},
1017	{0x24, 0x00},
1018	{0x25, 0x4a},
1019	{0x26, 0x00},
1020	{0x27, 0x00},
1021	{0x28, 0x00},
1022	{0x29, 0x00},
1023	{0x2a, 0x00},
1024	{0x2b, 0x00},
1025	{0x2c, 0x00},
1026	{0x2d, 0x4a},
1027	{0x2e, 0x00},
1028	{0x2f, 0x0a},
1029	{0x30, 0x26},
1030	{0x31, 0x5b},
1031	{0x32, 0x00},
1032	{0x33, 0x00},
1033	{0x34, 0x00},
1034	{0x35, 0x00},
1035	{0x36, 0xaa},
1036	{0x37, 0xaa},
1037	{0x38, 0xff},
1038	{0x39, 0xff},
1039	{0x3a, 0x79},
1040	{0x3b, 0x00},
1041	{0x3c, 0x00},
1042	{0x3d, 0x0b},
1043	{0x3e, 0x48},
1044	{0x3f, 0x04},
1045	{0x40, 0x00},
1046	{0x41, 0x08},
1047	{0x42, 0x00},
1048	{0x43, 0x08},
1049	{0x44, 0x08},
1050	{0x45, 0x14},
1051	{0x46, 0x05},
1052	{0x47, 0x09},
1053	{0x48, 0x00},
1054	{0x49, 0x00},
1055	{0x4a, 0x00},
1056	{0x4b, 0x00},
1057	{0x4c, 0x09},
1058	{0x4d, 0x73},
1059	{0x4e, 0x00},
1060	{0x4f, 0xc5},
1061	{0x50, 0x15},
1062	{0x51, 0x19},
1063	{0x52, 0x00},
1064	{0x53, 0x00},
1065	{0x54, 0x00},
1066	{0x55, 0x00},
1067	{0x56, 0x00},
1068	{0x57, 0x00},
1069	{0x58, 0x00},
1070	{0x59, 0xb0},
1071	{0x5a, 0x00},
1072	{0x5b, 0x00},
1073	{0x5c, 0x00},
1074	{0x5d, 0x00},
1075	{0x5e, 0x00},
1076	{0x5f, 0x00},
1077	{0x60, 0xe4},
1078	{0x61, 0x80},
1079	{0x62, 0x00},
1080	{0x63, 0x00},
1081	{0x64, 0x00},
1082	{0x65, 0x00},
1083	{0x66, 0x98},
1084	{0x67, 0x0a},
1085	{0x68, 0x00},
1086	{0x69, 0x00},
1087	{0x6a, 0x00},
1088	{0x6b, 0x00},
1089	{0x6c, 0x00}, /* RobertYu:20050125, request by JJSue */
1090	{0x6d, 0x03},
1091	{0x6e, 0x01},
1092	{0x6f, 0x00},
1093	{0x70, 0x00},
1094	{0x71, 0x00},
1095	{0x72, 0x00},
1096	{0x73, 0x00},
1097	{0x74, 0x00},
1098	{0x75, 0x00},
1099	{0x76, 0x00},
1100	{0x77, 0x00},
1101	{0x78, 0x00},
1102	{0x79, 0x00},
1103	{0x7a, 0x00},
1104	{0x7b, 0x00},
1105	{0x7c, 0x00},
1106	{0x7d, 0x00},
1107	{0x7e, 0x00},
1108	{0x7f, 0x00},
1109	{0x80, 0x8c},
1110	{0x81, 0x01},
1111	{0x82, 0x09},
1112	{0x83, 0x00},
1113	{0x84, 0x00},
1114	{0x85, 0x00},
1115	{0x86, 0x00},
1116	{0x87, 0x00},
1117	{0x88, 0x08},
1118	{0x89, 0x00},
1119	{0x8a, 0x0f},
1120	{0x8b, 0xb7},
1121	{0x8c, 0x88},
1122	{0x8d, 0x47},
1123	{0x8e, 0xaa},
1124	{0x8f, 0x02},
1125	{0x90, 0x22},
1126	{0x91, 0x00},
1127	{0x92, 0x00},
1128	{0x93, 0x00},
1129	{0x94, 0x00},
1130	{0x95, 0x00},
1131	{0x96, 0x00},
1132	{0x97, 0xeb},
1133	{0x98, 0x00},
1134	{0x99, 0x00},
1135	{0x9a, 0x00},
1136	{0x9b, 0x00},
1137	{0x9c, 0x00},
1138	{0x9d, 0x00},
1139	{0x9e, 0x00},
1140	{0x9f, 0x01},
1141	{0xa0, 0x00},
1142	{0xa1, 0x00},
1143	{0xa2, 0x00},
1144	{0xa3, 0x00},
1145	{0xa4, 0x00},
1146	{0xa5, 0x00},
1147	{0xa6, 0x10},
1148	{0xa7, 0x00},
1149	{0xa8, 0x18},
1150	{0xa9, 0x00},
1151	{0xaa, 0x00},
1152	{0xab, 0x00},
1153	{0xac, 0x00},
1154	{0xad, 0x00},
1155	{0xae, 0x00},
1156	{0xaf, 0x18},
1157	{0xb0, 0x38},
1158	{0xb1, 0x30},
1159	{0xb2, 0x00},
1160	{0xb3, 0x00},
1161	{0xb4, 0xff},
1162	{0xb5, 0x0f},
1163	{0xb6, 0xe4},
1164	{0xb7, 0xe2},
1165	{0xb8, 0x00},
1166	{0xb9, 0x00},
1167	{0xba, 0x00},
1168	{0xbb, 0x03},
1169	{0xbc, 0x01},
1170	{0xbd, 0x00},
1171	{0xbe, 0x00},
1172	{0xbf, 0x00},
1173	{0xc0, 0x18},
1174	{0xc1, 0x20},
1175	{0xc2, 0x07},
1176	{0xc3, 0x18},
1177	{0xc4, 0xff},
1178	{0xc5, 0x2c},
1179	{0xc6, 0x0c},
1180	{0xc7, 0x0a},
1181	{0xc8, 0x0e},
1182	{0xc9, 0x01},
1183	{0xca, 0x68},
1184	{0xcb, 0xa7},
1185	{0xcc, 0x3c},
1186	{0xcd, 0x10},
1187	{0xce, 0x00},
1188	{0xcf, 0x25},
1189	{0xd0, 0x40},
1190	{0xd1, 0x12},
1191	{0xd2, 0x00},
1192	{0xd3, 0x00},
1193	{0xd4, 0x10},
1194	{0xd5, 0x28},
1195	{0xd6, 0x80},
1196	{0xd7, 0x2A},
1197	{0xd8, 0x00},
1198	{0xd9, 0x00},
1199	{0xda, 0x00},
1200	{0xdb, 0x00},
1201	{0xdc, 0x00},
1202	{0xdd, 0x00},
1203	{0xde, 0x00},
1204	{0xdf, 0x00},
1205	{0xe0, 0x00},
1206	{0xe1, 0xB3},
1207	{0xe2, 0x00},
1208	{0xe3, 0x00},
1209	{0xe4, 0x00},
1210	{0xe5, 0x10},
1211	{0xe6, 0x00},
1212	{0xe7, 0x1C},
1213	{0xe8, 0x00},
1214	{0xe9, 0xf4},
1215	{0xea, 0x00},
1216	{0xeb, 0xff},
1217	{0xec, 0x79},
1218	{0xed, 0x20},
1219	{0xee, 0x30},
1220	{0xef, 0x01},
1221	{0xf0, 0x00},
1222	{0xf1, 0x3e},
1223	{0xf2, 0x00},
1224	{0xf3, 0x00},
1225	{0xf4, 0x00},
1226	{0xf5, 0x00},
1227	{0xf6, 0x00},
1228	{0xf7, 0x00},
1229	{0xf8, 0x00},
1230	{0xf9, 0x00},
1231	{0xfa, 0x00},
1232	{0xfb, 0x00},
1233	{0xfc, 0x00},
1234	{0xfd, 0x00},
1235	{0xfe, 0x00},
1236	{0xff, 0x00},
1237};
1238
1239#define CB_VT3253B0_INIT_FOR_UW2451 256
1240/* For UW2451 */
1241static unsigned char byVT3253B0_UW2451[CB_VT3253B0_INIT_FOR_UW2451][2] = {
1242	{0x00, 0x31},
1243	{0x01, 0x00},
1244	{0x02, 0x00},
1245	{0x03, 0x00},
1246	{0x04, 0x00},
1247	{0x05, 0x81},
1248	{0x06, 0x00},
1249	{0x07, 0x00},
1250	{0x08, 0x38},
1251	{0x09, 0x45},
1252	{0x0a, 0x28},
1253	{0x0b, 0x76},
1254	{0x0c, 0x00},
1255	{0x0d, 0x00},
1256	{0x0e, 0x80},
1257	{0x0f, 0x00},
1258	{0x10, 0x00},
1259	{0x11, 0x00},
1260	{0x12, 0x00},
1261	{0x13, 0x00},
1262	{0x14, 0x00},
1263	{0x15, 0x00},
1264	{0x16, 0x00},
1265	{0x17, 0x00},
1266	{0x18, 0x00},
1267	{0x19, 0x00},
1268	{0x1a, 0x00},
1269	{0x1b, 0x8f},
1270	{0x1c, 0x0f},
1271	{0x1d, 0x00},
1272	{0x1e, 0x00},
1273	{0x1f, 0x00},
1274	{0x20, 0x00},
1275	{0x21, 0x00},
1276	{0x22, 0x00},
1277	{0x23, 0x00},
1278	{0x24, 0x00},
1279	{0x25, 0x4a},
1280	{0x26, 0x00},
1281	{0x27, 0x00},
1282	{0x28, 0x00},
1283	{0x29, 0x00},
1284	{0x2a, 0x00},
1285	{0x2b, 0x00},
1286	{0x2c, 0x00},
1287	{0x2d, 0x18},
1288	{0x2e, 0x00},
1289	{0x2f, 0x0a},
1290	{0x30, 0x26},
1291	{0x31, 0x5b},
1292	{0x32, 0x00},
1293	{0x33, 0x00},
1294	{0x34, 0x00},
1295	{0x35, 0x00},
1296	{0x36, 0xaa},
1297	{0x37, 0xaa},
1298	{0x38, 0xff},
1299	{0x39, 0xff},
1300	{0x3a, 0x00},
1301	{0x3b, 0x00},
1302	{0x3c, 0x00},
1303	{0x3d, 0x03},
1304	{0x3e, 0x1d},
1305	{0x3f, 0x04},
1306	{0x40, 0x00},
1307	{0x41, 0x08},
1308	{0x42, 0x00},
1309	{0x43, 0x08},
1310	{0x44, 0x08},
1311	{0x45, 0x14},
1312	{0x46, 0x05},
1313	{0x47, 0x09},
1314	{0x48, 0x00},
1315	{0x49, 0x00},
1316	{0x4a, 0x00},
1317	{0x4b, 0x00},
1318	{0x4c, 0x09},
1319	{0x4d, 0x90},
1320	{0x4e, 0x00},
1321	{0x4f, 0xc5},
1322	{0x50, 0x15},
1323	{0x51, 0x19},
1324	{0x52, 0x00},
1325	{0x53, 0x00},
1326	{0x54, 0x00},
1327	{0x55, 0x00},
1328	{0x56, 0x00},
1329	{0x57, 0x00},
1330	{0x58, 0x00},
1331	{0x59, 0xb0},
1332	{0x5a, 0x00},
1333	{0x5b, 0x00},
1334	{0x5c, 0x00},
1335	{0x5d, 0x00},
1336	{0x5e, 0x00},
1337	{0x5f, 0x00},
1338	{0x60, 0xb3},
1339	{0x61, 0x81},
1340	{0x62, 0x00},
1341	{0x63, 0x00},
1342	{0x64, 0x00},
1343	{0x65, 0x00},
1344	{0x66, 0x57},
1345	{0x67, 0x6c},
1346	{0x68, 0x00},
1347	{0x69, 0x00},
1348	{0x6a, 0x00},
1349	{0x6b, 0x00},
1350	{0x6c, 0x00}, /* RobertYu:20050125, request by JJSue */
1351	{0x6d, 0x03},
1352	{0x6e, 0x01},
1353	{0x6f, 0x00},
1354	{0x70, 0x00},
1355	{0x71, 0x00},
1356	{0x72, 0x00},
1357	{0x73, 0x00},
1358	{0x74, 0x00},
1359	{0x75, 0x00},
1360	{0x76, 0x00},
1361	{0x77, 0x00},
1362	{0x78, 0x00},
1363	{0x79, 0x00},
1364	{0x7a, 0x00},
1365	{0x7b, 0x00},
1366	{0x7c, 0x00},
1367	{0x7d, 0x00},
1368	{0x7e, 0x00},
1369	{0x7f, 0x00},
1370	{0x80, 0x8c},
1371	{0x81, 0x00},
1372	{0x82, 0x0e},
1373	{0x83, 0x00},
1374	{0x84, 0x00},
1375	{0x85, 0x00},
1376	{0x86, 0x00},
1377	{0x87, 0x00},
1378	{0x88, 0x08},
1379	{0x89, 0x00},
1380	{0x8a, 0x0e},
1381	{0x8b, 0xa7},
1382	{0x8c, 0x88},
1383	{0x8d, 0x47},
1384	{0x8e, 0xaa},
1385	{0x8f, 0x02},
1386	{0x90, 0x00},
1387	{0x91, 0x00},
1388	{0x92, 0x00},
1389	{0x93, 0x00},
1390	{0x94, 0x00},
1391	{0x95, 0x00},
1392	{0x96, 0x00},
1393	{0x97, 0xe3},
1394	{0x98, 0x00},
1395	{0x99, 0x00},
1396	{0x9a, 0x00},
1397	{0x9b, 0x00},
1398	{0x9c, 0x00},
1399	{0x9d, 0x00},
1400	{0x9e, 0x00},
1401	{0x9f, 0x00},
1402	{0xa0, 0x00},
1403	{0xa1, 0x00},
1404	{0xa2, 0x00},
1405	{0xa3, 0x00},
1406	{0xa4, 0x00},
1407	{0xa5, 0x00},
1408	{0xa6, 0x10},
1409	{0xa7, 0x00},
1410	{0xa8, 0x18},
1411	{0xa9, 0x00},
1412	{0xaa, 0x00},
1413	{0xab, 0x00},
1414	{0xac, 0x00},
1415	{0xad, 0x00},
1416	{0xae, 0x00},
1417	{0xaf, 0x18},
1418	{0xb0, 0x18},
1419	{0xb1, 0x30},
1420	{0xb2, 0x00},
1421	{0xb3, 0x00},
1422	{0xb4, 0x00},
1423	{0xb5, 0x00},
1424	{0xb6, 0x00},
1425	{0xb7, 0x00},
1426	{0xb8, 0x00},
1427	{0xb9, 0x00},
1428	{0xba, 0x00},
1429	{0xbb, 0x03},
1430	{0xbc, 0x01},
1431	{0xbd, 0x00},
1432	{0xbe, 0x00},
1433	{0xbf, 0x00},
1434	{0xc0, 0x10},
1435	{0xc1, 0x20},
1436	{0xc2, 0x00},
1437	{0xc3, 0x20},
1438	{0xc4, 0x00},
1439	{0xc5, 0x2c},
1440	{0xc6, 0x1c},
1441	{0xc7, 0x10},
1442	{0xc8, 0x10},
1443	{0xc9, 0x01},
1444	{0xca, 0x68},
1445	{0xcb, 0xa7},
1446	{0xcc, 0x3c},
1447	{0xcd, 0x09},
1448	{0xce, 0x00},
1449	{0xcf, 0x20},
1450	{0xd0, 0x40},
1451	{0xd1, 0x10},
1452	{0xd2, 0x00},
1453	{0xd3, 0x00},
1454	{0xd4, 0x20},
1455	{0xd5, 0x28},
1456	{0xd6, 0xa0},
1457	{0xd7, 0x2a},
1458	{0xd8, 0x00},
1459	{0xd9, 0x00},
1460	{0xda, 0x00},
1461	{0xdb, 0x00},
1462	{0xdc, 0x00},
1463	{0xdd, 0x00},
1464	{0xde, 0x00},
1465	{0xdf, 0x00},
1466	{0xe0, 0x00},
1467	{0xe1, 0xd3},
1468	{0xe2, 0xc0},
1469	{0xe3, 0x00},
1470	{0xe4, 0x00},
1471	{0xe5, 0x10},
1472	{0xe6, 0x00},
1473	{0xe7, 0x12},
1474	{0xe8, 0x12},
1475	{0xe9, 0x34},
1476	{0xea, 0x00},
1477	{0xeb, 0xff},
1478	{0xec, 0x79},
1479	{0xed, 0x20},
1480	{0xee, 0x30},
1481	{0xef, 0x01},
1482	{0xf0, 0x00},
1483	{0xf1, 0x3e},
1484	{0xf2, 0x00},
1485	{0xf3, 0x00},
1486	{0xf4, 0x00},
1487	{0xf5, 0x00},
1488	{0xf6, 0x00},
1489	{0xf7, 0x00},
1490	{0xf8, 0x00},
1491	{0xf9, 0x00},
1492	{0xfa, 0x00},
1493	{0xfb, 0x00},
1494	{0xfc, 0x00},
1495	{0xfd, 0x00},
1496	{0xfe, 0x00},
1497	{0xff, 0x00},
1498};
1499
1500#define CB_VT3253B0_AGC 193
1501/* For AIROHA */
1502static unsigned char byVT3253B0_AGC[CB_VT3253B0_AGC][2] = {
1503	{0xF0, 0x00},
1504	{0xF1, 0x00},
1505	{0xF0, 0x80},
1506	{0xF0, 0x01},
1507	{0xF1, 0x00},
1508	{0xF0, 0x81},
1509	{0xF0, 0x02},
1510	{0xF1, 0x02},
1511	{0xF0, 0x82},
1512	{0xF0, 0x03},
1513	{0xF1, 0x04},
1514	{0xF0, 0x83},
1515	{0xF0, 0x03},
1516	{0xF1, 0x04},
1517	{0xF0, 0x84},
1518	{0xF0, 0x04},
1519	{0xF1, 0x06},
1520	{0xF0, 0x85},
1521	{0xF0, 0x05},
1522	{0xF1, 0x06},
1523	{0xF0, 0x86},
1524	{0xF0, 0x06},
1525	{0xF1, 0x06},
1526	{0xF0, 0x87},
1527	{0xF0, 0x07},
1528	{0xF1, 0x08},
1529	{0xF0, 0x88},
1530	{0xF0, 0x08},
1531	{0xF1, 0x08},
1532	{0xF0, 0x89},
1533	{0xF0, 0x09},
1534	{0xF1, 0x0A},
1535	{0xF0, 0x8A},
1536	{0xF0, 0x0A},
1537	{0xF1, 0x0A},
1538	{0xF0, 0x8B},
1539	{0xF0, 0x0B},
1540	{0xF1, 0x0C},
1541	{0xF0, 0x8C},
1542	{0xF0, 0x0C},
1543	{0xF1, 0x0C},
1544	{0xF0, 0x8D},
1545	{0xF0, 0x0D},
1546	{0xF1, 0x0E},
1547	{0xF0, 0x8E},
1548	{0xF0, 0x0E},
1549	{0xF1, 0x0E},
1550	{0xF0, 0x8F},
1551	{0xF0, 0x0F},
1552	{0xF1, 0x10},
1553	{0xF0, 0x90},
1554	{0xF0, 0x10},
1555	{0xF1, 0x10},
1556	{0xF0, 0x91},
1557	{0xF0, 0x11},
1558	{0xF1, 0x12},
1559	{0xF0, 0x92},
1560	{0xF0, 0x12},
1561	{0xF1, 0x12},
1562	{0xF0, 0x93},
1563	{0xF0, 0x13},
1564	{0xF1, 0x14},
1565	{0xF0, 0x94},
1566	{0xF0, 0x14},
1567	{0xF1, 0x14},
1568	{0xF0, 0x95},
1569	{0xF0, 0x15},
1570	{0xF1, 0x16},
1571	{0xF0, 0x96},
1572	{0xF0, 0x16},
1573	{0xF1, 0x16},
1574	{0xF0, 0x97},
1575	{0xF0, 0x17},
1576	{0xF1, 0x18},
1577	{0xF0, 0x98},
1578	{0xF0, 0x18},
1579	{0xF1, 0x18},
1580	{0xF0, 0x99},
1581	{0xF0, 0x19},
1582	{0xF1, 0x1A},
1583	{0xF0, 0x9A},
1584	{0xF0, 0x1A},
1585	{0xF1, 0x1A},
1586	{0xF0, 0x9B},
1587	{0xF0, 0x1B},
1588	{0xF1, 0x1C},
1589	{0xF0, 0x9C},
1590	{0xF0, 0x1C},
1591	{0xF1, 0x1C},
1592	{0xF0, 0x9D},
1593	{0xF0, 0x1D},
1594	{0xF1, 0x1E},
1595	{0xF0, 0x9E},
1596	{0xF0, 0x1E},
1597	{0xF1, 0x1E},
1598	{0xF0, 0x9F},
1599	{0xF0, 0x1F},
1600	{0xF1, 0x20},
1601	{0xF0, 0xA0},
1602	{0xF0, 0x20},
1603	{0xF1, 0x20},
1604	{0xF0, 0xA1},
1605	{0xF0, 0x21},
1606	{0xF1, 0x22},
1607	{0xF0, 0xA2},
1608	{0xF0, 0x22},
1609	{0xF1, 0x22},
1610	{0xF0, 0xA3},
1611	{0xF0, 0x23},
1612	{0xF1, 0x24},
1613	{0xF0, 0xA4},
1614	{0xF0, 0x24},
1615	{0xF1, 0x24},
1616	{0xF0, 0xA5},
1617	{0xF0, 0x25},
1618	{0xF1, 0x26},
1619	{0xF0, 0xA6},
1620	{0xF0, 0x26},
1621	{0xF1, 0x26},
1622	{0xF0, 0xA7},
1623	{0xF0, 0x27},
1624	{0xF1, 0x28},
1625	{0xF0, 0xA8},
1626	{0xF0, 0x28},
1627	{0xF1, 0x28},
1628	{0xF0, 0xA9},
1629	{0xF0, 0x29},
1630	{0xF1, 0x2A},
1631	{0xF0, 0xAA},
1632	{0xF0, 0x2A},
1633	{0xF1, 0x2A},
1634	{0xF0, 0xAB},
1635	{0xF0, 0x2B},
1636	{0xF1, 0x2C},
1637	{0xF0, 0xAC},
1638	{0xF0, 0x2C},
1639	{0xF1, 0x2C},
1640	{0xF0, 0xAD},
1641	{0xF0, 0x2D},
1642	{0xF1, 0x2E},
1643	{0xF0, 0xAE},
1644	{0xF0, 0x2E},
1645	{0xF1, 0x2E},
1646	{0xF0, 0xAF},
1647	{0xF0, 0x2F},
1648	{0xF1, 0x30},
1649	{0xF0, 0xB0},
1650	{0xF0, 0x30},
1651	{0xF1, 0x30},
1652	{0xF0, 0xB1},
1653	{0xF0, 0x31},
1654	{0xF1, 0x32},
1655	{0xF0, 0xB2},
1656	{0xF0, 0x32},
1657	{0xF1, 0x32},
1658	{0xF0, 0xB3},
1659	{0xF0, 0x33},
1660	{0xF1, 0x34},
1661	{0xF0, 0xB4},
1662	{0xF0, 0x34},
1663	{0xF1, 0x34},
1664	{0xF0, 0xB5},
1665	{0xF0, 0x35},
1666	{0xF1, 0x36},
1667	{0xF0, 0xB6},
1668	{0xF0, 0x36},
1669	{0xF1, 0x36},
1670	{0xF0, 0xB7},
1671	{0xF0, 0x37},
1672	{0xF1, 0x38},
1673	{0xF0, 0xB8},
1674	{0xF0, 0x38},
1675	{0xF1, 0x38},
1676	{0xF0, 0xB9},
1677	{0xF0, 0x39},
1678	{0xF1, 0x3A},
1679	{0xF0, 0xBA},
1680	{0xF0, 0x3A},
1681	{0xF1, 0x3A},
1682	{0xF0, 0xBB},
1683	{0xF0, 0x3B},
1684	{0xF1, 0x3C},
1685	{0xF0, 0xBC},
1686	{0xF0, 0x3C},
1687	{0xF1, 0x3C},
1688	{0xF0, 0xBD},
1689	{0xF0, 0x3D},
1690	{0xF1, 0x3E},
1691	{0xF0, 0xBE},
1692	{0xF0, 0x3E},
1693	{0xF1, 0x3E},
1694	{0xF0, 0xBF},
1695	{0xF0, 0x00},
1696};
1697
1698static const unsigned short awcFrameTime[MAX_RATE] = {
1699		10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216
1700};
1701
1702/*---------------------  Export Variables  --------------------------*/
1703/*
1704 * Description: Calculate data frame transmitting time
1705 *
1706 * Parameters:
1707 *  In:
1708 *      byPreambleType  - Preamble Type
1709 *      byPktType        - PK_TYPE_11A, PK_TYPE_11B, PK_TYPE_11GB, PK_TYPE_11GA
1710 *      cbFrameLength   - Baseband Type
1711 *      wRate           - Tx Rate
1712 *  Out:
1713 *
1714 * Return Value: FrameTime
1715 *
1716 */
1717unsigned int
1718BBuGetFrameTime(
1719	unsigned char byPreambleType,
1720	unsigned char byPktType,
1721	unsigned int cbFrameLength,
1722	unsigned short wRate
1723)
1724{
1725	unsigned int uFrameTime;
1726	unsigned int uPreamble;
1727	unsigned int uTmp;
1728	unsigned int uRateIdx = (unsigned int) wRate;
1729	unsigned int uRate = 0;
1730
1731	if (uRateIdx > RATE_54M) {
1732		ASSERT(0);
1733		return 0;
1734	}
1735
1736	uRate = (unsigned int)awcFrameTime[uRateIdx];
1737
1738	if (uRateIdx <= 3) {          /* CCK mode */
1739		if (byPreambleType == 1) /* Short */
1740			uPreamble = 96;
1741		else
1742			uPreamble = 192;
1743
1744		uFrameTime = (cbFrameLength * 80) / uRate;  /* ????? */
1745		uTmp = (uFrameTime * uRate) / 80;
1746		if (cbFrameLength != uTmp)
1747			uFrameTime++;
1748
1749		return uPreamble + uFrameTime;
1750	}
1751	uFrameTime = (cbFrameLength * 8 + 22) / uRate; /* ???????? */
1752	uTmp = ((uFrameTime * uRate) - 22) / 8;
1753	if (cbFrameLength != uTmp)
1754		uFrameTime++;
1755
1756	uFrameTime = uFrameTime * 4;    /* ??????? */
1757	if (byPktType != PK_TYPE_11A)
1758		uFrameTime += 6;     /* ?????? */
1759
1760	return 20 + uFrameTime; /* ?????? */
1761}
1762
1763/*
1764 * Description: Calculate Length, Service, and Signal fields of Phy for Tx
1765 *
1766 * Parameters:
1767 *  In:
1768 *      priv         - Device Structure
1769 *      frame_length   - Tx Frame Length
1770 *      tx_rate           - Tx Rate
1771 *  Out:
1772 *	struct vnt_phy_field *phy
1773 *		- pointer to Phy Length field
1774 *		- pointer to Phy Service field
1775 *		- pointer to Phy Signal field
1776 *
1777 * Return Value: none
1778 *
1779 */
1780void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length,
1781		       u16 tx_rate, u8 pkt_type, struct vnt_phy_field *phy)
1782{
1783	u32 bit_count;
1784	u32 count = 0;
1785	u32 tmp;
1786	int ext_bit;
1787	u8 preamble_type = priv->byPreambleType;
1788
1789	bit_count = frame_length * 8;
1790	ext_bit = false;
1791
1792	switch (tx_rate) {
1793	case RATE_1M:
1794		count = bit_count;
1795
1796		phy->signal = 0x00;
1797
1798		break;
1799	case RATE_2M:
1800		count = bit_count / 2;
1801
1802		if (preamble_type == 1)
1803			phy->signal = 0x09;
1804		else
1805			phy->signal = 0x01;
1806
1807		break;
1808	case RATE_5M:
1809		count = (bit_count * 10) / 55;
1810		tmp = (count * 55) / 10;
1811
1812		if (tmp != bit_count)
1813			count++;
1814
1815		if (preamble_type == 1)
1816			phy->signal = 0x0a;
1817		else
1818			phy->signal = 0x02;
1819
1820		break;
1821	case RATE_11M:
1822		count = bit_count / 11;
1823		tmp = count * 11;
1824
1825		if (tmp != bit_count) {
1826			count++;
1827
1828			if ((bit_count - tmp) <= 3)
1829				ext_bit = true;
1830		}
1831
1832		if (preamble_type == 1)
1833			phy->signal = 0x0b;
1834		else
1835			phy->signal = 0x03;
1836
1837		break;
1838	case RATE_6M:
1839		if (pkt_type == PK_TYPE_11A)
1840			phy->signal = 0x9b;
1841		else
1842			phy->signal = 0x8b;
1843
1844		break;
1845	case RATE_9M:
1846		if (pkt_type == PK_TYPE_11A)
1847			phy->signal = 0x9f;
1848		else
1849			phy->signal = 0x8f;
1850
1851		break;
1852	case RATE_12M:
1853		if (pkt_type == PK_TYPE_11A)
1854			phy->signal = 0x9a;
1855		else
1856			phy->signal = 0x8a;
1857
1858		break;
1859	case RATE_18M:
1860		if (pkt_type == PK_TYPE_11A)
1861			phy->signal = 0x9e;
1862		else
1863			phy->signal = 0x8e;
1864
1865		break;
1866	case RATE_24M:
1867		if (pkt_type == PK_TYPE_11A)
1868			phy->signal = 0x99;
1869		else
1870			phy->signal = 0x89;
1871
1872		break;
1873	case RATE_36M:
1874		if (pkt_type == PK_TYPE_11A)
1875			phy->signal = 0x9d;
1876		else
1877			phy->signal = 0x8d;
1878
1879		break;
1880	case RATE_48M:
1881		if (pkt_type == PK_TYPE_11A)
1882			phy->signal = 0x98;
1883		else
1884			phy->signal = 0x88;
1885
1886		break;
1887	case RATE_54M:
1888		if (pkt_type == PK_TYPE_11A)
1889			phy->signal = 0x9c;
1890		else
1891			phy->signal = 0x8c;
1892		break;
1893	default:
1894		if (pkt_type == PK_TYPE_11A)
1895			phy->signal = 0x9c;
1896		else
1897			phy->signal = 0x8c;
1898		break;
1899	}
1900
1901	if (pkt_type == PK_TYPE_11B) {
1902		phy->service = 0x00;
1903		if (ext_bit)
1904			phy->service |= 0x80;
1905		phy->len = cpu_to_le16((u16)count);
1906	} else {
1907		phy->service = 0x00;
1908		phy->len = cpu_to_le16((u16)frame_length);
1909	}
1910}
1911
1912/*
1913 * Description: Read a byte from BASEBAND, by embedded programming
1914 *
1915 * Parameters:
1916 *  In:
1917 *      dwIoBase    - I/O base address
1918 *      byBBAddr    - address of register in Baseband
1919 *  Out:
1920 *      pbyData     - data read
1921 *
1922 * Return Value: true if succeeded; false if failed.
1923 *
1924 */
1925bool BBbReadEmbedded(struct vnt_private *priv,
1926		     unsigned char byBBAddr, unsigned char *pbyData)
1927{
1928	void __iomem *dwIoBase = priv->PortOffset;
1929	unsigned short ww;
1930	unsigned char byValue;
1931
1932	/* BB reg offset */
1933	VNSvOutPortB(dwIoBase + MAC_REG_BBREGADR, byBBAddr);
1934
1935	/* turn on REGR */
1936	MACvRegBitsOn(dwIoBase, MAC_REG_BBREGCTL, BBREGCTL_REGR);
1937	/* W_MAX_TIMEOUT is the timeout period */
1938	for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
1939		VNSvInPortB(dwIoBase + MAC_REG_BBREGCTL, &byValue);
1940		if (byValue & BBREGCTL_DONE)
1941			break;
1942	}
1943
1944	/* get BB data */
1945	VNSvInPortB(dwIoBase + MAC_REG_BBREGDATA, pbyData);
1946
1947	if (ww == W_MAX_TIMEOUT) {
1948		DBG_PORT80(0x30);
1949		pr_debug(" DBG_PORT80(0x30)\n");
1950		return false;
1951	}
1952	return true;
1953}
1954
1955/*
1956 * Description: Write a Byte to BASEBAND, by embedded programming
1957 *
1958 * Parameters:
1959 *  In:
1960 *      dwIoBase    - I/O base address
1961 *      byBBAddr    - address of register in Baseband
1962 *      byData      - data to write
1963 *  Out:
1964 *      none
1965 *
1966 * Return Value: true if succeeded; false if failed.
1967 *
1968 */
1969bool BBbWriteEmbedded(struct vnt_private *priv,
1970		      unsigned char byBBAddr, unsigned char byData)
1971{
1972	void __iomem *dwIoBase = priv->PortOffset;
1973	unsigned short ww;
1974	unsigned char byValue;
1975
1976	/* BB reg offset */
1977	VNSvOutPortB(dwIoBase + MAC_REG_BBREGADR, byBBAddr);
1978	/* set BB data */
1979	VNSvOutPortB(dwIoBase + MAC_REG_BBREGDATA, byData);
1980
1981	/* turn on BBREGCTL_REGW */
1982	MACvRegBitsOn(dwIoBase, MAC_REG_BBREGCTL, BBREGCTL_REGW);
1983	/* W_MAX_TIMEOUT is the timeout period */
1984	for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
1985		VNSvInPortB(dwIoBase + MAC_REG_BBREGCTL, &byValue);
1986		if (byValue & BBREGCTL_DONE)
1987			break;
1988	}
1989
1990	if (ww == W_MAX_TIMEOUT) {
1991		DBG_PORT80(0x31);
1992		pr_debug(" DBG_PORT80(0x31)\n");
1993		return false;
1994	}
1995	return true;
1996}
1997
1998/*
1999 * 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 *
2009 * Return Value: true if succeeded; false if failed.
2010 *
2011 */
2012
2013bool BBbVT3253Init(struct vnt_private *priv)
2014{
2015	bool bResult = true;
2016	int        ii;
2017	void __iomem *dwIoBase = priv->PortOffset;
2018	unsigned char byRFType = priv->byRFType;
2019	unsigned char byLocalID = priv->byLocalID;
2020
2021	if (byRFType == RF_RFMD2959) {
2022		if (byLocalID <= REV_ID_VT3253_A1) {
2023			for (ii = 0; ii < CB_VT3253_INIT_FOR_RFMD; ii++)
2024				bResult &= BBbWriteEmbedded(priv,
2025					byVT3253InitTab_RFMD[ii][0],
2026					byVT3253InitTab_RFMD[ii][1]);
2027
2028		} else {
2029			for (ii = 0; ii < CB_VT3253B0_INIT_FOR_RFMD; ii++)
2030				bResult &= BBbWriteEmbedded(priv,
2031					byVT3253B0_RFMD[ii][0],
2032					byVT3253B0_RFMD[ii][1]);
2033
2034			for (ii = 0; ii < CB_VT3253B0_AGC_FOR_RFMD2959; ii++)
2035				bResult &= BBbWriteEmbedded(priv,
2036					byVT3253B0_AGC4_RFMD2959[ii][0],
2037					byVT3253B0_AGC4_RFMD2959[ii][1]);
2038
2039			VNSvOutPortD(dwIoBase + MAC_REG_ITRTMSET, 0x23);
2040			MACvRegBitsOn(dwIoBase, MAC_REG_PAPEDELAY, BIT(0));
2041		}
2042		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;
2050	} else if ((byRFType == RF_AIROHA) || (byRFType == RF_AL2230S)) {
2051		for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++)
2052			bResult &= BBbWriteEmbedded(priv,
2053				byVT3253B0_AIROHA2230[ii][0],
2054				byVT3253B0_AIROHA2230[ii][1]);
2055
2056		for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
2057			bResult &= BBbWriteEmbedded(priv,
2058				byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
2059
2060		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;
2068	} else if (byRFType == RF_UW2451) {
2069		for (ii = 0; ii < CB_VT3253B0_INIT_FOR_UW2451; ii++)
2070			bResult &= BBbWriteEmbedded(priv,
2071				byVT3253B0_UW2451[ii][0],
2072				byVT3253B0_UW2451[ii][1]);
2073
2074		for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
2075			bResult &= BBbWriteEmbedded(priv,
2076				byVT3253B0_AGC[ii][0],
2077				byVT3253B0_AGC[ii][1]);
2078
2079		VNSvOutPortB(dwIoBase + MAC_REG_ITRTMSET, 0x23);
2080		MACvRegBitsOn(dwIoBase, MAC_REG_PAPEDELAY, BIT(0));
2081
2082		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;
2090	} else if (byRFType == RF_UW2452) {
2091		for (ii = 0; ii < CB_VT3253B0_INIT_FOR_UW2451; ii++)
2092			bResult &= BBbWriteEmbedded(priv,
2093				byVT3253B0_UW2451[ii][0],
2094				byVT3253B0_UW2451[ii][1]);
2095
2096		/* Init ANT B select,TX Config CR09 = 0x61->0x45, 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted) */
2097		/*bResult &= BBbWriteEmbedded(dwIoBase,0x09,0x41);*/
2098		/* Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted) */
2099		/*bResult &= BBbWriteEmbedded(dwIoBase,0x0a,0x28);*/
2100		/* Select VC1/VC2, CR215 = 0x02->0x06 */
2101		bResult &= BBbWriteEmbedded(priv, 0xd7, 0x06);
2102
2103		/* {{RobertYu:20050125, request by Jack */
2104		bResult &= BBbWriteEmbedded(priv, 0x90, 0x20);
2105		bResult &= BBbWriteEmbedded(priv, 0x97, 0xeb);
2106		/* }} */
2107
2108		/* {{RobertYu:20050221, request by Jack */
2109		bResult &= BBbWriteEmbedded(priv, 0xa6, 0x00);
2110		bResult &= BBbWriteEmbedded(priv, 0xa8, 0x30);
2111		/* }} */
2112		bResult &= BBbWriteEmbedded(priv, 0xb0, 0x58);
2113
2114		for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
2115			bResult &= BBbWriteEmbedded(priv,
2116				byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
2117
2118		priv->abyBBVGA[0] = 0x14;
2119		priv->abyBBVGA[1] = 0x0A;
2120		priv->abyBBVGA[2] = 0x0;
2121		priv->abyBBVGA[3] = 0x0;
2122		priv->ldBmThreshold[0] = -60;
2123		priv->ldBmThreshold[1] = -50;
2124		priv->ldBmThreshold[2] = 0;
2125		priv->ldBmThreshold[3] = 0;
2126		/* }} RobertYu */
2127
2128	} else if (byRFType == RF_VT3226) {
2129		for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++)
2130			bResult &= BBbWriteEmbedded(priv,
2131				byVT3253B0_AIROHA2230[ii][0],
2132				byVT3253B0_AIROHA2230[ii][1]);
2133
2134		for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
2135			bResult &= BBbWriteEmbedded(priv,
2136				byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
2137
2138		priv->abyBBVGA[0] = 0x1C;
2139		priv->abyBBVGA[1] = 0x10;
2140		priv->abyBBVGA[2] = 0x0;
2141		priv->abyBBVGA[3] = 0x0;
2142		priv->ldBmThreshold[0] = -70;
2143		priv->ldBmThreshold[1] = -48;
2144		priv->ldBmThreshold[2] = 0;
2145		priv->ldBmThreshold[3] = 0;
2146		/* Fix VT3226 DFC system timing issue */
2147		MACvSetRFLE_LatchBase(dwIoBase);
2148		/* {{ RobertYu: 20050104 */
2149	} else if (byRFType == RF_AIROHA7230) {
2150		for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++)
2151			bResult &= BBbWriteEmbedded(priv,
2152				byVT3253B0_AIROHA2230[ii][0],
2153				byVT3253B0_AIROHA2230[ii][1]);
2154
2155
2156		/* {{ RobertYu:20050223, request by JerryChung */
2157		/* Init ANT B select,TX Config CR09 = 0x61->0x45, 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted) */
2158		/*bResult &= BBbWriteEmbedded(dwIoBase,0x09,0x41);*/
2159		/* Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted) */
2160		/*bResult &= BBbWriteEmbedded(dwIoBase,0x0a,0x28);*/
2161		/* Select VC1/VC2, CR215 = 0x02->0x06 */
2162		bResult &= BBbWriteEmbedded(priv, 0xd7, 0x06);
2163		/* }} */
2164
2165		for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
2166			bResult &= BBbWriteEmbedded(priv,
2167				byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
2168
2169		priv->abyBBVGA[0] = 0x1C;
2170		priv->abyBBVGA[1] = 0x10;
2171		priv->abyBBVGA[2] = 0x0;
2172		priv->abyBBVGA[3] = 0x0;
2173		priv->ldBmThreshold[0] = -70;
2174		priv->ldBmThreshold[1] = -48;
2175		priv->ldBmThreshold[2] = 0;
2176		priv->ldBmThreshold[3] = 0;
2177		/* }} RobertYu */
2178	} else {
2179		/* No VGA Table now */
2180		priv->bUpdateBBVGA = false;
2181		priv->abyBBVGA[0] = 0x1C;
2182	}
2183
2184	if (byLocalID > REV_ID_VT3253_A1) {
2185		BBbWriteEmbedded(priv, 0x04, 0x7F);
2186		BBbWriteEmbedded(priv, 0x0D, 0x01);
2187	}
2188
2189	return bResult;
2190}
2191
2192/*
2193 * Description: Set ShortSlotTime mode
2194 *
2195 * Parameters:
2196 *  In:
2197 *      priv     - Device Structure
2198 *  Out:
2199 *      none
2200 *
2201 * Return Value: none
2202 *
2203 */
2204void
2205BBvSetShortSlotTime(struct vnt_private *priv)
2206{
2207	unsigned char byBBRxConf = 0;
2208	unsigned char byBBVGA = 0;
2209
2210	BBbReadEmbedded(priv, 0x0A, &byBBRxConf); /* CR10 */
2211
2212	if (priv->bShortSlotTime)
2213		byBBRxConf &= 0xDF; /* 1101 1111 */
2214	else
2215		byBBRxConf |= 0x20; /* 0010 0000 */
2216
2217	/* patch for 3253B0 Baseband with Cardbus module */
2218	BBbReadEmbedded(priv, 0xE7, &byBBVGA);
2219	if (byBBVGA == priv->abyBBVGA[0])
2220		byBBRxConf |= 0x20; /* 0010 0000 */
2221
2222	BBbWriteEmbedded(priv, 0x0A, byBBRxConf); /* CR10 */
2223}
2224
2225void BBvSetVGAGainOffset(struct vnt_private *priv, unsigned char byData)
2226{
2227	unsigned char byBBRxConf = 0;
2228
2229	BBbWriteEmbedded(priv, 0xE7, byData);
2230
2231	BBbReadEmbedded(priv, 0x0A, &byBBRxConf); /* CR10 */
2232	/* patch for 3253B0 Baseband with Cardbus module */
2233	if (byData == priv->abyBBVGA[0])
2234		byBBRxConf |= 0x20; /* 0010 0000 */
2235	else if (priv->bShortSlotTime)
2236		byBBRxConf &= 0xDF; /* 1101 1111 */
2237	else
2238		byBBRxConf |= 0x20; /* 0010 0000 */
2239	priv->byBBVGACurrent = byData;
2240	BBbWriteEmbedded(priv, 0x0A, byBBRxConf); /* CR10 */
2241}
2242
2243/*
2244 * Description: Baseband SoftwareReset
2245 *
2246 * Parameters:
2247 *  In:
2248 *      dwIoBase    - I/O base address
2249 *  Out:
2250 *      none
2251 *
2252 * Return Value: none
2253 *
2254 */
2255void
2256BBvSoftwareReset(struct vnt_private *priv)
2257{
2258	BBbWriteEmbedded(priv, 0x50, 0x40);
2259	BBbWriteEmbedded(priv, 0x50, 0);
2260	BBbWriteEmbedded(priv, 0x9C, 0x01);
2261	BBbWriteEmbedded(priv, 0x9C, 0);
2262}
2263
2264/*
2265 * Description: Baseband Power Save Mode ON
2266 *
2267 * Parameters:
2268 *  In:
2269 *      dwIoBase    - I/O base address
2270 *  Out:
2271 *      none
2272 *
2273 * Return Value: none
2274 *
2275 */
2276void
2277BBvPowerSaveModeON(struct vnt_private *priv)
2278{
2279	unsigned char byOrgData;
2280
2281	BBbReadEmbedded(priv, 0x0D, &byOrgData);
2282	byOrgData |= BIT(0);
2283	BBbWriteEmbedded(priv, 0x0D, byOrgData);
2284}
2285
2286/*
2287 * Description: Baseband Power Save Mode OFF
2288 *
2289 * Parameters:
2290 *  In:
2291 *      dwIoBase    - I/O base address
2292 *  Out:
2293 *      none
2294 *
2295 * Return Value: none
2296 *
2297 */
2298void
2299BBvPowerSaveModeOFF(struct vnt_private *priv)
2300{
2301	unsigned char byOrgData;
2302
2303	BBbReadEmbedded(priv, 0x0D, &byOrgData);
2304	byOrgData &= ~(BIT(0));
2305	BBbWriteEmbedded(priv, 0x0D, byOrgData);
2306}
2307
2308/*
2309 * Description: Set Tx Antenna mode
2310 *
2311 * Parameters:
2312 *  In:
2313 *      priv          - Device Structure
2314 *      byAntennaMode    - Antenna Mode
2315 *  Out:
2316 *      none
2317 *
2318 * Return Value: none
2319 *
2320 */
2321
2322void
2323BBvSetTxAntennaMode(struct vnt_private *priv, unsigned char byAntennaMode)
2324{
2325	unsigned char byBBTxConf;
2326
2327	BBbReadEmbedded(priv, 0x09, &byBBTxConf); /* CR09 */
2328	if (byAntennaMode == ANT_DIVERSITY) {
2329		/* bit 1 is diversity */
2330		byBBTxConf |= 0x02;
2331	} else if (byAntennaMode == ANT_A) {
2332		/* bit 2 is ANTSEL */
2333		byBBTxConf &= 0xF9; /* 1111 1001 */
2334	} else if (byAntennaMode == ANT_B) {
2335		byBBTxConf &= 0xFD; /* 1111 1101 */
2336		byBBTxConf |= 0x04;
2337	}
2338	BBbWriteEmbedded(priv, 0x09, byBBTxConf); /* CR09 */
2339}
2340
2341/*
2342 * Description: Set Rx Antenna mode
2343 *
2344 * Parameters:
2345 *  In:
2346 *      priv          - Device Structure
2347 *      byAntennaMode    - Antenna Mode
2348 *  Out:
2349 *      none
2350 *
2351 * Return Value: none
2352 *
2353 */
2354
2355void
2356BBvSetRxAntennaMode(struct vnt_private *priv, unsigned char byAntennaMode)
2357{
2358	unsigned char byBBRxConf;
2359
2360	BBbReadEmbedded(priv, 0x0A, &byBBRxConf); /* CR10 */
2361	if (byAntennaMode == ANT_DIVERSITY) {
2362		byBBRxConf |= 0x01;
2363
2364	} else if (byAntennaMode == ANT_A) {
2365		byBBRxConf &= 0xFC; /* 1111 1100 */
2366	} else if (byAntennaMode == ANT_B) {
2367		byBBRxConf &= 0xFE; /* 1111 1110 */
2368		byBBRxConf |= 0x02;
2369	}
2370	BBbWriteEmbedded(priv, 0x0A, byBBRxConf); /* CR10 */
2371}
2372
2373/*
2374 * Description: BBvSetDeepSleep
2375 *
2376 * Parameters:
2377 *  In:
2378 *      priv          - Device Structure
2379 *  Out:
2380 *      none
2381 *
2382 * Return Value: none
2383 *
2384 */
2385void
2386BBvSetDeepSleep(struct vnt_private *priv, unsigned char byLocalID)
2387{
2388	BBbWriteEmbedded(priv, 0x0C, 0x17); /* CR12 */
2389	BBbWriteEmbedded(priv, 0x0D, 0xB9); /* CR13 */
2390}
2391
2392void
2393BBvExitDeepSleep(struct vnt_private *priv, unsigned char byLocalID)
2394{
2395	BBbWriteEmbedded(priv, 0x0C, 0x00); /* CR12 */
2396	BBbWriteEmbedded(priv, 0x0D, 0x01); /* CR13 */
2397}
2398