Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0+
0002 /*
0003  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
0004  * All rights reserved.
0005  *
0006  * Purpose: Implement functions to access baseband
0007  *
0008  * Author: Kyle Hsu
0009  *
0010  * Date: Aug.22, 2002
0011  *
0012  * Functions:
0013  *      bb_get_frame_time    - Calculate data frame transmitting time
0014  *      bb_read_embedded     - Embedded read baseband register via MAC
0015  *      bb_write_embedded    - Embedded write baseband register via MAC
0016  *      bb_vt3253_init       - VIA VT3253 baseband chip init code
0017  *
0018  * Revision History:
0019  *      06-10-2003 Bryan YC Fan:  Re-write codes to support VT3253 spec.
0020  *      08-07-2003 Bryan YC Fan:  Add MAXIM2827/2825 and RFMD2959 support.
0021  *      08-26-2003 Kyle Hsu    :  Modify BBuGetFrameTime() and
0022  *                BBvCalculateParameter().
0023  *                                cancel the setting of MAC_REG_SOFTPWRCTL on
0024  *                BBbVT3253Init().
0025  *                                Add the comments.
0026  *      09-01-2003 Bryan YC Fan:  RF & BB tables updated.
0027  *                                Modified BBvLoopbackOn & BBvLoopbackOff().
0028  *
0029  *
0030  */
0031 
0032 #include "mac.h"
0033 #include "baseband.h"
0034 #include "srom.h"
0035 #include "rf.h"
0036 
0037 /*---------------------  Static Classes  ----------------------------*/
0038 
0039 /*---------------------  Static Variables  --------------------------*/
0040 
0041 /*---------------------  Static Functions  --------------------------*/
0042 
0043 /*---------------------  Export Variables  --------------------------*/
0044 
0045 /*---------------------  Static Definitions -------------------------*/
0046 
0047 /*---------------------  Static Classes  ----------------------------*/
0048 
0049 /*---------------------  Static Variables  --------------------------*/
0050 
0051 #define CB_VT3253_INIT_FOR_RFMD 446
0052 static const unsigned char by_vt3253_init_tab_rfmd[CB_VT3253_INIT_FOR_RFMD][2] = {
0053     {0x00, 0x30},
0054     {0x01, 0x00},
0055     {0x02, 0x00},
0056     {0x03, 0x00},
0057     {0x04, 0x00},
0058     {0x05, 0x00},
0059     {0x06, 0x00},
0060     {0x07, 0x00},
0061     {0x08, 0x70},
0062     {0x09, 0x45},
0063     {0x0a, 0x2a},
0064     {0x0b, 0x76},
0065     {0x0c, 0x00},
0066     {0x0d, 0x01},
0067     {0x0e, 0x80},
0068     {0x0f, 0x00},
0069     {0x10, 0x00},
0070     {0x11, 0x00},
0071     {0x12, 0x00},
0072     {0x13, 0x00},
0073     {0x14, 0x00},
0074     {0x15, 0x00},
0075     {0x16, 0x00},
0076     {0x17, 0x00},
0077     {0x18, 0x00},
0078     {0x19, 0x00},
0079     {0x1a, 0x00},
0080     {0x1b, 0x9d},
0081     {0x1c, 0x05},
0082     {0x1d, 0x00},
0083     {0x1e, 0x00},
0084     {0x1f, 0x00},
0085     {0x20, 0x00},
0086     {0x21, 0x00},
0087     {0x22, 0x00},
0088     {0x23, 0x00},
0089     {0x24, 0x00},
0090     {0x25, 0x4a},
0091     {0x26, 0x00},
0092     {0x27, 0x00},
0093     {0x28, 0x00},
0094     {0x29, 0x00},
0095     {0x2a, 0x00},
0096     {0x2b, 0x00},
0097     {0x2c, 0x00},
0098     {0x2d, 0xa8},
0099     {0x2e, 0x1a},
0100     {0x2f, 0x0c},
0101     {0x30, 0x26},
0102     {0x31, 0x5b},
0103     {0x32, 0x00},
0104     {0x33, 0x00},
0105     {0x34, 0x00},
0106     {0x35, 0x00},
0107     {0x36, 0xaa},
0108     {0x37, 0xaa},
0109     {0x38, 0xff},
0110     {0x39, 0xff},
0111     {0x3a, 0x00},
0112     {0x3b, 0x00},
0113     {0x3c, 0x00},
0114     {0x3d, 0x0d},
0115     {0x3e, 0x51},
0116     {0x3f, 0x04},
0117     {0x40, 0x00},
0118     {0x41, 0x08},
0119     {0x42, 0x00},
0120     {0x43, 0x08},
0121     {0x44, 0x06},
0122     {0x45, 0x14},
0123     {0x46, 0x05},
0124     {0x47, 0x08},
0125     {0x48, 0x00},
0126     {0x49, 0x00},
0127     {0x4a, 0x00},
0128     {0x4b, 0x00},
0129     {0x4c, 0x09},
0130     {0x4d, 0x80},
0131     {0x4e, 0x00},
0132     {0x4f, 0xc5},
0133     {0x50, 0x14},
0134     {0x51, 0x19},
0135     {0x52, 0x00},
0136     {0x53, 0x00},
0137     {0x54, 0x00},
0138     {0x55, 0x00},
0139     {0x56, 0x00},
0140     {0x57, 0x00},
0141     {0x58, 0x00},
0142     {0x59, 0xb0},
0143     {0x5a, 0x00},
0144     {0x5b, 0x00},
0145     {0x5c, 0x00},
0146     {0x5d, 0x00},
0147     {0x5e, 0x00},
0148     {0x5f, 0x00},
0149     {0x60, 0x44},
0150     {0x61, 0x04},
0151     {0x62, 0x00},
0152     {0x63, 0x00},
0153     {0x64, 0x00},
0154     {0x65, 0x00},
0155     {0x66, 0x04},
0156     {0x67, 0xb7},
0157     {0x68, 0x00},
0158     {0x69, 0x00},
0159     {0x6a, 0x00},
0160     {0x6b, 0x00},
0161     {0x6c, 0x00},
0162     {0x6d, 0x03},
0163     {0x6e, 0x01},
0164     {0x6f, 0x00},
0165     {0x70, 0x00},
0166     {0x71, 0x00},
0167     {0x72, 0x00},
0168     {0x73, 0x00},
0169     {0x74, 0x00},
0170     {0x75, 0x00},
0171     {0x76, 0x00},
0172     {0x77, 0x00},
0173     {0x78, 0x00},
0174     {0x79, 0x00},
0175     {0x7a, 0x00},
0176     {0x7b, 0x00},
0177     {0x7c, 0x00},
0178     {0x7d, 0x00},
0179     {0x7e, 0x00},
0180     {0x7f, 0x00},
0181     {0x80, 0x0b},
0182     {0x81, 0x00},
0183     {0x82, 0x3c},
0184     {0x83, 0x00},
0185     {0x84, 0x00},
0186     {0x85, 0x00},
0187     {0x86, 0x00},
0188     {0x87, 0x00},
0189     {0x88, 0x08},
0190     {0x89, 0x00},
0191     {0x8a, 0x08},
0192     {0x8b, 0xa6},
0193     {0x8c, 0x84},
0194     {0x8d, 0x47},
0195     {0x8e, 0xbb},
0196     {0x8f, 0x02},
0197     {0x90, 0x21},
0198     {0x91, 0x0c},
0199     {0x92, 0x04},
0200     {0x93, 0x22},
0201     {0x94, 0x00},
0202     {0x95, 0x00},
0203     {0x96, 0x00},
0204     {0x97, 0xeb},
0205     {0x98, 0x00},
0206     {0x99, 0x00},
0207     {0x9a, 0x00},
0208     {0x9b, 0x00},
0209     {0x9c, 0x00},
0210     {0x9d, 0x00},
0211     {0x9e, 0x00},
0212     {0x9f, 0x00},
0213     {0xa0, 0x00},
0214     {0xa1, 0x00},
0215     {0xa2, 0x00},
0216     {0xa3, 0x00},
0217     {0xa4, 0x00},
0218     {0xa5, 0x00},
0219     {0xa6, 0x10},
0220     {0xa7, 0x04},
0221     {0xa8, 0x10},
0222     {0xa9, 0x00},
0223     {0xaa, 0x8f},
0224     {0xab, 0x00},
0225     {0xac, 0x00},
0226     {0xad, 0x00},
0227     {0xae, 0x00},
0228     {0xaf, 0x80},
0229     {0xb0, 0x38},
0230     {0xb1, 0x00},
0231     {0xb2, 0x00},
0232     {0xb3, 0x00},
0233     {0xb4, 0xee},
0234     {0xb5, 0xff},
0235     {0xb6, 0x10},
0236     {0xb7, 0x00},
0237     {0xb8, 0x00},
0238     {0xb9, 0x00},
0239     {0xba, 0x00},
0240     {0xbb, 0x03},
0241     {0xbc, 0x00},
0242     {0xbd, 0x00},
0243     {0xbe, 0x00},
0244     {0xbf, 0x00},
0245     {0xc0, 0x10},
0246     {0xc1, 0x10},
0247     {0xc2, 0x18},
0248     {0xc3, 0x20},
0249     {0xc4, 0x10},
0250     {0xc5, 0x00},
0251     {0xc6, 0x22},
0252     {0xc7, 0x14},
0253     {0xc8, 0x0f},
0254     {0xc9, 0x08},
0255     {0xca, 0xa4},
0256     {0xcb, 0xa7},
0257     {0xcc, 0x3c},
0258     {0xcd, 0x10},
0259     {0xce, 0x20},
0260     {0xcf, 0x00},
0261     {0xd0, 0x00},
0262     {0xd1, 0x10},
0263     {0xd2, 0x00},
0264     {0xd3, 0x00},
0265     {0xd4, 0x10},
0266     {0xd5, 0x33},
0267     {0xd6, 0x70},
0268     {0xd7, 0x01},
0269     {0xd8, 0x00},
0270     {0xd9, 0x00},
0271     {0xda, 0x00},
0272     {0xdb, 0x00},
0273     {0xdc, 0x00},
0274     {0xdd, 0x00},
0275     {0xde, 0x00},
0276     {0xdf, 0x00},
0277     {0xe0, 0x00},
0278     {0xe1, 0x00},
0279     {0xe2, 0xcc},
0280     {0xe3, 0x04},
0281     {0xe4, 0x08},
0282     {0xe5, 0x10},
0283     {0xe6, 0x00},
0284     {0xe7, 0x0e},
0285     {0xe8, 0x88},
0286     {0xe9, 0xd4},
0287     {0xea, 0x05},
0288     {0xeb, 0xf0},
0289     {0xec, 0x79},
0290     {0xed, 0x0f},
0291     {0xee, 0x04},
0292     {0xef, 0x04},
0293     {0xf0, 0x00},
0294     {0xf1, 0x00},
0295     {0xf2, 0x00},
0296     {0xf3, 0x00},
0297     {0xf4, 0x00},
0298     {0xf5, 0x00},
0299     {0xf6, 0x00},
0300     {0xf7, 0x00},
0301     {0xf8, 0x00},
0302     {0xf9, 0x00},
0303     {0xF0, 0x00},
0304     {0xF1, 0xF8},
0305     {0xF0, 0x80},
0306     {0xF0, 0x00},
0307     {0xF1, 0xF4},
0308     {0xF0, 0x81},
0309     {0xF0, 0x01},
0310     {0xF1, 0xF0},
0311     {0xF0, 0x82},
0312     {0xF0, 0x02},
0313     {0xF1, 0xEC},
0314     {0xF0, 0x83},
0315     {0xF0, 0x03},
0316     {0xF1, 0xE8},
0317     {0xF0, 0x84},
0318     {0xF0, 0x04},
0319     {0xF1, 0xE4},
0320     {0xF0, 0x85},
0321     {0xF0, 0x05},
0322     {0xF1, 0xE0},
0323     {0xF0, 0x86},
0324     {0xF0, 0x06},
0325     {0xF1, 0xDC},
0326     {0xF0, 0x87},
0327     {0xF0, 0x07},
0328     {0xF1, 0xD8},
0329     {0xF0, 0x88},
0330     {0xF0, 0x08},
0331     {0xF1, 0xD4},
0332     {0xF0, 0x89},
0333     {0xF0, 0x09},
0334     {0xF1, 0xD0},
0335     {0xF0, 0x8A},
0336     {0xF0, 0x0A},
0337     {0xF1, 0xCC},
0338     {0xF0, 0x8B},
0339     {0xF0, 0x0B},
0340     {0xF1, 0xC8},
0341     {0xF0, 0x8C},
0342     {0xF0, 0x0C},
0343     {0xF1, 0xC4},
0344     {0xF0, 0x8D},
0345     {0xF0, 0x0D},
0346     {0xF1, 0xC0},
0347     {0xF0, 0x8E},
0348     {0xF0, 0x0E},
0349     {0xF1, 0xBC},
0350     {0xF0, 0x8F},
0351     {0xF0, 0x0F},
0352     {0xF1, 0xB8},
0353     {0xF0, 0x90},
0354     {0xF0, 0x10},
0355     {0xF1, 0xB4},
0356     {0xF0, 0x91},
0357     {0xF0, 0x11},
0358     {0xF1, 0xB0},
0359     {0xF0, 0x92},
0360     {0xF0, 0x12},
0361     {0xF1, 0xAC},
0362     {0xF0, 0x93},
0363     {0xF0, 0x13},
0364     {0xF1, 0xA8},
0365     {0xF0, 0x94},
0366     {0xF0, 0x14},
0367     {0xF1, 0xA4},
0368     {0xF0, 0x95},
0369     {0xF0, 0x15},
0370     {0xF1, 0xA0},
0371     {0xF0, 0x96},
0372     {0xF0, 0x16},
0373     {0xF1, 0x9C},
0374     {0xF0, 0x97},
0375     {0xF0, 0x17},
0376     {0xF1, 0x98},
0377     {0xF0, 0x98},
0378     {0xF0, 0x18},
0379     {0xF1, 0x94},
0380     {0xF0, 0x99},
0381     {0xF0, 0x19},
0382     {0xF1, 0x90},
0383     {0xF0, 0x9A},
0384     {0xF0, 0x1A},
0385     {0xF1, 0x8C},
0386     {0xF0, 0x9B},
0387     {0xF0, 0x1B},
0388     {0xF1, 0x88},
0389     {0xF0, 0x9C},
0390     {0xF0, 0x1C},
0391     {0xF1, 0x84},
0392     {0xF0, 0x9D},
0393     {0xF0, 0x1D},
0394     {0xF1, 0x80},
0395     {0xF0, 0x9E},
0396     {0xF0, 0x1E},
0397     {0xF1, 0x7C},
0398     {0xF0, 0x9F},
0399     {0xF0, 0x1F},
0400     {0xF1, 0x78},
0401     {0xF0, 0xA0},
0402     {0xF0, 0x20},
0403     {0xF1, 0x74},
0404     {0xF0, 0xA1},
0405     {0xF0, 0x21},
0406     {0xF1, 0x70},
0407     {0xF0, 0xA2},
0408     {0xF0, 0x22},
0409     {0xF1, 0x6C},
0410     {0xF0, 0xA3},
0411     {0xF0, 0x23},
0412     {0xF1, 0x68},
0413     {0xF0, 0xA4},
0414     {0xF0, 0x24},
0415     {0xF1, 0x64},
0416     {0xF0, 0xA5},
0417     {0xF0, 0x25},
0418     {0xF1, 0x60},
0419     {0xF0, 0xA6},
0420     {0xF0, 0x26},
0421     {0xF1, 0x5C},
0422     {0xF0, 0xA7},
0423     {0xF0, 0x27},
0424     {0xF1, 0x58},
0425     {0xF0, 0xA8},
0426     {0xF0, 0x28},
0427     {0xF1, 0x54},
0428     {0xF0, 0xA9},
0429     {0xF0, 0x29},
0430     {0xF1, 0x50},
0431     {0xF0, 0xAA},
0432     {0xF0, 0x2A},
0433     {0xF1, 0x4C},
0434     {0xF0, 0xAB},
0435     {0xF0, 0x2B},
0436     {0xF1, 0x48},
0437     {0xF0, 0xAC},
0438     {0xF0, 0x2C},
0439     {0xF1, 0x44},
0440     {0xF0, 0xAD},
0441     {0xF0, 0x2D},
0442     {0xF1, 0x40},
0443     {0xF0, 0xAE},
0444     {0xF0, 0x2E},
0445     {0xF1, 0x3C},
0446     {0xF0, 0xAF},
0447     {0xF0, 0x2F},
0448     {0xF1, 0x38},
0449     {0xF0, 0xB0},
0450     {0xF0, 0x30},
0451     {0xF1, 0x34},
0452     {0xF0, 0xB1},
0453     {0xF0, 0x31},
0454     {0xF1, 0x30},
0455     {0xF0, 0xB2},
0456     {0xF0, 0x32},
0457     {0xF1, 0x2C},
0458     {0xF0, 0xB3},
0459     {0xF0, 0x33},
0460     {0xF1, 0x28},
0461     {0xF0, 0xB4},
0462     {0xF0, 0x34},
0463     {0xF1, 0x24},
0464     {0xF0, 0xB5},
0465     {0xF0, 0x35},
0466     {0xF1, 0x20},
0467     {0xF0, 0xB6},
0468     {0xF0, 0x36},
0469     {0xF1, 0x1C},
0470     {0xF0, 0xB7},
0471     {0xF0, 0x37},
0472     {0xF1, 0x18},
0473     {0xF0, 0xB8},
0474     {0xF0, 0x38},
0475     {0xF1, 0x14},
0476     {0xF0, 0xB9},
0477     {0xF0, 0x39},
0478     {0xF1, 0x10},
0479     {0xF0, 0xBA},
0480     {0xF0, 0x3A},
0481     {0xF1, 0x0C},
0482     {0xF0, 0xBB},
0483     {0xF0, 0x3B},
0484     {0xF1, 0x08},
0485     {0xF0, 0x00},
0486     {0xF0, 0x3C},
0487     {0xF1, 0x04},
0488     {0xF0, 0xBD},
0489     {0xF0, 0x3D},
0490     {0xF1, 0x00},
0491     {0xF0, 0xBE},
0492     {0xF0, 0x3E},
0493     {0xF1, 0x00},
0494     {0xF0, 0xBF},
0495     {0xF0, 0x3F},
0496     {0xF1, 0x00},
0497     {0xF0, 0xC0},
0498     {0xF0, 0x00},
0499 };
0500 
0501 #define CB_VT3253B0_INIT_FOR_RFMD 256
0502 static const unsigned char byVT3253B0_RFMD[CB_VT3253B0_INIT_FOR_RFMD][2] = {
0503     {0x00, 0x31},
0504     {0x01, 0x00},
0505     {0x02, 0x00},
0506     {0x03, 0x00},
0507     {0x04, 0x00},
0508     {0x05, 0x81},
0509     {0x06, 0x00},
0510     {0x07, 0x00},
0511     {0x08, 0x38},
0512     {0x09, 0x45},
0513     {0x0a, 0x2a},
0514     {0x0b, 0x76},
0515     {0x0c, 0x00},
0516     {0x0d, 0x00},
0517     {0x0e, 0x80},
0518     {0x0f, 0x00},
0519     {0x10, 0x00},
0520     {0x11, 0x00},
0521     {0x12, 0x00},
0522     {0x13, 0x00},
0523     {0x14, 0x00},
0524     {0x15, 0x00},
0525     {0x16, 0x00},
0526     {0x17, 0x00},
0527     {0x18, 0x00},
0528     {0x19, 0x00},
0529     {0x1a, 0x00},
0530     {0x1b, 0x8e},
0531     {0x1c, 0x06},
0532     {0x1d, 0x00},
0533     {0x1e, 0x00},
0534     {0x1f, 0x00},
0535     {0x20, 0x00},
0536     {0x21, 0x00},
0537     {0x22, 0x00},
0538     {0x23, 0x00},
0539     {0x24, 0x00},
0540     {0x25, 0x4a},
0541     {0x26, 0x00},
0542     {0x27, 0x00},
0543     {0x28, 0x00},
0544     {0x29, 0x00},
0545     {0x2a, 0x00},
0546     {0x2b, 0x00},
0547     {0x2c, 0x00},
0548     {0x2d, 0x34},
0549     {0x2e, 0x18},
0550     {0x2f, 0x0c},
0551     {0x30, 0x26},
0552     {0x31, 0x5b},
0553     {0x32, 0x00},
0554     {0x33, 0x00},
0555     {0x34, 0x00},
0556     {0x35, 0x00},
0557     {0x36, 0xaa},
0558     {0x37, 0xaa},
0559     {0x38, 0xff},
0560     {0x39, 0xff},
0561     {0x3a, 0xf8},
0562     {0x3b, 0x00},
0563     {0x3c, 0x00},
0564     {0x3d, 0x09},
0565     {0x3e, 0x0d},
0566     {0x3f, 0x04},
0567     {0x40, 0x00},
0568     {0x41, 0x08},
0569     {0x42, 0x00},
0570     {0x43, 0x08},
0571     {0x44, 0x08},
0572     {0x45, 0x14},
0573     {0x46, 0x05},
0574     {0x47, 0x08},
0575     {0x48, 0x00},
0576     {0x49, 0x00},
0577     {0x4a, 0x00},
0578     {0x4b, 0x00},
0579     {0x4c, 0x09},
0580     {0x4d, 0x80},
0581     {0x4e, 0x00},
0582     {0x4f, 0xc5},
0583     {0x50, 0x14},
0584     {0x51, 0x19},
0585     {0x52, 0x00},
0586     {0x53, 0x00},
0587     {0x54, 0x00},
0588     {0x55, 0x00},
0589     {0x56, 0x00},
0590     {0x57, 0x00},
0591     {0x58, 0x00},
0592     {0x59, 0xb0},
0593     {0x5a, 0x00},
0594     {0x5b, 0x00},
0595     {0x5c, 0x00},
0596     {0x5d, 0x00},
0597     {0x5e, 0x00},
0598     {0x5f, 0x00},
0599     {0x60, 0x39},
0600     {0x61, 0x83},
0601     {0x62, 0x00},
0602     {0x63, 0x00},
0603     {0x64, 0x00},
0604     {0x65, 0x00},
0605     {0x66, 0xc0},
0606     {0x67, 0x49},
0607     {0x68, 0x00},
0608     {0x69, 0x00},
0609     {0x6a, 0x00},
0610     {0x6b, 0x00},
0611     {0x6c, 0x00},
0612     {0x6d, 0x03},
0613     {0x6e, 0x01},
0614     {0x6f, 0x00},
0615     {0x70, 0x00},
0616     {0x71, 0x00},
0617     {0x72, 0x00},
0618     {0x73, 0x00},
0619     {0x74, 0x00},
0620     {0x75, 0x00},
0621     {0x76, 0x00},
0622     {0x77, 0x00},
0623     {0x78, 0x00},
0624     {0x79, 0x00},
0625     {0x7a, 0x00},
0626     {0x7b, 0x00},
0627     {0x7c, 0x00},
0628     {0x7d, 0x00},
0629     {0x7e, 0x00},
0630     {0x7f, 0x00},
0631     {0x80, 0x89},
0632     {0x81, 0x00},
0633     {0x82, 0x0e},
0634     {0x83, 0x00},
0635     {0x84, 0x00},
0636     {0x85, 0x00},
0637     {0x86, 0x00},
0638     {0x87, 0x00},
0639     {0x88, 0x08},
0640     {0x89, 0x00},
0641     {0x8a, 0x0e},
0642     {0x8b, 0xa7},
0643     {0x8c, 0x88},
0644     {0x8d, 0x47},
0645     {0x8e, 0xaa},
0646     {0x8f, 0x02},
0647     {0x90, 0x23},
0648     {0x91, 0x0c},
0649     {0x92, 0x06},
0650     {0x93, 0x08},
0651     {0x94, 0x00},
0652     {0x95, 0x00},
0653     {0x96, 0x00},
0654     {0x97, 0xeb},
0655     {0x98, 0x00},
0656     {0x99, 0x00},
0657     {0x9a, 0x00},
0658     {0x9b, 0x00},
0659     {0x9c, 0x00},
0660     {0x9d, 0x00},
0661     {0x9e, 0x00},
0662     {0x9f, 0x00},
0663     {0xa0, 0x00},
0664     {0xa1, 0x00},
0665     {0xa2, 0x00},
0666     {0xa3, 0xcd},
0667     {0xa4, 0x07},
0668     {0xa5, 0x33},
0669     {0xa6, 0x18},
0670     {0xa7, 0x00},
0671     {0xa8, 0x18},
0672     {0xa9, 0x00},
0673     {0xaa, 0x28},
0674     {0xab, 0x00},
0675     {0xac, 0x00},
0676     {0xad, 0x00},
0677     {0xae, 0x00},
0678     {0xaf, 0x18},
0679     {0xb0, 0x38},
0680     {0xb1, 0x30},
0681     {0xb2, 0x00},
0682     {0xb3, 0x00},
0683     {0xb4, 0x00},
0684     {0xb5, 0x00},
0685     {0xb6, 0x84},
0686     {0xb7, 0xfd},
0687     {0xb8, 0x00},
0688     {0xb9, 0x00},
0689     {0xba, 0x00},
0690     {0xbb, 0x03},
0691     {0xbc, 0x00},
0692     {0xbd, 0x00},
0693     {0xbe, 0x00},
0694     {0xbf, 0x00},
0695     {0xc0, 0x10},
0696     {0xc1, 0x20},
0697     {0xc2, 0x18},
0698     {0xc3, 0x20},
0699     {0xc4, 0x10},
0700     {0xc5, 0x2c},
0701     {0xc6, 0x1e},
0702     {0xc7, 0x10},
0703     {0xc8, 0x12},
0704     {0xc9, 0x01},
0705     {0xca, 0x6f},
0706     {0xcb, 0xa7},
0707     {0xcc, 0x3c},
0708     {0xcd, 0x10},
0709     {0xce, 0x00},
0710     {0xcf, 0x22},
0711     {0xd0, 0x00},
0712     {0xd1, 0x10},
0713     {0xd2, 0x00},
0714     {0xd3, 0x00},
0715     {0xd4, 0x10},
0716     {0xd5, 0x33},
0717     {0xd6, 0x80},
0718     {0xd7, 0x21},
0719     {0xd8, 0x00},
0720     {0xd9, 0x00},
0721     {0xda, 0x00},
0722     {0xdb, 0x00},
0723     {0xdc, 0x00},
0724     {0xdd, 0x00},
0725     {0xde, 0x00},
0726     {0xdf, 0x00},
0727     {0xe0, 0x00},
0728     {0xe1, 0xB3},
0729     {0xe2, 0x00},
0730     {0xe3, 0x00},
0731     {0xe4, 0x00},
0732     {0xe5, 0x10},
0733     {0xe6, 0x00},
0734     {0xe7, 0x18},
0735     {0xe8, 0x08},
0736     {0xe9, 0xd4},
0737     {0xea, 0x00},
0738     {0xeb, 0xff},
0739     {0xec, 0x79},
0740     {0xed, 0x10},
0741     {0xee, 0x30},
0742     {0xef, 0x02},
0743     {0xf0, 0x00},
0744     {0xf1, 0x09},
0745     {0xf2, 0x00},
0746     {0xf3, 0x00},
0747     {0xf4, 0x00},
0748     {0xf5, 0x00},
0749     {0xf6, 0x00},
0750     {0xf7, 0x00},
0751     {0xf8, 0x00},
0752     {0xf9, 0x00},
0753     {0xfa, 0x00},
0754     {0xfb, 0x00},
0755     {0xfc, 0x00},
0756     {0xfd, 0x00},
0757     {0xfe, 0x00},
0758     {0xff, 0x00},
0759 };
0760 
0761 #define CB_VT3253B0_AGC_FOR_RFMD2959 195
0762 /* For RFMD2959 */
0763 static
0764 unsigned char byVT3253B0_AGC4_RFMD2959[CB_VT3253B0_AGC_FOR_RFMD2959][2] = {
0765     {0xF0, 0x00},
0766     {0xF1, 0x3E},
0767     {0xF0, 0x80},
0768     {0xF0, 0x00},
0769     {0xF1, 0x3E},
0770     {0xF0, 0x81},
0771     {0xF0, 0x01},
0772     {0xF1, 0x3E},
0773     {0xF0, 0x82},
0774     {0xF0, 0x02},
0775     {0xF1, 0x3E},
0776     {0xF0, 0x83},
0777     {0xF0, 0x03},
0778     {0xF1, 0x3B},
0779     {0xF0, 0x84},
0780     {0xF0, 0x04},
0781     {0xF1, 0x39},
0782     {0xF0, 0x85},
0783     {0xF0, 0x05},
0784     {0xF1, 0x38},
0785     {0xF0, 0x86},
0786     {0xF0, 0x06},
0787     {0xF1, 0x37},
0788     {0xF0, 0x87},
0789     {0xF0, 0x07},
0790     {0xF1, 0x36},
0791     {0xF0, 0x88},
0792     {0xF0, 0x08},
0793     {0xF1, 0x35},
0794     {0xF0, 0x89},
0795     {0xF0, 0x09},
0796     {0xF1, 0x35},
0797     {0xF0, 0x8A},
0798     {0xF0, 0x0A},
0799     {0xF1, 0x34},
0800     {0xF0, 0x8B},
0801     {0xF0, 0x0B},
0802     {0xF1, 0x34},
0803     {0xF0, 0x8C},
0804     {0xF0, 0x0C},
0805     {0xF1, 0x33},
0806     {0xF0, 0x8D},
0807     {0xF0, 0x0D},
0808     {0xF1, 0x32},
0809     {0xF0, 0x8E},
0810     {0xF0, 0x0E},
0811     {0xF1, 0x31},
0812     {0xF0, 0x8F},
0813     {0xF0, 0x0F},
0814     {0xF1, 0x30},
0815     {0xF0, 0x90},
0816     {0xF0, 0x10},
0817     {0xF1, 0x2F},
0818     {0xF0, 0x91},
0819     {0xF0, 0x11},
0820     {0xF1, 0x2F},
0821     {0xF0, 0x92},
0822     {0xF0, 0x12},
0823     {0xF1, 0x2E},
0824     {0xF0, 0x93},
0825     {0xF0, 0x13},
0826     {0xF1, 0x2D},
0827     {0xF0, 0x94},
0828     {0xF0, 0x14},
0829     {0xF1, 0x2C},
0830     {0xF0, 0x95},
0831     {0xF0, 0x15},
0832     {0xF1, 0x2B},
0833     {0xF0, 0x96},
0834     {0xF0, 0x16},
0835     {0xF1, 0x2B},
0836     {0xF0, 0x97},
0837     {0xF0, 0x17},
0838     {0xF1, 0x2A},
0839     {0xF0, 0x98},
0840     {0xF0, 0x18},
0841     {0xF1, 0x29},
0842     {0xF0, 0x99},
0843     {0xF0, 0x19},
0844     {0xF1, 0x28},
0845     {0xF0, 0x9A},
0846     {0xF0, 0x1A},
0847     {0xF1, 0x27},
0848     {0xF0, 0x9B},
0849     {0xF0, 0x1B},
0850     {0xF1, 0x26},
0851     {0xF0, 0x9C},
0852     {0xF0, 0x1C},
0853     {0xF1, 0x25},
0854     {0xF0, 0x9D},
0855     {0xF0, 0x1D},
0856     {0xF1, 0x24},
0857     {0xF0, 0x9E},
0858     {0xF0, 0x1E},
0859     {0xF1, 0x24},
0860     {0xF0, 0x9F},
0861     {0xF0, 0x1F},
0862     {0xF1, 0x23},
0863     {0xF0, 0xA0},
0864     {0xF0, 0x20},
0865     {0xF1, 0x22},
0866     {0xF0, 0xA1},
0867     {0xF0, 0x21},
0868     {0xF1, 0x21},
0869     {0xF0, 0xA2},
0870     {0xF0, 0x22},
0871     {0xF1, 0x20},
0872     {0xF0, 0xA3},
0873     {0xF0, 0x23},
0874     {0xF1, 0x20},
0875     {0xF0, 0xA4},
0876     {0xF0, 0x24},
0877     {0xF1, 0x1F},
0878     {0xF0, 0xA5},
0879     {0xF0, 0x25},
0880     {0xF1, 0x1E},
0881     {0xF0, 0xA6},
0882     {0xF0, 0x26},
0883     {0xF1, 0x1D},
0884     {0xF0, 0xA7},
0885     {0xF0, 0x27},
0886     {0xF1, 0x1C},
0887     {0xF0, 0xA8},
0888     {0xF0, 0x28},
0889     {0xF1, 0x1B},
0890     {0xF0, 0xA9},
0891     {0xF0, 0x29},
0892     {0xF1, 0x1B},
0893     {0xF0, 0xAA},
0894     {0xF0, 0x2A},
0895     {0xF1, 0x1A},
0896     {0xF0, 0xAB},
0897     {0xF0, 0x2B},
0898     {0xF1, 0x1A},
0899     {0xF0, 0xAC},
0900     {0xF0, 0x2C},
0901     {0xF1, 0x19},
0902     {0xF0, 0xAD},
0903     {0xF0, 0x2D},
0904     {0xF1, 0x18},
0905     {0xF0, 0xAE},
0906     {0xF0, 0x2E},
0907     {0xF1, 0x17},
0908     {0xF0, 0xAF},
0909     {0xF0, 0x2F},
0910     {0xF1, 0x16},
0911     {0xF0, 0xB0},
0912     {0xF0, 0x30},
0913     {0xF1, 0x15},
0914     {0xF0, 0xB1},
0915     {0xF0, 0x31},
0916     {0xF1, 0x15},
0917     {0xF0, 0xB2},
0918     {0xF0, 0x32},
0919     {0xF1, 0x15},
0920     {0xF0, 0xB3},
0921     {0xF0, 0x33},
0922     {0xF1, 0x14},
0923     {0xF0, 0xB4},
0924     {0xF0, 0x34},
0925     {0xF1, 0x13},
0926     {0xF0, 0xB5},
0927     {0xF0, 0x35},
0928     {0xF1, 0x12},
0929     {0xF0, 0xB6},
0930     {0xF0, 0x36},
0931     {0xF1, 0x11},
0932     {0xF0, 0xB7},
0933     {0xF0, 0x37},
0934     {0xF1, 0x10},
0935     {0xF0, 0xB8},
0936     {0xF0, 0x38},
0937     {0xF1, 0x0F},
0938     {0xF0, 0xB9},
0939     {0xF0, 0x39},
0940     {0xF1, 0x0E},
0941     {0xF0, 0xBA},
0942     {0xF0, 0x3A},
0943     {0xF1, 0x0D},
0944     {0xF0, 0xBB},
0945     {0xF0, 0x3B},
0946     {0xF1, 0x0C},
0947     {0xF0, 0xBC},
0948     {0xF0, 0x3C},
0949     {0xF1, 0x0B},
0950     {0xF0, 0xBD},
0951     {0xF0, 0x3D},
0952     {0xF1, 0x0B},
0953     {0xF0, 0xBE},
0954     {0xF0, 0x3E},
0955     {0xF1, 0x0A},
0956     {0xF0, 0xBF},
0957     {0xF0, 0x3F},
0958     {0xF1, 0x09},
0959     {0xF0, 0x00},
0960 };
0961 
0962 #define CB_VT3253B0_INIT_FOR_AIROHA2230 256
0963 /* For AIROHA */
0964 static
0965 unsigned char byVT3253B0_AIROHA2230[CB_VT3253B0_INIT_FOR_AIROHA2230][2] = {
0966     {0x00, 0x31},
0967     {0x01, 0x00},
0968     {0x02, 0x00},
0969     {0x03, 0x00},
0970     {0x04, 0x00},
0971     {0x05, 0x80},
0972     {0x06, 0x00},
0973     {0x07, 0x00},
0974     {0x08, 0x70},
0975     {0x09, 0x41},
0976     {0x0a, 0x2A},
0977     {0x0b, 0x76},
0978     {0x0c, 0x00},
0979     {0x0d, 0x00},
0980     {0x0e, 0x80},
0981     {0x0f, 0x00},
0982     {0x10, 0x00},
0983     {0x11, 0x00},
0984     {0x12, 0x00},
0985     {0x13, 0x00},
0986     {0x14, 0x00},
0987     {0x15, 0x00},
0988     {0x16, 0x00},
0989     {0x17, 0x00},
0990     {0x18, 0x00},
0991     {0x19, 0x00},
0992     {0x1a, 0x00},
0993     {0x1b, 0x8f},
0994     {0x1c, 0x09},
0995     {0x1d, 0x00},
0996     {0x1e, 0x00},
0997     {0x1f, 0x00},
0998     {0x20, 0x00},
0999     {0x21, 0x00},
1000     {0x22, 0x00},
1001     {0x23, 0x00},
1002     {0x24, 0x00},
1003     {0x25, 0x4a},
1004     {0x26, 0x00},
1005     {0x27, 0x00},
1006     {0x28, 0x00},
1007     {0x29, 0x00},
1008     {0x2a, 0x00},
1009     {0x2b, 0x00},
1010     {0x2c, 0x00},
1011     {0x2d, 0x4a},
1012     {0x2e, 0x00},
1013     {0x2f, 0x0a},
1014     {0x30, 0x26},
1015     {0x31, 0x5b},
1016     {0x32, 0x00},
1017     {0x33, 0x00},
1018     {0x34, 0x00},
1019     {0x35, 0x00},
1020     {0x36, 0xaa},
1021     {0x37, 0xaa},
1022     {0x38, 0xff},
1023     {0x39, 0xff},
1024     {0x3a, 0x79},
1025     {0x3b, 0x00},
1026     {0x3c, 0x00},
1027     {0x3d, 0x0b},
1028     {0x3e, 0x48},
1029     {0x3f, 0x04},
1030     {0x40, 0x00},
1031     {0x41, 0x08},
1032     {0x42, 0x00},
1033     {0x43, 0x08},
1034     {0x44, 0x08},
1035     {0x45, 0x14},
1036     {0x46, 0x05},
1037     {0x47, 0x09},
1038     {0x48, 0x00},
1039     {0x49, 0x00},
1040     {0x4a, 0x00},
1041     {0x4b, 0x00},
1042     {0x4c, 0x09},
1043     {0x4d, 0x73},
1044     {0x4e, 0x00},
1045     {0x4f, 0xc5},
1046     {0x50, 0x15},
1047     {0x51, 0x19},
1048     {0x52, 0x00},
1049     {0x53, 0x00},
1050     {0x54, 0x00},
1051     {0x55, 0x00},
1052     {0x56, 0x00},
1053     {0x57, 0x00},
1054     {0x58, 0x00},
1055     {0x59, 0xb0},
1056     {0x5a, 0x00},
1057     {0x5b, 0x00},
1058     {0x5c, 0x00},
1059     {0x5d, 0x00},
1060     {0x5e, 0x00},
1061     {0x5f, 0x00},
1062     {0x60, 0xe4},
1063     {0x61, 0x80},
1064     {0x62, 0x00},
1065     {0x63, 0x00},
1066     {0x64, 0x00},
1067     {0x65, 0x00},
1068     {0x66, 0x98},
1069     {0x67, 0x0a},
1070     {0x68, 0x00},
1071     {0x69, 0x00},
1072     {0x6a, 0x00},
1073     {0x6b, 0x00},
1074     {0x6c, 0x00}, /* RobertYu:20050125, request by JJSue */
1075     {0x6d, 0x03},
1076     {0x6e, 0x01},
1077     {0x6f, 0x00},
1078     {0x70, 0x00},
1079     {0x71, 0x00},
1080     {0x72, 0x00},
1081     {0x73, 0x00},
1082     {0x74, 0x00},
1083     {0x75, 0x00},
1084     {0x76, 0x00},
1085     {0x77, 0x00},
1086     {0x78, 0x00},
1087     {0x79, 0x00},
1088     {0x7a, 0x00},
1089     {0x7b, 0x00},
1090     {0x7c, 0x00},
1091     {0x7d, 0x00},
1092     {0x7e, 0x00},
1093     {0x7f, 0x00},
1094     {0x80, 0x8c},
1095     {0x81, 0x01},
1096     {0x82, 0x09},
1097     {0x83, 0x00},
1098     {0x84, 0x00},
1099     {0x85, 0x00},
1100     {0x86, 0x00},
1101     {0x87, 0x00},
1102     {0x88, 0x08},
1103     {0x89, 0x00},
1104     {0x8a, 0x0f},
1105     {0x8b, 0xb7},
1106     {0x8c, 0x88},
1107     {0x8d, 0x47},
1108     {0x8e, 0xaa},
1109     {0x8f, 0x02},
1110     {0x90, 0x22},
1111     {0x91, 0x00},
1112     {0x92, 0x00},
1113     {0x93, 0x00},
1114     {0x94, 0x00},
1115     {0x95, 0x00},
1116     {0x96, 0x00},
1117     {0x97, 0xeb},
1118     {0x98, 0x00},
1119     {0x99, 0x00},
1120     {0x9a, 0x00},
1121     {0x9b, 0x00},
1122     {0x9c, 0x00},
1123     {0x9d, 0x00},
1124     {0x9e, 0x00},
1125     {0x9f, 0x01},
1126     {0xa0, 0x00},
1127     {0xa1, 0x00},
1128     {0xa2, 0x00},
1129     {0xa3, 0x00},
1130     {0xa4, 0x00},
1131     {0xa5, 0x00},
1132     {0xa6, 0x10},
1133     {0xa7, 0x00},
1134     {0xa8, 0x18},
1135     {0xa9, 0x00},
1136     {0xaa, 0x00},
1137     {0xab, 0x00},
1138     {0xac, 0x00},
1139     {0xad, 0x00},
1140     {0xae, 0x00},
1141     {0xaf, 0x18},
1142     {0xb0, 0x38},
1143     {0xb1, 0x30},
1144     {0xb2, 0x00},
1145     {0xb3, 0x00},
1146     {0xb4, 0xff},
1147     {0xb5, 0x0f},
1148     {0xb6, 0xe4},
1149     {0xb7, 0xe2},
1150     {0xb8, 0x00},
1151     {0xb9, 0x00},
1152     {0xba, 0x00},
1153     {0xbb, 0x03},
1154     {0xbc, 0x01},
1155     {0xbd, 0x00},
1156     {0xbe, 0x00},
1157     {0xbf, 0x00},
1158     {0xc0, 0x18},
1159     {0xc1, 0x20},
1160     {0xc2, 0x07},
1161     {0xc3, 0x18},
1162     {0xc4, 0xff},
1163     {0xc5, 0x2c},
1164     {0xc6, 0x0c},
1165     {0xc7, 0x0a},
1166     {0xc8, 0x0e},
1167     {0xc9, 0x01},
1168     {0xca, 0x68},
1169     {0xcb, 0xa7},
1170     {0xcc, 0x3c},
1171     {0xcd, 0x10},
1172     {0xce, 0x00},
1173     {0xcf, 0x25},
1174     {0xd0, 0x40},
1175     {0xd1, 0x12},
1176     {0xd2, 0x00},
1177     {0xd3, 0x00},
1178     {0xd4, 0x10},
1179     {0xd5, 0x28},
1180     {0xd6, 0x80},
1181     {0xd7, 0x2A},
1182     {0xd8, 0x00},
1183     {0xd9, 0x00},
1184     {0xda, 0x00},
1185     {0xdb, 0x00},
1186     {0xdc, 0x00},
1187     {0xdd, 0x00},
1188     {0xde, 0x00},
1189     {0xdf, 0x00},
1190     {0xe0, 0x00},
1191     {0xe1, 0xB3},
1192     {0xe2, 0x00},
1193     {0xe3, 0x00},
1194     {0xe4, 0x00},
1195     {0xe5, 0x10},
1196     {0xe6, 0x00},
1197     {0xe7, 0x1C},
1198     {0xe8, 0x00},
1199     {0xe9, 0xf4},
1200     {0xea, 0x00},
1201     {0xeb, 0xff},
1202     {0xec, 0x79},
1203     {0xed, 0x20},
1204     {0xee, 0x30},
1205     {0xef, 0x01},
1206     {0xf0, 0x00},
1207     {0xf1, 0x3e},
1208     {0xf2, 0x00},
1209     {0xf3, 0x00},
1210     {0xf4, 0x00},
1211     {0xf5, 0x00},
1212     {0xf6, 0x00},
1213     {0xf7, 0x00},
1214     {0xf8, 0x00},
1215     {0xf9, 0x00},
1216     {0xfa, 0x00},
1217     {0xfb, 0x00},
1218     {0xfc, 0x00},
1219     {0xfd, 0x00},
1220     {0xfe, 0x00},
1221     {0xff, 0x00},
1222 };
1223 
1224 #define CB_VT3253B0_INIT_FOR_UW2451 256
1225 /* For UW2451 */
1226 static unsigned char byVT3253B0_UW2451[CB_VT3253B0_INIT_FOR_UW2451][2] = {
1227     {0x00, 0x31},
1228     {0x01, 0x00},
1229     {0x02, 0x00},
1230     {0x03, 0x00},
1231     {0x04, 0x00},
1232     {0x05, 0x81},
1233     {0x06, 0x00},
1234     {0x07, 0x00},
1235     {0x08, 0x38},
1236     {0x09, 0x45},
1237     {0x0a, 0x28},
1238     {0x0b, 0x76},
1239     {0x0c, 0x00},
1240     {0x0d, 0x00},
1241     {0x0e, 0x80},
1242     {0x0f, 0x00},
1243     {0x10, 0x00},
1244     {0x11, 0x00},
1245     {0x12, 0x00},
1246     {0x13, 0x00},
1247     {0x14, 0x00},
1248     {0x15, 0x00},
1249     {0x16, 0x00},
1250     {0x17, 0x00},
1251     {0x18, 0x00},
1252     {0x19, 0x00},
1253     {0x1a, 0x00},
1254     {0x1b, 0x8f},
1255     {0x1c, 0x0f},
1256     {0x1d, 0x00},
1257     {0x1e, 0x00},
1258     {0x1f, 0x00},
1259     {0x20, 0x00},
1260     {0x21, 0x00},
1261     {0x22, 0x00},
1262     {0x23, 0x00},
1263     {0x24, 0x00},
1264     {0x25, 0x4a},
1265     {0x26, 0x00},
1266     {0x27, 0x00},
1267     {0x28, 0x00},
1268     {0x29, 0x00},
1269     {0x2a, 0x00},
1270     {0x2b, 0x00},
1271     {0x2c, 0x00},
1272     {0x2d, 0x18},
1273     {0x2e, 0x00},
1274     {0x2f, 0x0a},
1275     {0x30, 0x26},
1276     {0x31, 0x5b},
1277     {0x32, 0x00},
1278     {0x33, 0x00},
1279     {0x34, 0x00},
1280     {0x35, 0x00},
1281     {0x36, 0xaa},
1282     {0x37, 0xaa},
1283     {0x38, 0xff},
1284     {0x39, 0xff},
1285     {0x3a, 0x00},
1286     {0x3b, 0x00},
1287     {0x3c, 0x00},
1288     {0x3d, 0x03},
1289     {0x3e, 0x1d},
1290     {0x3f, 0x04},
1291     {0x40, 0x00},
1292     {0x41, 0x08},
1293     {0x42, 0x00},
1294     {0x43, 0x08},
1295     {0x44, 0x08},
1296     {0x45, 0x14},
1297     {0x46, 0x05},
1298     {0x47, 0x09},
1299     {0x48, 0x00},
1300     {0x49, 0x00},
1301     {0x4a, 0x00},
1302     {0x4b, 0x00},
1303     {0x4c, 0x09},
1304     {0x4d, 0x90},
1305     {0x4e, 0x00},
1306     {0x4f, 0xc5},
1307     {0x50, 0x15},
1308     {0x51, 0x19},
1309     {0x52, 0x00},
1310     {0x53, 0x00},
1311     {0x54, 0x00},
1312     {0x55, 0x00},
1313     {0x56, 0x00},
1314     {0x57, 0x00},
1315     {0x58, 0x00},
1316     {0x59, 0xb0},
1317     {0x5a, 0x00},
1318     {0x5b, 0x00},
1319     {0x5c, 0x00},
1320     {0x5d, 0x00},
1321     {0x5e, 0x00},
1322     {0x5f, 0x00},
1323     {0x60, 0xb3},
1324     {0x61, 0x81},
1325     {0x62, 0x00},
1326     {0x63, 0x00},
1327     {0x64, 0x00},
1328     {0x65, 0x00},
1329     {0x66, 0x57},
1330     {0x67, 0x6c},
1331     {0x68, 0x00},
1332     {0x69, 0x00},
1333     {0x6a, 0x00},
1334     {0x6b, 0x00},
1335     {0x6c, 0x00}, /* RobertYu:20050125, request by JJSue */
1336     {0x6d, 0x03},
1337     {0x6e, 0x01},
1338     {0x6f, 0x00},
1339     {0x70, 0x00},
1340     {0x71, 0x00},
1341     {0x72, 0x00},
1342     {0x73, 0x00},
1343     {0x74, 0x00},
1344     {0x75, 0x00},
1345     {0x76, 0x00},
1346     {0x77, 0x00},
1347     {0x78, 0x00},
1348     {0x79, 0x00},
1349     {0x7a, 0x00},
1350     {0x7b, 0x00},
1351     {0x7c, 0x00},
1352     {0x7d, 0x00},
1353     {0x7e, 0x00},
1354     {0x7f, 0x00},
1355     {0x80, 0x8c},
1356     {0x81, 0x00},
1357     {0x82, 0x0e},
1358     {0x83, 0x00},
1359     {0x84, 0x00},
1360     {0x85, 0x00},
1361     {0x86, 0x00},
1362     {0x87, 0x00},
1363     {0x88, 0x08},
1364     {0x89, 0x00},
1365     {0x8a, 0x0e},
1366     {0x8b, 0xa7},
1367     {0x8c, 0x88},
1368     {0x8d, 0x47},
1369     {0x8e, 0xaa},
1370     {0x8f, 0x02},
1371     {0x90, 0x00},
1372     {0x91, 0x00},
1373     {0x92, 0x00},
1374     {0x93, 0x00},
1375     {0x94, 0x00},
1376     {0x95, 0x00},
1377     {0x96, 0x00},
1378     {0x97, 0xe3},
1379     {0x98, 0x00},
1380     {0x99, 0x00},
1381     {0x9a, 0x00},
1382     {0x9b, 0x00},
1383     {0x9c, 0x00},
1384     {0x9d, 0x00},
1385     {0x9e, 0x00},
1386     {0x9f, 0x00},
1387     {0xa0, 0x00},
1388     {0xa1, 0x00},
1389     {0xa2, 0x00},
1390     {0xa3, 0x00},
1391     {0xa4, 0x00},
1392     {0xa5, 0x00},
1393     {0xa6, 0x10},
1394     {0xa7, 0x00},
1395     {0xa8, 0x18},
1396     {0xa9, 0x00},
1397     {0xaa, 0x00},
1398     {0xab, 0x00},
1399     {0xac, 0x00},
1400     {0xad, 0x00},
1401     {0xae, 0x00},
1402     {0xaf, 0x18},
1403     {0xb0, 0x18},
1404     {0xb1, 0x30},
1405     {0xb2, 0x00},
1406     {0xb3, 0x00},
1407     {0xb4, 0x00},
1408     {0xb5, 0x00},
1409     {0xb6, 0x00},
1410     {0xb7, 0x00},
1411     {0xb8, 0x00},
1412     {0xb9, 0x00},
1413     {0xba, 0x00},
1414     {0xbb, 0x03},
1415     {0xbc, 0x01},
1416     {0xbd, 0x00},
1417     {0xbe, 0x00},
1418     {0xbf, 0x00},
1419     {0xc0, 0x10},
1420     {0xc1, 0x20},
1421     {0xc2, 0x00},
1422     {0xc3, 0x20},
1423     {0xc4, 0x00},
1424     {0xc5, 0x2c},
1425     {0xc6, 0x1c},
1426     {0xc7, 0x10},
1427     {0xc8, 0x10},
1428     {0xc9, 0x01},
1429     {0xca, 0x68},
1430     {0xcb, 0xa7},
1431     {0xcc, 0x3c},
1432     {0xcd, 0x09},
1433     {0xce, 0x00},
1434     {0xcf, 0x20},
1435     {0xd0, 0x40},
1436     {0xd1, 0x10},
1437     {0xd2, 0x00},
1438     {0xd3, 0x00},
1439     {0xd4, 0x20},
1440     {0xd5, 0x28},
1441     {0xd6, 0xa0},
1442     {0xd7, 0x2a},
1443     {0xd8, 0x00},
1444     {0xd9, 0x00},
1445     {0xda, 0x00},
1446     {0xdb, 0x00},
1447     {0xdc, 0x00},
1448     {0xdd, 0x00},
1449     {0xde, 0x00},
1450     {0xdf, 0x00},
1451     {0xe0, 0x00},
1452     {0xe1, 0xd3},
1453     {0xe2, 0xc0},
1454     {0xe3, 0x00},
1455     {0xe4, 0x00},
1456     {0xe5, 0x10},
1457     {0xe6, 0x00},
1458     {0xe7, 0x12},
1459     {0xe8, 0x12},
1460     {0xe9, 0x34},
1461     {0xea, 0x00},
1462     {0xeb, 0xff},
1463     {0xec, 0x79},
1464     {0xed, 0x20},
1465     {0xee, 0x30},
1466     {0xef, 0x01},
1467     {0xf0, 0x00},
1468     {0xf1, 0x3e},
1469     {0xf2, 0x00},
1470     {0xf3, 0x00},
1471     {0xf4, 0x00},
1472     {0xf5, 0x00},
1473     {0xf6, 0x00},
1474     {0xf7, 0x00},
1475     {0xf8, 0x00},
1476     {0xf9, 0x00},
1477     {0xfa, 0x00},
1478     {0xfb, 0x00},
1479     {0xfc, 0x00},
1480     {0xfd, 0x00},
1481     {0xfe, 0x00},
1482     {0xff, 0x00},
1483 };
1484 
1485 #define CB_VT3253B0_AGC 193
1486 /* For AIROHA */
1487 static unsigned char byVT3253B0_AGC[CB_VT3253B0_AGC][2] = {
1488     {0xF0, 0x00},
1489     {0xF1, 0x00},
1490     {0xF0, 0x80},
1491     {0xF0, 0x01},
1492     {0xF1, 0x00},
1493     {0xF0, 0x81},
1494     {0xF0, 0x02},
1495     {0xF1, 0x02},
1496     {0xF0, 0x82},
1497     {0xF0, 0x03},
1498     {0xF1, 0x04},
1499     {0xF0, 0x83},
1500     {0xF0, 0x03},
1501     {0xF1, 0x04},
1502     {0xF0, 0x84},
1503     {0xF0, 0x04},
1504     {0xF1, 0x06},
1505     {0xF0, 0x85},
1506     {0xF0, 0x05},
1507     {0xF1, 0x06},
1508     {0xF0, 0x86},
1509     {0xF0, 0x06},
1510     {0xF1, 0x06},
1511     {0xF0, 0x87},
1512     {0xF0, 0x07},
1513     {0xF1, 0x08},
1514     {0xF0, 0x88},
1515     {0xF0, 0x08},
1516     {0xF1, 0x08},
1517     {0xF0, 0x89},
1518     {0xF0, 0x09},
1519     {0xF1, 0x0A},
1520     {0xF0, 0x8A},
1521     {0xF0, 0x0A},
1522     {0xF1, 0x0A},
1523     {0xF0, 0x8B},
1524     {0xF0, 0x0B},
1525     {0xF1, 0x0C},
1526     {0xF0, 0x8C},
1527     {0xF0, 0x0C},
1528     {0xF1, 0x0C},
1529     {0xF0, 0x8D},
1530     {0xF0, 0x0D},
1531     {0xF1, 0x0E},
1532     {0xF0, 0x8E},
1533     {0xF0, 0x0E},
1534     {0xF1, 0x0E},
1535     {0xF0, 0x8F},
1536     {0xF0, 0x0F},
1537     {0xF1, 0x10},
1538     {0xF0, 0x90},
1539     {0xF0, 0x10},
1540     {0xF1, 0x10},
1541     {0xF0, 0x91},
1542     {0xF0, 0x11},
1543     {0xF1, 0x12},
1544     {0xF0, 0x92},
1545     {0xF0, 0x12},
1546     {0xF1, 0x12},
1547     {0xF0, 0x93},
1548     {0xF0, 0x13},
1549     {0xF1, 0x14},
1550     {0xF0, 0x94},
1551     {0xF0, 0x14},
1552     {0xF1, 0x14},
1553     {0xF0, 0x95},
1554     {0xF0, 0x15},
1555     {0xF1, 0x16},
1556     {0xF0, 0x96},
1557     {0xF0, 0x16},
1558     {0xF1, 0x16},
1559     {0xF0, 0x97},
1560     {0xF0, 0x17},
1561     {0xF1, 0x18},
1562     {0xF0, 0x98},
1563     {0xF0, 0x18},
1564     {0xF1, 0x18},
1565     {0xF0, 0x99},
1566     {0xF0, 0x19},
1567     {0xF1, 0x1A},
1568     {0xF0, 0x9A},
1569     {0xF0, 0x1A},
1570     {0xF1, 0x1A},
1571     {0xF0, 0x9B},
1572     {0xF0, 0x1B},
1573     {0xF1, 0x1C},
1574     {0xF0, 0x9C},
1575     {0xF0, 0x1C},
1576     {0xF1, 0x1C},
1577     {0xF0, 0x9D},
1578     {0xF0, 0x1D},
1579     {0xF1, 0x1E},
1580     {0xF0, 0x9E},
1581     {0xF0, 0x1E},
1582     {0xF1, 0x1E},
1583     {0xF0, 0x9F},
1584     {0xF0, 0x1F},
1585     {0xF1, 0x20},
1586     {0xF0, 0xA0},
1587     {0xF0, 0x20},
1588     {0xF1, 0x20},
1589     {0xF0, 0xA1},
1590     {0xF0, 0x21},
1591     {0xF1, 0x22},
1592     {0xF0, 0xA2},
1593     {0xF0, 0x22},
1594     {0xF1, 0x22},
1595     {0xF0, 0xA3},
1596     {0xF0, 0x23},
1597     {0xF1, 0x24},
1598     {0xF0, 0xA4},
1599     {0xF0, 0x24},
1600     {0xF1, 0x24},
1601     {0xF0, 0xA5},
1602     {0xF0, 0x25},
1603     {0xF1, 0x26},
1604     {0xF0, 0xA6},
1605     {0xF0, 0x26},
1606     {0xF1, 0x26},
1607     {0xF0, 0xA7},
1608     {0xF0, 0x27},
1609     {0xF1, 0x28},
1610     {0xF0, 0xA8},
1611     {0xF0, 0x28},
1612     {0xF1, 0x28},
1613     {0xF0, 0xA9},
1614     {0xF0, 0x29},
1615     {0xF1, 0x2A},
1616     {0xF0, 0xAA},
1617     {0xF0, 0x2A},
1618     {0xF1, 0x2A},
1619     {0xF0, 0xAB},
1620     {0xF0, 0x2B},
1621     {0xF1, 0x2C},
1622     {0xF0, 0xAC},
1623     {0xF0, 0x2C},
1624     {0xF1, 0x2C},
1625     {0xF0, 0xAD},
1626     {0xF0, 0x2D},
1627     {0xF1, 0x2E},
1628     {0xF0, 0xAE},
1629     {0xF0, 0x2E},
1630     {0xF1, 0x2E},
1631     {0xF0, 0xAF},
1632     {0xF0, 0x2F},
1633     {0xF1, 0x30},
1634     {0xF0, 0xB0},
1635     {0xF0, 0x30},
1636     {0xF1, 0x30},
1637     {0xF0, 0xB1},
1638     {0xF0, 0x31},
1639     {0xF1, 0x32},
1640     {0xF0, 0xB2},
1641     {0xF0, 0x32},
1642     {0xF1, 0x32},
1643     {0xF0, 0xB3},
1644     {0xF0, 0x33},
1645     {0xF1, 0x34},
1646     {0xF0, 0xB4},
1647     {0xF0, 0x34},
1648     {0xF1, 0x34},
1649     {0xF0, 0xB5},
1650     {0xF0, 0x35},
1651     {0xF1, 0x36},
1652     {0xF0, 0xB6},
1653     {0xF0, 0x36},
1654     {0xF1, 0x36},
1655     {0xF0, 0xB7},
1656     {0xF0, 0x37},
1657     {0xF1, 0x38},
1658     {0xF0, 0xB8},
1659     {0xF0, 0x38},
1660     {0xF1, 0x38},
1661     {0xF0, 0xB9},
1662     {0xF0, 0x39},
1663     {0xF1, 0x3A},
1664     {0xF0, 0xBA},
1665     {0xF0, 0x3A},
1666     {0xF1, 0x3A},
1667     {0xF0, 0xBB},
1668     {0xF0, 0x3B},
1669     {0xF1, 0x3C},
1670     {0xF0, 0xBC},
1671     {0xF0, 0x3C},
1672     {0xF1, 0x3C},
1673     {0xF0, 0xBD},
1674     {0xF0, 0x3D},
1675     {0xF1, 0x3E},
1676     {0xF0, 0xBE},
1677     {0xF0, 0x3E},
1678     {0xF1, 0x3E},
1679     {0xF0, 0xBF},
1680     {0xF0, 0x00},
1681 };
1682 
1683 static const unsigned short awc_frame_time[MAX_RATE] = {
1684         10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216
1685 };
1686 
1687 /*---------------------  Export Variables  --------------------------*/
1688 /*
1689  * Description: Calculate data frame transmitting time
1690  *
1691  * Parameters:
1692  *  In:
1693  *      preamble_type     - Preamble Type
1694  *      by_pkt_type        - PK_TYPE_11A, PK_TYPE_11B, PK_TYPE_11GB, PK_TYPE_11GA
1695  *      cb_frame_length   - Baseband Type
1696  *      tx_rate           - Tx Rate
1697  *  Out:
1698  *
1699  * Return Value: FrameTime
1700  *
1701  */
1702 unsigned int bb_get_frame_time(unsigned char preamble_type,
1703                    unsigned char by_pkt_type,
1704                    unsigned int cb_frame_length,
1705                    unsigned short tx_rate)
1706 {
1707     unsigned int frame_time;
1708     unsigned int preamble;
1709     unsigned int tmp;
1710     unsigned int rate_idx = (unsigned int)tx_rate;
1711     unsigned int rate = 0;
1712 
1713     if (rate_idx > RATE_54M)
1714         return 0;
1715 
1716     rate = (unsigned int)awc_frame_time[rate_idx];
1717 
1718     if (rate_idx <= 3) {            /* CCK mode */
1719         if (preamble_type == PREAMBLE_SHORT)
1720             preamble = 96;
1721         else
1722             preamble = 192;
1723         frame_time = (cb_frame_length * 80) / rate;  /* ????? */
1724         tmp = (frame_time * rate) / 80;
1725         if (cb_frame_length != tmp)
1726             frame_time++;
1727 
1728         return preamble + frame_time;
1729     }
1730     frame_time = (cb_frame_length * 8 + 22) / rate; /* ???????? */
1731     tmp = ((frame_time * rate) - 22) / 8;
1732     if (cb_frame_length != tmp)
1733         frame_time++;
1734 
1735     frame_time = frame_time * 4;    /* ??????? */
1736     if (by_pkt_type != PK_TYPE_11A)
1737         frame_time += 6;     /* ?????? */
1738 
1739     return 20 + frame_time; /* ?????? */
1740 }
1741 
1742 /*
1743  * Description: Calculate Length, Service, and Signal fields of Phy for Tx
1744  *
1745  * Parameters:
1746  *  In:
1747  *      priv         - Device Structure
1748  *      frame_length   - Tx Frame Length
1749  *      tx_rate           - Tx Rate
1750  *  Out:
1751  *  struct vnt_phy_field *phy
1752  *      - pointer to Phy Length field
1753  *      - pointer to Phy Service field
1754  *      - pointer to Phy Signal field
1755  *
1756  * Return Value: none
1757  *
1758  */
1759 void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length,
1760                u16 tx_rate, u8 pkt_type, struct vnt_phy_field *phy)
1761 {
1762     u32 bit_count;
1763     u32 count = 0;
1764     u32 tmp;
1765     int ext_bit;
1766     u8 preamble_type = priv->preamble_type;
1767 
1768     bit_count = frame_length * 8;
1769     ext_bit = false;
1770 
1771     switch (tx_rate) {
1772     case RATE_1M:
1773         count = bit_count;
1774 
1775         phy->signal = 0x00;
1776 
1777         break;
1778     case RATE_2M:
1779         count = bit_count / 2;
1780 
1781         if (preamble_type == PREAMBLE_SHORT)
1782             phy->signal = 0x09;
1783         else
1784             phy->signal = 0x01;
1785 
1786         break;
1787     case RATE_5M:
1788         count = (bit_count * 10) / 55;
1789         tmp = (count * 55) / 10;
1790 
1791         if (tmp != bit_count)
1792             count++;
1793 
1794         if (preamble_type == PREAMBLE_SHORT)
1795             phy->signal = 0x0a;
1796         else
1797             phy->signal = 0x02;
1798 
1799         break;
1800     case RATE_11M:
1801         count = bit_count / 11;
1802         tmp = count * 11;
1803 
1804         if (tmp != bit_count) {
1805             count++;
1806 
1807             if ((bit_count - tmp) <= 3)
1808                 ext_bit = true;
1809         }
1810 
1811         if (preamble_type == PREAMBLE_SHORT)
1812             phy->signal = 0x0b;
1813         else
1814             phy->signal = 0x03;
1815 
1816         break;
1817     case RATE_6M:
1818         if (pkt_type == PK_TYPE_11A)
1819             phy->signal = 0x9b;
1820         else
1821             phy->signal = 0x8b;
1822 
1823         break;
1824     case RATE_9M:
1825         if (pkt_type == PK_TYPE_11A)
1826             phy->signal = 0x9f;
1827         else
1828             phy->signal = 0x8f;
1829 
1830         break;
1831     case RATE_12M:
1832         if (pkt_type == PK_TYPE_11A)
1833             phy->signal = 0x9a;
1834         else
1835             phy->signal = 0x8a;
1836 
1837         break;
1838     case RATE_18M:
1839         if (pkt_type == PK_TYPE_11A)
1840             phy->signal = 0x9e;
1841         else
1842             phy->signal = 0x8e;
1843 
1844         break;
1845     case RATE_24M:
1846         if (pkt_type == PK_TYPE_11A)
1847             phy->signal = 0x99;
1848         else
1849             phy->signal = 0x89;
1850 
1851         break;
1852     case RATE_36M:
1853         if (pkt_type == PK_TYPE_11A)
1854             phy->signal = 0x9d;
1855         else
1856             phy->signal = 0x8d;
1857 
1858         break;
1859     case RATE_48M:
1860         if (pkt_type == PK_TYPE_11A)
1861             phy->signal = 0x98;
1862         else
1863             phy->signal = 0x88;
1864 
1865         break;
1866     case RATE_54M:
1867         if (pkt_type == PK_TYPE_11A)
1868             phy->signal = 0x9c;
1869         else
1870             phy->signal = 0x8c;
1871         break;
1872     default:
1873         if (pkt_type == PK_TYPE_11A)
1874             phy->signal = 0x9c;
1875         else
1876             phy->signal = 0x8c;
1877         break;
1878     }
1879 
1880     if (pkt_type == PK_TYPE_11B) {
1881         phy->service = 0x00;
1882         if (ext_bit)
1883             phy->service |= 0x80;
1884         phy->len = cpu_to_le16((u16)count);
1885     } else {
1886         phy->service = 0x00;
1887         phy->len = cpu_to_le16((u16)frame_length);
1888     }
1889 }
1890 
1891 /*
1892  * Description: Read a byte from BASEBAND, by embedded programming
1893  *
1894  * Parameters:
1895  *  In:
1896  *      iobase      - I/O base address
1897  *      by_bb_addr  - address of register in Baseband
1898  *  Out:
1899  *      pby_data    - data read
1900  *
1901  * Return Value: true if succeeded; false if failed.
1902  *
1903  */
1904 bool bb_read_embedded(struct vnt_private *priv, unsigned char by_bb_addr,
1905               unsigned char *pby_data)
1906 {
1907     void __iomem *iobase = priv->port_offset;
1908     unsigned short ww;
1909     unsigned char by_value;
1910 
1911     /* BB reg offset */
1912     iowrite8(by_bb_addr, iobase + MAC_REG_BBREGADR);
1913 
1914     /* turn on REGR */
1915     vt6655_mac_reg_bits_on(iobase, MAC_REG_BBREGCTL, BBREGCTL_REGR);
1916     /* W_MAX_TIMEOUT is the timeout period */
1917     for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
1918         by_value = ioread8(iobase + MAC_REG_BBREGCTL);
1919         if (by_value & BBREGCTL_DONE)
1920             break;
1921     }
1922 
1923     /* get BB data */
1924     *pby_data = ioread8(iobase + MAC_REG_BBREGDATA);
1925 
1926     if (ww == W_MAX_TIMEOUT) {
1927         pr_debug(" DBG_PORT80(0x30)\n");
1928         return false;
1929     }
1930     return true;
1931 }
1932 
1933 /*
1934  * Description: Write a Byte to BASEBAND, by embedded programming
1935  *
1936  * Parameters:
1937  *  In:
1938  *      iobase      - I/O base address
1939  *      by_bb_addr  - address of register in Baseband
1940  *      by_data     - data to write
1941  *  Out:
1942  *      none
1943  *
1944  * Return Value: true if succeeded; false if failed.
1945  *
1946  */
1947 bool bb_write_embedded(struct vnt_private *priv, unsigned char by_bb_addr,
1948                unsigned char by_data)
1949 {
1950     void __iomem *iobase = priv->port_offset;
1951     unsigned short ww;
1952     unsigned char by_value;
1953 
1954     /* BB reg offset */
1955     iowrite8(by_bb_addr, iobase + MAC_REG_BBREGADR);
1956     /* set BB data */
1957     iowrite8(by_data, iobase + MAC_REG_BBREGDATA);
1958 
1959     /* turn on BBREGCTL_REGW */
1960     vt6655_mac_reg_bits_on(iobase, MAC_REG_BBREGCTL, BBREGCTL_REGW);
1961     /* W_MAX_TIMEOUT is the timeout period */
1962     for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
1963         by_value = ioread8(iobase + MAC_REG_BBREGCTL);
1964         if (by_value & BBREGCTL_DONE)
1965             break;
1966     }
1967 
1968     if (ww == W_MAX_TIMEOUT) {
1969         pr_debug(" DBG_PORT80(0x31)\n");
1970         return false;
1971     }
1972     return true;
1973 }
1974 
1975 /*
1976  * Description: VIA VT3253 Baseband chip init function
1977  *
1978  * Parameters:
1979  *  In:
1980  *      iobase      - I/O base address
1981  *      byRevId     - Revision ID
1982  *      byRFType    - RF type
1983  *  Out:
1984  *      none
1985  *
1986  * Return Value: true if succeeded; false if failed.
1987  *
1988  */
1989 
1990 bool bb_vt3253_init(struct vnt_private *priv)
1991 {
1992     bool result = true;
1993     int        ii;
1994     void __iomem *iobase = priv->port_offset;
1995     unsigned char by_rf_type = priv->byRFType;
1996     unsigned char by_local_id = priv->local_id;
1997 
1998     if (by_rf_type == RF_RFMD2959) {
1999         if (by_local_id <= REV_ID_VT3253_A1) {
2000             for (ii = 0; ii < CB_VT3253_INIT_FOR_RFMD; ii++)
2001                 result &= bb_write_embedded(priv,
2002                     by_vt3253_init_tab_rfmd[ii][0],
2003                     by_vt3253_init_tab_rfmd[ii][1]);
2004 
2005         } else {
2006             for (ii = 0; ii < CB_VT3253B0_INIT_FOR_RFMD; ii++)
2007                 result &= bb_write_embedded(priv,
2008                     byVT3253B0_RFMD[ii][0],
2009                     byVT3253B0_RFMD[ii][1]);
2010 
2011             for (ii = 0; ii < CB_VT3253B0_AGC_FOR_RFMD2959; ii++)
2012                 result &= bb_write_embedded(priv,
2013                     byVT3253B0_AGC4_RFMD2959[ii][0],
2014                     byVT3253B0_AGC4_RFMD2959[ii][1]);
2015 
2016             iowrite32(0x23, iobase + MAC_REG_ITRTMSET);
2017             vt6655_mac_reg_bits_on(iobase, MAC_REG_PAPEDELAY, BIT(0));
2018         }
2019         priv->abyBBVGA[0] = 0x18;
2020         priv->abyBBVGA[1] = 0x0A;
2021         priv->abyBBVGA[2] = 0x0;
2022         priv->abyBBVGA[3] = 0x0;
2023         priv->dbm_threshold[0] = -70;
2024         priv->dbm_threshold[1] = -50;
2025         priv->dbm_threshold[2] = 0;
2026         priv->dbm_threshold[3] = 0;
2027     } else if ((by_rf_type == RF_AIROHA) || (by_rf_type == RF_AL2230S)) {
2028         for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++)
2029             result &= bb_write_embedded(priv,
2030                 byVT3253B0_AIROHA2230[ii][0],
2031                 byVT3253B0_AIROHA2230[ii][1]);
2032 
2033         for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
2034             result &= bb_write_embedded(priv,
2035                 byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
2036 
2037         priv->abyBBVGA[0] = 0x1C;
2038         priv->abyBBVGA[1] = 0x10;
2039         priv->abyBBVGA[2] = 0x0;
2040         priv->abyBBVGA[3] = 0x0;
2041         priv->dbm_threshold[0] = -70;
2042         priv->dbm_threshold[1] = -48;
2043         priv->dbm_threshold[2] = 0;
2044         priv->dbm_threshold[3] = 0;
2045     } else if (by_rf_type == RF_UW2451) {
2046         for (ii = 0; ii < CB_VT3253B0_INIT_FOR_UW2451; ii++)
2047             result &= bb_write_embedded(priv,
2048                 byVT3253B0_UW2451[ii][0],
2049                 byVT3253B0_UW2451[ii][1]);
2050 
2051         for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
2052             result &= bb_write_embedded(priv,
2053                 byVT3253B0_AGC[ii][0],
2054                 byVT3253B0_AGC[ii][1]);
2055 
2056         iowrite8(0x23, iobase + MAC_REG_ITRTMSET);
2057         vt6655_mac_reg_bits_on(iobase, MAC_REG_PAPEDELAY, BIT(0));
2058 
2059         priv->abyBBVGA[0] = 0x14;
2060         priv->abyBBVGA[1] = 0x0A;
2061         priv->abyBBVGA[2] = 0x0;
2062         priv->abyBBVGA[3] = 0x0;
2063         priv->dbm_threshold[0] = -60;
2064         priv->dbm_threshold[1] = -50;
2065         priv->dbm_threshold[2] = 0;
2066         priv->dbm_threshold[3] = 0;
2067     } else if (by_rf_type == RF_VT3226) {
2068         for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++)
2069             result &= bb_write_embedded(priv,
2070                 byVT3253B0_AIROHA2230[ii][0],
2071                 byVT3253B0_AIROHA2230[ii][1]);
2072 
2073         for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
2074             result &= bb_write_embedded(priv,
2075                 byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
2076 
2077         priv->abyBBVGA[0] = 0x1C;
2078         priv->abyBBVGA[1] = 0x10;
2079         priv->abyBBVGA[2] = 0x0;
2080         priv->abyBBVGA[3] = 0x0;
2081         priv->dbm_threshold[0] = -70;
2082         priv->dbm_threshold[1] = -48;
2083         priv->dbm_threshold[2] = 0;
2084         priv->dbm_threshold[3] = 0;
2085         /* Fix VT3226 DFC system timing issue */
2086         MACvSetRFLE_LatchBase(iobase);
2087         /* {{ RobertYu: 20050104 */
2088     } else {
2089         /* No VGA Table now */
2090         priv->bUpdateBBVGA = false;
2091         priv->abyBBVGA[0] = 0x1C;
2092     }
2093 
2094     if (by_local_id > REV_ID_VT3253_A1) {
2095         bb_write_embedded(priv, 0x04, 0x7F);
2096         bb_write_embedded(priv, 0x0D, 0x01);
2097     }
2098 
2099     return result;
2100 }
2101 
2102 /*
2103  * Description: Set ShortSlotTime mode
2104  *
2105  * Parameters:
2106  *  In:
2107  *      priv     - Device Structure
2108  *  Out:
2109  *      none
2110  *
2111  * Return Value: none
2112  *
2113  */
2114 void
2115 bb_set_short_slot_time(struct vnt_private *priv)
2116 {
2117     unsigned char by_bb_rx_conf = 0;
2118     unsigned char by_bb_vga = 0;
2119 
2120     bb_read_embedded(priv, 0x0A, &by_bb_rx_conf); /* CR10 */
2121 
2122     if (priv->short_slot_time)
2123         by_bb_rx_conf &= 0xDF; /* 1101 1111 */
2124     else
2125         by_bb_rx_conf |= 0x20; /* 0010 0000 */
2126 
2127     /* patch for 3253B0 Baseband with Cardbus module */
2128     bb_read_embedded(priv, 0xE7, &by_bb_vga);
2129     if (by_bb_vga == priv->abyBBVGA[0])
2130         by_bb_rx_conf |= 0x20; /* 0010 0000 */
2131 
2132     bb_write_embedded(priv, 0x0A, by_bb_rx_conf); /* CR10 */
2133 }
2134 
2135 void bb_set_vga_gain_offset(struct vnt_private *priv, unsigned char by_data)
2136 {
2137     unsigned char by_bb_rx_conf = 0;
2138 
2139     bb_write_embedded(priv, 0xE7, by_data);
2140 
2141     bb_read_embedded(priv, 0x0A, &by_bb_rx_conf); /* CR10 */
2142     /* patch for 3253B0 Baseband with Cardbus module */
2143     if (by_data == priv->abyBBVGA[0])
2144         by_bb_rx_conf |= 0x20; /* 0010 0000 */
2145     else if (priv->short_slot_time)
2146         by_bb_rx_conf &= 0xDF; /* 1101 1111 */
2147     else
2148         by_bb_rx_conf |= 0x20; /* 0010 0000 */
2149     priv->byBBVGACurrent = by_data;
2150     bb_write_embedded(priv, 0x0A, by_bb_rx_conf); /* CR10 */
2151 }
2152 
2153 /*
2154  * Description: Baseband SoftwareReset
2155  *
2156  * Parameters:
2157  *  In:
2158  *      iobase      - I/O base address
2159  *  Out:
2160  *      none
2161  *
2162  * Return Value: none
2163  *
2164  */
2165 void
2166 bb_software_reset(struct vnt_private *priv)
2167 {
2168     bb_write_embedded(priv, 0x50, 0x40);
2169     bb_write_embedded(priv, 0x50, 0);
2170     bb_write_embedded(priv, 0x9C, 0x01);
2171     bb_write_embedded(priv, 0x9C, 0);
2172 }
2173 
2174 /*
2175  * Description: Baseband Power Save Mode ON
2176  *
2177  * Parameters:
2178  *  In:
2179  *      iobase      - I/O base address
2180  *  Out:
2181  *      none
2182  *
2183  * Return Value: none
2184  *
2185  */
2186 void
2187 bb_power_save_mode_on(struct vnt_private *priv)
2188 {
2189     unsigned char by_org_data;
2190 
2191     bb_read_embedded(priv, 0x0D, &by_org_data);
2192     by_org_data |= BIT(0);
2193     bb_write_embedded(priv, 0x0D, by_org_data);
2194 }
2195 
2196 /*
2197  * Description: Baseband Power Save Mode OFF
2198  *
2199  * Parameters:
2200  *  In:
2201  *      iobase      - I/O base address
2202  *  Out:
2203  *      none
2204  *
2205  * Return Value: none
2206  *
2207  */
2208 void
2209 bb_power_save_mode_off(struct vnt_private *priv)
2210 {
2211     unsigned char by_org_data;
2212 
2213     bb_read_embedded(priv, 0x0D, &by_org_data);
2214     by_org_data &= ~(BIT(0));
2215     bb_write_embedded(priv, 0x0D, by_org_data);
2216 }
2217 
2218 /*
2219  * Description: Set Tx Antenna mode
2220  *
2221  * Parameters:
2222  *  In:
2223  *      priv          - Device Structure
2224  *      by_antenna_mode    - Antenna Mode
2225  *  Out:
2226  *      none
2227  *
2228  * Return Value: none
2229  *
2230  */
2231 
2232 void
2233 bb_set_tx_antenna_mode(struct vnt_private *priv, unsigned char by_antenna_mode)
2234 {
2235     unsigned char by_bb_tx_conf;
2236 
2237     bb_read_embedded(priv, 0x09, &by_bb_tx_conf); /* CR09 */
2238     if (by_antenna_mode == ANT_DIVERSITY) {
2239         /* bit 1 is diversity */
2240         by_bb_tx_conf |= 0x02;
2241     } else if (by_antenna_mode == ANT_A) {
2242         /* bit 2 is ANTSEL */
2243         by_bb_tx_conf &= 0xF9; /* 1111 1001 */
2244     } else if (by_antenna_mode == ANT_B) {
2245         by_bb_tx_conf &= 0xFD; /* 1111 1101 */
2246         by_bb_tx_conf |= 0x04;
2247     }
2248     bb_write_embedded(priv, 0x09, by_bb_tx_conf); /* CR09 */
2249 }
2250 
2251 /*
2252  * Description: Set Rx Antenna mode
2253  *
2254  * Parameters:
2255  *  In:
2256  *      priv          - Device Structure
2257  *      by_antenna_mode   - Antenna Mode
2258  *  Out:
2259  *      none
2260  *
2261  * Return Value: none
2262  *
2263  */
2264 
2265 void
2266 bb_set_rx_antenna_mode(struct vnt_private *priv, unsigned char by_antenna_mode)
2267 {
2268     unsigned char by_bb_rx_conf;
2269 
2270     bb_read_embedded(priv, 0x0A, &by_bb_rx_conf); /* CR10 */
2271     if (by_antenna_mode == ANT_DIVERSITY) {
2272         by_bb_rx_conf |= 0x01;
2273 
2274     } else if (by_antenna_mode == ANT_A) {
2275         by_bb_rx_conf &= 0xFC; /* 1111 1100 */
2276     } else if (by_antenna_mode == ANT_B) {
2277         by_bb_rx_conf &= 0xFE; /* 1111 1110 */
2278         by_bb_rx_conf |= 0x02;
2279     }
2280     bb_write_embedded(priv, 0x0A, by_bb_rx_conf); /* CR10 */
2281 }
2282 
2283 /*
2284  * Description: bb_set_deep_sleep
2285  *
2286  * Parameters:
2287  *  In:
2288  *      priv          - Device Structure
2289  *  Out:
2290  *      none
2291  *
2292  * Return Value: none
2293  *
2294  */
2295 void
2296 bb_set_deep_sleep(struct vnt_private *priv, unsigned char by_local_id)
2297 {
2298     bb_write_embedded(priv, 0x0C, 0x17); /* CR12 */
2299     bb_write_embedded(priv, 0x0D, 0xB9); /* CR13 */
2300 }
2301