From owner-svn-src-head@FreeBSD.ORG Wed Aug 24 00:45:54 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C590106564A; Wed, 24 Aug 2011 00:45:54 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4292B8FC08; Wed, 24 Aug 2011 00:45:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7O0jsci026350; Wed, 24 Aug 2011 00:45:54 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7O0jsuR026347; Wed, 24 Aug 2011 00:45:54 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201108240045.p7O0jsuR026347@svn.freebsd.org> From: Adrian Chadd Date: Wed, 24 Aug 2011 00:45:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225125 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2011 00:45:54 -0000 Author: adrian Date: Wed Aug 24 00:45:53 2011 New Revision: 225125 URL: http://svn.freebsd.org/changeset/base/225125 Log: 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) Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c Tue Aug 23 23:33:38 2011 (r225124) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c Wed Aug 24 00:45:53 2011 (r225125) @@ -222,15 +222,19 @@ ar5416SetStaBeaconTimers(struct ath_hal 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", Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Tue Aug 23 23:33:38 2011 (r225124) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Wed Aug 24 00:45:53 2011 (r225125) @@ -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