diff options
author | adrian <adrian@FreeBSD.org> | 2011-08-24 00:45:53 +0000 |
---|---|---|
committer | adrian <adrian@FreeBSD.org> | 2011-08-24 00:45:53 +0000 |
commit | 27255f3ff70af7978fb31a48fb987132402949eb (patch) | |
tree | 917e2af88d37272468801a416df8f93baf7ca4a7 | |
parent | 4e8b5e7fc05010a8b3225286e7b4afc9a48351d5 (diff) | |
download | FreeBSD-src-27255f3ff70af7978fb31a48fb987132402949eb.zip FreeBSD-src-27255f3ff70af7978fb31a48fb987132402949eb.tar.gz |
TIM/Timer fixes for AR5416 and later:
* Fix SLEEP1/SLEEP2 register definitions; the CAB/Beacon timeout
fields have changed in AR5416 and later
* The TIM_PERIOD and DTIM_PERIOD registers are now microsecond fields,
not TU.
Obtained from: Linux ath9k, Atheros reference
Approved by: re (kib, blanket)
-rw-r--r-- | sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c | 14 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ar5416/ar5416reg.h | 8 |
2 files changed, 17 insertions, 5 deletions
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c b/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c index e4aeb8d..8a36cf5 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c +++ b/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c @@ -222,15 +222,19 @@ ar5416SetStaBeaconTimers(struct ath_hal *ah, const HAL_BEACON_STATE *bs) OS_REG_WRITE(ah, AR_NEXT_TIM, TU_TO_USEC(nextTbtt - SLEEP_SLOP)); /* cab timeout is now in 1/8 TU */ - OS_REG_WRITE(ah, AR_SLEEP1, + OS_REG_WRITE(ah, AR5416_SLEEP1, SM((CAB_TIMEOUT_VAL << 3), AR5416_SLEEP1_CAB_TIMEOUT) - | AR_SLEEP1_ASSUME_DTIM); + | AR5416_SLEEP1_ASSUME_DTIM); + + /* XXX autosleep? Use min beacon timeout; check ath9k -adrian */ /* beacon timeout is now in 1/8 TU */ - OS_REG_WRITE(ah, AR_SLEEP2, + OS_REG_WRITE(ah, AR5416_SLEEP2, SM((BEACON_TIMEOUT_VAL << 3), AR5416_SLEEP2_BEACON_TIMEOUT)); - OS_REG_WRITE(ah, AR_TIM_PERIOD, beaconintval); - OS_REG_WRITE(ah, AR_DTIM_PERIOD, dtimperiod); + /* TIM_PERIOD and DTIM_PERIOD are now in uS. */ + OS_REG_WRITE(ah, AR_TIM_PERIOD, TU_TO_USEC(beaconintval)); + OS_REG_WRITE(ah, AR_DTIM_PERIOD, TU_TO_USEC(dtimperiod)); + OS_REG_SET_BIT(ah, AR_TIMER_MODE, AR_TIMER_MODE_TBTT | AR_TIMER_MODE_TIM | AR_TIMER_MODE_DTIM); HALDEBUG(ah, HAL_DEBUG_BEACON, "%s: next DTIM %d\n", diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416reg.h b/sys/dev/ath/ath_hal/ar5416/ar5416reg.h index 561c5b4..6d1c272 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416reg.h +++ b/sys/dev/ath/ath_hal/ar5416/ar5416reg.h @@ -79,6 +79,13 @@ #endif /* AH_SUPPORT_AR9130 */ #define AR_RESET_TSF 0x8020 + +/* + * AR_SLEEP1 / AR_SLEEP2 are in the same place as in + * AR5212, however the fields have changed. + */ +#define AR5416_SLEEP1 0x80d4 +#define AR5416_SLEEP2 0x80d8 #define AR_RXFIFO_CFG 0x8114 #define AR_PHY_ERR_1 0x812c #define AR_PHY_ERR_MASK_1 0x8130 /* mask for AR_PHY_ERR_1 */ @@ -402,6 +409,7 @@ #define AR9271_AN_RF2G6_OFFS_S 20 /* Sleep control */ +#define AR5416_SLEEP1_ASSUME_DTIM 0x00080000 #define AR5416_SLEEP1_CAB_TIMEOUT 0xFFE00000 /* Cab timeout (TU) */ #define AR5416_SLEEP1_CAB_TIMEOUT_S 22 |