From owner-svn-src-head@freebsd.org Thu Feb 2 09:19:59 2017 Return-Path: Delivered-To: svn-src-head@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 1975FCCDFFC; Thu, 2 Feb 2017 09:19:59 +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 C735C1906; Thu, 2 Feb 2017 09:19:58 +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 v129Jv6b090404; Thu, 2 Feb 2017 09:19:57 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v129Jvia090400; Thu, 2 Feb 2017 09:19:57 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201702020919.v129Jvia090400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 2 Feb 2017 09:19:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r313091 - 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-head@freebsd.org X-Mailman-Version: 2.1.23 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: Thu, 02 Feb 2017 09:19:59 -0000 Author: adrian Date: Thu Feb 2 09:19:57 2017 New Revision: 313091 URL: https://svnweb.freebsd.org/changeset/base/313091 Log: [ath_hal] [ar9300] initial radar detection glue. * flesh out a "get default DFS parameters" routine * remove the stub that returns NULL * fix up the enable DFS method to do what FreeBSD does - specifically, allow pe_enabled to be set/cleared. This allows the radar pulse reporting code to function, but it doesn't yet do anything useful. Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.h head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_radar.c head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300phy.h Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.h ============================================================================== --- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.h Thu Feb 2 06:14:44 2017 (r313090) +++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.h Thu Feb 2 09:19:57 2017 (r313091) @@ -1489,6 +1489,7 @@ extern HAL_BOOL ar9300_radar_wait(struc extern struct dfs_pulse * ar9300_get_dfs_radars(struct ath_hal *ah, u_int32_t dfsdomain, int *numradars, struct dfs_bin5pulse **bin5pulses, int *numb5radars, HAL_PHYERR_PARAM *pe); +extern HAL_BOOL ar9300_get_default_dfs_thresh(struct ath_hal *ah, HAL_PHYERR_PARAM *pe); extern void ar9300_adjust_difs(struct ath_hal *ah, u_int32_t val); extern u_int32_t ar9300_dfs_config_fft(struct ath_hal *ah, HAL_BOOL is_enable); extern void ar9300_cac_tx_quiet(struct ath_hal *ah, HAL_BOOL enable); Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c ============================================================================== --- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c Thu Feb 2 06:14:44 2017 (r313090) +++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c Thu Feb 2 09:19:57 2017 (r313091) @@ -219,7 +219,7 @@ ar9300_attach_freebsd_ops(struct ath_hal /* DFS functions */ ah->ah_enableDfs = ar9300_enable_dfs; ah->ah_getDfsThresh = ar9300_get_dfs_thresh; - ah->ah_getDfsDefaultThresh = ar9300_freebsd_get_dfs_default_thresh; + ah->ah_getDfsDefaultThresh = ar9300_get_default_dfs_thresh; // procradarevent ah->ah_isFastClockEnabled = ar9300_is_fast_clock_enabled; ah->ah_get11nExtBusy = ar9300_get_11n_ext_busy; @@ -696,16 +696,6 @@ ar9300_freebsd_get_mib_cycle_counts(stru return (AH_FALSE); } -HAL_BOOL -ar9300_freebsd_get_dfs_default_thresh(struct ath_hal *ah, - HAL_PHYERR_PARAM *pe) -{ - - /* XXX not yet */ - - return (AH_FALSE); -} - /* * Clear multicast filter by index - from FreeBSD ar5212_recv.c */ Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_radar.c ============================================================================== --- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_radar.c Thu Feb 2 06:14:44 2017 (r313090) +++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_radar.c Thu Feb 2 09:19:57 2017 (r313091) @@ -235,7 +235,14 @@ ar9300_enable_dfs(struct ath_hal *ah, HA int reg_writes = 0; val = OS_REG_READ(ah, AR_PHY_RADAR_0); - val |= AR_PHY_RADAR_0_FFT_ENA | AR_PHY_RADAR_0_ENA; + val |= AR_PHY_RADAR_0_FFT_ENA; + + + if (pe->pe_enabled != HAL_PHYERR_PARAM_NOVAL) { + val &= ~AR_PHY_RADAR_0_ENA; + val |= SM(pe->pe_enabled, AR_PHY_RADAR_0_ENA); + } + if (pe->pe_firpwr != HAL_PHYERR_PARAM_NOVAL) { val &= ~AR_PHY_RADAR_0_FIRPWR; val |= SM(pe->pe_firpwr, AR_PHY_RADAR_0_FIRPWR); @@ -328,6 +335,7 @@ ar9300_get_dfs_thresh(struct ath_hal *ah pe->pe_height = MS(val, AR_PHY_RADAR_0_HEIGHT); pe->pe_prssi = MS(val, AR_PHY_RADAR_0_PRSSI); pe->pe_inband = MS(val, AR_PHY_RADAR_0_INBAND); + pe->pe_enabled = !! MS(val, AR_PHY_RADAR_0_ENA); val = OS_REG_READ(ah, AR_PHY_RADAR_1); @@ -425,6 +433,23 @@ ar9300_get_dfs_radars( return dfs_radars; } +HAL_BOOL +ar9300_get_default_dfs_thresh(struct ath_hal *ah, HAL_PHYERR_PARAM *pe) +{ + + pe->pe_firpwr = AR9300_DFS_FIRPWR; + pe->pe_rrssi = AR9300_DFS_RRSSI; + pe->pe_height = AR9300_DFS_HEIGHT; + pe->pe_prssi = AR9300_DFS_PRSSI; + /* see prssi comment above */ + + pe->pe_inband = AR9300_DFS_INBAND; + pe->pe_relpwr = AR9300_DFS_RELPWR; + pe->pe_relstep = AR9300_DFS_RELSTEP; + pe->pe_maxlen = AR9300_DFS_MAXLEN; + return (AH_TRUE); +} + void ar9300_adjust_difs(struct ath_hal *ah, u_int32_t val) { if (val == 0) { Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300phy.h ============================================================================== --- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300phy.h Thu Feb 2 06:14:44 2017 (r313090) +++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300phy.h Thu Feb 2 09:19:57 2017 (r313091) @@ -222,6 +222,7 @@ #define AR_PHY_TIMING5_RSSI_THR1A_ENA (0x1 << 15) /* BB_radar_detection) */ #define AR_PHY_RADAR_0_ENA 0x00000001 /* Enable radar detection */ +#define AR_PHY_RADAR_0_ENA_S 0 #define AR_PHY_RADAR_0_FFT_ENA 0x80000000 /* Enable FFT data */ #define AR_PHY_RADAR_0_INBAND 0x0000003e /* Inband pulse threshold */ #define AR_PHY_RADAR_0_INBAND_S 1