Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Dec 2015 05:36:46 +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: r291642 - in head/sys: conf contrib/dev/ath/ath_hal/ar9300 modules/ath
Message-ID:  <201512020536.tB25ak8j043325@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Wed Dec  2 05:36:45 2015
New Revision: 291642
URL: https://svnweb.freebsd.org/changeset/base/291642

Log:
  Add initial ar9300 HAL support for the spectral scan mode.

Modified:
  head/sys/conf/files
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd_inc.h
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_spectral.c
  head/sys/modules/ath/Makefile

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Wed Dec  2 05:35:04 2015	(r291641)
+++ head/sys/conf/files	Wed Dec  2 05:36:45 2015	(r291642)
@@ -1058,6 +1058,8 @@ contrib/dev/ath/ath_hal/ar9300/ar9300_st
 	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 \

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c
==============================================================================
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c	Wed Dec  2 05:35:04 2015	(r291641)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c	Wed Dec  2 05:36:45 2015	(r291642)
@@ -224,6 +224,14 @@ ar9300_attach_freebsd_ops(struct ath_hal
 	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;

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd_inc.h
==============================================================================
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd_inc.h	Wed Dec  2 05:35:04 2015	(r291641)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd_inc.h	Wed Dec  2 05:36:45 2015	(r291642)
@@ -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       /* ??? */

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_spectral.c
==============================================================================
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_spectral.c	Wed Dec  2 05:35:04 2015	(r291641)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_spectral.c	Wed Dec  2 05:36:45 2015	(r291642)
@@ -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 at
     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 at
     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_ha
 
     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(str
 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 at
 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 at
     return nf;
 }
 
-#endif
 #endif /* ATH_SUPPORT_SPECTRAL */
+//#endif
 

Modified: head/sys/modules/ath/Makefile
==============================================================================
--- head/sys/modules/ath/Makefile	Wed Dec  2 05:35:04 2015	(r291641)
+++ head/sys/modules/ath/Makefile	Wed Dec  2 05:36:45 2015	(r291642)
@@ -131,7 +131,7 @@ SRCS+= ar9300_radio.c ar9300_xmit.c ar93
 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"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512020536.tB25ak8j043325>