summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/conf/files2
-rw-r--r--sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c8
-rw-r--r--sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd_inc.h2
-rw-r--r--sys/contrib/dev/ath/ath_hal/ar9300/ar9300_spectral.c28
-rw-r--r--sys/modules/ath/Makefile2
5 files changed, 32 insertions, 10 deletions
diff --git a/sys/conf/files b/sys/conf/files
index 3d511db..3eb2ab5 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1058,6 +1058,8 @@ contrib/dev/ath/ath_hal/ar9300/ar9300_stub.c optional ath_hal | ath_ar9300 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
contrib/dev/ath/ath_hal/ar9300/ar9300_stub_funcs.c optional ath_hal | ath_ar9300 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
+contrib/dev/ath/ath_hal/ar9300/ar9300_spectral.c optional ath_hal | ath_ar9300 \
+ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
contrib/dev/ath/ath_hal/ar9300/ar9300_timer.c optional ath_hal | ath_ar9300 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
contrib/dev/ath/ath_hal/ar9300/ar9300_xmit.c optional ath_hal | ath_ar9300 \
diff --git a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c
index 0f817f6..d00f7c8 100644
--- a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c
+++ b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c
@@ -224,6 +224,14 @@ ar9300_attach_freebsd_ops(struct ath_hal *ah)
ah->ah_isFastClockEnabled = ar9300_is_fast_clock_enabled;
ah->ah_get11nExtBusy = ar9300_get_11n_ext_busy;
+ /* Spectral Scan Functions */
+ ah->ah_spectralConfigure = ar9300_configure_spectral_scan;
+ ah->ah_spectralGetConfig = ar9300_get_spectral_params;
+ ah->ah_spectralStart = ar9300_start_spectral_scan;
+ ah->ah_spectralStop = ar9300_stop_spectral_scan;
+ ah->ah_spectralIsEnabled = ar9300_is_spectral_enabled;
+ ah->ah_spectralIsActive = ar9300_is_spectral_active;
+
/* Key cache functions */
ah->ah_getKeyCacheSize = ar9300_get_key_cache_size;
ah->ah_resetKeyCacheEntry = ar9300_reset_key_cache_entry;
diff --git a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd_inc.h b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd_inc.h
index 6ec700f..1ad0a44 100644
--- a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd_inc.h
+++ b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd_inc.h
@@ -17,7 +17,7 @@
#define ATH_ANT_DIV_COMB 1 /* Antenna combining */
#define ATH_SUPPORT_RAW_ADC_CAPTURE 0 /* Raw ADC capture support */
#define ATH_TRAFFIC_FAST_RECOVER 0 /* XXX not sure yet */
-#define ATH_SUPPORT_SPECTRAL 0 /* Spectral scan support */
+#define ATH_SUPPORT_SPECTRAL 1 /* Spectral scan support */
#define ATH_BT_COEX 1 /* Enable BT Coex code */
#define ATH_PCIE_ERROR_MONITOR 0 /* ??? */
#define ATH_SUPPORT_CRDC 0 /* ??? */
diff --git a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_spectral.c b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_spectral.c
index 1219b77..9eda4a6 100644
--- a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_spectral.c
+++ b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_spectral.c
@@ -15,12 +15,14 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR9300
+//#ifdef AH_SUPPORT_AR9300
#include "ah.h"
#include "ah_desc.h"
#include "ah_internal.h"
+#include "ar9300_freebsd_inc.h"
+
#include "ar9300/ar9300phy.h"
#include "ar9300/ar9300.h"
#include "ar9300/ar9300reg.h"
@@ -310,7 +312,7 @@ ar9300_configure_spectral_scan(struct ath_hal *ah, HAL_SPECTRAL_PARAM *ss)
u_int32_t val, i;
struct ath_hal_9300 *ahp = AH9300(ah);
HAL_BOOL asleep = ahp->ah_chip_full_sleep;
- int16_t nf_buf[NUM_NF_READINGS];
+ int16_t nf_buf[HAL_NUM_NF_READINGS];
if ((AR_SREV_WASP(ah) || AR_SREV_SCORPION(ah)) && asleep) {
ar9300_set_power_mode(ah, HAL_PM_AWAKE, AH_TRUE);
@@ -319,7 +321,7 @@ ar9300_configure_spectral_scan(struct ath_hal *ah, HAL_SPECTRAL_PARAM *ss)
ar9300_prep_spectral_scan(ah);
if (ss->ss_spectral_pri) {
- for (i = 0; i < NUM_NF_READINGS; i++) {
+ for (i = 0; i < HAL_NUM_NF_READINGS; i++) {
nf_buf[i] = NOISE_PWR_DBM_2_INT(ss->ss_nf_cal[i]);
}
ar9300_load_nf(ah, nf_buf);
@@ -392,11 +394,17 @@ void
ar9300_get_spectral_params(struct ath_hal *ah, HAL_SPECTRAL_PARAM *ss)
{
u_int32_t val;
- HAL_CHANNEL_INTERNAL *chan = AH_PRIVATE(ah)->ah_curchan;
+ HAL_CHANNEL_INTERNAL *chan = NULL;
+ const struct ieee80211_channel *c;
int i, ichain, rx_chain_status;
struct ath_hal_9300 *ahp = AH9300(ah);
HAL_BOOL asleep = ahp->ah_chip_full_sleep;
+ c = AH_PRIVATE(ah)->ah_curchan;
+ if (c != NULL)
+ chan = ath_hal_checkchannel(ah, c);
+
+ // XXX TODO: just always wake up all chips?
if ((AR_SREV_WASP(ah) || AR_SREV_SCORPION(ah)) && asleep) {
ar9300_set_power_mode(ah, HAL_PM_AWAKE, AH_TRUE);
}
@@ -414,7 +422,7 @@ ar9300_get_spectral_params(struct ath_hal *ah, HAL_SPECTRAL_PARAM *ss)
if (chan != NULL) {
rx_chain_status = OS_REG_READ(ah, AR_PHY_RX_CHAINMASK) & 0x7;
- for (i = 0; i < NUM_NF_READINGS; i++) {
+ for (i = 0; i < HAL_NUM_NF_READINGS; i++) {
ichain = i % 3;
if (rx_chain_status & (1 << ichain)) {
ss->ss_nf_cal[i] =
@@ -550,14 +558,16 @@ u_int32_t ar9300_get_spectral_config(struct ath_hal *ah)
int16_t ar9300_get_ctl_chan_nf(struct ath_hal *ah)
{
int16_t nf;
+#if 0
struct ath_hal_private *ahpriv = AH_PRIVATE(ah);
+#endif
if ( (OS_REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) == 0) {
/* Noise floor calibration value is ready */
nf = MS(OS_REG_READ(ah, AR_PHY_CCA_0), AR_PHY_MINCCA_PWR);
} else {
/* NF calibration is not done, return nominal value */
- nf = ahpriv->nfp->nominal;
+ nf = AH9300(ah)->nfp->nominal;
}
if (nf & 0x100) {
nf = (0 - ((nf ^ 0x1ff) + 1));
@@ -568,14 +578,16 @@ int16_t ar9300_get_ctl_chan_nf(struct ath_hal *ah)
int16_t ar9300_get_ext_chan_nf(struct ath_hal *ah)
{
int16_t nf;
+#if 0
struct ath_hal_private *ahpriv = AH_PRIVATE(ah);
+#endif
if ((OS_REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) == 0) {
/* Noise floor calibration value is ready */
nf = MS(OS_REG_READ(ah, AR_PHY_EXT_CCA), AR_PHY_EXT_MINCCA_PWR);
} else {
/* NF calibration is not done, return nominal value */
- nf = ahpriv->nfp->nominal;
+ nf = AH9300(ah)->nfp->nominal;
}
if (nf & 0x100) {
nf = (0 - ((nf ^ 0x1ff) + 1));
@@ -583,6 +595,6 @@ int16_t ar9300_get_ext_chan_nf(struct ath_hal *ah)
return nf;
}
-#endif
#endif /* ATH_SUPPORT_SPECTRAL */
+//#endif
diff --git a/sys/modules/ath/Makefile b/sys/modules/ath/Makefile
index 03f00d6..d100532 100644
--- a/sys/modules/ath/Makefile
+++ b/sys/modules/ath/Makefile
@@ -131,7 +131,7 @@ SRCS+= ar9300_radio.c ar9300_xmit.c ar9300_attach.c ar9300_mci.c ar9300_stub.c
SRCS+= ar9300_xmit_ds.c ar9300_beacon.c ar9300_misc.c ar9300_recv.c
SRCS+= ar9300_stub_funcs.c ar9300_eeprom.c ar9300_paprd.c ar9300_recv_ds.c
SRCS+= ar9300_freebsd.c ar9300_phy.c ar9300_reset.c ar9300_gpio.c
-SRCS+= ar9300_power.c ar9300_timer.c
+SRCS+= ar9300_power.c ar9300_timer.c ar9300_spectral.c
# NB: rate control is bound to the driver by symbol names so only pick one
.if ${ATH_RATE} == "sample"
OpenPOWER on IntegriCloud