diff --git a/sys/dev/ath/ath_hal/ah_internal.h b/sys/dev/ath/ath_hal/ah_internal.h index 2caf5cc581ac..2ddb2b462446 100644 --- a/sys/dev/ath/ath_hal/ah_internal.h +++ b/sys/dev/ath/ath_hal/ah_internal.h @@ -408,14 +408,15 @@ extern HAL_BOOL ath_hal_getTxQProps(struct ath_hal *ah, HAL_TXQ_INFO *qInfo, const HAL_TX_QUEUE_INFO *qi); typedef enum { - HAL_ANI_PRESENT, /* is ANI support present */ - HAL_ANI_NOISE_IMMUNITY_LEVEL, /* set level */ - HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION, /* enable/disable */ - HAL_ANI_CCK_WEAK_SIGNAL_THR, /* enable/disable */ - HAL_ANI_FIRSTEP_LEVEL, /* set level */ - HAL_ANI_SPUR_IMMUNITY_LEVEL, /* set level */ - HAL_ANI_MODE = 6, /* 0 => manual, 1 => auto (XXX do not change) */ - HAL_ANI_PHYERR_RESET, /* reset phy error stats */ + HAL_ANI_PRESENT = 0x1, /* is ANI support present */ + HAL_ANI_NOISE_IMMUNITY_LEVEL = 0x2, /* set level */ + HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION = 0x4, /* enable/disable */ + HAL_ANI_CCK_WEAK_SIGNAL_THR = 0x8, /* enable/disable */ + HAL_ANI_FIRSTEP_LEVEL = 0x10, /* set level */ + HAL_ANI_SPUR_IMMUNITY_LEVEL = 0x20, /* set level */ + HAL_ANI_MODE = 0x40, /* 0 => manual, 1 => auto (XXX do not change) */ + HAL_ANI_PHYERR_RESET =0x80, /* reset phy error stats */ + HAL_ANI_ALL = 0xff } HAL_ANI_CMD; #define HAL_SPUR_VAL_MASK 0x3FFF diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416.h b/sys/dev/ath/ath_hal/ar5416/ar5416.h index 695ccb35dab1..1aebacd934d5 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416.h +++ b/sys/dev/ath/ath_hal/ar5416/ar5416.h @@ -87,6 +87,8 @@ struct ath_hal_5416 { uint32_t ah_rx_chainmask; uint32_t ah_tx_chainmask; + HAL_ANI_CMD ah_ani_function; + struct ar5416PerCal ah_cal; /* periodic calibration state */ struct ar5416NfLimits nf_2g; diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c b/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c index f8b5a4306793..2939c245f91c 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c +++ b/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c @@ -177,7 +177,7 @@ ar5416AniControl(struct ath_hal *ah, HAL_ANI_CMD cmd, int param) OS_MARK(ah, AH_MARK_ANI_CONTROL, cmd); - switch (cmd) { + switch (cmd & AH5416(ah)->ah_ani_function) { case HAL_ANI_NOISE_IMMUNITY_LEVEL: { u_int level = param; @@ -354,13 +354,15 @@ ar5416AniOfdmErrTrigger(struct ath_hal *ah) aniState = ahp->ah_curani; params = aniState->params; /* First, raise noise immunity level, up to max */ - if (aniState->noiseImmunityLevel+1 < params->maxNoiseImmunityLevel) { + if ((AH5416(ah)->ah_ani_function & HAL_ANI_NOISE_IMMUNITY_LEVEL) && + (aniState->noiseImmunityLevel+1 < params->maxNoiseImmunityLevel)) { ar5416AniControl(ah, HAL_ANI_NOISE_IMMUNITY_LEVEL, aniState->noiseImmunityLevel + 1); return; } /* then, raise spur immunity level, up to max */ - if (aniState->spurImmunityLevel+1 < params->maxSpurImmunityLevel) { + if ((AH5416(ah)->ah_ani_function & HAL_ANI_SPUR_IMMUNITY_LEVEL) && + (aniState->spurImmunityLevel+1 < params->maxSpurImmunityLevel)) { ar5416AniControl(ah, HAL_ANI_SPUR_IMMUNITY_LEVEL, aniState->spurImmunityLevel + 1); return; diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c index f8d5bfa4d054..2fcb7de17fcd 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c +++ b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c @@ -168,6 +168,9 @@ ar5416InitState(struct ath_hal_5416 *ahp5416, uint16_t devid, HAL_SOFTC sc, */ AH5416(ah)->ah_rx_chainmask = AR5416_DEFAULT_RXCHAINMASK; AH5416(ah)->ah_tx_chainmask = AR5416_DEFAULT_TXCHAINMASK; + + /* Enable all ANI functions to begin with */ + AH5416(ah)->ah_ani_function = HAL_ANI_ALL; } uint32_t