From owner-svn-src-all@freebsd.org Fri Jul 8 22:59:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63DEAB84771; Fri, 8 Jul 2016 22:59:16 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1BA9E1593; Fri, 8 Jul 2016 22:59:16 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u68MxFIF008467; Fri, 8 Jul 2016 22:59:15 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u68MxFx7008466; Fri, 8 Jul 2016 22:59:15 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201607082259.u68MxFx7008466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 8 Jul 2016 22:59:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302468 - head/sys/contrib/dev/ath/ath_hal/ar9300 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jul 2016 22:59:16 -0000 Author: adrian Date: Fri Jul 8 22:59:15 2016 New Revision: 302468 URL: https://svnweb.freebsd.org/changeset/base/302468 Log: [ath_hal] add in locationing timer support and capabilities. * add support to read the timer and capability * add support to enable/disable the location timer. On AR9380 at least, enabling the location timer is required to make the timer tick, otherwise location packets return a timestamp of 0. However, it then makes /all/ RX packets use the RX location timestamp instead of the TSF timestamp. So, unless I find another magical way to do location timestamping, we will have to dynamically switch things on/off and ensure the TX/RX path handles the "different" timestamps correctly. Tested: * AR9380, STA mode Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c ============================================================================== --- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c Fri Jul 8 22:39:37 2016 (r302467) +++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c Fri Jul 8 22:59:15 2016 (r302468) @@ -26,7 +26,9 @@ #include "ar9300/ar9300.h" #include "ar9300/ar9300reg.h" #include "ar9300/ar9300phy.h" +#include "ar9300/ar9300desc.h" +static u_int32_t ar9300_read_loc_timer(struct ath_hal *ah); void ar9300_get_hw_hangs(struct ath_hal *ah, hal_hw_hangs_t *hangs) @@ -947,6 +949,14 @@ ar9300_get_capability(struct ath_hal *ah return (HAL_ENOTSUPP); (*result) = !! (ahp->ah_misc_mode & AR_PCU_TXOP_TBTT_LIMIT_ENA); return (HAL_OK); + case HAL_CAP_TOA_LOCATIONING: + if (capability == 0) + return HAL_OK; + if (capability == 2) { + *result = ar9300_read_loc_timer(ah); + return (HAL_OK); + } + return HAL_ENOTSUPP; default: return ath_hal_getcapability(ah, type, capability, result); } @@ -1060,6 +1070,14 @@ ar9300_set_capability(struct ath_hal *ah } return AH_TRUE; + case HAL_CAP_TOA_LOCATIONING: + if (capability == 0) + return AH_TRUE; + if (capability == 1) { + ar9300_update_loc_ctl_reg(ah, setting); + return AH_TRUE; + } + return AH_FALSE; /* fall thru... */ default: return ath_hal_setcapability(ah, type, capability, setting, status); @@ -3855,6 +3873,13 @@ ar9300SetDfs3StreamFix(struct ath_hal *a return AH_FALSE; } +static u_int32_t +ar9300_read_loc_timer(struct ath_hal *ah) +{ + + return OS_REG_READ(ah, AR_LOC_TIMER_REG); +} + HAL_BOOL ar9300_set_ctl_pwr(struct ath_hal *ah, u_int8_t *ctl_array) {