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