Author: adrian
Date: Fri Mar 11 11:35:36 2011
New Revision: 219480
URL: http://svn.freebsd.org/changeset/base/219480

Log:
  Introduce methods for the initial calibration and the new PA calibration
  routines.
  
  These are needed for the AR9285/AR2427 and AR9287 calibration routines
  which will be introducecd in a later commit.

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416.h
  head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.h

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416.h    Fri Mar 11 11:07:53 2011        
(r219479)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h    Fri Mar 11 11:35:36 2011        
(r219480)
@@ -74,6 +74,12 @@ struct ath_hal_5416 {
        void            (*ah_spurMitigate)(struct ath_hal *,
                            const struct ieee80211_channel *);
 
+       /* calibration ops */
+       HAL_BOOL        (*ah_cal_initcal)(struct ath_hal *,
+                           const struct ieee80211_channel *);
+       void            (*ah_cal_pacal)(struct ath_hal *,
+                           HAL_BOOL is_reset);
+
        /* optional open-loop tx power control related methods */
        void            (*ah_olcInit)(struct ath_hal *);
        void            (*ah_olcTempCompensation)(struct ath_hal *);

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c     Fri Mar 11 11:07:53 
2011        (r219479)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c     Fri Mar 11 11:35:36 
2011        (r219480)
@@ -178,6 +178,9 @@ ar5416InitState(struct ath_hal_5416 *ahp
        AH5416(ah)->ah_writeIni         = ar5416WriteIni;
        AH5416(ah)->ah_spurMitigate     = ar5416SpurMitigate;
 
+       /* Internal calibration ops */
+       AH5416(ah)->ah_cal_initcal      = ar5416InitCalHardware;
+
        /* Internal TX power control related operations */
        AH5416(ah)->ah_olcInit = ar5416olcInit;
        AH5416(ah)->ah_olcTempCompensation      = ar5416olcTempCompensation;

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c        Fri Mar 11 11:07:53 
2011        (r219479)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c        Fri Mar 11 11:35:36 
2011        (r219480)
@@ -183,18 +183,9 @@ ar5416RunInitCals(struct ath_hal *ah, in
 }
 #endif
 
-/*
- * Initialize Calibration infrastructure.
- */
 HAL_BOOL
-ar5416InitCal(struct ath_hal *ah, const struct ieee80211_channel *chan)
+ar5416InitCalHardware(struct ath_hal *ah, const struct ieee80211_channel *chan)
 {
-       struct ar5416PerCal *cal = &AH5416(ah)->ah_cal;
-       HAL_CHANNEL_INTERNAL *ichan;
-
-       ichan = ath_hal_checkchannel(ah, chan);
-       HALASSERT(ichan != AH_NULL);
-
        if (AR_SREV_MERLIN_10_OR_LATER(ah)) {
                /* Enable Rx Filter Cal */
                OS_REG_CLR_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC);
@@ -235,6 +226,32 @@ ar5416InitCal(struct ath_hal *ah, const 
                return AH_FALSE;
        }
 
+       return AH_TRUE;
+}
+
+/*
+ * Initialize Calibration infrastructure.
+ */
+HAL_BOOL
+ar5416InitCal(struct ath_hal *ah, const struct ieee80211_channel *chan)
+{
+       struct ar5416PerCal *cal = &AH5416(ah)->ah_cal;
+       HAL_CHANNEL_INTERNAL *ichan;
+
+       ichan = ath_hal_checkchannel(ah, chan);
+       HALASSERT(ichan != AH_NULL);
+
+       /* Do initial chipset-specific calibration */
+       if (! AH5416(ah)->ah_cal_initcal(ah, chan)) {
+               HALDEBUG(ah, HAL_DEBUG_ANY, "%s: initial chipset calibration 
did "
+                   "not complete in time; noisy environment?\n", __func__);
+               return AH_FALSE;
+       }
+
+       /* If there's PA Cal, do it */
+       if (AH5416(ah)->ah_cal_pacal)
+               AH5416(ah)->ah_cal_pacal(ah, AH_TRUE);
+
        /* 
         * Do NF calibration after DC offset and other CALs.
         * Per system engineers, noise floor value can sometimes be 20 dB
@@ -468,6 +485,10 @@ ar5416PerCalibrationN(struct ath_hal *ah
 
        /* Do NF cal only at longer intervals */
        if (longcal) {
+               /* Do PA calibration if the chipset supports */
+               if (AH5416(ah)->ah_cal_pacal)
+                       AH5416(ah)->ah_cal_pacal(ah, AH_FALSE);
+
                /* Do temperature compensation if the chipset needs it */
                AH5416(ah)->ah_olcTempCompensation(ah);
 

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.h        Fri Mar 11 11:07:53 
2011        (r219479)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.h        Fri Mar 11 11:35:36 
2011        (r219480)
@@ -102,6 +102,7 @@ struct ar5416PerCal {
        }                                                               \
 } while (0)
 
+HAL_BOOL       ar5416InitCalHardware(struct ath_hal *ah, const struct 
ieee80211_channel *chan);
 HAL_BOOL ar5416InitCal(struct ath_hal *, const struct ieee80211_channel *);
 HAL_BOOL ar5416PerCalibration(struct ath_hal *,  struct ieee80211_channel *,
            HAL_BOOL *isIQdone);
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to