Deleted Added
full compact
ar5211_attach.c (185380) ar5211_attach.c (185406)
1/*
2 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3 * Copyright (c) 2002-2006 Atheros Communications, Inc.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 *
17 * $Id: ar5211_attach.c,v 1.11 2008/11/27 22:29:52 sam Exp $
18 */
19#include "opt_ah.h"
20
1/*
2 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3 * Copyright (c) 2002-2006 Atheros Communications, Inc.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 *
17 * $Id: ar5211_attach.c,v 1.11 2008/11/27 22:29:52 sam Exp $
18 */
19#include "opt_ah.h"
20
21#ifdef AH_SUPPORT_AR5211
22
23#include "ah.h"
24#include "ah_internal.h"
25#include "ah_devid.h"
26
27#include "ar5211/ar5211.h"
28#include "ar5211/ar5211reg.h"
29#include "ar5211/ar5211phy.h"
30
31#include "ah_eeprom_v3.h"
32
33static HAL_BOOL ar5211GetChannelEdges(struct ath_hal *ah,
34 uint16_t flags, uint16_t *low, uint16_t *high);
35static HAL_BOOL ar5211GetChipPowerLimits(struct ath_hal *ah,
36 HAL_CHANNEL *chans, uint32_t nchans);
37
38static const struct ath_hal_private ar5211hal = {{
39 .ah_magic = AR5211_MAGIC,
40 .ah_abi = HAL_ABI_VERSION,
41 .ah_countryCode = CTRY_DEFAULT,
42
43 .ah_getRateTable = ar5211GetRateTable,
44 .ah_detach = ar5211Detach,
45
46 /* Reset Functions */
47 .ah_reset = ar5211Reset,
48 .ah_phyDisable = ar5211PhyDisable,
49 .ah_disable = ar5211Disable,
50 .ah_setPCUConfig = ar5211SetPCUConfig,
51 .ah_perCalibration = ar5211PerCalibration,
52 .ah_perCalibrationN = ar5211PerCalibrationN,
53 .ah_resetCalValid = ar5211ResetCalValid,
54 .ah_setTxPowerLimit = ar5211SetTxPowerLimit,
55 .ah_getChanNoise = ath_hal_getChanNoise,
56
57 /* Transmit functions */
58 .ah_updateTxTrigLevel = ar5211UpdateTxTrigLevel,
59 .ah_setupTxQueue = ar5211SetupTxQueue,
60 .ah_setTxQueueProps = ar5211SetTxQueueProps,
61 .ah_getTxQueueProps = ar5211GetTxQueueProps,
62 .ah_releaseTxQueue = ar5211ReleaseTxQueue,
63 .ah_resetTxQueue = ar5211ResetTxQueue,
64 .ah_getTxDP = ar5211GetTxDP,
65 .ah_setTxDP = ar5211SetTxDP,
66 .ah_numTxPending = ar5211NumTxPending,
67 .ah_startTxDma = ar5211StartTxDma,
68 .ah_stopTxDma = ar5211StopTxDma,
69 .ah_setupTxDesc = ar5211SetupTxDesc,
70 .ah_setupXTxDesc = ar5211SetupXTxDesc,
71 .ah_fillTxDesc = ar5211FillTxDesc,
72 .ah_procTxDesc = ar5211ProcTxDesc,
73 .ah_getTxIntrQueue = ar5211GetTxIntrQueue,
74 .ah_reqTxIntrDesc = ar5211IntrReqTxDesc,
75
76 /* RX Functions */
77 .ah_getRxDP = ar5211GetRxDP,
78 .ah_setRxDP = ar5211SetRxDP,
79 .ah_enableReceive = ar5211EnableReceive,
80 .ah_stopDmaReceive = ar5211StopDmaReceive,
81 .ah_startPcuReceive = ar5211StartPcuReceive,
82 .ah_stopPcuReceive = ar5211StopPcuReceive,
83 .ah_setMulticastFilter = ar5211SetMulticastFilter,
84 .ah_setMulticastFilterIndex = ar5211SetMulticastFilterIndex,
85 .ah_clrMulticastFilterIndex = ar5211ClrMulticastFilterIndex,
86 .ah_getRxFilter = ar5211GetRxFilter,
87 .ah_setRxFilter = ar5211SetRxFilter,
88 .ah_setupRxDesc = ar5211SetupRxDesc,
89 .ah_procRxDesc = ar5211ProcRxDesc,
90 .ah_rxMonitor = ar5211AniPoll,
91 .ah_procMibEvent = ar5211MibEvent,
92
93 /* Misc Functions */
94 .ah_getCapability = ar5211GetCapability,
95 .ah_setCapability = ar5211SetCapability,
96 .ah_getDiagState = ar5211GetDiagState,
97 .ah_getMacAddress = ar5211GetMacAddress,
98 .ah_setMacAddress = ar5211SetMacAddress,
99 .ah_getBssIdMask = ar5211GetBssIdMask,
100 .ah_setBssIdMask = ar5211SetBssIdMask,
101 .ah_setRegulatoryDomain = ar5211SetRegulatoryDomain,
102 .ah_setLedState = ar5211SetLedState,
103 .ah_writeAssocid = ar5211WriteAssocid,
104 .ah_gpioCfgInput = ar5211GpioCfgInput,
105 .ah_gpioCfgOutput = ar5211GpioCfgOutput,
106 .ah_gpioGet = ar5211GpioGet,
107 .ah_gpioSet = ar5211GpioSet,
108 .ah_gpioSetIntr = ar5211GpioSetIntr,
109 .ah_getTsf32 = ar5211GetTsf32,
110 .ah_getTsf64 = ar5211GetTsf64,
111 .ah_resetTsf = ar5211ResetTsf,
112 .ah_detectCardPresent = ar5211DetectCardPresent,
113 .ah_updateMibCounters = ar5211UpdateMibCounters,
114 .ah_getRfGain = ar5211GetRfgain,
115 .ah_getDefAntenna = ar5211GetDefAntenna,
116 .ah_setDefAntenna = ar5211SetDefAntenna,
117 .ah_getAntennaSwitch = ar5211GetAntennaSwitch,
118 .ah_setAntennaSwitch = ar5211SetAntennaSwitch,
119 .ah_setSifsTime = ar5211SetSifsTime,
120 .ah_getSifsTime = ar5211GetSifsTime,
121 .ah_setSlotTime = ar5211SetSlotTime,
122 .ah_getSlotTime = ar5211GetSlotTime,
123 .ah_setAckTimeout = ar5211SetAckTimeout,
124 .ah_getAckTimeout = ar5211GetAckTimeout,
125 .ah_setAckCTSRate = ar5211SetAckCTSRate,
126 .ah_getAckCTSRate = ar5211GetAckCTSRate,
127 .ah_setCTSTimeout = ar5211SetCTSTimeout,
128 .ah_getCTSTimeout = ar5211GetCTSTimeout,
129 .ah_setDecompMask = ar5211SetDecompMask,
130 .ah_setCoverageClass = ar5211SetCoverageClass,
131
132 /* Key Cache Functions */
133 .ah_getKeyCacheSize = ar5211GetKeyCacheSize,
134 .ah_resetKeyCacheEntry = ar5211ResetKeyCacheEntry,
135 .ah_isKeyCacheEntryValid = ar5211IsKeyCacheEntryValid,
136 .ah_setKeyCacheEntry = ar5211SetKeyCacheEntry,
137 .ah_setKeyCacheEntryMac = ar5211SetKeyCacheEntryMac,
138
139 /* Power Management Functions */
140 .ah_setPowerMode = ar5211SetPowerMode,
141 .ah_getPowerMode = ar5211GetPowerMode,
142
143 /* Beacon Functions */
144 .ah_setBeaconTimers = ar5211SetBeaconTimers,
145 .ah_beaconInit = ar5211BeaconInit,
146 .ah_setStationBeaconTimers = ar5211SetStaBeaconTimers,
147 .ah_resetStationBeaconTimers = ar5211ResetStaBeaconTimers,
148
149 /* Interrupt Functions */
150 .ah_isInterruptPending = ar5211IsInterruptPending,
151 .ah_getPendingInterrupts = ar5211GetPendingInterrupts,
152 .ah_getInterrupts = ar5211GetInterrupts,
153 .ah_setInterrupts = ar5211SetInterrupts },
154
155 .ah_getChannelEdges = ar5211GetChannelEdges,
156 .ah_getWirelessModes = ar5211GetWirelessModes,
157 .ah_eepromRead = ar5211EepromRead,
158#ifdef AH_SUPPORT_WRITE_EEPROM
159 .ah_eepromWrite = ar5211EepromWrite,
160#endif
161 .ah_gpioCfgInput = ar5211GpioCfgInput,
162 .ah_gpioCfgOutput = ar5211GpioCfgOutput,
163 .ah_gpioGet = ar5211GpioGet,
164 .ah_gpioSet = ar5211GpioSet,
165 .ah_gpioSetIntr = ar5211GpioSetIntr,
166 .ah_getChipPowerLimits = ar5211GetChipPowerLimits,
167};
168
169static HAL_BOOL ar5211ChipTest(struct ath_hal *);
170static HAL_BOOL ar5211FillCapabilityInfo(struct ath_hal *ah);
171
172/*
173 * Return the revsion id for the radio chip. This
174 * fetched via the PHY.
175 */
176static uint32_t
177ar5211GetRadioRev(struct ath_hal *ah)
178{
179 uint32_t val;
180 int i;
181
182 OS_REG_WRITE(ah, (AR_PHY_BASE + (0x34 << 2)), 0x00001c16);
183 for (i = 0; i < 8; i++)
184 OS_REG_WRITE(ah, (AR_PHY_BASE + (0x20 << 2)), 0x00010000);
185 val = (OS_REG_READ(ah, AR_PHY_BASE + (256 << 2)) >> 24) & 0xff;
186 val = ((val & 0xf0) >> 4) | ((val & 0x0f) << 4);
187 return ath_hal_reverseBits(val, 8);
188}
189
190/*
191 * Attach for an AR5211 part.
192 */
193struct ath_hal *
194ar5211Attach(uint16_t devid, HAL_SOFTC sc,
195 HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status)
196{
197#define N(a) (sizeof(a)/sizeof(a[0]))
198 struct ath_hal_5211 *ahp;
199 struct ath_hal *ah;
200 uint32_t val;
201 uint16_t eeval;
202 HAL_STATUS ecode;
203
204 HALDEBUG(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
205 __func__, sc, (void*) st, (void*) sh);
206
207 /* NB: memory is returned zero'd */
208 ahp = ath_hal_malloc(sizeof (struct ath_hal_5211));
209 if (ahp == AH_NULL) {
210 HALDEBUG(AH_NULL, HAL_DEBUG_ANY,
211 "%s: cannot allocate memory for state block\n", __func__);
212 ecode = HAL_ENOMEM;
213 goto bad;
214 }
215 ah = &ahp->ah_priv.h;
216 /* set initial values */
217 OS_MEMCPY(&ahp->ah_priv, &ar5211hal, sizeof(struct ath_hal_private));
218 ah->ah_sc = sc;
219 ah->ah_st = st;
220 ah->ah_sh = sh;
221
222 ah->ah_devid = devid; /* NB: for AH_DEBUG_ALQ */
223 AH_PRIVATE(ah)->ah_devid = devid;
224 AH_PRIVATE(ah)->ah_subvendorid = 0; /* XXX */
225
226 AH_PRIVATE(ah)->ah_powerLimit = MAX_RATE_POWER;
227 AH_PRIVATE(ah)->ah_tpScale = HAL_TP_SCALE_MAX; /* no scaling */
228
229 ahp->ah_diversityControl = HAL_ANT_VARIABLE;
230 ahp->ah_staId1Defaults = 0;
231 ahp->ah_rssiThr = INIT_RSSI_THR;
232 ahp->ah_sifstime = (u_int) -1;
233 ahp->ah_slottime = (u_int) -1;
234 ahp->ah_acktimeout = (u_int) -1;
235 ahp->ah_ctstimeout = (u_int) -1;
236
237 if (!ar5211ChipReset(ah, AH_FALSE)) { /* reset chip */
238 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: chip reset failed\n", __func__);
239 ecode = HAL_EIO;
240 goto bad;
241 }
242 if (AH_PRIVATE(ah)->ah_devid == AR5211_FPGA11B) {
243 /* set it back to OFDM mode to be able to read analog rev id */
244 OS_REG_WRITE(ah, AR5211_PHY_MODE, AR5211_PHY_MODE_OFDM);
245 OS_REG_WRITE(ah, AR_PHY_PLL_CTL, AR_PHY_PLL_CTL_44);
246 OS_DELAY(1000);
247 }
248
249 /* Read Revisions from Chips */
250 val = OS_REG_READ(ah, AR_SREV) & AR_SREV_ID_M;
251 AH_PRIVATE(ah)->ah_macVersion = val >> AR_SREV_ID_S;
252 AH_PRIVATE(ah)->ah_macRev = val & AR_SREV_REVISION_M;
253
254 if (AH_PRIVATE(ah)->ah_macVersion < AR_SREV_VERSION_MAUI_2 ||
255 AH_PRIVATE(ah)->ah_macVersion > AR_SREV_VERSION_OAHU) {
256 HALDEBUG(ah, HAL_DEBUG_ANY,
257 "%s: Mac Chip Rev 0x%x is not supported by this driver\n",
258 __func__, AH_PRIVATE(ah)->ah_macVersion);
259 ecode = HAL_ENOTSUPP;
260 goto bad;
261 }
262
263 AH_PRIVATE(ah)->ah_phyRev = OS_REG_READ(ah, AR_PHY_CHIP_ID);
264
265 if (!ar5211ChipTest(ah)) {
266 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: hardware self-test failed\n",
267 __func__);
268 ecode = HAL_ESELFTEST;
269 goto bad;
270 }
271
272 /* Set correct Baseband to analog shift setting to access analog chips. */
273 if (AH_PRIVATE(ah)->ah_macVersion >= AR_SREV_VERSION_OAHU) {
274 OS_REG_WRITE(ah, AR_PHY_BASE, 0x00000007);
275 } else {
276 OS_REG_WRITE(ah, AR_PHY_BASE, 0x00000047);
277 }
278 OS_DELAY(2000);
279
280 /* Read Radio Chip Rev Extract */
281 AH_PRIVATE(ah)->ah_analog5GhzRev = ar5211GetRadioRev(ah);
282 if ((AH_PRIVATE(ah)->ah_analog5GhzRev & 0xf0) != RAD5_SREV_MAJOR) {
283 HALDEBUG(ah, HAL_DEBUG_ANY,
284 "%s: 5G Radio Chip Rev 0x%02X is not supported by this "
285 "driver\n", __func__, AH_PRIVATE(ah)->ah_analog5GhzRev);
286 ecode = HAL_ENOTSUPP;
287 goto bad;
288 }
289
290 val = (OS_REG_READ(ah, AR_PCICFG) & AR_PCICFG_EEPROM_SIZE_M) >>
291 AR_PCICFG_EEPROM_SIZE_S;
292 if (val != AR_PCICFG_EEPROM_SIZE_16K) {
293 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unsupported EEPROM size "
294 "%u (0x%x) found\n", __func__, val, val);
295 ecode = HAL_EESIZE;
296 goto bad;
297 }
298 ecode = ath_hal_legacyEepromAttach(ah);
299 if (ecode != HAL_OK) {
300 goto bad;
301 }
302
303 /* If Bmode and AR5211, verify 2.4 analog exists */
304 if (AH_PRIVATE(ah)->ah_macVersion >= AR_SREV_VERSION_OAHU &&
305 ath_hal_eepromGetFlag(ah, AR_EEP_BMODE)) {
306 /* Set correct Baseband to analog shift setting to access analog chips. */
307 OS_REG_WRITE(ah, AR_PHY_BASE, 0x00004007);
308 OS_DELAY(2000);
309 AH_PRIVATE(ah)->ah_analog2GhzRev = ar5211GetRadioRev(ah);
310
311 /* Set baseband for 5GHz chip */
312 OS_REG_WRITE(ah, AR_PHY_BASE, 0x00000007);
313 OS_DELAY(2000);
314 if ((AH_PRIVATE(ah)->ah_analog2GhzRev & 0xF0) != RAD2_SREV_MAJOR) {
315 HALDEBUG(ah, HAL_DEBUG_ANY,
316 "%s: 2G Radio Chip Rev 0x%x is not supported by "
317 "this driver\n", __func__,
318 AH_PRIVATE(ah)->ah_analog2GhzRev);
319 ecode = HAL_ENOTSUPP;
320 goto bad;
321 }
322 } else {
323 ath_hal_eepromSet(ah, AR_EEP_BMODE, AH_FALSE);
324 }
325
326 ecode = ath_hal_eepromGet(ah, AR_EEP_REGDMN_0, &eeval);
327 if (ecode != HAL_OK) {
328 HALDEBUG(ah, HAL_DEBUG_ANY,
329 "%s: cannot read regulatory domain from EEPROM\n",
330 __func__);
331 goto bad;
332 }
333 AH_PRIVATE(ah)->ah_currentRD = eeval;
334 AH_PRIVATE(ah)->ah_getNfAdjust = ar5211GetNfAdjust;
335
336 /*
337 * Got everything we need now to setup the capabilities.
338 */
339 (void) ar5211FillCapabilityInfo(ah);
340
341 /* Initialize gain ladder thermal calibration structure */
342 ar5211InitializeGainValues(ah);
343
344 ecode = ath_hal_eepromGet(ah, AR_EEP_MACADDR, ahp->ah_macaddr);
345 if (ecode != HAL_OK) {
346 HALDEBUG(ah, HAL_DEBUG_ANY,
347 "%s: error getting mac address from EEPROM\n", __func__);
348 goto bad;
349 }
350
351 HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s: return\n", __func__);
352
353 return ah;
354bad:
355 if (ahp)
356 ar5211Detach((struct ath_hal *) ahp);
357 if (status)
358 *status = ecode;
359 return AH_NULL;
360#undef N
361}
362
363void
364ar5211Detach(struct ath_hal *ah)
365{
366 HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s:\n", __func__);
367
368 HALASSERT(ah != AH_NULL);
369 HALASSERT(ah->ah_magic == AR5211_MAGIC);
370
371 ath_hal_eepromDetach(ah);
372 ath_hal_free(ah);
373}
374
375static HAL_BOOL
376ar5211ChipTest(struct ath_hal *ah)
377{
378 uint32_t regAddr[2] = { AR_STA_ID0, AR_PHY_BASE+(8 << 2) };
379 uint32_t regHold[2];
380 uint32_t patternData[4] =
381 { 0x55555555, 0xaaaaaaaa, 0x66666666, 0x99999999 };
382 int i, j;
383
384 /* Test PHY & MAC registers */
385 for (i = 0; i < 2; i++) {
386 uint32_t addr = regAddr[i];
387 uint32_t wrData, rdData;
388
389 regHold[i] = OS_REG_READ(ah, addr);
390 for (j = 0; j < 0x100; j++) {
391 wrData = (j << 16) | j;
392 OS_REG_WRITE(ah, addr, wrData);
393 rdData = OS_REG_READ(ah, addr);
394 if (rdData != wrData) {
395 HALDEBUG(ah, HAL_DEBUG_ANY,
396"%s: address test failed addr: 0x%08x - wr:0x%08x != rd:0x%08x\n",
397 __func__, addr, wrData, rdData);
398 return AH_FALSE;
399 }
400 }
401 for (j = 0; j < 4; j++) {
402 wrData = patternData[j];
403 OS_REG_WRITE(ah, addr, wrData);
404 rdData = OS_REG_READ(ah, addr);
405 if (wrData != rdData) {
406 HALDEBUG(ah, HAL_DEBUG_ANY,
407"%s: address test failed addr: 0x%08x - wr:0x%08x != rd:0x%08x\n",
408 __func__, addr, wrData, rdData);
409 return AH_FALSE;
410 }
411 }
412 OS_REG_WRITE(ah, regAddr[i], regHold[i]);
413 }
414 OS_DELAY(100);
415 return AH_TRUE;
416}
417
418/*
419 * Store the channel edges for the requested operational mode
420 */
421static HAL_BOOL
422ar5211GetChannelEdges(struct ath_hal *ah,
423 uint16_t flags, uint16_t *low, uint16_t *high)
424{
425 if (flags & CHANNEL_5GHZ) {
426 *low = 4920;
427 *high = 6100;
428 return AH_TRUE;
429 }
430 if (flags & CHANNEL_2GHZ && ath_hal_eepromGetFlag(ah, AR_EEP_BMODE)) {
431 *low = 2312;
432 *high = 2732;
433 return AH_TRUE;
434 }
435 return AH_FALSE;
436}
437
438static HAL_BOOL
439ar5211GetChipPowerLimits(struct ath_hal *ah, HAL_CHANNEL *chans, uint32_t nchans)
440{
441 HAL_CHANNEL *chan;
442 int i;
443
444 /* XXX fill in, this is just a placeholder */
445 for (i = 0; i < nchans; i++) {
446 chan = &chans[i];
447 HALDEBUG(ah, HAL_DEBUG_ATTACH,
448 "%s: no min/max power for %u/0x%x\n",
449 __func__, chan->channel, chan->channelFlags);
450 chan->maxTxPower = MAX_RATE_POWER;
451 chan->minTxPower = 0;
452 }
453 return AH_TRUE;
454}
455
456/*
457 * Fill all software cached or static hardware state information.
458 */
459static HAL_BOOL
460ar5211FillCapabilityInfo(struct ath_hal *ah)
461{
462 struct ath_hal_private *ahpriv = AH_PRIVATE(ah);
463 HAL_CAPABILITIES *pCap = &ahpriv->ah_caps;
464
465 /* Construct wireless mode from EEPROM */
466 pCap->halWirelessModes = 0;
467 if (ath_hal_eepromGetFlag(ah, AR_EEP_AMODE)) {
468 pCap->halWirelessModes |= HAL_MODE_11A;
469 if (!ath_hal_eepromGetFlag(ah, AR_EEP_TURBO5DISABLE))
470 pCap->halWirelessModes |= HAL_MODE_TURBO;
471 }
472 if (ath_hal_eepromGetFlag(ah, AR_EEP_BMODE))
473 pCap->halWirelessModes |= HAL_MODE_11B;
474
475 pCap->halLow2GhzChan = 2312;
476 pCap->halHigh2GhzChan = 2732;
477 pCap->halLow5GhzChan = 4920;
478 pCap->halHigh5GhzChan = 6100;
479
480 pCap->halChanSpreadSupport = AH_TRUE;
481 pCap->halSleepAfterBeaconBroken = AH_TRUE;
482 pCap->halPSPollBroken = AH_TRUE;
483 pCap->halVEOLSupport = AH_TRUE;
484
485 pCap->halTotalQueues = HAL_NUM_TX_QUEUES;
486 pCap->halKeyCacheSize = 128;
487
488 /* XXX not needed */
489 pCap->halChanHalfRate = AH_FALSE;
490 pCap->halChanQuarterRate = AH_FALSE;
491
492 if (ath_hal_eepromGetFlag(ah, AR_EEP_RFKILL) &&
493 ath_hal_eepromGet(ah, AR_EEP_RFSILENT, &ahpriv->ah_rfsilent) == HAL_OK) {
494 /* NB: enabled by default */
495 ahpriv->ah_rfkillEnabled = AH_TRUE;
496 pCap->halRfSilentSupport = AH_TRUE;
497 }
498
499 pCap->halTstampPrecision = 13;
500
501 /* XXX might be ok w/ some chip revs */
502 ahpriv->ah_rxornIsFatal = AH_TRUE;
503 return AH_TRUE;
504}
21#include "ah.h"
22#include "ah_internal.h"
23#include "ah_devid.h"
24
25#include "ar5211/ar5211.h"
26#include "ar5211/ar5211reg.h"
27#include "ar5211/ar5211phy.h"
28
29#include "ah_eeprom_v3.h"
30
31static HAL_BOOL ar5211GetChannelEdges(struct ath_hal *ah,
32 uint16_t flags, uint16_t *low, uint16_t *high);
33static HAL_BOOL ar5211GetChipPowerLimits(struct ath_hal *ah,
34 HAL_CHANNEL *chans, uint32_t nchans);
35
36static const struct ath_hal_private ar5211hal = {{
37 .ah_magic = AR5211_MAGIC,
38 .ah_abi = HAL_ABI_VERSION,
39 .ah_countryCode = CTRY_DEFAULT,
40
41 .ah_getRateTable = ar5211GetRateTable,
42 .ah_detach = ar5211Detach,
43
44 /* Reset Functions */
45 .ah_reset = ar5211Reset,
46 .ah_phyDisable = ar5211PhyDisable,
47 .ah_disable = ar5211Disable,
48 .ah_setPCUConfig = ar5211SetPCUConfig,
49 .ah_perCalibration = ar5211PerCalibration,
50 .ah_perCalibrationN = ar5211PerCalibrationN,
51 .ah_resetCalValid = ar5211ResetCalValid,
52 .ah_setTxPowerLimit = ar5211SetTxPowerLimit,
53 .ah_getChanNoise = ath_hal_getChanNoise,
54
55 /* Transmit functions */
56 .ah_updateTxTrigLevel = ar5211UpdateTxTrigLevel,
57 .ah_setupTxQueue = ar5211SetupTxQueue,
58 .ah_setTxQueueProps = ar5211SetTxQueueProps,
59 .ah_getTxQueueProps = ar5211GetTxQueueProps,
60 .ah_releaseTxQueue = ar5211ReleaseTxQueue,
61 .ah_resetTxQueue = ar5211ResetTxQueue,
62 .ah_getTxDP = ar5211GetTxDP,
63 .ah_setTxDP = ar5211SetTxDP,
64 .ah_numTxPending = ar5211NumTxPending,
65 .ah_startTxDma = ar5211StartTxDma,
66 .ah_stopTxDma = ar5211StopTxDma,
67 .ah_setupTxDesc = ar5211SetupTxDesc,
68 .ah_setupXTxDesc = ar5211SetupXTxDesc,
69 .ah_fillTxDesc = ar5211FillTxDesc,
70 .ah_procTxDesc = ar5211ProcTxDesc,
71 .ah_getTxIntrQueue = ar5211GetTxIntrQueue,
72 .ah_reqTxIntrDesc = ar5211IntrReqTxDesc,
73
74 /* RX Functions */
75 .ah_getRxDP = ar5211GetRxDP,
76 .ah_setRxDP = ar5211SetRxDP,
77 .ah_enableReceive = ar5211EnableReceive,
78 .ah_stopDmaReceive = ar5211StopDmaReceive,
79 .ah_startPcuReceive = ar5211StartPcuReceive,
80 .ah_stopPcuReceive = ar5211StopPcuReceive,
81 .ah_setMulticastFilter = ar5211SetMulticastFilter,
82 .ah_setMulticastFilterIndex = ar5211SetMulticastFilterIndex,
83 .ah_clrMulticastFilterIndex = ar5211ClrMulticastFilterIndex,
84 .ah_getRxFilter = ar5211GetRxFilter,
85 .ah_setRxFilter = ar5211SetRxFilter,
86 .ah_setupRxDesc = ar5211SetupRxDesc,
87 .ah_procRxDesc = ar5211ProcRxDesc,
88 .ah_rxMonitor = ar5211AniPoll,
89 .ah_procMibEvent = ar5211MibEvent,
90
91 /* Misc Functions */
92 .ah_getCapability = ar5211GetCapability,
93 .ah_setCapability = ar5211SetCapability,
94 .ah_getDiagState = ar5211GetDiagState,
95 .ah_getMacAddress = ar5211GetMacAddress,
96 .ah_setMacAddress = ar5211SetMacAddress,
97 .ah_getBssIdMask = ar5211GetBssIdMask,
98 .ah_setBssIdMask = ar5211SetBssIdMask,
99 .ah_setRegulatoryDomain = ar5211SetRegulatoryDomain,
100 .ah_setLedState = ar5211SetLedState,
101 .ah_writeAssocid = ar5211WriteAssocid,
102 .ah_gpioCfgInput = ar5211GpioCfgInput,
103 .ah_gpioCfgOutput = ar5211GpioCfgOutput,
104 .ah_gpioGet = ar5211GpioGet,
105 .ah_gpioSet = ar5211GpioSet,
106 .ah_gpioSetIntr = ar5211GpioSetIntr,
107 .ah_getTsf32 = ar5211GetTsf32,
108 .ah_getTsf64 = ar5211GetTsf64,
109 .ah_resetTsf = ar5211ResetTsf,
110 .ah_detectCardPresent = ar5211DetectCardPresent,
111 .ah_updateMibCounters = ar5211UpdateMibCounters,
112 .ah_getRfGain = ar5211GetRfgain,
113 .ah_getDefAntenna = ar5211GetDefAntenna,
114 .ah_setDefAntenna = ar5211SetDefAntenna,
115 .ah_getAntennaSwitch = ar5211GetAntennaSwitch,
116 .ah_setAntennaSwitch = ar5211SetAntennaSwitch,
117 .ah_setSifsTime = ar5211SetSifsTime,
118 .ah_getSifsTime = ar5211GetSifsTime,
119 .ah_setSlotTime = ar5211SetSlotTime,
120 .ah_getSlotTime = ar5211GetSlotTime,
121 .ah_setAckTimeout = ar5211SetAckTimeout,
122 .ah_getAckTimeout = ar5211GetAckTimeout,
123 .ah_setAckCTSRate = ar5211SetAckCTSRate,
124 .ah_getAckCTSRate = ar5211GetAckCTSRate,
125 .ah_setCTSTimeout = ar5211SetCTSTimeout,
126 .ah_getCTSTimeout = ar5211GetCTSTimeout,
127 .ah_setDecompMask = ar5211SetDecompMask,
128 .ah_setCoverageClass = ar5211SetCoverageClass,
129
130 /* Key Cache Functions */
131 .ah_getKeyCacheSize = ar5211GetKeyCacheSize,
132 .ah_resetKeyCacheEntry = ar5211ResetKeyCacheEntry,
133 .ah_isKeyCacheEntryValid = ar5211IsKeyCacheEntryValid,
134 .ah_setKeyCacheEntry = ar5211SetKeyCacheEntry,
135 .ah_setKeyCacheEntryMac = ar5211SetKeyCacheEntryMac,
136
137 /* Power Management Functions */
138 .ah_setPowerMode = ar5211SetPowerMode,
139 .ah_getPowerMode = ar5211GetPowerMode,
140
141 /* Beacon Functions */
142 .ah_setBeaconTimers = ar5211SetBeaconTimers,
143 .ah_beaconInit = ar5211BeaconInit,
144 .ah_setStationBeaconTimers = ar5211SetStaBeaconTimers,
145 .ah_resetStationBeaconTimers = ar5211ResetStaBeaconTimers,
146
147 /* Interrupt Functions */
148 .ah_isInterruptPending = ar5211IsInterruptPending,
149 .ah_getPendingInterrupts = ar5211GetPendingInterrupts,
150 .ah_getInterrupts = ar5211GetInterrupts,
151 .ah_setInterrupts = ar5211SetInterrupts },
152
153 .ah_getChannelEdges = ar5211GetChannelEdges,
154 .ah_getWirelessModes = ar5211GetWirelessModes,
155 .ah_eepromRead = ar5211EepromRead,
156#ifdef AH_SUPPORT_WRITE_EEPROM
157 .ah_eepromWrite = ar5211EepromWrite,
158#endif
159 .ah_gpioCfgInput = ar5211GpioCfgInput,
160 .ah_gpioCfgOutput = ar5211GpioCfgOutput,
161 .ah_gpioGet = ar5211GpioGet,
162 .ah_gpioSet = ar5211GpioSet,
163 .ah_gpioSetIntr = ar5211GpioSetIntr,
164 .ah_getChipPowerLimits = ar5211GetChipPowerLimits,
165};
166
167static HAL_BOOL ar5211ChipTest(struct ath_hal *);
168static HAL_BOOL ar5211FillCapabilityInfo(struct ath_hal *ah);
169
170/*
171 * Return the revsion id for the radio chip. This
172 * fetched via the PHY.
173 */
174static uint32_t
175ar5211GetRadioRev(struct ath_hal *ah)
176{
177 uint32_t val;
178 int i;
179
180 OS_REG_WRITE(ah, (AR_PHY_BASE + (0x34 << 2)), 0x00001c16);
181 for (i = 0; i < 8; i++)
182 OS_REG_WRITE(ah, (AR_PHY_BASE + (0x20 << 2)), 0x00010000);
183 val = (OS_REG_READ(ah, AR_PHY_BASE + (256 << 2)) >> 24) & 0xff;
184 val = ((val & 0xf0) >> 4) | ((val & 0x0f) << 4);
185 return ath_hal_reverseBits(val, 8);
186}
187
188/*
189 * Attach for an AR5211 part.
190 */
191struct ath_hal *
192ar5211Attach(uint16_t devid, HAL_SOFTC sc,
193 HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status)
194{
195#define N(a) (sizeof(a)/sizeof(a[0]))
196 struct ath_hal_5211 *ahp;
197 struct ath_hal *ah;
198 uint32_t val;
199 uint16_t eeval;
200 HAL_STATUS ecode;
201
202 HALDEBUG(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
203 __func__, sc, (void*) st, (void*) sh);
204
205 /* NB: memory is returned zero'd */
206 ahp = ath_hal_malloc(sizeof (struct ath_hal_5211));
207 if (ahp == AH_NULL) {
208 HALDEBUG(AH_NULL, HAL_DEBUG_ANY,
209 "%s: cannot allocate memory for state block\n", __func__);
210 ecode = HAL_ENOMEM;
211 goto bad;
212 }
213 ah = &ahp->ah_priv.h;
214 /* set initial values */
215 OS_MEMCPY(&ahp->ah_priv, &ar5211hal, sizeof(struct ath_hal_private));
216 ah->ah_sc = sc;
217 ah->ah_st = st;
218 ah->ah_sh = sh;
219
220 ah->ah_devid = devid; /* NB: for AH_DEBUG_ALQ */
221 AH_PRIVATE(ah)->ah_devid = devid;
222 AH_PRIVATE(ah)->ah_subvendorid = 0; /* XXX */
223
224 AH_PRIVATE(ah)->ah_powerLimit = MAX_RATE_POWER;
225 AH_PRIVATE(ah)->ah_tpScale = HAL_TP_SCALE_MAX; /* no scaling */
226
227 ahp->ah_diversityControl = HAL_ANT_VARIABLE;
228 ahp->ah_staId1Defaults = 0;
229 ahp->ah_rssiThr = INIT_RSSI_THR;
230 ahp->ah_sifstime = (u_int) -1;
231 ahp->ah_slottime = (u_int) -1;
232 ahp->ah_acktimeout = (u_int) -1;
233 ahp->ah_ctstimeout = (u_int) -1;
234
235 if (!ar5211ChipReset(ah, AH_FALSE)) { /* reset chip */
236 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: chip reset failed\n", __func__);
237 ecode = HAL_EIO;
238 goto bad;
239 }
240 if (AH_PRIVATE(ah)->ah_devid == AR5211_FPGA11B) {
241 /* set it back to OFDM mode to be able to read analog rev id */
242 OS_REG_WRITE(ah, AR5211_PHY_MODE, AR5211_PHY_MODE_OFDM);
243 OS_REG_WRITE(ah, AR_PHY_PLL_CTL, AR_PHY_PLL_CTL_44);
244 OS_DELAY(1000);
245 }
246
247 /* Read Revisions from Chips */
248 val = OS_REG_READ(ah, AR_SREV) & AR_SREV_ID_M;
249 AH_PRIVATE(ah)->ah_macVersion = val >> AR_SREV_ID_S;
250 AH_PRIVATE(ah)->ah_macRev = val & AR_SREV_REVISION_M;
251
252 if (AH_PRIVATE(ah)->ah_macVersion < AR_SREV_VERSION_MAUI_2 ||
253 AH_PRIVATE(ah)->ah_macVersion > AR_SREV_VERSION_OAHU) {
254 HALDEBUG(ah, HAL_DEBUG_ANY,
255 "%s: Mac Chip Rev 0x%x is not supported by this driver\n",
256 __func__, AH_PRIVATE(ah)->ah_macVersion);
257 ecode = HAL_ENOTSUPP;
258 goto bad;
259 }
260
261 AH_PRIVATE(ah)->ah_phyRev = OS_REG_READ(ah, AR_PHY_CHIP_ID);
262
263 if (!ar5211ChipTest(ah)) {
264 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: hardware self-test failed\n",
265 __func__);
266 ecode = HAL_ESELFTEST;
267 goto bad;
268 }
269
270 /* Set correct Baseband to analog shift setting to access analog chips. */
271 if (AH_PRIVATE(ah)->ah_macVersion >= AR_SREV_VERSION_OAHU) {
272 OS_REG_WRITE(ah, AR_PHY_BASE, 0x00000007);
273 } else {
274 OS_REG_WRITE(ah, AR_PHY_BASE, 0x00000047);
275 }
276 OS_DELAY(2000);
277
278 /* Read Radio Chip Rev Extract */
279 AH_PRIVATE(ah)->ah_analog5GhzRev = ar5211GetRadioRev(ah);
280 if ((AH_PRIVATE(ah)->ah_analog5GhzRev & 0xf0) != RAD5_SREV_MAJOR) {
281 HALDEBUG(ah, HAL_DEBUG_ANY,
282 "%s: 5G Radio Chip Rev 0x%02X is not supported by this "
283 "driver\n", __func__, AH_PRIVATE(ah)->ah_analog5GhzRev);
284 ecode = HAL_ENOTSUPP;
285 goto bad;
286 }
287
288 val = (OS_REG_READ(ah, AR_PCICFG) & AR_PCICFG_EEPROM_SIZE_M) >>
289 AR_PCICFG_EEPROM_SIZE_S;
290 if (val != AR_PCICFG_EEPROM_SIZE_16K) {
291 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unsupported EEPROM size "
292 "%u (0x%x) found\n", __func__, val, val);
293 ecode = HAL_EESIZE;
294 goto bad;
295 }
296 ecode = ath_hal_legacyEepromAttach(ah);
297 if (ecode != HAL_OK) {
298 goto bad;
299 }
300
301 /* If Bmode and AR5211, verify 2.4 analog exists */
302 if (AH_PRIVATE(ah)->ah_macVersion >= AR_SREV_VERSION_OAHU &&
303 ath_hal_eepromGetFlag(ah, AR_EEP_BMODE)) {
304 /* Set correct Baseband to analog shift setting to access analog chips. */
305 OS_REG_WRITE(ah, AR_PHY_BASE, 0x00004007);
306 OS_DELAY(2000);
307 AH_PRIVATE(ah)->ah_analog2GhzRev = ar5211GetRadioRev(ah);
308
309 /* Set baseband for 5GHz chip */
310 OS_REG_WRITE(ah, AR_PHY_BASE, 0x00000007);
311 OS_DELAY(2000);
312 if ((AH_PRIVATE(ah)->ah_analog2GhzRev & 0xF0) != RAD2_SREV_MAJOR) {
313 HALDEBUG(ah, HAL_DEBUG_ANY,
314 "%s: 2G Radio Chip Rev 0x%x is not supported by "
315 "this driver\n", __func__,
316 AH_PRIVATE(ah)->ah_analog2GhzRev);
317 ecode = HAL_ENOTSUPP;
318 goto bad;
319 }
320 } else {
321 ath_hal_eepromSet(ah, AR_EEP_BMODE, AH_FALSE);
322 }
323
324 ecode = ath_hal_eepromGet(ah, AR_EEP_REGDMN_0, &eeval);
325 if (ecode != HAL_OK) {
326 HALDEBUG(ah, HAL_DEBUG_ANY,
327 "%s: cannot read regulatory domain from EEPROM\n",
328 __func__);
329 goto bad;
330 }
331 AH_PRIVATE(ah)->ah_currentRD = eeval;
332 AH_PRIVATE(ah)->ah_getNfAdjust = ar5211GetNfAdjust;
333
334 /*
335 * Got everything we need now to setup the capabilities.
336 */
337 (void) ar5211FillCapabilityInfo(ah);
338
339 /* Initialize gain ladder thermal calibration structure */
340 ar5211InitializeGainValues(ah);
341
342 ecode = ath_hal_eepromGet(ah, AR_EEP_MACADDR, ahp->ah_macaddr);
343 if (ecode != HAL_OK) {
344 HALDEBUG(ah, HAL_DEBUG_ANY,
345 "%s: error getting mac address from EEPROM\n", __func__);
346 goto bad;
347 }
348
349 HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s: return\n", __func__);
350
351 return ah;
352bad:
353 if (ahp)
354 ar5211Detach((struct ath_hal *) ahp);
355 if (status)
356 *status = ecode;
357 return AH_NULL;
358#undef N
359}
360
361void
362ar5211Detach(struct ath_hal *ah)
363{
364 HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s:\n", __func__);
365
366 HALASSERT(ah != AH_NULL);
367 HALASSERT(ah->ah_magic == AR5211_MAGIC);
368
369 ath_hal_eepromDetach(ah);
370 ath_hal_free(ah);
371}
372
373static HAL_BOOL
374ar5211ChipTest(struct ath_hal *ah)
375{
376 uint32_t regAddr[2] = { AR_STA_ID0, AR_PHY_BASE+(8 << 2) };
377 uint32_t regHold[2];
378 uint32_t patternData[4] =
379 { 0x55555555, 0xaaaaaaaa, 0x66666666, 0x99999999 };
380 int i, j;
381
382 /* Test PHY & MAC registers */
383 for (i = 0; i < 2; i++) {
384 uint32_t addr = regAddr[i];
385 uint32_t wrData, rdData;
386
387 regHold[i] = OS_REG_READ(ah, addr);
388 for (j = 0; j < 0x100; j++) {
389 wrData = (j << 16) | j;
390 OS_REG_WRITE(ah, addr, wrData);
391 rdData = OS_REG_READ(ah, addr);
392 if (rdData != wrData) {
393 HALDEBUG(ah, HAL_DEBUG_ANY,
394"%s: address test failed addr: 0x%08x - wr:0x%08x != rd:0x%08x\n",
395 __func__, addr, wrData, rdData);
396 return AH_FALSE;
397 }
398 }
399 for (j = 0; j < 4; j++) {
400 wrData = patternData[j];
401 OS_REG_WRITE(ah, addr, wrData);
402 rdData = OS_REG_READ(ah, addr);
403 if (wrData != rdData) {
404 HALDEBUG(ah, HAL_DEBUG_ANY,
405"%s: address test failed addr: 0x%08x - wr:0x%08x != rd:0x%08x\n",
406 __func__, addr, wrData, rdData);
407 return AH_FALSE;
408 }
409 }
410 OS_REG_WRITE(ah, regAddr[i], regHold[i]);
411 }
412 OS_DELAY(100);
413 return AH_TRUE;
414}
415
416/*
417 * Store the channel edges for the requested operational mode
418 */
419static HAL_BOOL
420ar5211GetChannelEdges(struct ath_hal *ah,
421 uint16_t flags, uint16_t *low, uint16_t *high)
422{
423 if (flags & CHANNEL_5GHZ) {
424 *low = 4920;
425 *high = 6100;
426 return AH_TRUE;
427 }
428 if (flags & CHANNEL_2GHZ && ath_hal_eepromGetFlag(ah, AR_EEP_BMODE)) {
429 *low = 2312;
430 *high = 2732;
431 return AH_TRUE;
432 }
433 return AH_FALSE;
434}
435
436static HAL_BOOL
437ar5211GetChipPowerLimits(struct ath_hal *ah, HAL_CHANNEL *chans, uint32_t nchans)
438{
439 HAL_CHANNEL *chan;
440 int i;
441
442 /* XXX fill in, this is just a placeholder */
443 for (i = 0; i < nchans; i++) {
444 chan = &chans[i];
445 HALDEBUG(ah, HAL_DEBUG_ATTACH,
446 "%s: no min/max power for %u/0x%x\n",
447 __func__, chan->channel, chan->channelFlags);
448 chan->maxTxPower = MAX_RATE_POWER;
449 chan->minTxPower = 0;
450 }
451 return AH_TRUE;
452}
453
454/*
455 * Fill all software cached or static hardware state information.
456 */
457static HAL_BOOL
458ar5211FillCapabilityInfo(struct ath_hal *ah)
459{
460 struct ath_hal_private *ahpriv = AH_PRIVATE(ah);
461 HAL_CAPABILITIES *pCap = &ahpriv->ah_caps;
462
463 /* Construct wireless mode from EEPROM */
464 pCap->halWirelessModes = 0;
465 if (ath_hal_eepromGetFlag(ah, AR_EEP_AMODE)) {
466 pCap->halWirelessModes |= HAL_MODE_11A;
467 if (!ath_hal_eepromGetFlag(ah, AR_EEP_TURBO5DISABLE))
468 pCap->halWirelessModes |= HAL_MODE_TURBO;
469 }
470 if (ath_hal_eepromGetFlag(ah, AR_EEP_BMODE))
471 pCap->halWirelessModes |= HAL_MODE_11B;
472
473 pCap->halLow2GhzChan = 2312;
474 pCap->halHigh2GhzChan = 2732;
475 pCap->halLow5GhzChan = 4920;
476 pCap->halHigh5GhzChan = 6100;
477
478 pCap->halChanSpreadSupport = AH_TRUE;
479 pCap->halSleepAfterBeaconBroken = AH_TRUE;
480 pCap->halPSPollBroken = AH_TRUE;
481 pCap->halVEOLSupport = AH_TRUE;
482
483 pCap->halTotalQueues = HAL_NUM_TX_QUEUES;
484 pCap->halKeyCacheSize = 128;
485
486 /* XXX not needed */
487 pCap->halChanHalfRate = AH_FALSE;
488 pCap->halChanQuarterRate = AH_FALSE;
489
490 if (ath_hal_eepromGetFlag(ah, AR_EEP_RFKILL) &&
491 ath_hal_eepromGet(ah, AR_EEP_RFSILENT, &ahpriv->ah_rfsilent) == HAL_OK) {
492 /* NB: enabled by default */
493 ahpriv->ah_rfkillEnabled = AH_TRUE;
494 pCap->halRfSilentSupport = AH_TRUE;
495 }
496
497 pCap->halTstampPrecision = 13;
498
499 /* XXX might be ok w/ some chip revs */
500 ahpriv->ah_rxornIsFatal = AH_TRUE;
501 return AH_TRUE;
502}
505#endif /* AH_SUPPORT_AR5211 */
503
504static const char*
505ar5211Probe(uint16_t vendorid, uint16_t devid)
506{
507 if (vendorid == ATHEROS_VENDOR_ID) {
508 if (devid == AR5211_DEVID || devid == AR5311_DEVID ||
509 devid == AR5211_DEFAULT)
510 return "Atheros 5211";
511 if (devid == AR5211_FPGA11B)
512 return "Atheros 5211 (FPGA)";
513 }
514 return AH_NULL;
515}
516AH_CHIP(ar5211, ar5211Probe, ar5211Attach);