FreeBSD kernel ATH device code
ar5212_attach.c
Go to the documentation of this file.
1/*-
2 * SPDX-License-Identifier: ISC
3 *
4 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
5 * Copyright (c) 2002-2008 Atheros Communications, Inc.
6 *
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 *
19 * $FreeBSD$
20 */
21#include "opt_ah.h"
22
23#include "ah.h"
24#include "ah_internal.h"
25#include "ah_devid.h"
26
27#include "ar5212/ar5212.h"
28#include "ar5212/ar5212reg.h"
29#include "ar5212/ar5212phy.h"
30
31#define AH_5212_COMMON
32#include "ar5212/ar5212.ini"
33
34static void ar5212ConfigPCIE(struct ath_hal *ah, HAL_BOOL restore,
35 HAL_BOOL power_off);
36static void ar5212DisablePCIE(struct ath_hal *ah);
37
38static const struct ath_hal_private ar5212hal = {{
39 .ah_magic = AR5212_MAGIC,
40
41 .ah_getRateTable = ar5212GetRateTable,
42 .ah_detach = ar5212Detach,
43
44 /* Reset Functions */
45 .ah_reset = ar5212Reset,
46 .ah_phyDisable = ar5212PhyDisable,
47 .ah_disable = ar5212Disable,
48 .ah_configPCIE = ar5212ConfigPCIE,
49 .ah_disablePCIE = ar5212DisablePCIE,
50 .ah_setPCUConfig = ar5212SetPCUConfig,
51 .ah_perCalibration = ar5212PerCalibration,
52 .ah_perCalibrationN = ar5212PerCalibrationN,
53 .ah_resetCalValid = ar5212ResetCalValid,
54 .ah_setTxPowerLimit = ar5212SetTxPowerLimit,
55 .ah_getChanNoise = ath_hal_getChanNoise,
56
57 /* Transmit functions */
58 .ah_updateTxTrigLevel = ar5212UpdateTxTrigLevel,
59 .ah_setupTxQueue = ar5212SetupTxQueue,
60 .ah_setTxQueueProps = ar5212SetTxQueueProps,
61 .ah_getTxQueueProps = ar5212GetTxQueueProps,
62 .ah_releaseTxQueue = ar5212ReleaseTxQueue,
63 .ah_resetTxQueue = ar5212ResetTxQueue,
64 .ah_getTxDP = ar5212GetTxDP,
65 .ah_setTxDP = ar5212SetTxDP,
66 .ah_numTxPending = ar5212NumTxPending,
67 .ah_startTxDma = ar5212StartTxDma,
68 .ah_stopTxDma = ar5212StopTxDma,
69 .ah_setupTxDesc = ar5212SetupTxDesc,
70 .ah_setupXTxDesc = ar5212SetupXTxDesc,
71 .ah_fillTxDesc = ar5212FillTxDesc,
72 .ah_procTxDesc = ar5212ProcTxDesc,
73 .ah_getTxIntrQueue = ar5212GetTxIntrQueue,
74 .ah_reqTxIntrDesc = ar5212IntrReqTxDesc,
75 .ah_getTxCompletionRates = ar5212GetTxCompletionRates,
76 .ah_setTxDescLink = ar5212SetTxDescLink,
77 .ah_getTxDescLink = ar5212GetTxDescLink,
78 .ah_getTxDescLinkPtr = ar5212GetTxDescLinkPtr,
79
80 /* RX Functions */
81 .ah_getRxDP = ar5212GetRxDP,
82 .ah_setRxDP = ar5212SetRxDP,
83 .ah_enableReceive = ar5212EnableReceive,
84 .ah_stopDmaReceive = ar5212StopDmaReceive,
85 .ah_startPcuReceive = ar5212StartPcuReceive,
86 .ah_stopPcuReceive = ar5212StopPcuReceive,
87 .ah_setMulticastFilter = ar5212SetMulticastFilter,
88 .ah_setMulticastFilterIndex = ar5212SetMulticastFilterIndex,
89 .ah_clrMulticastFilterIndex = ar5212ClrMulticastFilterIndex,
90 .ah_getRxFilter = ar5212GetRxFilter,
91 .ah_setRxFilter = ar5212SetRxFilter,
92 .ah_setupRxDesc = ar5212SetupRxDesc,
93 .ah_procRxDesc = ar5212ProcRxDesc,
94 .ah_rxMonitor = ar5212RxMonitor,
95 .ah_aniPoll = ar5212AniPoll,
96 .ah_procMibEvent = ar5212ProcessMibIntr,
97
98 /* Misc Functions */
99 .ah_getCapability = ar5212GetCapability,
100 .ah_setCapability = ar5212SetCapability,
101 .ah_getDiagState = ar5212GetDiagState,
102 .ah_getMacAddress = ar5212GetMacAddress,
103 .ah_setMacAddress = ar5212SetMacAddress,
104 .ah_getBssIdMask = ar5212GetBssIdMask,
105 .ah_setBssIdMask = ar5212SetBssIdMask,
106 .ah_setRegulatoryDomain = ar5212SetRegulatoryDomain,
107 .ah_setLedState = ar5212SetLedState,
108 .ah_writeAssocid = ar5212WriteAssocid,
109 .ah_gpioCfgInput = ar5212GpioCfgInput,
110 .ah_gpioCfgOutput = ar5212GpioCfgOutput,
111 .ah_gpioGet = ar5212GpioGet,
112 .ah_gpioSet = ar5212GpioSet,
113 .ah_gpioSetIntr = ar5212GpioSetIntr,
114 .ah_getTsf32 = ar5212GetTsf32,
115 .ah_getTsf64 = ar5212GetTsf64,
116 .ah_setTsf64 = ar5212SetTsf64,
117 .ah_resetTsf = ar5212ResetTsf,
118 .ah_detectCardPresent = ar5212DetectCardPresent,
119 .ah_updateMibCounters = ar5212UpdateMibCounters,
120 .ah_getRfGain = ar5212GetRfgain,
121 .ah_getDefAntenna = ar5212GetDefAntenna,
122 .ah_setDefAntenna = ar5212SetDefAntenna,
123 .ah_getAntennaSwitch = ar5212GetAntennaSwitch,
124 .ah_setAntennaSwitch = ar5212SetAntennaSwitch,
125 .ah_setSifsTime = ar5212SetSifsTime,
126 .ah_getSifsTime = ar5212GetSifsTime,
127 .ah_setSlotTime = ar5212SetSlotTime,
128 .ah_getSlotTime = ar5212GetSlotTime,
129 .ah_setAckTimeout = ar5212SetAckTimeout,
130 .ah_getAckTimeout = ar5212GetAckTimeout,
131 .ah_setAckCTSRate = ar5212SetAckCTSRate,
132 .ah_getAckCTSRate = ar5212GetAckCTSRate,
133 .ah_setCTSTimeout = ar5212SetCTSTimeout,
134 .ah_getCTSTimeout = ar5212GetCTSTimeout,
135 .ah_setDecompMask = ar5212SetDecompMask,
136 .ah_setCoverageClass = ar5212SetCoverageClass,
137 .ah_setQuiet = ar5212SetQuiet,
138 .ah_getMibCycleCounts = ar5212GetMibCycleCounts,
139 .ah_setChainMasks = ar5212SetChainMasks,
140 .ah_getNav = ar5212GetNav,
141 .ah_setNav = ar5212SetNav,
142
143 /* DFS Functions */
144 .ah_enableDfs = ar5212EnableDfs,
145 .ah_getDfsThresh = ar5212GetDfsThresh,
146 .ah_getDfsDefaultThresh = ar5212GetDfsDefaultThresh,
147 .ah_procRadarEvent = ar5212ProcessRadarEvent,
148 .ah_isFastClockEnabled = ar5212IsFastClockEnabled,
149 .ah_get11nExtBusy = ar5212Get11nExtBusy,
150
151 /* Key Cache Functions */
152 .ah_getKeyCacheSize = ar5212GetKeyCacheSize,
153 .ah_resetKeyCacheEntry = ar5212ResetKeyCacheEntry,
154 .ah_isKeyCacheEntryValid = ar5212IsKeyCacheEntryValid,
155 .ah_setKeyCacheEntry = ar5212SetKeyCacheEntry,
156 .ah_setKeyCacheEntryMac = ar5212SetKeyCacheEntryMac,
157
158 /* Power Management Functions */
159 .ah_setPowerMode = ar5212SetPowerMode,
160 .ah_getPowerMode = ar5212GetPowerMode,
161
162 /* Beacon Functions */
163 .ah_setBeaconTimers = ar5212SetBeaconTimers,
164 .ah_beaconInit = ar5212BeaconInit,
165 .ah_setStationBeaconTimers = ar5212SetStaBeaconTimers,
166 .ah_resetStationBeaconTimers = ar5212ResetStaBeaconTimers,
167 .ah_getNextTBTT = ar5212GetNextTBTT,
168
169 /* Interrupt Functions */
170 .ah_isInterruptPending = ar5212IsInterruptPending,
171 .ah_getPendingInterrupts = ar5212GetPendingInterrupts,
172 .ah_getInterrupts = ar5212GetInterrupts,
173 .ah_setInterrupts = ar5212SetInterrupts },
174
175 .ah_getChannelEdges = ar5212GetChannelEdges,
176 .ah_getWirelessModes = ar5212GetWirelessModes,
177 .ah_eepromRead = ar5212EepromRead,
178#ifdef AH_SUPPORT_WRITE_EEPROM
179 .ah_eepromWrite = ar5212EepromWrite,
180#endif
181 .ah_getChipPowerLimits = ar5212GetChipPowerLimits,
182};
183
184uint32_t
186{
187 uint32_t val;
188 int i;
189
190 /* Read Radio Chip Rev Extract */
191 OS_REG_WRITE(ah, AR_PHY(0x34), 0x00001c16);
192 for (i = 0; i < 8; i++)
193 OS_REG_WRITE(ah, AR_PHY(0x20), 0x00010000);
194 val = (OS_REG_READ(ah, AR_PHY(256)) >> 24) & 0xff;
195 val = ((val & 0xf0) >> 4) | ((val & 0x0f) << 4);
196 return ath_hal_reverseBits(val, 8);
197}
198
199static void
201{
202 static const struct ar5212AniParams aniparams = {
203 .maxNoiseImmunityLevel = 4, /* levels 0..4 */
204 .totalSizeDesired = { -55, -55, -55, -55, -62 },
205 .coarseHigh = { -14, -14, -14, -14, -12 },
206 .coarseLow = { -64, -64, -64, -64, -70 },
207 .firpwr = { -78, -78, -78, -78, -80 },
208 .maxSpurImmunityLevel = 2, /* NB: depends on chip rev */
209 .cycPwrThr1 = { 2, 4, 6, 8, 10, 12, 14, 16 },
210 .maxFirstepLevel = 2, /* levels 0..2 */
211 .firstep = { 0, 4, 8 },
212 .ofdmTrigHigh = 500,
213 .ofdmTrigLow = 200,
214 .cckTrigHigh = 200,
215 .cckTrigLow = 100,
216 .rssiThrHigh = 40,
217 .rssiThrLow = 7,
218 .period = 100,
219 };
220 if (AH_PRIVATE(ah)->ah_macVersion < AR_SREV_VERSION_GRIFFIN) {
221 struct ar5212AniParams tmp;
222 OS_MEMCPY(&tmp, &aniparams, sizeof(struct ar5212AniParams));
223 tmp.maxSpurImmunityLevel = 7; /* Venice and earlier */
224 ar5212AniAttach(ah, &tmp, &tmp, AH_TRUE);
225 } else
226 ar5212AniAttach(ah, &aniparams, &aniparams, AH_TRUE);
227
228 /* Set overridable ANI methods */
229 AH5212(ah)->ah_aniControl = ar5212AniControl;
230}
231
232/*
233 * Attach for an AR5212 part.
234 */
235void
236ar5212InitState(struct ath_hal_5212 *ahp, uint16_t devid, HAL_SOFTC sc,
237 HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status)
238{
239#define N(a) (sizeof(a)/sizeof(a[0]))
240 static const uint8_t defbssidmask[IEEE80211_ADDR_LEN] =
241 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
242 struct ath_hal *ah;
243
244 ah = &ahp->ah_priv.h;
245 /* set initial values */
246 OS_MEMCPY(&ahp->ah_priv, &ar5212hal, sizeof(struct ath_hal_private));
247 ah->ah_sc = sc;
248 ah->ah_st = st;
249 ah->ah_sh = sh;
250
251 ah->ah_devid = devid; /* NB: for alq */
252 AH_PRIVATE(ah)->ah_devid = devid;
253 AH_PRIVATE(ah)->ah_subvendorid = 0; /* XXX */
254
255 AH_PRIVATE(ah)->ah_powerLimit = MAX_RATE_POWER;
256 AH_PRIVATE(ah)->ah_tpScale = HAL_TP_SCALE_MAX; /* no scaling */
257
259 ahp->ah_diversity = AH_TRUE;
261 /*
262 * Enable MIC handling.
263 */
266 ahp->ah_tpcEnabled = AH_FALSE; /* disabled by default */
267 ahp->ah_phyPowerOn = AH_FALSE;
271 ahp->ah_beaconInterval = 100; /* XXX [20..1000] */
272 ahp->ah_enable32kHzClock = DONT_USE_32KHZ;/* XXX */
273 ahp->ah_slottime = (u_int) -1;
274 ahp->ah_acktimeout = (u_int) -1;
275 ahp->ah_ctstimeout = (u_int) -1;
276 ahp->ah_sifstime = (u_int) -1;
279
280 OS_MEMCPY(&ahp->ah_bssidmask, defbssidmask, IEEE80211_ADDR_LEN);
281#undef N
282}
283
284/*
285 * Validate MAC version and revision.
286 */
287static HAL_BOOL
288ar5212IsMacSupported(uint8_t macVersion, uint8_t macRev)
289{
290#define N(a) (sizeof(a)/sizeof(a[0]))
291 static const struct {
292 uint8_t version;
293 uint8_t revMin, revMax;
294 } macs[] = {
299 { AR_SREV_5413,
301 { AR_SREV_5424,
303 { AR_SREV_2425,
305 { AR_SREV_2417,
307 };
308 int i;
309
310 for (i = 0; i < N(macs); i++)
311 if (macs[i].version == macVersion &&
312 macs[i].revMin <= macRev && macRev <= macs[i].revMax)
313 return AH_TRUE;
314 return AH_FALSE;
315#undef N
316}
317
318/*
319 * Attach for an AR5212 part.
320 */
321static struct ath_hal *
322ar5212Attach(uint16_t devid, HAL_SOFTC sc,
323 HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata,
325{
326#define AH_EEPROM_PROTECT(ah) \
327 (AH_PRIVATE(ah)->ah_ispcie)? AR_EEPROM_PROTECT_PCIE : AR_EEPROM_PROTECT)
328 struct ath_hal_5212 *ahp;
329 struct ath_hal *ah;
330 struct ath_hal_rf *rf;
331 uint32_t val;
332 uint16_t eeval;
333 HAL_STATUS ecode;
334
335 HALDEBUG(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
336 __func__, sc, (void*) st, (void*) sh);
337
338 /* NB: memory is returned zero'd */
339 ahp = ath_hal_malloc(sizeof (struct ath_hal_5212));
340 if (ahp == AH_NULL) {
342 "%s: cannot allocate memory for state block\n", __func__);
343 *status = HAL_ENOMEM;
344 return AH_NULL;
345 }
346 ar5212InitState(ahp, devid, sc, st, sh, status);
347 ah = &ahp->ah_priv.h;
348
350 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: couldn't wakeup chip\n",
351 __func__);
352 ecode = HAL_EIO;
353 goto bad;
354 }
355 /* Read Revisions from Chips before taking out of reset */
356 val = OS_REG_READ(ah, AR_SREV) & AR_SREV_ID;
357 AH_PRIVATE(ah)->ah_macVersion = val >> AR_SREV_ID_S;
358 AH_PRIVATE(ah)->ah_macRev = val & AR_SREV_REVISION;
359 AH_PRIVATE(ah)->ah_ispcie = IS_5424(ah) || IS_2425(ah);
360
361 if (!ar5212IsMacSupported(AH_PRIVATE(ah)->ah_macVersion, AH_PRIVATE(ah)->ah_macRev)) {
363 "%s: Mac Chip Rev 0x%02x.%x not supported\n" ,
364 __func__, AH_PRIVATE(ah)->ah_macVersion,
365 AH_PRIVATE(ah)->ah_macRev);
366 ecode = HAL_ENOTSUPP;
367 goto bad;
368 }
369
370 /* setup common ini data; rf backends handle remainder */
371 HAL_INI_INIT(&ahp->ah_ini_modes, ar5212Modes, 6);
372 HAL_INI_INIT(&ahp->ah_ini_common, ar5212Common, 2);
373
374 if (!ar5212ChipReset(ah, AH_NULL)) { /* reset chip */
375 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: chip reset failed\n", __func__);
376 ecode = HAL_EIO;
377 goto bad;
378 }
379
380 AH_PRIVATE(ah)->ah_phyRev = OS_REG_READ(ah, AR_PHY_CHIP_ID);
381
382 if (AH_PRIVATE(ah)->ah_ispcie) {
383 /* XXX: build flag to disable this? */
385 }
386
387 if (!ar5212ChipTest(ah)) {
388 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: hardware self-test failed\n",
389 __func__);
390 ecode = HAL_ESELFTEST;
391 goto bad;
392 }
393
394 /* Enable PCI core retry fix in software for Hainan and up */
395 if (AH_PRIVATE(ah)->ah_macVersion >= AR_SREV_VERSION_VENICE)
397
398 /*
399 * Set correct Baseband to analog shift
400 * setting to access analog chips.
401 */
402 OS_REG_WRITE(ah, AR_PHY(0), 0x00000007);
403
404 /* Read Radio Chip Rev Extract */
405 AH_PRIVATE(ah)->ah_analog5GhzRev = ar5212GetRadioRev(ah);
406
407 rf = ath_hal_rfprobe(ah, &ecode);
408 if (rf == AH_NULL)
409 goto bad;
410
411 /* NB: silently accept anything in release code per Atheros */
412 switch (AH_PRIVATE(ah)->ah_analog5GhzRev & AR_RADIO_SREV_MAJOR) {
420 break;
421 default:
422 if (AH_PRIVATE(ah)->ah_analog5GhzRev == 0) {
423 /*
424 * When RF_Silent is used, the
425 * analog chip is reset. So when the system boots
426 * up with the radio switch off we cannot determine
427 * the RF chip rev. To workaround this check the
428 * mac+phy revs and if Hainan, set the radio rev
429 * to Derby.
430 */
431 if (AH_PRIVATE(ah)->ah_macVersion == AR_SREV_VERSION_VENICE &&
432 AH_PRIVATE(ah)->ah_macRev == AR_SREV_HAINAN &&
433 AH_PRIVATE(ah)->ah_phyRev == AR_PHYREV_HAINAN) {
434 AH_PRIVATE(ah)->ah_analog5GhzRev = AR_ANALOG5REV_HAINAN;
435 break;
436 }
437 if (IS_2413(ah)) { /* Griffin */
438 AH_PRIVATE(ah)->ah_analog5GhzRev =
440 break;
441 }
442 if (IS_5413(ah)) { /* Eagle */
443 AH_PRIVATE(ah)->ah_analog5GhzRev =
445 break;
446 }
447 if (IS_2425(ah) || IS_2417(ah)) {/* Swan or Nala */
448 AH_PRIVATE(ah)->ah_analog5GhzRev =
450 break;
451 }
452 }
453#ifdef AH_DEBUG
455 "%s: 5G Radio Chip Rev 0x%02X is not supported by "
456 "this driver\n",
457 __func__, AH_PRIVATE(ah)->ah_analog5GhzRev);
458 ecode = HAL_ENOTSUPP;
459 goto bad;
460#endif
461 }
462 if (IS_RAD5112_REV1(ah)) {
464 "%s: 5112 Rev 1 is not supported by this "
465 "driver (analog5GhzRev 0x%x)\n", __func__,
466 AH_PRIVATE(ah)->ah_analog5GhzRev);
467 ecode = HAL_ENOTSUPP;
468 goto bad;
469 }
470
471 val = OS_REG_READ(ah, AR_PCICFG);
472 val = MS(val, AR_PCICFG_EEPROM_SIZE);
473 if (val == 0) {
474 if (!AH_PRIVATE(ah)->ah_ispcie) {
476 "%s: unsupported EEPROM size %u (0x%x) found\n",
477 __func__, val, val);
478 ecode = HAL_EESIZE;
479 goto bad;
480 }
481 /* XXX AH_PRIVATE(ah)->ah_isPciExpress = AH_TRUE; */
482 } else if (val != AR_PCICFG_EEPROM_SIZE_16K) {
483 if (AR_PCICFG_EEPROM_SIZE_FAILED == val) {
485 "%s: unsupported EEPROM size %u (0x%x) found\n",
486 __func__, val, val);
487 ecode = HAL_EESIZE;
488 goto bad;
489 }
491 "%s: EEPROM size = %d. Must be %d (16k).\n",
492 __func__, val, AR_PCICFG_EEPROM_SIZE_16K);
493 ecode = HAL_EESIZE;
494 goto bad;
495 }
496 ecode = ath_hal_legacyEepromAttach(ah);
497 if (ecode != HAL_OK) {
498 goto bad;
499 }
501
502 /*
503 * If Bmode and AR5212, verify 2.4 analog exists
504 */
506 (AH_PRIVATE(ah)->ah_analog5GhzRev & 0xF0) == AR_RAD5111_SREV_MAJOR) {
507 /*
508 * Set correct Baseband to analog shift
509 * setting to access analog chips.
510 */
511 OS_REG_WRITE(ah, AR_PHY(0), 0x00004007);
512 OS_DELAY(2000);
513 AH_PRIVATE(ah)->ah_analog2GhzRev = ar5212GetRadioRev(ah);
514
515 /* Set baseband for 5GHz chip */
516 OS_REG_WRITE(ah, AR_PHY(0), 0x00000007);
517 OS_DELAY(2000);
518 if ((AH_PRIVATE(ah)->ah_analog2GhzRev & 0xF0) != AR_RAD2111_SREV_MAJOR) {
520 "%s: 2G Radio Chip Rev 0x%02X is not "
521 "supported by this driver\n", __func__,
522 AH_PRIVATE(ah)->ah_analog2GhzRev);
523 ecode = HAL_ENOTSUPP;
524 goto bad;
525 }
526 }
527
528 ecode = ath_hal_eepromGet(ah, AR_EEP_REGDMN_0, &eeval);
529 if (ecode != HAL_OK) {
531 "%s: cannot read regulatory domain from EEPROM\n",
532 __func__);
533 goto bad;
534 }
535 AH_PRIVATE(ah)->ah_currentRD = eeval;
536 /* XXX record serial number */
537
538 /*
539 * Got everything we need now to setup the capabilities.
540 */
541 if (!ar5212FillCapabilityInfo(ah)) {
543 "%s: failed ar5212FillCapabilityInfo\n", __func__);
544 ecode = HAL_EEREAD;
545 goto bad;
546 }
547
548 if (!rf->attach(ah, &ecode)) {
549 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: RF setup failed, status %u\n",
550 __func__, ecode);
551 goto bad;
552 }
553 /*
554 * Set noise floor adjust method; we arrange a
555 * direct call instead of thunking.
556 */
557 AH_PRIVATE(ah)->ah_getNfAdjust = ahp->ah_rfHal->getNfAdjust;
558
559 /* Initialize gain ladder thermal calibration structure */
561
563 if (ecode != HAL_OK) {
565 "%s: error getting mac address from EEPROM\n", __func__);
566 goto bad;
567 }
568
569 ar5212AniSetup(ah);
570 /* Setup of Radar/AR structures happens in ath_hal_initchannels*/
572
573 /* XXX EAR stuff goes here */
574
575 HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s: return\n", __func__);
576
577 return ah;
578
579bad:
580 if (ahp)
581 ar5212Detach((struct ath_hal *) ahp);
582 if (status)
583 *status = ecode;
584 return AH_NULL;
585#undef AH_EEPROM_PROTECT
586}
587
588void
590{
591 HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s:\n", __func__);
592
593 HALASSERT(ah != AH_NULL);
595
596 ar5212AniDetach(ah);
597 ar5212RfDetach(ah);
598 ar5212Disable(ah);
600
602 ath_hal_free(ah);
603}
604
607{
608 uint32_t regAddr[2] = { AR_STA_ID0, AR_PHY_BASE+(8 << 2) };
609 uint32_t regHold[2];
610 uint32_t patternData[4] =
611 { 0x55555555, 0xaaaaaaaa, 0x66666666, 0x99999999 };
612 int i, j;
613
614 /* Test PHY & MAC registers */
615 for (i = 0; i < 2; i++) {
616 uint32_t addr = regAddr[i];
617 uint32_t wrData, rdData;
618
619 regHold[i] = OS_REG_READ(ah, addr);
620 for (j = 0; j < 0x100; j++) {
621 wrData = (j << 16) | j;
622 OS_REG_WRITE(ah, addr, wrData);
623 rdData = OS_REG_READ(ah, addr);
624 if (rdData != wrData) {
626"%s: address test failed addr: 0x%08x - wr:0x%08x != rd:0x%08x\n",
627 __func__, addr, wrData, rdData);
628 return AH_FALSE;
629 }
630 }
631 for (j = 0; j < 4; j++) {
632 wrData = patternData[j];
633 OS_REG_WRITE(ah, addr, wrData);
634 rdData = OS_REG_READ(ah, addr);
635 if (wrData != rdData) {
637"%s: address test failed addr: 0x%08x - wr:0x%08x != rd:0x%08x\n",
638 __func__, addr, wrData, rdData);
639 return AH_FALSE;
640 }
641 }
642 OS_REG_WRITE(ah, regAddr[i], regHold[i]);
643 }
644 OS_DELAY(100);
645 return AH_TRUE;
646}
647
648/*
649 * Store the channel edges for the requested operational mode
650 */
653 uint16_t flags, uint16_t *low, uint16_t *high)
654{
655 if (flags & IEEE80211_CHAN_5GHZ) {
656 *low = 4915;
657 *high = 6100;
658 return AH_TRUE;
659 }
660 if ((flags & IEEE80211_CHAN_2GHZ) &&
663 *low = 2312;
664 *high = 2732;
665 return AH_TRUE;
666 }
667 return AH_FALSE;
668}
669
670/*
671 * Disable PLL when in L0s as well as receiver clock when in L1.
672 * This power saving option must be enabled through the Serdes.
673 *
674 * Programming the Serdes must go through the same 288 bit serial shift
675 * register as the other analog registers. Hence the 9 writes.
676 *
677 * XXX Clean up the magic numbers.
678 */
679static void
680ar5212ConfigPCIE(struct ath_hal *ah, HAL_BOOL restore, HAL_BOOL power_off)
681{
682 OS_REG_WRITE(ah, AR_PCIE_SERDES, 0x9248fc00);
683 OS_REG_WRITE(ah, AR_PCIE_SERDES, 0x24924924);
684
685 /* RX shut off when elecidle is asserted */
686 OS_REG_WRITE(ah, AR_PCIE_SERDES, 0x28000039);
687 OS_REG_WRITE(ah, AR_PCIE_SERDES, 0x53160824);
688 OS_REG_WRITE(ah, AR_PCIE_SERDES, 0xe5980579);
689
690 /* Shut off PLL and CLKREQ active in L1 */
691 OS_REG_WRITE(ah, AR_PCIE_SERDES, 0x001defff);
692 OS_REG_WRITE(ah, AR_PCIE_SERDES, 0x1aaabe40);
693 OS_REG_WRITE(ah, AR_PCIE_SERDES, 0xbe105554);
694 OS_REG_WRITE(ah, AR_PCIE_SERDES, 0x000e3007);
695
696 /* Load the new settings */
697 OS_REG_WRITE(ah, AR_PCIE_SERDES2, 0x00000000);
698}
699
700static void
702{
703 /* NB: fill in for 9100 */
704}
705
706/*
707 * Fill all software cached or static hardware state information.
708 * Return failure if capabilities are to come from EEPROM and
709 * cannot be read.
710 */
713{
714#define AR_KEYTABLE_SIZE 128
715#define IS_GRIFFIN_LITE(ah) \
716 (AH_PRIVATE(ah)->ah_macVersion == AR_SREV_VERSION_GRIFFIN && \
717 AH_PRIVATE(ah)->ah_macRev == AR_SREV_GRIFFIN_LITE)
718#define IS_COBRA(ah) \
719 (AH_PRIVATE(ah)->ah_macVersion == AR_SREV_VERSION_COBRA)
720#define IS_2112(ah) \
721 ((AH_PRIVATE(ah)->ah_analog5GhzRev & 0xF0) == AR_RAD2112_SREV_MAJOR)
722
723 struct ath_hal_private *ahpriv = AH_PRIVATE(ah);
724 HAL_CAPABILITIES *pCap = &ahpriv->ah_caps;
725 uint16_t capField, val;
726
727 /* Read the capability EEPROM location */
728 if (ath_hal_eepromGet(ah, AR_EEP_OPCAP, &capField) != HAL_OK) {
730 "%s: unable to read caps from eeprom\n", __func__);
731 return AH_FALSE;
732 }
733 if (IS_2112(ah))
735 if (capField == 0 && IS_GRIFFIN_LITE(ah)) {
736 /*
737 * For griffin-lite cards with unprogrammed capabilities.
738 */
744 "%s: override caps for griffin-lite, now 0x%x (+!turbo)\n",
745 __func__, capField);
746 }
747
748 /* Modify reg domain on newer cards that need to work with older sw */
749 if (ahpriv->ah_opmode != HAL_M_HOSTAP &&
751 if (ahpriv->ah_currentRD == 0x64 ||
752 ahpriv->ah_currentRD == 0x65)
753 ahpriv->ah_currentRD += 5;
754 else if (ahpriv->ah_currentRD == 0x41)
755 ahpriv->ah_currentRD = 0x43;
756 HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s: regdomain mapped to 0x%x\n",
757 __func__, ahpriv->ah_currentRD);
758 }
759
763 "%s: enable Bmode and disable turbo for Swan/Nala\n",
764 __func__);
770 }
771
772 /* Construct wireless mode from EEPROM */
773 pCap->halWirelessModes = 0;
778 }
786 }
787
788 pCap->halLow2GhzChan = 2312;
789 /* XXX 2417 too? */
790 if (IS_RAD5112_ANY(ah) || IS_5413(ah) || IS_2425(ah) || IS_2417(ah))
791 pCap->halHigh2GhzChan = 2500;
792 else
793 pCap->halHigh2GhzChan = 2732;
794
795 /*
796 * For AR5111 version < 4, the lowest centre frequency supported is
797 * 5130MHz. For AR5111 version 4, the 4.9GHz channels are supported
798 * but only in 10MHz increments.
799 *
800 * In addition, the programming method is wrong - it uses the IEEE
801 * channel number to calculate the frequency, rather than the
802 * channel centre. Since half/quarter rates re-use some of the
803 * 5GHz channel IEEE numbers, this will result in a badly programmed
804 * synth.
805 *
806 * Until the relevant support is written, just limit lower frequency
807 * support for AR5111 so things aren't incorrectly programmed.
808 *
809 * XXX It's also possible this code doesn't correctly limit the
810 * centre frequencies of potential channels; this is very important
811 * for half/quarter rate!
812 */
814 pCap->halLow5GhzChan = 5120; /* XXX lowest centre = 5130MHz */
815 } else {
816 pCap->halLow5GhzChan = 4915;
817 }
818 pCap->halHigh5GhzChan = 6100;
819
824 ((AH_PRIVATE(ah)->ah_macVersion > AR_SREV_VERSION_VENICE) ||
826 (AH_PRIVATE(ah)->ah_macRev >= AR_SREV_VERSION_OAHU))));
827
831 /*
832 * Starting with Griffin TX+RX mic keys can be combined
833 * in one key cache slot.
834 */
837 else
841
842 if (ahpriv->ah_macRev > 1 || IS_COBRA(ah)) {
843 pCap->halCompressSupport =
852 }
854
855 pCap->halPSPollBroken = AH_TRUE; /* XXX fixed in later revs? */
856 pCap->halNumMRRetries = 4; /* Hardware supports 4 MRR */
857 pCap->halNumTxMaps = 1; /* Single TX ptr per descr */
858 pCap->halVEOLSupport = AH_TRUE;
861 if ((ahpriv->ah_macVersion == AR_SREV_VERSION_VENICE &&
862 ahpriv->ah_macRev == 8) ||
865
866 if (ath_hal_eepromGet(ah, AR_EEP_MAXQCU, &val) == HAL_OK)
867 pCap->halTotalQueues = val;
868 else
870
871 if (ath_hal_eepromGet(ah, AR_EEP_KCENTRIES, &val) == HAL_OK)
872 pCap->halKeyCacheSize = val;
873 else
875
876 pCap->halChanHalfRate = AH_TRUE;
878
879 /*
880 * RSSI uses the combined field; some 11n NICs may use
881 * the control chain RSSI.
882 */
884
887 /* NB: enabled by default */
888 ahpriv->ah_rfkillEnabled = AH_TRUE;
890 }
891
892 /* NB: this is a guess, no one seems to know the answer */
893 ahpriv->ah_rxornIsFatal =
894 (AH_PRIVATE(ah)->ah_macVersion < AR_SREV_VERSION_VENICE);
895
896 /* enable features that first appeared in Hainan */
899 AH_PRIVATE(ah)->ah_macVersion > AR_SREV_VERSION_VENICE) {
900 /* h/w phy counters */
902 /* bssid match disable */
904 }
905
906 pCap->halRxTstampPrecision = 15;
907 pCap->halTxTstampPrecision = 16;
909 | HAL_INT_RX
910 | HAL_INT_TX
914 ;
915 if (AH_PRIVATE(ah)->ah_macVersion < AR_SREV_VERSION_GRIFFIN)
916 pCap->halIntrMask &= ~HAL_INT_TBTT;
917
920
921 return AH_TRUE;
922#undef IS_COBRA
923#undef IS_GRIFFIN_LITE
924#undef AR_KEYTABLE_SIZE
925}
926
927static const char*
928ar5212Probe(uint16_t vendorid, uint16_t devid)
929{
930 if (vendorid == ATHEROS_VENDOR_ID ||
931 vendorid == ATHEROS_3COM_VENDOR_ID ||
932 vendorid == ATHEROS_3COM2_VENDOR_ID) {
933 switch (devid) {
934 case AR5212_FPGA:
935 return "Atheros 5212 (FPGA)";
936 case AR5212_DEVID:
937 case AR5212_DEVID_IBM:
938 case AR5212_DEFAULT:
939 return "Atheros 5212";
940 case AR5212_AR2413:
941 return "Atheros 2413";
942 case AR5212_AR2417:
943 return "Atheros 2417";
944 case AR5212_AR5413:
945 return "Atheros 5413";
946 case AR5212_AR5424:
947 return "Atheros 5424/2424";
948 }
949 }
950 return AH_NULL;
951}
uint32_t ath_hal_reverseBits(uint32_t val, uint32_t n)
Definition: ah.c:333
struct ath_hal_rf * ath_hal_rfprobe(struct ath_hal *ah, HAL_STATUS *ecode)
Definition: ah.c:240
int16_t ath_hal_getChanNoise(struct ath_hal *ah, const struct ieee80211_channel *chan)
Definition: ah.c:1158
HAL_STATUS
Definition: ah.h:71
@ HAL_EIO
Definition: ah.h:75
@ HAL_ESELFTEST
Definition: ah.h:86
@ HAL_EEREAD
Definition: ah.h:80
@ HAL_ENOTSUPP
Definition: ah.h:85
@ HAL_OK
Definition: ah.h:72
@ HAL_ENOMEM
Definition: ah.h:74
@ HAL_EESIZE
Definition: ah.h:82
@ HAL_MODE_108G
Definition: ah.h:666
@ HAL_MODE_TURBO
Definition: ah.h:658
@ HAL_MODE_11G
Definition: ah.h:664
@ HAL_MODE_11A
Definition: ah.h:657
@ HAL_MODE_11B
Definition: ah.h:659
#define HAL_NUM_TX_QUEUES
Definition: ah.h:251
@ HAL_M_HOSTAP
Definition: ah.h:767
@ HAL_PM_AWAKE
Definition: ah.h:440
@ HAL_PM_FULL_SLEEP
Definition: ah.h:441
@ HAL_ANT_VARIABLE
Definition: ah.h:759
@ HAL_INT_BNR
Definition: ah.h:493
@ HAL_INT_COMMON
Definition: ah.h:514
@ HAL_INT_FATAL
Definition: ah.h:505
@ HAL_INT_TX
Definition: ah.h:481
@ HAL_INT_TBTT
Definition: ah.h:500
@ HAL_INT_RX
Definition: ah.h:473
@ HAL_INT_BMISC
Definition: ah.h:507
HAL_BOOL
Definition: ah.h:93
@ AH_FALSE
Definition: ah.h:94
@ AH_TRUE
Definition: ah.h:95
@ HAL_DEBUG_ANY
Definition: ah_debug.h:62
@ HAL_DEBUG_ATTACH
Definition: ah_debug.h:30
#define AR5212_AR2413
Definition: ah_devid.h:66
#define AR5212_DEVID_IBM
Definition: ah_devid.h:50
#define AR5212_AR2417
Definition: ah_devid.h:69
#define AR5212_FPGA
Definition: ah_devid.h:49
#define AR_SUBVENDOR_ID_NOG
Definition: ah_devid.h:101
#define ATHEROS_3COM_VENDOR_ID
Definition: ah_devid.h:31
#define AR5212_DEVID
Definition: ah_devid.h:48
#define AR5212_AR5424
Definition: ah_devid.h:68
#define AR_SUBVENDOR_ID_NEW_A
Definition: ah_devid.h:102
#define AR5212_DEFAULT
Definition: ah_devid.h:47
#define ATHEROS_3COM2_VENDOR_ID
Definition: ah_devid.h:32
#define AR5212_AR5413
Definition: ah_devid.h:67
#define ATHEROS_VENDOR_ID
Definition: ah_devid.h:25
HAL_STATUS ath_hal_legacyEepromAttach(struct ath_hal *ah)
#define MAX_RATE_POWER
Definition: ah_eeprom.h:163
@ AR_EEP_GMODE
Definition: ah_eeprom.h:72
@ AR_EEP_COMPRESS
Definition: ah_eeprom.h:78
@ AR_EEP_MACADDR
Definition: ah_eeprom.h:77
@ AR_EEP_BMODE
Definition: ah_eeprom.h:71
@ AR_EEP_TURBO2DISABLE
Definition: ah_eeprom.h:74
@ AR_EEP_AES
Definition: ah_eeprom.h:80
@ AR_EEP_REGDMN_0
Definition: ah_eeprom.h:86
@ AR_EEP_MAXQCU
Definition: ah_eeprom.h:82
@ AR_EEP_KCENTRIES
Definition: ah_eeprom.h:83
@ AR_EEP_BURST
Definition: ah_eeprom.h:81
@ AR_EEP_OPCAP
Definition: ah_eeprom.h:88
@ AR_EEP_ISTALON
Definition: ah_eeprom.h:75
@ AR_EEP_RFKILL
Definition: ah_eeprom.h:69
@ AR_EEP_FASTFRAME
Definition: ah_eeprom.h:79
@ AR_EEP_RFSILENT
Definition: ah_eeprom.h:90
@ AR_EEP_TURBO5DISABLE
Definition: ah_eeprom.h:73
@ AR_EEP_AMODE
Definition: ah_eeprom.h:70
@ HAL_TP_SCALE_MAX
Definition: ah_internal.h:67
#define OS_REG_SET_BIT(_a, _r, _f)
Definition: ah_internal.h:594
#define ath_hal_eepromSet(_ah, _param, _val)
Definition: ah_internal.h:488
#define HAL_INI_INIT(_ia, _data, _cols)
Definition: ah_internal.h:910
#define SM(_v, _f)
Definition: ah_internal.h:587
#define MS(_v, _f)
Definition: ah_internal.h:588
#define IEEE80211_ADDR_LEN
Definition: ah_internal.h:501
#define ath_hal_configPCIE(_ah, _reset, _poweroff)
Definition: ah_internal.h:468
#define ath_hal_eepromGet(_ah, _param, _val)
Definition: ah_internal.h:486
#define AH_PRIVATE(_ah)
Definition: ah_internal.h:442
void * ath_hal_malloc(size_t)
#define AH_NULL
Definition: ah_internal.h:28
#define HALASSERT(_x)
Definition: ah_internal.h:683
#define HALDEBUG(_ah, __m,...)
Definition: ah_internal.h:658
#define ath_hal_eepromGetFlag(_ah, _param)
Definition: ah_internal.h:490
#define ath_hal_eepromDetach(_ah)
Definition: ah_internal.h:482
void ath_hal_free(void *p)
Definition: ah_osdep.c:116
#define OS_DELAY(_n)
Definition: ah_osdep.h:69
bus_space_tag_t HAL_BUS_TAG
Definition: ah_osdep.h:50
#define OS_REG_WRITE(_ah, _reg, _val)
Definition: ah_osdep.h:139
void * HAL_SOFTC
Definition: ah_osdep.h:49
bus_space_handle_t HAL_BUS_HANDLE
Definition: ah_osdep.h:51
#define OS_MEMCPY(_d, _s, _n)
Definition: ah_osdep.h:73
#define OS_REG_READ(_ah, _reg)
Definition: ah_osdep.h:140
#define MAX_TX_FIFO_THRESHOLD
Definition: ar5210.h:74
#define INIT_RSSI_THR
Definition: ar5210.h:84
#define AR_PHY_BASE
Definition: ar5210phy.h:29
#define AR_PHY(_n)
Definition: ar5210phy.h:30
#define AR_STA_ID0
Definition: ar5210reg.h:70
#define AR_SREV
Definition: ar5210reg.h:63
#define AR_PCICFG
Definition: ar5210reg.h:59
#define INIT_TX_FIFO_THRESHOLD
Definition: ar5211.h:68
#define AR_PHY_CHIP_ID
Definition: ar5211phy.h:36
#define AR_PCICFG_EEPROM_SIZE_16K
Definition: ar5211reg.h:710
#define AR_SREV_ID_S
Definition: ar5211reg.h:711
#define AR_SREV_D2PLUS
Definition: ar5211reg.h:714
#define AR_PCICFG_EEPROM_SIZE_FAILED
Definition: ar5211reg.h:649
#define AR_SREV_VERSION_OAHU
Definition: ar5211reg.h:725
HAL_BOOL ar5212GetTxQueueProps(struct ath_hal *ah, int q, HAL_TXQ_INFO *qInfo)
Definition: ar5212_xmit.c:105
HAL_BOOL ar5212EepromRead(struct ath_hal *, u_int off, uint16_t *data)
Definition: ar5212_eeprom.c:38
void ar5212AniDetach(struct ath_hal *)
Definition: ar5212_ani.c:209
void ar5212GetTxIntrQueue(struct ath_hal *ah, uint32_t *)
Definition: ar5212_xmit.c:953
HAL_BOOL ar5212SetCTSTimeout(struct ath_hal *, u_int)
Definition: ar5212_misc.c:547
HAL_BOOL ar5212Reset(struct ath_hal *ah, HAL_OPMODE opmode, struct ieee80211_channel *chan, HAL_BOOL bChannelChange, HAL_RESET_TYPE, HAL_STATUS *status)
Definition: ar5212_reset.c:119
HAL_RFGAIN ar5212GetRfgain(struct ath_hal *ah)
HAL_BOOL ar5212GetMibCycleCounts(struct ath_hal *, HAL_SURVEY_SAMPLE *)
Definition: ar5212_misc.c:1416
void ar5212GetDfsThresh(struct ath_hal *ah, HAL_PHYERR_PARAM *pe)
Definition: ar5212_misc.c:1307
HAL_STATUS ar5212SetQuiet(struct ath_hal *ah, uint32_t period, uint32_t duration, uint32_t nextStart, HAL_QUIET_FLAG flag)
Definition: ar5212_misc.c:639
HAL_BOOL ar5212SetTxPowerLimit(struct ath_hal *ah, uint32_t limit)
HAL_BOOL ar5212FillTxDesc(struct ath_hal *ah, struct ath_desc *ds, HAL_DMA_ADDR *bufAddrList, uint32_t *segLenList, u_int descId, u_int qcuId, HAL_BOOL firstSeg, HAL_BOOL lastSeg, const struct ath_desc *ds0)
Definition: ar5212_xmit.c:806
uint32_t ar5212GetTsf32(struct ath_hal *ah)
Definition: ar5212_misc.c:263
void ar5212SetTxDescLink(struct ath_hal *ah, void *ds, uint32_t link)
Definition: ar5212_xmit.c:982
void ar5212SetNav(struct ath_hal *, u_int)
Definition: ar5212_misc.c:1483
void ar5212SetMulticastFilter(struct ath_hal *ah, uint32_t filter0, uint32_t filter1)
Definition: ar5212_recv.c:119
HAL_BOOL ar5212SetKeyCacheEntry(struct ath_hal *ah, uint16_t entry, const HAL_KEYVAL *k, const uint8_t *mac, int xorKey)
HAL_BOOL ar5212SetSlotTime(struct ath_hal *, u_int)
Definition: ar5212_misc.c:475
void ar5212StopPcuReceive(struct ath_hal *ah)
Definition: ar5212_recv.c:106
HAL_BOOL ar5212PerCalibration(struct ath_hal *ah, struct ieee80211_channel *chan, HAL_BOOL *isIQdone)
HAL_BOOL ar5212GetTxCompletionRates(struct ath_hal *ah, const struct ath_desc *ds0, int *rates, int *tries)
Definition: ar5212_xmit.c:964
u_int ar5212GetCTSTimeout(struct ath_hal *)
Definition: ar5212_misc.c:566
uint32_t ar5212GpioGet(struct ath_hal *ah, uint32_t gpio)
Definition: ar5212_gpio.c:92
HAL_ANT_SETTING ar5212GetAntennaSwitch(struct ath_hal *)
Definition: ar5212_misc.c:423
void ar5212GetTxDescLinkPtr(struct ath_hal *ah, void *ds, uint32_t **linkptr)
Definition: ar5212_xmit.c:998
HAL_BOOL ar5212GetDfsDefaultThresh(struct ath_hal *ah, HAL_PHYERR_PARAM *pe)
Definition: ar5212_misc.c:1270
HAL_BOOL ar5212SetMacAddress(struct ath_hal *ah, const uint8_t *)
Definition: ar5212_misc.c:46
HAL_BOOL ar5212SetMulticastFilterIndex(struct ath_hal *, uint32_t ix)
Definition: ar5212_recv.c:149
uint64_t ar5212GetNextTBTT(struct ath_hal *)
Definition: ar5212_beacon.c:34
int ar5212SetupTxQueue(struct ath_hal *ah, HAL_TX_QUEUE type, const HAL_TXQ_INFO *qInfo)
Definition: ar5212_xmit.c:122
void ar5212EnableReceive(struct ath_hal *ah)
Definition: ar5212_recv.c:58
HAL_BOOL ar5212SetBssIdMask(struct ath_hal *, const uint8_t *)
Definition: ar5212_misc.c:63
HAL_STATUS ar5212ProcRxDesc(struct ath_hal *ah, struct ath_desc *, uint32_t, struct ath_desc *, uint64_t, struct ath_rx_status *)
Definition: ar5212_recv.c:248
u_int ar5212GetNav(struct ath_hal *)
Definition: ar5212_misc.c:1468
void ar5212SetBeaconTimers(struct ath_hal *ah, const HAL_BEACON_TIMERS *)
Definition: ar5212_beacon.c:47
#define AH_RADIO_MAJOR(ah)
Definition: ar5212.h:382
HAL_BOOL ar5212SetupTxDesc(struct ath_hal *ah, struct ath_desc *ds, u_int pktLen, u_int hdrLen, HAL_PKT_TYPE type, u_int txPower, u_int txRate0, u_int txTries0, u_int keyIx, u_int antMode, u_int flags, u_int rtsctsRate, u_int rtsctsDuration, u_int compicvLen, u_int compivLen, u_int comp)
Definition: ar5212_xmit.c:690
HAL_BOOL ar5212StopTxDma(struct ath_hal *ah, u_int q)
Definition: ar5212_xmit.c:590
#define IS_2425(ah)
Definition: ar5212.h:376
HAL_BOOL ar5212ReleaseTxQueue(struct ath_hal *ah, u_int q)
Definition: ar5212_xmit.c:232
HAL_BOOL ar5212SetTxQueueProps(struct ath_hal *ah, int q, const HAL_TXQ_INFO *qInfo)
Definition: ar5212_xmit.c:88
void ar5212SetRxFilter(struct ath_hal *ah, uint32_t bits)
Definition: ar5212_recv.c:187
HAL_BOOL ar5212IsFastClockEnabled(struct ath_hal *ah)
Definition: ar5212_misc.c:1397
void ar5212AniAttach(struct ath_hal *, const struct ar5212AniParams *, const struct ar5212AniParams *, HAL_BOOL ena)
Definition: ar5212_ani.c:152
void ar5212ResetStaBeaconTimers(struct ath_hal *ah)
u_int ar5212GetAckTimeout(struct ath_hal *)
Definition: ar5212_misc.c:519
u_int ar5212GetSifsTime(struct ath_hal *)
Definition: ar5212_misc.c:468
#define IS_5424(ah)
Definition: ar5212.h:370
void ar5212IntrReqTxDesc(struct ath_hal *ah, struct ath_desc *)
Definition: ar5212_xmit.c:794
u_int ar5212GetSlotTime(struct ath_hal *)
Definition: ar5212_misc.c:493
void ar5212SetStaBeaconTimers(struct ath_hal *ah, const HAL_BEACON_STATE *)
void ar5212ProcessMibIntr(struct ath_hal *, const HAL_NODE_STATS *)
Definition: ar5212_ani.c:685
HAL_BOOL ar5212SetCapability(struct ath_hal *, HAL_CAPABILITY_TYPE, uint32_t, uint32_t, HAL_STATUS *)
Definition: ar5212_misc.c:932
HAL_BOOL ar5212StopDmaReceive(struct ath_hal *ah)
Definition: ar5212_recv.c:67
HAL_BOOL ar5212UpdateTxTrigLevel(struct ath_hal *, HAL_BOOL IncTrigLevel)
Definition: ar5212_xmit.c:48
void ar5212UpdateMibCounters(struct ath_hal *ah, HAL_MIB_STATS *stats)
Definition: ar5212_misc.c:383
HAL_BOOL ar5212ClrMulticastFilterIndex(struct ath_hal *, uint32_t ix)
Definition: ar5212_recv.c:129
void ar5212SetTsf64(struct ath_hal *ah, uint64_t tsf64)
Definition: ar5212_misc.c:269
uint32_t ar5212NumTxPending(struct ath_hal *ah, u_int q)
Definition: ar5212_xmit.c:566
uint32_t ar5212GetTxDP(struct ath_hal *ah, u_int q)
Definition: ar5212_xmit.c:516
void ar5212SetChainMasks(struct ath_hal *, uint32_t, uint32_t)
Definition: ar5212_misc.c:1457
void ar5212InitializeGainValues(struct ath_hal *)
Definition: ar5212_rfgain.c:66
#define IS_5413(ah)
Definition: ar5212.h:374
HAL_BOOL ar5212SetupXTxDesc(struct ath_hal *, struct ath_desc *, u_int txRate1, u_int txRetries1, u_int txRate2, u_int txRetries2, u_int txRate3, u_int txRetries3)
Definition: ar5212_xmit.c:762
#define ar5212RfDetach(ah)
Definition: ar5212.h:405
HAL_BOOL ar5212EepromWrite(struct ath_hal *, u_int off, uint16_t data)
HAL_BOOL ar5212GetChipPowerLimits(struct ath_hal *ah, struct ieee80211_channel *chan)
uint32_t ar5212Get11nExtBusy(struct ath_hal *ah)
Definition: ar5212_misc.c:1407
void ar5212GetBssIdMask(struct ath_hal *ah, uint8_t *mac)
Definition: ar5212_misc.c:55
HAL_BOOL ar5212SetTxDP(struct ath_hal *ah, u_int q, uint32_t txdp)
Definition: ar5212_xmit.c:526
HAL_BOOL ar5212SetAckTimeout(struct ath_hal *, u_int)
Definition: ar5212_misc.c:500
HAL_BOOL ar5212IsKeyCacheEntryValid(struct ath_hal *, uint16_t entry)
HAL_BOOL ar5212GpioCfgOutput(struct ath_hal *, uint32_t gpio, HAL_GPIO_MUX_TYPE)
Definition: ar5212_gpio.c:41
HAL_BOOL ar5212StartTxDma(struct ath_hal *ah, u_int q)
Definition: ar5212_xmit.c:546
HAL_BOOL ar5212SetSifsTime(struct ath_hal *, u_int)
Definition: ar5212_misc.c:450
HAL_BOOL ar5212SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
Definition: ar5212_power.c:122
HAL_BOOL ar5212Disable(struct ath_hal *ah)
Definition: ar5212_reset.c:844
HAL_BOOL ar5212GetPendingInterrupts(struct ath_hal *ah, HAL_INT *)
HAL_INT ar5212SetInterrupts(struct ath_hal *ah, HAL_INT ints)
HAL_BOOL ar5212ResetTxQueue(struct ath_hal *ah, u_int q)
Definition: ar5212_xmit.c:270
void ar5212SetLedState(struct ath_hal *ah, HAL_LED_STATE state)
Definition: ar5212_misc.c:177
HAL_BOOL ar5212GpioCfgInput(struct ath_hal *, uint32_t gpio)
Definition: ar5212_gpio.c:59
#define IS_2417(ah)
Definition: ar5212.h:378
uint32_t ar5212GetRxDP(struct ath_hal *ath, HAL_RX_QUEUE)
Definition: ar5212_recv.c:35
void ar5212StartPcuReceive(struct ath_hal *ah, HAL_BOOL)
Definition: ar5212_recv.c:90
HAL_BOOL ar5212PerCalibrationN(struct ath_hal *ah, struct ieee80211_channel *chan, u_int chainMask, HAL_BOOL longCal, HAL_BOOL *isCalDone)
Definition: ar5212_reset.c:974
u_int ar5212GetDefAntenna(struct ath_hal *ah)
Definition: ar5212_misc.c:411
void ar5212SetDefAntenna(struct ath_hal *ah, u_int antenna)
Definition: ar5212_misc.c:417
HAL_POWER_MODE ar5212GetPowerMode(struct ath_hal *ah)
Definition: ar5212_power.c:165
void ar5212SetPCUConfig(struct ath_hal *)
Definition: ar5212_misc.c:653
#define IS_RAD5112_ANY(ah)
Definition: ar5212.h:393
void ar5212AniPoll(struct ath_hal *, const struct ieee80211_channel *)
Definition: ar5212_ani.c:983
const HAL_RATE_TABLE * ar5212GetRateTable(struct ath_hal *, u_int mode)
Definition: ar5212_phy.c:164
void ar5212EnableDfs(struct ath_hal *ah, HAL_PHYERR_PARAM *pe)
Definition: ar5212_misc.c:1166
#define IS_RAD5112_REV1(ah)
Definition: ar5212.h:396
#define AH5212(_ah)
Definition: ar5212.h:354
u_int ar5212GetAckCTSRate(struct ath_hal *)
Definition: ar5212_misc.c:526
HAL_STATUS ar5212ProcTxDesc(struct ath_hal *ah, struct ath_desc *, struct ath_tx_status *)
Definition: ar5212_xmit.c:878
void ar5212SetCoverageClass(struct ath_hal *, uint8_t, int)
Definition: ar5212_misc.c:589
u_int ar5212GetWirelessModes(struct ath_hal *ah)
Definition: ar5212_misc.c:115
HAL_BOOL ar5212ProcessRadarEvent(struct ath_hal *ah, struct ath_rx_status *rxs, uint64_t fulltsf, const char *buf, HAL_DFS_EVENT *event)
Definition: ar5212_misc.c:1351
HAL_BOOL ar5212ResetCalValid(struct ath_hal *ah, const struct ieee80211_channel *)
HAL_BOOL ar5212AniControl(struct ath_hal *, HAL_ANI_CMD cmd, int param)
Definition: ar5212_ani.c:222
void ar5212GpioSetIntr(struct ath_hal *ah, u_int, uint32_t ilevel)
Definition: ar5212_gpio.c:107
void ar5212GetMacAddress(struct ath_hal *ah, uint8_t *mac)
Definition: ar5212_misc.c:38
uint32_t ar5212GetKeyCacheSize(struct ath_hal *)
void ar5212GetTxDescLink(struct ath_hal *ah, void *ds, uint32_t *link)
Definition: ar5212_xmit.c:990
uint64_t ar5212GetTsf64(struct ath_hal *ah)
Definition: ar5212_misc.c:235
HAL_BOOL ar5212SetAntennaSwitch(struct ath_hal *, HAL_ANT_SETTING)
Definition: ar5212_misc.c:429
void ar5212InitNfCalHistBuffer(struct ath_hal *)
#define AR5212_MAGIC
Definition: ar5212.h:26
HAL_BOOL ar5212SetAckCTSRate(struct ath_hal *, u_int)
Definition: ar5212_misc.c:532
HAL_BOOL ar5212SetDecompMask(struct ath_hal *, uint16_t, int)
Definition: ar5212_misc.c:574
void ar5212SetRxDP(struct ath_hal *ah, uint32_t rxdp, HAL_RX_QUEUE)
Definition: ar5212_recv.c:46
void ar5212ResetTsf(struct ath_hal *ah)
Definition: ar5212_misc.c:279
HAL_BOOL ar5212PhyDisable(struct ath_hal *ah)
Definition: ar5212_reset.c:835
HAL_BOOL ar5212GpioSet(struct ath_hal *, uint32_t gpio, uint32_t val)
Definition: ar5212_gpio.c:74
HAL_INT ar5212GetInterrupts(struct ath_hal *ah)
HAL_STATUS ar5212GetCapability(struct ath_hal *, HAL_CAPABILITY_TYPE, uint32_t, uint32_t *)
Definition: ar5212_misc.c:795
HAL_BOOL ar5212DetectCardPresent(struct ath_hal *ah)
Definition: ar5212_misc.c:348
HAL_BOOL ar5212SetRegulatoryDomain(struct ath_hal *ah, uint16_t regDomain, HAL_STATUS *stats)
Definition: ar5212_misc.c:79
uint32_t ar5212GetRxFilter(struct ath_hal *ah)
Definition: ar5212_recv.c:169
HAL_BOOL ar5212GetDiagState(struct ath_hal *ah, int request, const void *args, uint32_t argsize, void **result, uint32_t *resultsize)
Definition: ar5212_misc.c:1052
HAL_BOOL ar5212ChipReset(struct ath_hal *ah, const struct ieee80211_channel *)
Definition: ar5212_reset.c:863
HAL_BOOL ar5212SetupRxDesc(struct ath_hal *, struct ath_desc *, uint32_t size, u_int flags)
Definition: ar5212_recv.c:222
HAL_BOOL ar5212ResetKeyCacheEntry(struct ath_hal *ah, uint16_t entry)
void ar5212BeaconInit(struct ath_hal *ah, uint32_t next_beacon, uint32_t beacon_period)
Definition: ar5212_beacon.c:90
HAL_BOOL ar5212IsInterruptPending(struct ath_hal *ah)
void ar5212WriteAssocid(struct ath_hal *ah, const uint8_t *bssid, uint16_t assocId)
Definition: ar5212_misc.c:219
void ar5212RxMonitor(struct ath_hal *, const HAL_NODE_STATS *, const struct ieee80211_channel *)
Definition: ar5212_ani.c:971
HAL_BOOL ar5212SetKeyCacheEntryMac(struct ath_hal *, uint16_t entry, const uint8_t *mac)
#define IS_2413(ah)
Definition: ar5212.h:368
static void ar5212DisablePCIE(struct ath_hal *ah)
AH_CHIP(AR5212, ar5212Probe, ar5212Attach)
void ar5212Detach(struct ath_hal *ah)
#define AR_KEYTABLE_SIZE
static void ar5212AniSetup(struct ath_hal *ah)
HAL_BOOL ar5212FillCapabilityInfo(struct ath_hal *ah)
static const char * ar5212Probe(uint16_t vendorid, uint16_t devid)
HAL_BOOL ar5212ChipTest(struct ath_hal *ah)
HAL_BOOL ar5212GetChannelEdges(struct ath_hal *ah, uint16_t flags, uint16_t *low, uint16_t *high)
static struct ath_hal * ar5212Attach(uint16_t devid, HAL_SOFTC sc, HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata, HAL_OPS_CONFIG *ah_config, HAL_STATUS *status)
static void ar5212ConfigPCIE(struct ath_hal *ah, HAL_BOOL restore, HAL_BOOL power_off)
#define IS_2112(ah)
static const struct ath_hal_private ar5212hal
Definition: ar5212_attach.c:38
static HAL_BOOL ar5212IsMacSupported(uint8_t macVersion, uint8_t macRev)
#define IS_COBRA(ah)
uint32_t ar5212GetRadioRev(struct ath_hal *ah)
#define IS_GRIFFIN_LITE(ah)
#define N(a)
void ar5212InitState(struct ath_hal_5212 *ahp, uint16_t devid, HAL_SOFTC sc, HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status)
#define AR_RAD5111_SREV_MAJOR
Definition: ar5212reg.h:798
#define AR_SREV_5413
Definition: ar5212reg.h:785
#define AR_PCICFG_EEPROM_SIZE
Definition: ar5212reg.h:709
#define AR_PCIE_SERDES2
Definition: ar5212reg.h:247
#define AR_PCIE_SERDES
Definition: ar5212reg.h:246
#define AR_TPC_CHIRP
Definition: ar5212reg.h:943
#define AR_SREV_5424
Definition: ar5212reg.h:787
#define AR_SREV_ID
Definition: ar5212reg.h:758
#define AR_TPC_ACK
Definition: ar5212reg.h:939
#define AR_SREV_HAINAN
Definition: ar5212reg.h:771
#define AR_STA_ID1_CRPT_MIC_ENABLE
Definition: ar5212reg.h:856
#define AR_PHYREV_HAINAN
Definition: ar5212reg.h:793
#define AR_SREV_REVISION_MAX
Definition: ar5212reg.h:762
#define AR_PCICFG_RETRYFIXEN
Definition: ar5212reg.h:723
#define AR_SREV_REVISION
Definition: ar5212reg.h:760
#define AR_RAD2112_SREV_MAJOR
Definition: ar5212reg.h:804
#define AR_SREV_VERSION_GRIFFIN
Definition: ar5212reg.h:780
#define AR_RAD5112_SREV_MAJOR
Definition: ar5212reg.h:801
#define AR_SREV_2417
Definition: ar5212reg.h:789
#define AR_RAD5424_SREV_MAJOR
Definition: ar5212reg.h:811
#define AR_RAD2111_SREV_MAJOR
Definition: ar5212reg.h:800
#define AR_SREV_VERSION_VENICE
Definition: ar5212reg.h:779
#define AR_SREV_REVISION_MIN
Definition: ar5212reg.h:761
#define AR_RAD5413_SREV_MAJOR
Definition: ar5212reg.h:808
#define AR_ANALOG5REV_HAINAN
Definition: ar5212reg.h:794
#define AR_TPC_CTS
Definition: ar5212reg.h:941
#define AR_RADIO_SREV_MAJOR
Definition: ar5212reg.h:796
#define AR_RAD2413_SREV_MAJOR
Definition: ar5212reg.h:807
#define AR_SREV_2425
Definition: ar5212reg.h:788
uint32_t halChanSpreadSupport
Definition: ah_internal.h:223
uint32_t halRfSilentSupport
Definition: ah_internal.h:247
uint32_t halBssidMatchSupport
Definition: ah_internal.h:267
uint32_t halTurboPrimeSupport
Definition: ah_internal.h:230
uint32_t halHwPhyCounterSupport
Definition: ah_internal.h:248
uint32_t halMicCkipSupport
Definition: ah_internal.h:232
uint16_t halLow5GhzChan
Definition: ah_internal.h:298
uint32_t halFastFramesSupport
Definition: ah_internal.h:227
uint32_t halUseCombinedRadarRssi
Definition: ah_internal.h:262
uint32_t halIntrMask
Definition: ah_internal.h:308
uint32_t halMicAesCcmSupport
Definition: ah_internal.h:231
uint16_t halHigh5GhzChan
Definition: ah_internal.h:298
uint32_t halBssIdMaskSupport
Definition: ah_internal.h:240
uint32_t halCipherAesCcmSupport
Definition: ah_internal.h:235
uint32_t halTurboGSupport
Definition: ah_internal.h:229
uint16_t halLow2GhzChan
Definition: ah_internal.h:299
uint16_t halKeyCacheSize
Definition: ah_internal.h:297
uint32_t halCipherTkipSupport
Definition: ah_internal.h:237
uint32_t halVEOLSupport
Definition: ah_internal.h:239
uint16_t halTotalQueues
Definition: ah_internal.h:296
uint16_t halHigh2GhzChan
Definition: ah_internal.h:299
uint32_t halCipherCkipSupport
Definition: ah_internal.h:236
uint32_t halCompressSupport
Definition: ah_internal.h:225
uint32_t halMcastKeySrchSupport
Definition: ah_internal.h:241
uint32_t halTsfAddSupport
Definition: ah_internal.h:242
uint32_t halWirelessModes
Definition: ah_internal.h:295
uint32_t halTkipMicTxRxKeySupport
Definition: ah_internal.h:234
uint32_t halMicTkipSupport
Definition: ah_internal.h:233
uint32_t halChanHalfRate
Definition: ah_internal.h:243
uint32_t halHasRxSelfLinkedTail
Definition: ah_internal.h:269
uint32_t halChapTuningSupport
Definition: ah_internal.h:228
uint32_t halChanQuarterRate
Definition: ah_internal.h:244
uint32_t halPSPollBroken
Definition: ah_internal.h:238
uint32_t halBurstSupport
Definition: ah_internal.h:226
uint32_t hal4kbSplitTransSupport
Definition: ah_internal.h:268
uint32_t halSleepAfterBeaconBroken
Definition: ah_internal.h:224
int16_t(* getNfAdjust)(struct ath_hal *, const HAL_CHANNEL_INTERNAL *)
Definition: ar5212.h:150
int maxNoiseImmunityLevel
Definition: ar5212.h:154
int maxSpurImmunityLevel
Definition: ar5212.h:160
u_int ah_acktimeout
Definition: ar5212.h:308
HAL_ANT_SETTING ah_antControl
Definition: ar5212.h:277
u_int ah_ctstimeout
Definition: ar5212.h:309
HAL_INI_ARRAY ah_ini_common
Definition: ar5212.h:252
uint8_t ah_txTrigLev
Definition: ar5212.h:338
u_int ah_slottime
Definition: ar5212.h:307
enum ath_hal_5212::@23 ah_enable32kHzClock
uint8_t ah_bssidmask[IEEE80211_ADDR_LEN]
Definition: ar5212.h:258
enum ath_hal_5212::@22 ah_bIQCalibration
HAL_BOOL ah_phyPowerOn
Definition: ar5212.h:291
uint32_t ah_staId1Defaults
Definition: ar5212.h:286
uint32_t ah_rssiThr
Definition: ar5212.h:288
uint8_t ah_macaddr[IEEE80211_ADDR_LEN]
Definition: ar5212.h:256
uint32_t ah_beaconInterval
Definition: ar5212.h:294
uint8_t ah_maxTxTrigLev
Definition: ar5212.h:339
uint32_t ah_macTPC
Definition: ar5212.h:293
HAL_BOOL ah_tpcEnabled
Definition: ar5212.h:290
HAL_BOOL ah_diversity
Definition: ar5212.h:278
RF_HAL_FUNCS * ah_rfHal
Definition: ar5212.h:266
struct ath_hal_private ah_priv
Definition: ar5212.h:245
u_int ah_sifstime
Definition: ar5212.h:310
HAL_BOOL ah_isHb63
Definition: ar5212.h:292
HAL_INI_ARRAY ah_ini_modes
Definition: ar5212.h:251
HAL_CAPABILITIES ah_caps
Definition: ah_internal.h:402
struct ath_hal h
Definition: ah_internal.h:358
uint16_t ah_macRev
Definition: ah_internal.h:392
HAL_REG_DOMAIN ah_currentRD
Definition: ah_internal.h:413
HAL_BOOL ah_rfkillEnabled
Definition: ah_internal.h:426
uint16_t ah_rfsilent
Definition: ah_internal.h:425
HAL_OPMODE ah_opmode
Definition: ah_internal.h:400
uint16_t ah_subvendorid
Definition: ah_internal.h:390
uint32_t ah_macVersion
Definition: ah_internal.h:391
HAL_BOOL(* attach)(struct ath_hal *ah, HAL_STATUS *ecode)
Definition: ah_internal.h:124
Definition: ah.h:1219
HAL_BUS_TAG ah_st
Definition: ah.h:1224
uint16_t ah_devid
Definition: ah.h:1221
uint32_t ah_magic
Definition: ah.h:1220
HAL_BUS_HANDLE ah_sh
Definition: ah.h:1225
HAL_OPS_CONFIG ah_config
Definition: ah.h:1243
HAL_SOFTC ah_sc
Definition: ah.h:1223