ar9285_reset.c (220539) | ar9285_reset.c (220590) |
---|---|
1/* 2 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 3 * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 * | 1/* 2 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 3 * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 * |
17 * $FreeBSD: head/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c 220539 2011-04-11 11:15:34Z adrian $ | 17 * $FreeBSD: head/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c 220590 2011-04-13 04:40:59Z adrian $ |
18 */ 19 20/* 21 * This is almost the same as ar5416_reset.c but uses the v4k EEPROM and 22 * supports only 2Ghz operation. 23 */ 24 25#include "opt_ah.h" --- 4 unchanged lines hidden (view full) --- 30 31#include "ah_eeprom_v14.h" 32#include "ah_eeprom_v4k.h" 33 34#include "ar9002/ar9285.h" 35#include "ar5416/ar5416.h" 36#include "ar5416/ar5416reg.h" 37#include "ar5416/ar5416phy.h" | 18 */ 19 20/* 21 * This is almost the same as ar5416_reset.c but uses the v4k EEPROM and 22 * supports only 2Ghz operation. 23 */ 24 25#include "opt_ah.h" --- 4 unchanged lines hidden (view full) --- 30 31#include "ah_eeprom_v14.h" 32#include "ah_eeprom_v4k.h" 33 34#include "ar9002/ar9285.h" 35#include "ar5416/ar5416.h" 36#include "ar5416/ar5416reg.h" 37#include "ar5416/ar5416phy.h" |
38 | 38#include "ar9002/ar9002phy.h" |
39#include "ar9002/ar9285phy.h" 40 41/* Eeprom versioning macros. Returns true if the version is equal or newer than the ver specified */ 42#define EEP_MINOR(_ah) \ 43 (AH_PRIVATE(_ah)->ah_eeversion & AR5416_EEP_VER_MINOR_MASK) 44#define IS_EEP_MINOR_V2(_ah) (EEP_MINOR(_ah) >= AR5416_EEP_MINOR_VER_2) 45#define IS_EEP_MINOR_V3(_ah) (EEP_MINOR(_ah) >= AR5416_EEP_MINOR_VER_3) 46 --- 363 unchanged lines hidden (view full) --- 410 411 if ((eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >= 412 AR5416_EEP_MINOR_VER_3) { 413 if (IEEE80211_IS_CHAN_HT40(chan)) 414 OS_REG_RMW_FIELD(ah, AR_PHY_SETTLING, 415 AR_PHY_SETTLING_SWITCH, pModal->swSettleHt40); 416 } 417 | 39#include "ar9002/ar9285phy.h" 40 41/* Eeprom versioning macros. Returns true if the version is equal or newer than the ver specified */ 42#define EEP_MINOR(_ah) \ 43 (AH_PRIVATE(_ah)->ah_eeversion & AR5416_EEP_VER_MINOR_MASK) 44#define IS_EEP_MINOR_V2(_ah) (EEP_MINOR(_ah) >= AR5416_EEP_MINOR_VER_2) 45#define IS_EEP_MINOR_V3(_ah) (EEP_MINOR(_ah) >= AR5416_EEP_MINOR_VER_3) 46 --- 363 unchanged lines hidden (view full) --- 410 411 if ((eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >= 412 AR5416_EEP_MINOR_VER_3) { 413 if (IEEE80211_IS_CHAN_HT40(chan)) 414 OS_REG_RMW_FIELD(ah, AR_PHY_SETTLING, 415 AR_PHY_SETTLING_SWITCH, pModal->swSettleHt40); 416 } 417 |
418 /* 419 * Program the CCK TX gain factor appropriately if needed. 420 * The AR9285/AR9271 has a non-constant PA tx gain behaviour 421 * for CCK versus OFDM rates; other chips deal with this 422 * differently. 423 * 424 * The mask/shift/multiply hackery is done so place the same 425 * value (bb_desired_scale) into multiple 5-bit fields. 426 * For example, AR_PHY_TX_PWRCTRL9 has bb_desired_scale written 427 * to three fields: (0..4), (5..9) and (10..14). 428 */ 429 if (AR_SREV_9271(ah) || AR_SREV_KITE(ah)) { 430 uint8_t bb_desired_scale = (pModal->bb_scale_smrt_antenna & EEP_4K_BB_DESIRED_SCALE_MASK); 431 if ((eep->baseEepHeader.txGainType == 0) && (bb_desired_scale != 0)) { 432 uint32_t pwrctrl, mask, clr; 433 434 mask = (1<<0) | (1<<5) | (1<<10) | (1<<15) | (1<<20) | (1<<25); 435 pwrctrl = mask * bb_desired_scale; 436 clr = mask * 0x1f; 437 OS_REG_RMW(ah, AR_PHY_TX_PWRCTRL8, pwrctrl, clr); 438 OS_REG_RMW(ah, AR_PHY_TX_PWRCTRL10, pwrctrl, clr); 439 OS_REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL12, pwrctrl, clr); 440 441 mask = (1<<0) | (1<<5) | (1<<15); 442 pwrctrl = mask * bb_desired_scale; 443 clr = mask * 0x1f; 444 OS_REG_RMW(ah, AR_PHY_TX_PWRCTRL9, pwrctrl, clr); 445 446 mask = (1<<0) | (1<<5); 447 pwrctrl = mask * bb_desired_scale; 448 clr = mask * 0x1f; 449 OS_REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL11, pwrctrl, clr); 450 OS_REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL13, pwrctrl, clr); 451 } 452 } 453 |
|
418 return AH_TRUE; 419} 420 421/* 422 * Helper functions common for AP/CB/XB 423 */ 424 425static HAL_BOOL --- 475 unchanged lines hidden --- | 454 return AH_TRUE; 455} 456 457/* 458 * Helper functions common for AP/CB/XB 459 */ 460 461static HAL_BOOL --- 475 unchanged lines hidden --- |