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