aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/dev
diff options
context:
space:
mode:
authorAdrian Chadd <adrian@FreeBSD.org>2016-07-08 22:59:15 +0000
committerAdrian Chadd <adrian@FreeBSD.org>2016-07-08 22:59:15 +0000
commite6df5ff5446473d64d99176317066e4ccbdbdcda (patch)
tree7ac0b237f57bb7cf73ba75994a698a6ce5fb28be /sys/contrib/dev
parentb10add4ea4e92842e03d8cb2d369a064c26313af (diff)
downloadsrc-e6df5ff5446473d64d99176317066e4ccbdbdcda.tar.gz
src-e6df5ff5446473d64d99176317066e4ccbdbdcda.zip
[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
Notes
Notes: svn path=/head/; revision=302468
Diffstat (limited to 'sys/contrib/dev')
-rw-r--r--sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c
index d320df1d1e56..26ce2b03df26 100644
--- a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c
+++ b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c
@@ -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, HAL_CAPABILITY_TYPE type,
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, HAL_CAPABILITY_TYPE type,
}
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 *ah, u_int32_t val)
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)
{