Date: Thu, 2 Feb 2017 09:19:57 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> 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 Message-ID: <201702020919.v129Jvia090400@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702020919.v129Jvia090400>