For chips that are full reset in ar5416ChipReset(), save and restore the TSF.

Merlin (ar9280) and later were full-reset if they're doing open-loop TX
power control but the TSF wasn't being saved/restored.

Add ar5212SetTsf64() which sets the 64 bit TSF appropriately.
This commit is contained in:
Adrian Chadd 2011-03-09 04:39:35 +00:00
parent bdbd7b1333
commit beb4faf377
3 changed files with 17 additions and 0 deletions

View File

@ -462,6 +462,7 @@ extern void ar5212WriteAssocid(struct ath_hal *ah, const uint8_t *bssid,
uint16_t assocId);
extern uint32_t ar5212GetTsf32(struct ath_hal *ah);
extern uint64_t ar5212GetTsf64(struct ath_hal *ah);
extern void ar5212SetTsf64(struct ath_hal *ah, uint64_t tsf64);
extern void ar5212ResetTsf(struct ath_hal *ah);
extern void ar5212SetBasicRate(struct ath_hal *ah, HAL_RATE_SET *pSet);
extern uint32_t ar5212GetRandomSeed(struct ath_hal *ah);

View File

@ -264,6 +264,13 @@ ar5212GetTsf32(struct ath_hal *ah)
return OS_REG_READ(ah, AR_TSF_L32);
}
void
ar5212SetTsf64(struct ath_hal *ah, uint64_t tsf64)
{
OS_REG_WRITE(ah, AR_TSF_L32, tsf64 & 0xffffffff);
OS_REG_WRITE(ah, AR_TSF_U32, (tsf64 >> 32) & 0xffffffff);
}
/*
* Reset the current hardware tsf for stamlme.
*/

View File

@ -95,6 +95,7 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMODE opmode,
uint32_t powerVal, rssiThrReg;
uint32_t ackTpcPow, ctsTpcPow, chirpTpcPow;
int i;
uint64_t tsf = 0;
OS_MARK(ah, AH_MARK_RESET, bChannelChange);
@ -151,6 +152,10 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMODE opmode,
(AR_MAC_LED_ASSOC | AR_MAC_LED_MODE |
AR_MAC_LED_BLINK_THRESH_SEL | AR_MAC_LED_BLINK_SLOW);
/* For chips on which the RTC reset is done, save TSF before it gets cleared */
if (AR_SREV_MERLIN_20_OR_LATER(ah) && ath_hal_eepromGetFlag(ah, AR_EEP_OL_PWRCTRL))
tsf = ar5212GetTsf64(ah);
if (!ar5416ChipReset(ah, chan)) {
HALDEBUG(ah, HAL_DEBUG_ANY, "%s: chip reset failed\n", __func__);
FAIL(HAL_EIO);
@ -159,6 +164,10 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMODE opmode,
/* Restore bmiss rssi & count thresholds */
OS_REG_WRITE(ah, AR_RSSI_THR, rssiThrReg);
/* Restore TSF */
if (tsf)
ar5212SetTsf64(ah, tsf);
OS_MARK(ah, AH_MARK_RESET_LINE, __LINE__);
if (AR_SREV_MERLIN_10_OR_LATER(ah))
OS_REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE);