From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 13:25:12 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 E056F106564A; Sat, 30 Jul 2011 13:25: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 CF4138FC13; Sat, 30 Jul 2011 13:25: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 p6UDPBdT001580; Sat, 30 Jul 2011 13:25:11 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UDPBkA001576; Sat, 30 Jul 2011 13:25:11 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201107301325.p6UDPBkA001576@svn.freebsd.org> From: Adrian Chadd Date: Sat, 30 Jul 2011 13:25: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: r224512 - 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: Sat, 30 Jul 2011 13:25:12 -0000 Author: adrian Date: Sat Jul 30 13:25:11 2011 New Revision: 224512 URL: http://svn.freebsd.org/changeset/base/224512 Log: Bring over AR5416 specific RX filter get/set routines. This in particular fixes radar PHY handling - on the AR5212 NIC, one enables the AR_PHY_ERR_RADAR bit in AR_PHY_ERR; the AR5416 and later also needs a bit set in AR_RX_FILTER. A follow-up commit is needed to convert the AR5416 ANI code to use this particular method, as it's currently using the AR5212 methods directly. Obtained from: Atheros Approved by: re (kib) Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c head/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.h Sat Jul 30 13:22:44 2011 (r224511) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h Sat Jul 30 13:25:11 2011 (r224512) @@ -218,6 +218,8 @@ extern HAL_BOOL ar5416ResetKeyCacheEntry extern HAL_BOOL ar5416SetKeyCacheEntry(struct ath_hal *ah, uint16_t entry, const HAL_KEYVAL *k, const uint8_t *mac, int xorKey); +extern uint32_t ar5416GetRxFilter(struct ath_hal *ah); +extern void ar5416SetRxFilter(struct ath_hal *ah, uint32_t bits); extern void ar5416StartPcuReceive(struct ath_hal *ah); extern void ar5416StopPcuReceive(struct ath_hal *ah); extern HAL_BOOL ar5416SetupRxDesc(struct ath_hal *, Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Sat Jul 30 13:22:44 2011 (r224511) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Sat Jul 30 13:25:11 2011 (r224512) @@ -117,6 +117,8 @@ ar5416InitState(struct ath_hal_5416 *ahp ah->ah_resetTxQueue = ar5416ResetTxQueue; /* Receive Functions */ + ah->ah_getRxFilter = ar5416GetRxFilter; + ah->ah_setRxFilter = ar5416SetRxFilter; ah->ah_startPcuReceive = ar5416StartPcuReceive; ah->ah_stopPcuReceive = ar5416StopPcuReceive; ah->ah_setupRxDesc = ar5416SetupRxDesc; Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c Sat Jul 30 13:22:44 2011 (r224511) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c Sat Jul 30 13:25:11 2011 (r224512) @@ -27,6 +27,46 @@ #include "ar5416/ar5416desc.h" /* + * Get the receive filter. + */ +uint32_t +ar5416GetRxFilter(struct ath_hal *ah) +{ + uint32_t bits = OS_REG_READ(ah, AR_RX_FILTER); + uint32_t phybits = OS_REG_READ(ah, AR_PHY_ERR); + + if (phybits & AR_PHY_ERR_RADAR) + bits |= HAL_RX_FILTER_PHYRADAR; + if (phybits & (AR_PHY_ERR_OFDM_TIMING | AR_PHY_ERR_CCK_TIMING)) + bits |= HAL_RX_FILTER_PHYERR; + return bits; +} + +/* + * Set the receive filter. + */ +void +ar5416SetRxFilter(struct ath_hal *ah, u_int32_t bits) +{ + uint32_t phybits; + + OS_REG_WRITE(ah, AR_RX_FILTER, (bits & 0xffff)); + phybits = 0; + if (bits & HAL_RX_FILTER_PHYRADAR) + phybits |= AR_PHY_ERR_RADAR; + if (bits & HAL_RX_FILTER_PHYERR) + phybits |= AR_PHY_ERR_OFDM_TIMING | AR_PHY_ERR_CCK_TIMING; + OS_REG_WRITE(ah, AR_PHY_ERR, phybits); + if (phybits) { + OS_REG_WRITE(ah, AR_RXCFG, + OS_REG_READ(ah, AR_RXCFG) | AR_RXCFG_ZLFDMA); + } else { + OS_REG_WRITE(ah, AR_RXCFG, + OS_REG_READ(ah, AR_RXCFG) &~ AR_RXCFG_ZLFDMA); + } +} + +/* * Start receive at the PCU engine */ void