From owner-svn-src-head@FreeBSD.ORG Tue Oct 4 00:32:11 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 4F9E3106564A; Tue, 4 Oct 2011 00:32:11 +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 25F698FC13; Tue, 4 Oct 2011 00:32:11 +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 p940WBae034444; Tue, 4 Oct 2011 00:32:11 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p940WBY1034440; Tue, 4 Oct 2011 00:32:11 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201110040032.p940WBY1034440@svn.freebsd.org> From: Adrian Chadd Date: Tue, 4 Oct 2011 00:32:11 +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: r225957 - 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: Tue, 04 Oct 2011 00:32:11 -0000 Author: adrian Date: Tue Oct 4 00:32:10 2011 New Revision: 225957 URL: http://svn.freebsd.org/changeset/base/225957 Log: Add an AR5416 aware version of the "current RSSI" function. Pre-11n devices and AR5416 use AR_PHY(263) for current RX RSSI. AR9130 and later have a fourth calibration register (for doing ADC calibration) and thus the register has moved to AR_PHY(271). This isn't currently used by any of the active code; I'm committing this for completeness and in case any third party code attempts to use it for legacy reasons. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c head/sys/dev/ath/ath_hal/ar5416/ar5416phy.h Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.h Tue Oct 4 00:29:10 2011 (r225956) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h Tue Oct 4 00:32:10 2011 (r225957) @@ -190,6 +190,7 @@ extern void ar5416SetLedState(struct ath extern uint64_t ar5416GetTsf64(struct ath_hal *ah); extern void ar5416SetTsf64(struct ath_hal *ah, uint64_t tsf64); extern void ar5416ResetTsf(struct ath_hal *ah); +extern uint32_t ar5416GetCurRssi(struct ath_hal *ah); extern HAL_BOOL ar5416SetAntennaSwitch(struct ath_hal *, HAL_ANT_SETTING); extern HAL_BOOL ar5416SetDecompMask(struct ath_hal *, uint16_t, int); extern void ar5416SetCoverageClass(struct ath_hal *, uint8_t, int); Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Tue Oct 4 00:29:10 2011 (r225956) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Tue Oct 4 00:32:10 2011 (r225957) @@ -143,6 +143,14 @@ ar5416ResetTsf(struct ath_hal *ah) OS_REG_WRITE(ah, AR_RESET_TSF, AR_RESET_TSF_ONCE); } +uint32_t +ar5416GetCurRssi(struct ath_hal *ah) +{ + if (AR_SREV_OWL(ah)) + return (OS_REG_READ(ah, AR_PHY_CURRENT_RSSI) & 0xff); + return (OS_REG_READ(ah, AR9130_PHY_CURRENT_RSSI) & 0xff); +} + HAL_BOOL ar5416SetAntennaSwitch(struct ath_hal *ah, HAL_ANT_SETTING settings) { Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416phy.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416phy.h Tue Oct 4 00:29:10 2011 (r225956) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416phy.h Tue Oct 4 00:32:10 2011 (r225957) @@ -156,8 +156,14 @@ #define AR_PHY_CAL_MEAS_0(_i) (0x9c10 + ((_i) << 12)) #define AR_PHY_CAL_MEAS_1(_i) (0x9c14 + ((_i) << 12)) #define AR_PHY_CAL_MEAS_2(_i) (0x9c18 + ((_i) << 12)) +/* This is AR9130 and later */ #define AR_PHY_CAL_MEAS_3(_i) (0x9c1c + ((_i) << 12)) +/* + * AR5416 still uses AR_PHY(263) for current RSSI; + * AR9130 and later uses AR_PHY(271). + */ +#define AR9130_PHY_CURRENT_RSSI 0x9c3c /* rssi of current frame rx'd */ #define AR_PHY_CCA 0x9864 #define AR_PHY_MINCCA_PWR 0x0FF80000