Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src add AR9285 support



details:   https://anonhg.NetBSD.org/src/rev/0d18081233d0
branches:  trunk
changeset: 762458:0d18081233d0
user:      cegger <cegger%NetBSD.org@localhost>
date:      Mon Feb 21 11:06:37 2011 +0000

description:
add AR9285 support

diffstat:

 share/man/man4/ath.4                                     |    6 +-
 sys/external/isc/atheros_hal/conf/files.ath_hal          |    5 +-
 sys/external/isc/atheros_hal/conf/std.ath_hal            |    1 +
 sys/external/isc/atheros_hal/dist/ah.h                   |    6 +-
 sys/external/isc/atheros_hal/dist/ah_eeprom_v14.h        |    3 +-
 sys/external/isc/atheros_hal/dist/ar5212/ar5212.h        |    5 +-
 sys/external/isc/atheros_hal/dist/ar5212/ar5212_attach.c |    5 +-
 sys/external/isc/atheros_hal/dist/ar5212/ar5212_xmit.c   |    9 +-
 sys/external/isc/atheros_hal/dist/ar5416/ar5416.h        |   18 +-
 sys/external/isc/atheros_hal/dist/ar5416/ar5416_attach.c |   19 +-
 sys/external/isc/atheros_hal/dist/ar5416/ar5416_reset.c  |   50 +-
 sys/external/isc/atheros_hal/dist/ar5416/ar5416phy.h     |   16 +-
 sys/external/isc/atheros_hal/dist/ar5416/ar5416reg.h     |   32 +-
 sys/external/isc/atheros_hal/dist/ar5416/ar9280.h        |    3 +
 sys/external/isc/atheros_hal/dist/ar5416/ar9280_attach.c |   19 +-
 sys/external/isc/atheros_hal/dist/ar5416/ar9285.c        |   64 +
 sys/external/isc/atheros_hal/dist/ar5416/ar9285.h        |   43 +
 sys/external/isc/atheros_hal/dist/ar5416/ar9285.ini      |  699 +++++++++++
 sys/external/isc/atheros_hal/dist/ar5416/ar9285_attach.c |  407 ++++++
 sys/external/isc/atheros_hal/dist/ar5416/ar9285_reset.c  |  908 +++++++++++++++
 sys/external/isc/atheros_hal/dist/ar5416/ar9285v2.ini    |  746 ++++++++++++
 21 files changed, 3010 insertions(+), 54 deletions(-)

diffs (truncated from 3509 to 300 lines):

diff -r fd36df021e6f -r 0d18081233d0 share/man/man4/ath.4
--- a/share/man/man4/ath.4      Mon Feb 21 10:14:29 2011 +0000
+++ b/share/man/man4/ath.4      Mon Feb 21 11:06:37 2011 +0000
@@ -1,4 +1,4 @@
-.\"     $NetBSD: ath.4,v 1.29 2011/02/20 11:22:34 jmcneill Exp $
+.\"     $NetBSD: ath.4,v 1.30 2011/02/21 11:08:21 cegger Exp $
 .\"
 .\" Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
 .\" All rights reserved.
@@ -41,7 +41,7 @@
 .\" $FreeBSD: /repoman/r/ncvs/src/share/man/man4/ath.4,v 1.16 2004/02/18 08:30:08 maxim Exp $
 .\" parts from $FreeBSD: /repoman/r/ncvs/src/share/man/man4/ath_hal.4,v 1.7 2004/01/07 20:49:51 blackend Exp $
 .\"
-.Dd February 20, 2011
+.Dd February 21, 2011
 .Dt ATH 4
 .Os
 .Sh NAME
@@ -55,7 +55,7 @@
 .Nm
 driver provides support for wireless network adapters based on
 the Atheros AR2413, AR2417, AR5210, AR5211, AR5212, AR5213, AR5413,
-AR5416, AR5424, AR9160, and AR9280 chips.
+AR5416, AR5424, AR9160, AR9280, and AR9285 chips.
 Chip-specific support is provided by the Atheros Hardware Access Layer
 (HAL).
 .Pp
diff -r fd36df021e6f -r 0d18081233d0 sys/external/isc/atheros_hal/conf/files.ath_hal
--- a/sys/external/isc/atheros_hal/conf/files.ath_hal   Mon Feb 21 10:14:29 2011 +0000
+++ b/sys/external/isc/atheros_hal/conf/files.ath_hal   Mon Feb 21 11:06:37 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.ath_hal,v 1.2 2011/02/20 11:21:02 jmcneill Exp $
+#      $NetBSD: files.ath_hal,v 1.3 2011/02/21 11:06:37 cegger Exp $
 
 defflag opt_athhal.h   ATHHAL_ASSERT ATHHAL_DEBUG ATHHAL_DEBUG_ALQ
 defflag opt_athhal.h   ATHHAL_WRITE_EEPROM ATHHAL_WRITE_REGDOMAIN
@@ -135,6 +135,9 @@
 file   external/isc/atheros_hal/dist/ar5416/ar9160_attach.c    ath & athhal_ar5416
 file   external/isc/atheros_hal/dist/ar5416/ar9280.c           ath & athhal_ar5416
 file   external/isc/atheros_hal/dist/ar5416/ar9280_attach.c    ath & athhal_ar5416
+file   external/isc/atheros_hal/dist/ar5416/ar9285.c           ath & athhal_ar5416
+file   external/isc/atheros_hal/dist/ar5416/ar9285_attach.c    ath & athhal_ar5416
+file   external/isc/atheros_hal/dist/ar5416/ar9285_reset.c     ath & athhal_ar5416
 
 #
 #
diff -r fd36df021e6f -r 0d18081233d0 sys/external/isc/atheros_hal/conf/std.ath_hal
--- a/sys/external/isc/atheros_hal/conf/std.ath_hal     Mon Feb 21 10:14:29 2011 +0000
+++ b/sys/external/isc/atheros_hal/conf/std.ath_hal     Mon Feb 21 11:06:37 2011 +0000
@@ -13,6 +13,7 @@
 #options ATHHAL_AR2317
 options ATHHAL_AR5416
 options ATHHAL_AR9280
+options ATHHAL_AR9285
 
 # Atheros AR5212/AR5312 RF Support
 #
diff -r fd36df021e6f -r 0d18081233d0 sys/external/isc/atheros_hal/dist/ah.h
--- a/sys/external/isc/atheros_hal/dist/ah.h    Mon Feb 21 10:14:29 2011 +0000
+++ b/sys/external/isc/atheros_hal/dist/ah.h    Mon Feb 21 11:06:37 2011 +0000
@@ -14,7 +14,7 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: ah.h,v 1.2 2011/02/20 11:21:02 jmcneill Exp $
+ * $Id: ah.h,v 1.3 2011/02/21 11:06:38 cegger Exp $
  */
 
 #ifndef _ATH_AH_H_
@@ -677,7 +677,11 @@
        HAL_BOOL  __ahdecl(*ah_perCalibrationN)(struct ath_hal *, HAL_CHANNEL *,
                        u_int chainMask, HAL_BOOL longCal, HAL_BOOL *isCalDone);
        HAL_BOOL  __ahdecl(*ah_resetCalValid)(struct ath_hal *, HAL_CHANNEL *);
+       HAL_BOOL  __ahdecl(*ah_setTxPower)(struct ath_hal *,
+                       HAL_CHANNEL *, uint16_t *);
        HAL_BOOL  __ahdecl(*ah_setTxPowerLimit)(struct ath_hal *, uint32_t);
+       HAL_BOOL  __ahdecl(*ah_setBoardValues)(struct ath_hal *,
+                       HAL_CHANNEL *);
 
        /* Transmit functions */
        HAL_BOOL  __ahdecl(*ah_updateTxTrigLevel)(struct ath_hal*,
diff -r fd36df021e6f -r 0d18081233d0 sys/external/isc/atheros_hal/dist/ah_eeprom_v14.h
--- a/sys/external/isc/atheros_hal/dist/ah_eeprom_v14.h Mon Feb 21 10:14:29 2011 +0000
+++ b/sys/external/isc/atheros_hal/dist/ah_eeprom_v14.h Mon Feb 21 11:06:37 2011 +0000
@@ -14,7 +14,7 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: ah_eeprom_v14.h,v 1.1.1.1 2008/12/11 04:46:24 alc Exp $
+ * $Id: ah_eeprom_v14.h,v 1.2 2011/02/21 11:06:38 cegger Exp $
  */
 #ifndef _AH_EEPROM_V14_H_
 #define _AH_EEPROM_V14_H_
@@ -76,6 +76,7 @@
 #define AR5416_EEPMISC_BIG_ENDIAN      0x01
 #define FREQ2FBIN(x,y)                         ((y) ? ((x) - 2300) : (((x) - 4800) / 5))
 #define AR5416_MAX_CHAINS              3
+#define        AR5416_PWR_TABLE_OFFSET_DB      -5
 #define AR5416_ANT_16S                 25
 
 #define AR5416_NUM_ANT_CHAIN_FIELDS     7
diff -r fd36df021e6f -r 0d18081233d0 sys/external/isc/atheros_hal/dist/ar5212/ar5212.h
--- a/sys/external/isc/atheros_hal/dist/ar5212/ar5212.h Mon Feb 21 10:14:29 2011 +0000
+++ b/sys/external/isc/atheros_hal/dist/ar5212/ar5212.h Mon Feb 21 11:06:37 2011 +0000
@@ -14,7 +14,7 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: ar5212.h,v 1.2 2011/02/20 11:21:03 jmcneill Exp $
+ * $Id: ar5212.h,v 1.3 2011/02/21 11:06:38 cegger Exp $
  */
 #ifndef _ATH_AR5212_H_
 #define _ATH_AR5212_H_
@@ -328,6 +328,9 @@
        uint16_t        *ah_pcdacTable;
        u_int           ah_pcdacTableSize;
        uint16_t        ah_ratesArray[16];
+
+       uint8_t         ah_txTrigLev;           /* current Tx trigger level */
+       uint8_t         ah_maxTxTrigLev;        /* max tx trigger level */
 };
 #define        AH5212(_ah)     ((struct ath_hal_5212 *)(_ah))
 
diff -r fd36df021e6f -r 0d18081233d0 sys/external/isc/atheros_hal/dist/ar5212/ar5212_attach.c
--- a/sys/external/isc/atheros_hal/dist/ar5212/ar5212_attach.c  Mon Feb 21 10:14:29 2011 +0000
+++ b/sys/external/isc/atheros_hal/dist/ar5212/ar5212_attach.c  Mon Feb 21 11:06:37 2011 +0000
@@ -14,7 +14,7 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: ar5212_attach.c,v 1.2 2011/02/20 11:21:03 jmcneill Exp $
+ * $Id: ar5212_attach.c,v 1.3 2011/02/21 11:06:38 cegger Exp $
  */
 #include "opt_ah.h"
 
@@ -255,6 +255,9 @@
        ahp->ah_acktimeout = (u_int) -1;
        ahp->ah_ctstimeout = (u_int) -1;
        ahp->ah_sifstime = (u_int) -1;
+       ahp->ah_txTrigLev = INIT_TX_FIFO_THRESHOLD;
+       ahp->ah_maxTxTrigLev = MAX_TX_FIFO_THRESHOLD;
+
        OS_MEMCPY(&ahp->ah_bssidmask, defbssidmask, IEEE80211_ADDR_LEN);
 #undef N
 }
diff -r fd36df021e6f -r 0d18081233d0 sys/external/isc/atheros_hal/dist/ar5212/ar5212_xmit.c
--- a/sys/external/isc/atheros_hal/dist/ar5212/ar5212_xmit.c    Mon Feb 21 10:14:29 2011 +0000
+++ b/sys/external/isc/atheros_hal/dist/ar5212/ar5212_xmit.c    Mon Feb 21 11:06:37 2011 +0000
@@ -14,7 +14,7 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: ar5212_xmit.c,v 1.1.1.1 2008/12/11 04:46:43 alc Exp $
+ * $Id: ar5212_xmit.c,v 1.2 2011/02/21 11:06:38 cegger Exp $
  */
 #include "opt_ah.h"
 
@@ -48,6 +48,9 @@
        uint32_t txcfg, curLevel, newLevel;
        HAL_INT omask;
 
+       if (ahp->ah_txTrigLev >= ahp->ah_maxTxTrigLev)
+               return AH_FALSE;
+
        /*
         * Disable interrupts while futzing with the fifo level.
         */
@@ -57,7 +60,7 @@
        curLevel = MS(txcfg, AR_FTRIG);
        newLevel = curLevel;
        if (bIncTrigLevel) {            /* increase the trigger level */
-               if (curLevel < MAX_TX_FIFO_THRESHOLD)
+               if (curLevel < ahp->ah_maxTxTrigLev)
                        newLevel++;
        } else if (curLevel > MIN_TX_FIFO_THRESHOLD)
                newLevel--;
@@ -66,6 +69,8 @@
                OS_REG_WRITE(ah, AR_TXCFG,
                        (txcfg &~ AR_FTRIG) | SM(newLevel, AR_FTRIG));
 
+       ahp->ah_txTrigLev = newLevel;
+
        /* re-enable chip interrupts */
        ar5212SetInterrupts(ah, omask);
 
diff -r fd36df021e6f -r 0d18081233d0 sys/external/isc/atheros_hal/dist/ar5416/ar5416.h
--- a/sys/external/isc/atheros_hal/dist/ar5416/ar5416.h Mon Feb 21 10:14:29 2011 +0000
+++ b/sys/external/isc/atheros_hal/dist/ar5416/ar5416.h Mon Feb 21 11:06:37 2011 +0000
@@ -14,13 +14,14 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: ar5416.h,v 1.2 2011/02/20 11:21:03 jmcneill Exp $
+ * $Id: ar5416.h,v 1.3 2011/02/21 11:06:38 cegger Exp $
  */
 #ifndef _ATH_AR5416_H_
 #define _ATH_AR5416_H_
 
 #include "ar5212/ar5212.h"
 #include "ar5416_cal.h"
+#include "ah_eeprom_v14.h"     /* for CAL_TARGET_POWER_* */
 
 #define        AR5416_MAGIC    0x20065416
 
@@ -91,6 +92,7 @@
 
 struct ath_hal;
 
+extern uint32_t ar5416GetRadioRev(struct ath_hal *ah);
 extern struct ath_hal * ar5416Attach(uint16_t devid, HAL_SOFTC sc,
                HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status);
 extern void ar5416InitState(struct ath_hal_5416 *, uint16_t devid,
@@ -175,11 +177,25 @@
 extern HAL_BOOL ar5416Disable(struct ath_hal *ah);
 extern HAL_BOOL ar5416ChipReset(struct ath_hal *ah, HAL_CHANNEL *);
 extern HAL_BOOL ar5416SetResetReg(struct ath_hal *, uint32_t type);
+extern HAL_BOOL ar5416SetBoardValues(struct ath_hal *, HAL_CHANNEL *);
 extern HAL_BOOL ar5416SetTxPowerLimit(struct ath_hal *ah, uint32_t limit);
+extern HAL_BOOL ar5416SetTransmitPower(struct ath_hal *,
+               HAL_CHANNEL *, uint16_t *);
 extern HAL_BOOL ar5416GetChipPowerLimits(struct ath_hal *ah,
                HAL_CHANNEL *chans, uint32_t nchans);
 extern void ar5416GetChannelCenters(struct ath_hal *,
                HAL_CHANNEL_INTERNAL *chan, CHAN_CENTERS *centers);
+extern  void ar5416GetTargetPowers(struct ath_hal *ah, 
+               HAL_CHANNEL_INTERNAL *chan,
+               CAL_TARGET_POWER_HT *powInfo,
+               uint16_t numChannels, CAL_TARGET_POWER_HT *pNewPower,
+               uint16_t numRates, HAL_BOOL isHt40Target);
+extern  void ar5416GetTargetPowersLeg(struct ath_hal *ah, 
+               HAL_CHANNEL_INTERNAL *chan,
+               CAL_TARGET_POWER_LEG *powInfo,
+               uint16_t numChannels, CAL_TARGET_POWER_LEG *pNewPower,
+               uint16_t numRates, HAL_BOOL isExtTarget);
+
 
 extern HAL_BOOL ar5416StopTxDma(struct ath_hal *ah, u_int q);
 extern HAL_BOOL ar5416SetupTxDesc(struct ath_hal *ah, struct ath_desc *ds,
diff -r fd36df021e6f -r 0d18081233d0 sys/external/isc/atheros_hal/dist/ar5416/ar5416_attach.c
--- a/sys/external/isc/atheros_hal/dist/ar5416/ar5416_attach.c  Mon Feb 21 10:14:29 2011 +0000
+++ b/sys/external/isc/atheros_hal/dist/ar5416/ar5416_attach.c  Mon Feb 21 11:06:37 2011 +0000
@@ -14,7 +14,7 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: ar5416_attach.c,v 1.2 2011/02/20 11:21:04 jmcneill Exp $
+ * $Id: ar5416_attach.c,v 1.3 2011/02/21 11:06:38 cegger Exp $
  */
 #include "opt_ah.h"
 
@@ -89,6 +89,8 @@
        ah->ah_perCalibrationN          = ar5416PerCalibrationN,
        ah->ah_resetCalValid            = ar5416ResetCalValid,
        ah->ah_setTxPowerLimit          = ar5416SetTxPowerLimit;
+       ah->ah_setTxPower               = ar5416SetTransmitPower;
+       ah->ah_setBoardValues           = ar5416SetBoardValues;
 
        /* Transmit functions */
        ah->ah_stopTxDma                = ar5416StopTxDma;
@@ -172,6 +174,21 @@
        AH5416(ah)->ah_tx_chainmask = AR5416_DEFAULT_TXCHAINMASK;
 }
 
+uint32_t
+ar5416GetRadioRev(struct ath_hal *ah)
+{
+       uint32_t val;
+       int i;
+
+       /* Read Radio Chip Rev Extract */
+       OS_REG_WRITE(ah, AR_PHY(0x36), 0x00007058);
+       for (i = 0; i < 8; i++)
+               OS_REG_WRITE(ah, AR_PHY(0x20), 0x00010000);
+       val = (OS_REG_READ(ah, AR_PHY(256)) >> 24) & 0xff;
+       val = ((val & 0xf0) >> 4) | ((val & 0x0f) << 4);
+       return ath_hal_reverseBits(val, 8);
+}
+
 /*
  * Attach for an AR5416 part.
  */
diff -r fd36df021e6f -r 0d18081233d0 sys/external/isc/atheros_hal/dist/ar5416/ar5416_reset.c
--- a/sys/external/isc/atheros_hal/dist/ar5416/ar5416_reset.c   Mon Feb 21 10:14:29 2011 +0000
+++ b/sys/external/isc/atheros_hal/dist/ar5416/ar5416_reset.c   Mon Feb 21 11:06:37 2011 +0000
@@ -14,7 +14,7 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: ar5416_reset.c,v 1.3 2011/02/20 11:21:04 jmcneill Exp $
+ * $Id: ar5416_reset.c,v 1.4 2011/02/21 11:06:38 cegger Exp $
  */
 #include "opt_ah.h"
 
@@ -45,7 +45,7 @@
 static void ar5416InitQoS(struct ath_hal *ah);
 static void ar5416InitUserSettings(struct ath_hal *ah);
 
-static HAL_BOOL ar5416SetTransmitPower(struct ath_hal *ah, 
+static HAL_BOOL _ar5416SetTransmitPower(struct ath_hal *ah,
        HAL_CHANNEL_INTERNAL *chan, uint16_t *rfXpdGain);



Home | Main Index | Thread Index | Old Index