Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/isc/atheros_hal add AR9280 support
details: https://anonhg.NetBSD.org/src/rev/1e6992c0dce8
branches: trunk
changeset: 762388:1e6992c0dce8
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun Feb 20 11:21:02 2011 +0000
description:
add AR9280 support
diffstat:
sys/external/isc/atheros_hal/conf/files.ath_hal | 8 +-
sys/external/isc/atheros_hal/conf/std.ath_hal | 2 +-
sys/external/isc/atheros_hal/dist/ah.h | 4 +-
sys/external/isc/atheros_hal/dist/ah_eeprom_v4k.c | 388 ++++++
sys/external/isc/atheros_hal/dist/ah_eeprom_v4k.h | 157 ++
sys/external/isc/atheros_hal/dist/ah_internal.h | 18 +-
sys/external/isc/atheros_hal/dist/ar5210/ar5210_attach.c | 17 +-
sys/external/isc/atheros_hal/dist/ar5211/ar5211_attach.c | 17 +-
sys/external/isc/atheros_hal/dist/ar5212/ar2425.c | 4 +-
sys/external/isc/atheros_hal/dist/ar5212/ar5212.h | 4 +-
sys/external/isc/atheros_hal/dist/ar5212/ar5212_attach.c | 82 +-
sys/external/isc/atheros_hal/dist/ar5212/ar5212_reset.c | 4 +-
sys/external/isc/atheros_hal/dist/ar5212/ar5413.c | 4 +-
sys/external/isc/atheros_hal/dist/ar5416/ar5416.h | 11 +-
sys/external/isc/atheros_hal/dist/ar5416/ar5416.ini | 16 +-
sys/external/isc/atheros_hal/dist/ar5416/ar5416_attach.c | 332 +++++-
sys/external/isc/atheros_hal/dist/ar5416/ar5416_reset.c | 682 +----------
sys/external/isc/atheros_hal/dist/ar5416/ar5416reg.h | 16 +-
sys/external/isc/atheros_hal/dist/ar5416/ar9160.ini | 16 +-
sys/external/isc/atheros_hal/dist/ar5416/ar9160_attach.c | 7 +-
sys/external/isc/atheros_hal/dist/ar5416/ar9280.c | 361 +++++
sys/external/isc/atheros_hal/dist/ar5416/ar9280.h | 40 +
sys/external/isc/atheros_hal/dist/ar5416/ar9280_attach.c | 753 ++++++++++++
sys/external/isc/atheros_hal/dist/ar5416/ar9280v1.ini | 582 +++++++++
sys/external/isc/atheros_hal/dist/ar5416/ar9280v2.ini | 941 +++++++++++++++
25 files changed, 3745 insertions(+), 721 deletions(-)
diffs (truncated from 5089 to 300 lines):
diff -r fcebfdbbc3d2 -r 1e6992c0dce8 sys/external/isc/atheros_hal/conf/files.ath_hal
--- a/sys/external/isc/atheros_hal/conf/files.ath_hal Sun Feb 20 10:26:26 2011 +0000
+++ b/sys/external/isc/atheros_hal/conf/files.ath_hal Sun Feb 20 11:21:02 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.ath_hal,v 1.1 2008/12/11 14:11:43 alc Exp $
+# $NetBSD: files.ath_hal,v 1.2 2011/02/20 11:21:02 jmcneill Exp $
defflag opt_athhal.h ATHHAL_ASSERT ATHHAL_DEBUG ATHHAL_DEBUG_ALQ
defflag opt_athhal.h ATHHAL_WRITE_EEPROM ATHHAL_WRITE_REGDOMAIN
@@ -6,11 +6,13 @@
define athhal_eeprom_v1
define athhal_eeprom_v3
define athhal_eeprom_v14
+define athhal_eeprom_v4k
file external/isc/atheros_hal/dist/ah.c ath
file external/isc/atheros_hal/dist/ah_eeprom_v1.c ath & athhal_eeprom_v1
file external/isc/atheros_hal/dist/ah_eeprom_v3.c ath & athhal_eeprom_v3
file external/isc/atheros_hal/dist/ah_eeprom_v14.c ath & athhal_eeprom_v14
+file external/isc/atheros_hal/dist/ah_eeprom_v4k.c ath & athhal_eeprom_v4k
file external/isc/atheros_hal/dist/ah_regdomain.c ath
# Atheros HAL's OS dependant code
@@ -109,7 +111,7 @@
# Atheros AR5416 family
#
-defflag opt_athhal.h ATHHAL_AR5416: athhal_eeprom_v14, athhal_ar5212_subr
+defflag opt_athhal.h ATHHAL_AR5416: athhal_eeprom_v14, athhal_eeprom_v4k, athhal_ar5212_subr
defflag opt_athhal.h ATHHAL_AR9280: ATHHAL_AR5416
file external/isc/atheros_hal/dist/ar5416/ar2133.c ath & athhal_ar5416
@@ -131,6 +133,8 @@
file external/isc/atheros_hal/dist/ar5416/ar5416_reset.c ath & athhal_ar5416
file external/isc/atheros_hal/dist/ar5416/ar5416_xmit.c ath & athhal_ar5416
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
#
#
diff -r fcebfdbbc3d2 -r 1e6992c0dce8 sys/external/isc/atheros_hal/conf/std.ath_hal
--- a/sys/external/isc/atheros_hal/conf/std.ath_hal Sun Feb 20 10:26:26 2011 +0000
+++ b/sys/external/isc/atheros_hal/conf/std.ath_hal Sun Feb 20 11:21:02 2011 +0000
@@ -12,7 +12,7 @@
#options ATHHAL_AR2316
#options ATHHAL_AR2317
options ATHHAL_AR5416
-#options ATHHAL_AR9280
+options ATHHAL_AR9280
# Atheros AR5212/AR5312 RF Support
#
diff -r fcebfdbbc3d2 -r 1e6992c0dce8 sys/external/isc/atheros_hal/dist/ah.h
--- a/sys/external/isc/atheros_hal/dist/ah.h Sun Feb 20 10:26:26 2011 +0000
+++ b/sys/external/isc/atheros_hal/dist/ah.h Sun Feb 20 11:21:02 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.1.1.1 2008/12/11 04:46:23 alc Exp $
+ * $Id: ah.h,v 1.2 2011/02/20 11:21:02 jmcneill Exp $
*/
#ifndef _ATH_AH_H_
@@ -669,6 +669,8 @@
HAL_STATUS *status);
HAL_BOOL __ahdecl(*ah_phyDisable)(struct ath_hal *);
HAL_BOOL __ahdecl(*ah_disable)(struct ath_hal *);
+ void __ahdecl(*ah_configPCIE)(struct ath_hal *, HAL_BOOL restore);
+ void __ahdecl(*ah_disablePCIE)(struct ath_hal *);
void __ahdecl(*ah_setPCUConfig)(struct ath_hal *);
HAL_BOOL __ahdecl(*ah_perCalibration)(struct ath_hal*, HAL_CHANNEL *,
HAL_BOOL *);
diff -r fcebfdbbc3d2 -r 1e6992c0dce8 sys/external/isc/atheros_hal/dist/ah_eeprom_v4k.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/external/isc/atheros_hal/dist/ah_eeprom_v4k.c Sun Feb 20 11:21:02 2011 +0000
@@ -0,0 +1,388 @@
+/*
+ * Copyright (c) 2009 Rui Paulo <rpaulo%FreeBSD.org@localhost>
+ * Copyright (c) 2008 Sam Leffler, Errno Consulting
+ * Copyright (c) 2008 Atheros Communications, Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * $FreeBSD: src/sys/dev/ath/ath_hal/ah_eeprom_v4k.c,v 1.1.2.3.2.1 2010/06/14 02:09:06 kensmith Exp $
+ */
+#include "opt_ah.h"
+
+#include "ah.h"
+#include "ah_internal.h"
+#include "ah_eeprom_v14.h"
+#include "ah_eeprom_v4k.h"
+
+static HAL_STATUS
+v4kEepromGet(struct ath_hal *ah, int param, void *val)
+{
+#define CHAN_A_IDX 0
+#define CHAN_B_IDX 1
+#define IS_VERS(op, v) ((pBase->version & AR5416_EEP_VER_MINOR_MASK) op (v))
+ HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom;
+ const MODAL_EEP4K_HEADER *pModal = &ee->ee_base.modalHeader;
+ const BASE_EEP4K_HEADER *pBase = &ee->ee_base.baseEepHeader;
+ uint32_t sum;
+ uint8_t *macaddr;
+ int i;
+
+ switch (param) {
+ case AR_EEP_NFTHRESH_2:
+ *(int16_t *)val = pModal->noiseFloorThreshCh[0];
+ return HAL_OK;
+ case AR_EEP_MACADDR: /* Get MAC Address */
+ sum = 0;
+ macaddr = val;
+ for (i = 0; i < 6; i++) {
+ macaddr[i] = pBase->macAddr[i];
+ sum += pBase->macAddr[i];
+ }
+ if (sum == 0 || sum == 0xffff*3) {
+ HALDEBUG(ah, HAL_DEBUG_ANY, "%s: bad mac address %s\n",
+ __func__, ath_hal_ether_sprintf(macaddr));
+ return HAL_EEBADMAC;
+ }
+ return HAL_OK;
+ case AR_EEP_REGDMN_0:
+ return pBase->regDmn[0];
+ case AR_EEP_REGDMN_1:
+ return pBase->regDmn[1];
+ case AR_EEP_OPCAP:
+ return pBase->deviceCap;
+ case AR_EEP_OPMODE:
+ return pBase->opCapFlags;
+ case AR_EEP_RFSILENT:
+ return pBase->rfSilent;
+ case AR_EEP_OB_2:
+ return pModal->ob;
+ case AR_EEP_DB_2:
+ return pModal->db;
+ case AR_EEP_TXMASK:
+ return pBase->txMask;
+ case AR_EEP_RXMASK:
+ return pBase->rxMask;
+ case AR_EEP_RXGAIN_TYPE:
+ return AR5416_EEP_RXGAIN_ORIG;
+ case AR_EEP_TXGAIN_TYPE:
+ return IS_VERS(>=, AR5416_EEP_MINOR_VER_19) ?
+ pBase->txGainType : AR5416_EEP_TXGAIN_ORIG;
+ case AR_EEP_OL_PWRCTRL:
+ HALASSERT(val == AH_NULL);
+ return HAL_EIO;
+ case AR_EEP_AMODE:
+ HALASSERT(val == AH_NULL);
+ return pBase->opCapFlags & AR5416_OPFLAGS_11A ?
+ HAL_OK : HAL_EIO;
+ case AR_EEP_BMODE:
+ case AR_EEP_GMODE:
+ HALASSERT(val == AH_NULL);
+ return pBase->opCapFlags & AR5416_OPFLAGS_11G ?
+ HAL_OK : HAL_EIO;
+ case AR_EEP_32KHZCRYSTAL:
+ case AR_EEP_COMPRESS:
+ case AR_EEP_FASTFRAME: /* XXX policy decision, h/w can do it */
+ case AR_EEP_WRITEPROTECT: /* NB: no write protect bit */
+ HALASSERT(val == AH_NULL);
+ /* fall thru... */
+ case AR_EEP_MAXQCU: /* NB: not in opCapFlags */
+ case AR_EEP_KCENTRIES: /* NB: not in opCapFlags */
+ return HAL_EIO;
+ case AR_EEP_AES:
+ case AR_EEP_BURST:
+ case AR_EEP_RFKILL:
+ case AR_EEP_TURBO2DISABLE:
+ HALASSERT(val == AH_NULL);
+ return HAL_OK;
+ case AR_EEP_ANTGAINMAX_2:
+ *(int8_t *) val = ee->ee_antennaGainMax;
+ return HAL_OK;
+ default:
+ HALASSERT(0);
+ return HAL_EINVAL;
+ }
+#undef IS_VERS
+#undef CHAN_A_IDX
+#undef CHAN_B_IDX
+}
+
+static HAL_BOOL
+v4kEepromSet(struct ath_hal *ah, int param, int v)
+{
+ HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom;
+
+ switch (param) {
+ case AR_EEP_ANTGAINMAX_2:
+ ee->ee_antennaGainMax = (int8_t) v;
+ return HAL_OK;
+ }
+ return HAL_EINVAL;
+}
+
+static HAL_BOOL
+v4kEepromDiag(struct ath_hal *ah, int request,
+ const void *args, uint32_t argsize, void **result, uint32_t *resultsize)
+{
+ HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom;
+
+ switch (request) {
+ case HAL_DIAG_EEPROM:
+ *result = &ee->ee_base;
+ *resultsize = sizeof(ee->ee_base);
+ return AH_TRUE;
+ }
+ return AH_FALSE;
+}
+
+/* Do structure specific swaps if Eeprom format is non native to host */
+static void
+eepromSwap(struct ar5416eeprom_4k *ee)
+{
+ uint32_t integer, i;
+ uint16_t word;
+ MODAL_EEP4K_HEADER *pModal;
+
+ /* convert Base Eep header */
+ word = __bswap16(ee->baseEepHeader.length);
+ ee->baseEepHeader.length = word;
+
+ word = __bswap16(ee->baseEepHeader.checksum);
+ ee->baseEepHeader.checksum = word;
+
+ word = __bswap16(ee->baseEepHeader.version);
+ ee->baseEepHeader.version = word;
+
+ word = __bswap16(ee->baseEepHeader.regDmn[0]);
+ ee->baseEepHeader.regDmn[0] = word;
+
+ word = __bswap16(ee->baseEepHeader.regDmn[1]);
+ ee->baseEepHeader.regDmn[1] = word;
+
+ word = __bswap16(ee->baseEepHeader.rfSilent);
+ ee->baseEepHeader.rfSilent = word;
+
+ word = __bswap16(ee->baseEepHeader.blueToothOptions);
+ ee->baseEepHeader.blueToothOptions = word;
+
+ word = __bswap16(ee->baseEepHeader.deviceCap);
+ ee->baseEepHeader.deviceCap = word;
+
+ /* convert Modal Eep header */
+ pModal = &ee->modalHeader;
+
+ /* XXX linux/ah_osdep.h only defines __bswap32 for BE */
+ integer = __bswap32(pModal->antCtrlCommon);
+ pModal->antCtrlCommon = integer;
+
+ for (i = 0; i < AR5416_4K_MAX_CHAINS; i++) {
+ integer = __bswap32(pModal->antCtrlChain[i]);
+ pModal->antCtrlChain[i] = integer;
+ }
+
+ for (i = 0; i < AR5416_EEPROM_MODAL_SPURS; i++) {
+ word = __bswap16(pModal->spurChans[i].spurChan);
+ pModal->spurChans[i].spurChan = word;
+ }
+}
+
+static uint16_t
+v4kEepromGetSpurChan(struct ath_hal *ah, int ix, HAL_BOOL is2GHz)
+{
+ HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom;
+
+ HALASSERT(0 <= ix && ix < AR5416_EEPROM_MODAL_SPURS);
+ HALASSERT(is2GHz);
+ return ee->ee_base.modalHeader.spurChans[ix].spurChan;
+}
+
+/**************************************************************************
+ * fbin2freq
+ *
+ * Get channel value from binary representation held in eeprom
+ * RETURNS: the frequency in MHz
+ */
+static uint16_t
+fbin2freq(uint8_t fbin, HAL_BOOL is2GHz)
+{
+ /*
+ * Reserved value 0xFF provides an empty definition both as
+ * an fbin and as a frequency - do not convert
+ */
+ if (fbin == AR5416_BCHAN_UNUSED)
+ return fbin;
Home |
Main Index |
Thread Index |
Old Index