iPXE
ath9k_hw.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008-2011 Atheros Communications Inc.
3 *
4 * Modified for iPXE by Scott K Logan <logans@cottsay.net> July 2011
5 * Original from Linux kernel 3.0.1
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
20FILE_SECBOOT ( FORBIDDEN );
21
22#include <ipxe/vsprintf.h>
23#include <ipxe/io.h>
24
25#include "hw.h"
26#include "hw-ops.h"
27#include "ar9003_mac.h"
28
29static int ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type);
30
31/* Private hardware callbacks */
32
37
42
44 struct ath9k_channel *chan)
45{
47}
48
50{
51 if (!ath9k_hw_private_ops(ah)->init_mode_gain_regs)
52 return;
53
55}
56
58{
59 /* You will not have this callback if using the old ANI */
60 if (!ath9k_hw_private_ops(ah)->ani_cache_ini_regs)
61 return;
62
64}
65
66/********************/
67/* Helper Functions */
68/********************/
69
70static void ath9k_hw_set_clockrate(struct ath_hw *ah)
71{
73 struct net80211_device *dev = common->dev;
74 unsigned int clockrate;
75
76 if (!ah->curchan) /* should really check for CCK instead */
77 clockrate = ATH9K_CLOCK_RATE_CCK;
78 else if ((dev->channels + dev->channel)->band == NET80211_BAND_2GHZ)
80 else if (ah->caps.hw_caps & ATH9K_HW_CAP_FASTCLOCK)
82 else
84
85 common->clockrate = clockrate;
86}
87
88static u32 ath9k_hw_mac_to_clks(struct ath_hw *ah, u32 usecs)
89{
91
92 return usecs * common->clockrate;
93}
94
96{
97 unsigned int i;
98
99 for (i = 0; i < (timeout / AH_TIME_QUANTUM); i++) {
100 if ((REG_READ(ah, reg) & mask) == val)
101 return 1;
102
104 }
105
106 DBG("ath9k: "
107 "timeout (%d us) on reg 0x%x: 0x%08x & 0x%08x != 0x%08x\n",
108 timeout, reg, REG_READ(ah, reg), mask, val);
109
110 return 0;
111}
112
114 int column, unsigned int *writecnt)
115{
116 unsigned int r;
117
119 for (r = 0; r < array->ia_rows; r++) {
120 REG_WRITE(ah, INI_RA(array, r, 0),
121 INI_RA(array, r, column));
122 DO_DELAY(*writecnt);
123 }
125}
126
128{
129 u32 retval;
130 unsigned int i;
131
132 for (i = 0, retval = 0; i < n; i++) {
133 retval = (retval << 1) | (val & 1);
134 val >>= 1;
135 }
136 return retval;
137}
138
140 u8 phy, int kbps,
141 u32 frameLen, u16 rateix,
142 int shortPreamble)
143{
144 u32 bitsPerSymbol, numBits, numSymbols, phyTime, txTime;
145
146 if (kbps == 0)
147 return 0;
148
149 switch (phy) {
150 case CHANNEL_CCK:
152 if (shortPreamble)
153 phyTime >>= 1;
154 numBits = frameLen << 3;
155 txTime = CCK_SIFS_TIME + phyTime + ((numBits * 1000) / kbps);
156 break;
157 case CHANNEL_OFDM:
158 if (ah->curchan && IS_CHAN_QUARTER_RATE(ah->curchan)) {
159 bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME_QUARTER) / 1000;
160 numBits = OFDM_PLCP_BITS + (frameLen << 3);
161 numSymbols = DIV_ROUND_UP(numBits, bitsPerSymbol);
164 + (numSymbols * OFDM_SYMBOL_TIME_QUARTER);
165 } else if (ah->curchan &&
166 IS_CHAN_HALF_RATE(ah->curchan)) {
167 bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME_HALF) / 1000;
168 numBits = OFDM_PLCP_BITS + (frameLen << 3);
169 numSymbols = DIV_ROUND_UP(numBits, bitsPerSymbol);
170 txTime = OFDM_SIFS_TIME_HALF +
172 + (numSymbols * OFDM_SYMBOL_TIME_HALF);
173 } else {
174 bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME) / 1000;
175 numBits = OFDM_PLCP_BITS + (frameLen << 3);
176 numSymbols = DIV_ROUND_UP(numBits, bitsPerSymbol);
178 + (numSymbols * OFDM_SYMBOL_TIME);
179 }
180 break;
181 default:
182 DBG("ath9k: "
183 "Unknown phy %d (rate ix %d)\n", phy, rateix);
184 txTime = 0;
185 break;
186 }
187
188 return txTime;
189}
190
192 struct ath9k_channel *chan,
193 struct chan_centers *centers)
194{
195 int8_t extoff;
196
197 if (!IS_CHAN_HT40(chan)) {
198 centers->ctl_center = centers->ext_center =
199 centers->synth_center = chan->channel;
200 return;
201 }
202
203 if ((chan->chanmode == CHANNEL_A_HT40PLUS) ||
204 (chan->chanmode == CHANNEL_G_HT40PLUS)) {
205 centers->synth_center =
207 extoff = 1;
208 } else {
209 centers->synth_center =
211 extoff = -1;
212 }
213
214 centers->ctl_center =
215 centers->synth_center - (extoff * HT40_CHANNEL_CENTER_SHIFT);
216 /* 25 MHz spacing is supported by hw but not on upper layers */
217 centers->ext_center =
218 centers->synth_center + (extoff * HT40_CHANNEL_CENTER_SHIFT);
219}
220
221/******************/
222/* Chip Revisions */
223/******************/
224
226{
227 u32 val;
228
229 switch (ah->hw_version.devid) {
231 ah->hw_version.macVersion = AR_SREV_VERSION_9100;
232 break;
234 ah->hw_version.macVersion = AR_SREV_VERSION_9340;
236 ah->hw_version.macRev = MS(val, AR_SREV_REVISION2);
237 return;
238 }
239
241
242 if (val == 0xFF) {
244 ah->hw_version.macVersion =
246 ah->hw_version.macRev = MS(val, AR_SREV_REVISION2);
247 ah->is_pciexpress = (val & AR_SREV_TYPE2_HOST_MODE) ? 0 : 1;
248 } else {
249 if (!AR_SREV_9100(ah))
250 ah->hw_version.macVersion = MS(val, AR_SREV_VERSION);
251
252 ah->hw_version.macRev = val & AR_SREV_REVISION;
253
254 if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCIE)
255 ah->is_pciexpress = 1;
256 }
257}
258
259/************************************/
260/* HW Attach, Detach, Init Routines */
261/************************************/
262
263static void ath9k_hw_disablepcie(struct ath_hw *ah)
264{
265 if (!AR_SREV_5416(ah))
266 return;
267
268 REG_WRITE(ah, AR_PCIE_SERDES, 0x9248fc00);
269 REG_WRITE(ah, AR_PCIE_SERDES, 0x24924924);
270 REG_WRITE(ah, AR_PCIE_SERDES, 0x28000029);
271 REG_WRITE(ah, AR_PCIE_SERDES, 0x57160824);
272 REG_WRITE(ah, AR_PCIE_SERDES, 0x25980579);
273 REG_WRITE(ah, AR_PCIE_SERDES, 0x00000000);
274 REG_WRITE(ah, AR_PCIE_SERDES, 0x1aaabe40);
275 REG_WRITE(ah, AR_PCIE_SERDES, 0xbe105554);
276 REG_WRITE(ah, AR_PCIE_SERDES, 0x000e1007);
277
278 REG_WRITE(ah, AR_PCIE_SERDES2, 0x00000000);
279}
280
281/* This should work for all families including legacy */
282static int ath9k_hw_chip_test(struct ath_hw *ah)
283{
284 u32 regAddr[2] = { AR_STA_ID0 };
285 u32 regHold[2];
286 static const u32 patternData[4] = {
287 0x55555555, 0xaaaaaaaa, 0x66666666, 0x99999999
288 };
289 int i, j, loop_max;
290
292 loop_max = 2;
293 regAddr[1] = AR_PHY_BASE + (8 << 2);
294 } else
295 loop_max = 1;
296
297 for (i = 0; i < loop_max; i++) {
298 u32 addr = regAddr[i];
299 u32 wrData, rdData;
300
301 regHold[i] = REG_READ(ah, addr);
302 for (j = 0; j < 0x100; j++) {
303 wrData = (j << 16) | j;
304 REG_WRITE(ah, addr, wrData);
305 rdData = REG_READ(ah, addr);
306 if (rdData != wrData) {
307 DBG("ath9k: "
308 "address test failed addr: 0x%08x - wr:0x%08x != rd:0x%08x\n",
309 addr, wrData, rdData);
310 return 0;
311 }
312 }
313 for (j = 0; j < 4; j++) {
314 wrData = patternData[j];
315 REG_WRITE(ah, addr, wrData);
316 rdData = REG_READ(ah, addr);
317 if (wrData != rdData) {
318 DBG("ath9k: "
319 "address test failed addr: 0x%08x - wr:0x%08x != rd:0x%08x\n",
320 addr, wrData, rdData);
321 return 0;
322 }
323 }
324 REG_WRITE(ah, regAddr[i], regHold[i]);
325 }
326 udelay(100);
327
328 return 1;
329}
330
331static void ath9k_hw_init_config(struct ath_hw *ah)
332{
333 int i;
334
335 ah->config.dma_beacon_response_time = 2;
336 ah->config.sw_beacon_response_time = 10;
337 ah->config.additional_swba_backoff = 0;
338 ah->config.ack_6mb = 0x0;
339 ah->config.cwm_ignore_extcca = 0;
340 ah->config.pcie_powersave_enable = 0;
341 ah->config.pcie_clock_req = 0;
342 ah->config.pcie_waen = 0;
343 ah->config.analog_shiftreg = 1;
344 ah->config.enable_ani = 1;
345
346 for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
347 ah->config.spurchans[i][0] = AR_NO_SPUR;
348 ah->config.spurchans[i][1] = AR_NO_SPUR;
349 }
350
351 /* PAPRD needs some more work to be enabled */
352 ah->config.paprd_disable = 1;
353
354 ah->config.rx_intr_mitigation = 1;
355 ah->config.pcieSerDesWrite = 1;
356}
357
358static void ath9k_hw_init_defaults(struct ath_hw *ah)
359{
360 struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
361
362 regulatory->country_code = CTRY_DEFAULT;
363 regulatory->power_limit = MAX_RATE_POWER;
364 regulatory->tp_scale = ATH9K_TP_SCALE_MAX;
365
366 ah->hw_version.magic = AR5416_MAGIC;
367 ah->hw_version.subvendorid = 0;
368
369 ah->atim_window = 0;
370 ah->sta_id1_defaults =
373 if (AR_SREV_9100(ah))
374 ah->sta_id1_defaults |= AR_STA_ID1_AR9100_BA_FIX;
375 ah->enable_32kHz_clock = DONT_USE_32KHZ;
376 ah->slottime = 20;
377 ah->globaltxtimeout = (u32) -1;
378 ah->power_mode = ATH9K_PM_UNDEFINED;
379}
380
381static int ath9k_hw_init_macaddr(struct ath_hw *ah)
382{
384 u32 sum;
385 int i;
386 u16 eeval;
387 static const u32 EEP_MAC[] = { EEP_MAC_LSW, EEP_MAC_MID, EEP_MAC_MSW };
388
389 sum = 0;
390 for (i = 0; i < 3; i++) {
391 eeval = ah->eep_ops->get_eeprom(ah, EEP_MAC[i]);
392 sum += eeval;
393 common->macaddr[2 * i] = eeval >> 8;
394 common->macaddr[2 * i + 1] = eeval & 0xff;
395 }
396 if (sum == 0 || sum == 0xffff * 3)
397 return -EADDRNOTAVAIL;
398
399 return 0;
400}
401
402static int ath9k_hw_post_init(struct ath_hw *ah)
403{
405 int ecode;
406
407 if (common->bus_ops->ath_bus_type != ATH_USB) {
409 return -ENODEV;
410 }
411
413 ecode = ar9002_hw_rf_claim(ah);
414 if (ecode != 0)
415 return ecode;
416 }
417
418 ecode = ath9k_hw_eeprom_init(ah);
419 if (ecode != 0)
420 return ecode;
421
422 DBG("ath9k: "
423 "Eeprom VER: %d, REV: %d\n",
424 ah->eep_ops->get_eeprom_ver(ah),
425 ah->eep_ops->get_eeprom_rev(ah));
426
428 if (ecode) {
429 DBG("ath9k: "
430 "Failed allocating banks for external radio\n");
432 return ecode;
433 }
434
435 if (!AR_SREV_9100(ah) && !AR_SREV_9340(ah)) {
438 }
439
440 return 0;
441}
442
443static void ath9k_hw_attach_ops(struct ath_hw *ah)
444{
447 else
449}
450
451/* Called for all hardware families */
452static int __ath9k_hw_init(struct ath_hw *ah)
453{
455 int r = 0;
456
458
459 /*
460 * Read back AR_WA into a permanent copy and set bits 14 and 17.
461 * We need to do this to avoid RMW of this register. We cannot
462 * read the reg when chip is asleep.
463 */
464 ah->WARegVal = REG_READ(ah, AR_WA);
465 ah->WARegVal |= (AR_WA_D3_L1_DISABLE |
467
469 DBG("ath9k: Couldn't reset chip\n");
470 return -EIO;
471 }
472
475
477
479 DBG("ath9k: Couldn't wakeup chip\n");
480 return -EIO;
481 }
482
483 if (ah->config.serialize_regmode == SER_REG_MODE_AUTO) {
484 if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI ||
485 ((AR_SREV_9160(ah) || AR_SREV_9280(ah)) &&
486 !ah->is_pciexpress)) {
487 ah->config.serialize_regmode =
489 } else {
490 ah->config.serialize_regmode =
492 }
493 }
494
495 DBG2("ath9k: serialize_regmode is %d\n",
496 ah->config.serialize_regmode);
497
499 ah->config.max_txtrig_level = MAX_TX_FIFO_THRESHOLD >> 1;
500 else
501 ah->config.max_txtrig_level = MAX_TX_FIFO_THRESHOLD;
502
503 switch (ah->hw_version.macVersion) {
515 break;
516 default:
517 DBG("ath9k: "
518 "Mac Chip Rev 0x%02x.%x is not supported by this driver\n",
519 ah->hw_version.macVersion, ah->hw_version.macRev);
520 return -EOPNOTSUPP;
521 }
522
524 ah->is_pciexpress = 0;
525
526 ah->hw_version.phyRev = REG_READ(ah, AR_PHY_CHIP_ID);
528
529 ah->ani_function = ATH9K_ANI_ALL;
531 ah->ani_function &= ~ATH9K_ANI_NOISE_IMMUNITY_LEVEL;
533 ah->ani_function &= ~ATH9K_ANI_MRC_CCK;
534
536
537
538 if (ah->is_pciexpress)
540 else
542
545
547 if (r)
548 return r;
549
552 if (r)
553 return r;
554
556 if (r) {
557 DBG("ath9k: Failed to initialize MAC address\n");
558 return r;
559 }
560
562 ah->tx_trig_level = (AR_FTRIG_256B >> AR_FTRIG_S);
563 else
564 ah->tx_trig_level = (AR_FTRIG_512B >> AR_FTRIG_S);
565
566 common->state = ATH_HW_INITIALIZED;
567
568 return 0;
569}
570
572{
573 int ret;
575
576 /* These are all the AR5008/AR9001/AR9002 hardware family of chipsets */
577 switch (ah->hw_version.devid) {
578 case AR5416_DEVID_PCI:
581 case AR9160_DEVID_PCI:
582 case AR9280_DEVID_PCI:
585 case AR9287_DEVID_PCI:
591 break;
592 default:
593 if (common->bus_ops->ath_bus_type == ATH_USB)
594 break;
595 DBG("ath9k: Hardware device ID 0x%04x not supported\n",
596 ah->hw_version.devid);
597 return -EOPNOTSUPP;
598 }
599
600 ret = __ath9k_hw_init(ah);
601 if (ret) {
602 DBG("ath9k: "
603 "Unable to initialize hardware; initialization status: %d\n",
604 ret);
605 return ret;
606 }
607
608 return 0;
609}
610
612{
614 udelay(100);
616
617 while ((REG_READ(ah, PLL4) & PLL4_MEAS_DONE) == 0)
618 udelay(100);
619
620 return (REG_READ(ah, PLL3) & SQSUM_DVC_MASK) >> 3;
621}
622
623static void ath9k_hw_init_pll(struct ath_hw *ah,
624 struct ath9k_channel *chan)
625{
626 u32 pll;
627
628 if (AR_SREV_9485(ah)) {
629
630 /* program BB PLL ki and kd value, ki=0x4, kd=0x40 */
634 AR_CH0_DPLL2_KD, 0x40);
636 AR_CH0_DPLL2_KI, 0x4);
637
644
651
652 /* program BB PLL phase_shift to 0x6 */
655
658 udelay(1000);
659 } else if (AR_SREV_9340(ah)) {
660 u32 regval, pll2_divint, pll2_divfrac, refdiv;
661
663 udelay(1000);
664
665 REG_SET_BIT(ah, AR_PHY_PLL_MODE, 0x1 << 16);
666 udelay(100);
667
668 if (ah->is_clk_25mhz) {
669 pll2_divint = 0x54;
670 pll2_divfrac = 0x1eb85;
671 refdiv = 3;
672 } else {
673 pll2_divint = 88;
674 pll2_divfrac = 0;
675 refdiv = 5;
676 }
677
678 regval = REG_READ(ah, AR_PHY_PLL_MODE);
679 regval |= (0x1 << 16);
680 REG_WRITE(ah, AR_PHY_PLL_MODE, regval);
681 udelay(100);
682
683 REG_WRITE(ah, AR_PHY_PLL_CONTROL, (refdiv << 27) |
684 (pll2_divint << 18) | pll2_divfrac);
685 udelay(100);
686
687 regval = REG_READ(ah, AR_PHY_PLL_MODE);
688 regval = (regval & 0x80071fff) | (0x1 << 30) | (0x1 << 13) |
689 (0x4 << 26) | (0x18 << 19);
690 REG_WRITE(ah, AR_PHY_PLL_MODE, regval);
692 REG_READ(ah, AR_PHY_PLL_MODE) & 0xfffeffff);
693 udelay(1000);
694 }
695
696 pll = ath9k_hw_compute_pll_control(ah, chan);
697
699
701 udelay(1000);
702
703 /* Switch the core clock for ar9271 to 117Mhz */
704 if (AR_SREV_9271(ah)) {
705 udelay(500);
706 REG_WRITE(ah, 0x50040, 0x304);
707 }
708
710
712
713 if (AR_SREV_9340(ah)) {
714 if (ah->is_clk_25mhz) {
715 REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1);
716 REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7);
717 REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae);
718 } else {
719 REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1);
720 REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400);
721 REG_WRITE(ah, AR_SLP32_INC, 0x0001e800);
722 }
723 udelay(100);
724 }
725}
726
728{
729 u32 sync_default = AR_INTR_SYNC_DEFAULT;
730 u32 imr_reg = AR_IMR_TXERR |
734
735 if (AR_SREV_9340(ah))
736 sync_default &= ~AR_INTR_SYNC_HOST1_FATAL;
737
739 imr_reg |= AR_IMR_RXOK_HP;
740 if (ah->config.rx_intr_mitigation)
741 imr_reg |= AR_IMR_RXINTM | AR_IMR_RXMINTR;
742 else
743 imr_reg |= AR_IMR_RXOK_LP;
744
745 } else {
746 if (ah->config.rx_intr_mitigation)
747 imr_reg |= AR_IMR_RXINTM | AR_IMR_RXMINTR;
748 else
749 imr_reg |= AR_IMR_RXOK;
750 }
751
752 if (ah->config.tx_intr_mitigation)
753 imr_reg |= AR_IMR_TXINTM | AR_IMR_TXMINTR;
754 else
755 imr_reg |= AR_IMR_TXOK;
756
758
759 REG_WRITE(ah, AR_IMR, imr_reg);
760// ah->imrs2_reg |= AR_IMR_S2_GTT;
761 REG_WRITE(ah, AR_IMR_S2, ah->imrs2_reg);
762
763 if (!AR_SREV_9100(ah)) {
764 REG_WRITE(ah, AR_INTR_SYNC_CAUSE, 0xFFFFFFFF);
765 REG_WRITE(ah, AR_INTR_SYNC_ENABLE, sync_default);
767 }
768
770
776 }
777}
778
779static void ath9k_hw_setslottime(struct ath_hw *ah, u32 us)
780{
782 val = min(val, (u32) 0xFFFF);
784}
785
786static void ath9k_hw_set_ack_timeout(struct ath_hw *ah, u32 us)
787{
789 val = min(val, (u32) MS(0xFFFFFFFF, AR_TIME_OUT_ACK));
791}
792
793static void ath9k_hw_set_cts_timeout(struct ath_hw *ah, u32 us)
794{
796 val = min(val, (u32) MS(0xFFFFFFFF, AR_TIME_OUT_CTS));
798}
799
801{
802 if (tu > 0xFFFF) {
803 DBG("ath9k: "
804 "bad global tx timeout %d\n", tu);
805 ah->globaltxtimeout = (u32) -1;
806 return 0;
807 } else {
809 ah->globaltxtimeout = tu;
810 return 1;
811 }
812}
813
815{
816 int acktimeout;
817 int slottime;
818 int sifstime;
819
820 DBG2("ath9k: ah->misc_mode 0x%x\n",
821 ah->misc_mode);
822
823 if (ah->misc_mode != 0)
824 REG_SET_BIT(ah, AR_PCU_MISC, ah->misc_mode);
825
826 if ((ah->dev->channels + ah->dev->channel)->band == NET80211_BAND_5GHZ)
827 sifstime = 16;
828 else
829 sifstime = 10;
830
831 /* As defined by IEEE 802.11-2007 17.3.8.6 */
832 slottime = ah->slottime + 3 * ah->coverage_class;
833 acktimeout = slottime + sifstime;
834
835 /*
836 * Workaround for early ACK timeouts, add an offset to match the
837 * initval's 64us ack timeout value.
838 * This was initially only meant to work around an issue with delayed
839 * BA frames in some implementations, but it has been found to fix ACK
840 * timeout issues in other cases as well.
841 */
842 if ((ah->dev->channels + ah->dev->channel)->band == NET80211_BAND_2GHZ)
843 acktimeout += 64 - sifstime - ah->slottime;
844
845 ath9k_hw_setslottime(ah, ah->slottime);
846 ath9k_hw_set_ack_timeout(ah, acktimeout);
847 ath9k_hw_set_cts_timeout(ah, acktimeout);
848 if (ah->globaltxtimeout != (u32) -1)
849 ath9k_hw_set_global_txtimeout(ah, ah->globaltxtimeout);
850}
851
853{
855
856 if (common->state < ATH_HW_INITIALIZED)
857 goto free_hw;
858
860
861free_hw:
863}
864
865/*******/
866/* INI */
867/*******/
868
870{
871 u32 ctl = ath_regd_get_band_ctl(reg, chan->chan->band);
872
873 if (IS_CHAN_B(chan))
874 ctl |= CTL_11B;
875 else if (IS_CHAN_G(chan))
876 ctl |= CTL_11G;
877 else
878 ctl |= CTL_11A;
879
880 return ctl;
881}
882
883/****************************************/
884/* Reset and Channel Switching Routines */
885/****************************************/
886
887static inline void ath9k_hw_set_dma(struct ath_hw *ah)
888{
890
892
893 /*
894 * set AHB_MODE not to do cacheline prefetches
895 */
898
899 /*
900 * let mac dma reads be in 128 byte chunks
901 */
903
905
906 /*
907 * Restore TX Trigger Level to its pre-reset value.
908 * The initial value depends on whether aggregation is enabled, and is
909 * adjusted whenever underruns are detected.
910 */
912 REG_RMW_FIELD(ah, AR_TXCFG, AR_FTRIG, ah->tx_trig_level);
913
915
916 /*
917 * let mac dma writes be in 128 byte chunks
918 */
920
921 /*
922 * Setup receive FIFO threshold to hold off TX activities
923 */
924 REG_WRITE(ah, AR_RXFIFO_CFG, 0x200);
925
929
930 ath9k_hw_set_rx_bufsize(ah, common->rx_bufsize -
931 ah->caps.rx_status_len);
932 }
933
934 /*
935 * reduce the number of usable entries in PCU TXBUF to avoid
936 * wrap around issues.
937 */
938 if (AR_SREV_9285(ah)) {
939 /* For AR9285 the number of Fifos are reduced to half.
940 * So set the usable tx buf size also to half to
941 * avoid data/delimiter underruns
942 */
945 } else if (!AR_SREV_9271(ah)) {
948 }
949
951
954}
955
965
967 u32 *coef_mantissa, u32 *coef_exponent)
968{
969 u32 coef_exp, coef_man;
970
971 for (coef_exp = 31; coef_exp > 0; coef_exp--)
972 if ((coef_scaled >> coef_exp) & 0x1)
973 break;
974
975 coef_exp = 14 - (coef_exp - COEF_SCALE_S);
976
977 coef_man = coef_scaled + (1 << (COEF_SCALE_S - coef_exp - 1));
978
979 *coef_mantissa = coef_man >> (COEF_SCALE_S - coef_exp);
980 *coef_exponent = coef_exp - 16;
981}
982
983static int ath9k_hw_set_reset(struct ath_hw *ah, int type)
984{
985 u32 rst_flags;
986 u32 tmpReg;
987
988 if (AR_SREV_9100(ah)) {
992 }
993
995
997 REG_WRITE(ah, AR_WA, ah->WARegVal);
998 udelay(10);
999 }
1000
1003
1004 if (AR_SREV_9100(ah)) {
1007 } else {
1008 tmpReg = REG_READ(ah, AR_INTR_SYNC_CAUSE);
1009 if (tmpReg &
1012 u32 val;
1014
1015 val = AR_RC_HOSTIF;
1017 val |= AR_RC_AHB;
1018 REG_WRITE(ah, AR_RC, val);
1019
1020 } else if (!AR_SREV_9300_20_OR_LATER(ah))
1022
1023 rst_flags = AR_RTC_RC_MAC_WARM;
1024 if (type == ATH9K_RESET_COLD)
1025 rst_flags |= AR_RTC_RC_MAC_COLD;
1026 }
1027
1028 REG_WRITE(ah, AR_RTC_RC, rst_flags);
1029
1031
1032 udelay(50);
1033
1034 REG_WRITE(ah, AR_RTC_RC, 0);
1036 DBG("ath9k: "
1037 "RTC stuck in MAC reset\n");
1038 return 0;
1039 }
1040
1041 if (!AR_SREV_9100(ah))
1042 REG_WRITE(ah, AR_RC, 0);
1043
1044 if (AR_SREV_9100(ah))
1045 udelay(50);
1046
1047 return 1;
1048}
1049
1051{
1053
1055 REG_WRITE(ah, AR_WA, ah->WARegVal);
1056 udelay(10);
1057 }
1058
1061
1064
1066
1068
1070 udelay(2);
1071
1073 REG_WRITE(ah, AR_RC, 0);
1074
1076
1077 if (!ath9k_hw_wait(ah,
1081 AH_WAIT_TIMEOUT)) {
1082 DBG("ath9k: "
1083 "RTC not waking up\n");
1084 return 0;
1085 }
1086
1088}
1089
1091{
1093 REG_WRITE(ah, AR_WA, ah->WARegVal);
1094 udelay(10);
1095 }
1096
1099
1100 switch (type) {
1103 case ATH9K_RESET_WARM:
1104 case ATH9K_RESET_COLD:
1105 return ath9k_hw_set_reset(ah, type);
1106 default:
1107 return 0;
1108 }
1109}
1110
1111static int ath9k_hw_chip_reset(struct ath_hw *ah,
1112 struct ath9k_channel *chan)
1113{
1114 if (AR_SREV_9280(ah) && ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) {
1116 return 0;
1118 return 0;
1119
1121 return 0;
1122
1123 ah->chip_fullsleep = 0;
1124 ath9k_hw_init_pll(ah, chan);
1125 ath9k_hw_set_rfmode(ah, chan);
1126
1127 return 1;
1128}
1129
1131 struct ath9k_channel *chan)
1132{
1133 struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
1134 struct net80211_channel *channel = chan->chan;
1135 u32 qnum;
1136 int r;
1137
1138 for (qnum = 0; qnum < AR_NUM_QCU; qnum++) {
1139 if (ath9k_hw_numtxpending(ah, qnum)) {
1140 DBG("ath9k: "
1141 "Transmit frames pending on queue %d\n", qnum);
1142 return 0;
1143 }
1144 }
1145
1146 if (!ath9k_hw_rfbus_req(ah)) {
1147 DBG("ath9k: Could not kill baseband RX\n");
1148 return 0;
1149 }
1150
1152
1153 r = ath9k_hw_rf_set_freq(ah, chan);
1154 if (r) {
1155 DBG("ath9k: Failed to set channel\n");
1156 return 0;
1157 }
1159
1160 ah->eep_ops->set_txpower(ah, chan,
1161 ath9k_regd_get_ctl(regulatory, chan),
1162 0,
1163 channel->maxpower * 2,
1165 (u32) regulatory->power_limit), 0);
1166
1168
1169 if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan))
1171
1173
1174 return 1;
1175}
1176
1178{
1179 u32 gpio_mask = ah->gpio_mask;
1180 int i;
1181
1182 for (i = 0; gpio_mask; i++, gpio_mask >>= 1) {
1183 if (!(gpio_mask & 1))
1184 continue;
1185
1187 ath9k_hw_set_gpio(ah, i, !!(ah->gpio_val & BIT(i)));
1188 }
1189}
1190
1192{
1193 int count = 50;
1194 u32 reg;
1195
1197 return 1;
1198
1199 do {
1201
1202 if ((reg & 0x7E7FFFEF) == 0x00702400)
1203 continue;
1204
1205 switch (reg & 0x7E000B00) {
1206 case 0x1E000000:
1207 case 0x52000B00:
1208 case 0x18000B00:
1209 continue;
1210 default:
1211 return 1;
1212 }
1213 } while (count-- > 0);
1214
1215 return 0;
1216}
1217
1218int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
1219 struct ath9k_hw_cal_data *caldata, int bChannelChange)
1220{
1222 u32 saveLedState;
1223 struct ath9k_channel *curchan = ah->curchan;
1224 u32 saveDefAntenna;
1225 u32 macStaId1;
1226 int i, r;
1227
1228 ah->txchainmask = common->tx_chainmask;
1229 ah->rxchainmask = common->rx_chainmask;
1230
1232 return -EIO;
1233
1234 if (curchan && !ah->chip_fullsleep)
1235 ath9k_hw_getnf(ah, curchan);
1236
1237 ah->caldata = caldata;
1238 if (caldata &&
1239 (chan->channel != caldata->channel ||
1240 (chan->channelFlags & ~CHANNEL_CW_INT) !=
1241 (caldata->channelFlags & ~CHANNEL_CW_INT))) {
1242 /* Operating channel changed, reset channel calibration data */
1243 memset(caldata, 0, sizeof(*caldata));
1245 }
1246
1247 if (bChannelChange &&
1248 (ah->chip_fullsleep != 1) &&
1249 (ah->curchan != NULL) &&
1250 (chan->channel != ah->curchan->channel) &&
1251 ((chan->channelFlags & CHANNEL_ALL) ==
1252 (ah->curchan->channelFlags & CHANNEL_ALL)) &&
1253 (!AR_SREV_9280(ah) || AR_DEVID_7010(ah))) {
1254
1256 ath9k_hw_loadnf(ah, ah->curchan);
1258 if (AR_SREV_9271(ah))
1260 return 0;
1261 }
1262 }
1263
1264 saveDefAntenna = REG_READ(ah, AR_DEF_ANTENNA);
1265 if (saveDefAntenna == 0)
1266 saveDefAntenna = 1;
1267
1269
1270 saveLedState = REG_READ(ah, AR_CFG_LED) &
1273
1275
1276 ah->paprd_table_write_done = 0;
1277
1278 /* Only required on the first reset */
1279 if (AR_SREV_9271(ah) && ah->htc_reset_init) {
1280 REG_WRITE(ah,
1283 udelay(50);
1284 }
1285
1286 if (!ath9k_hw_chip_reset(ah, chan)) {
1287 DBG("ath9k: Chip reset failed\n");
1288 return -EINVAL;
1289 }
1290
1291 /* Only required on the first reset */
1292 if (AR_SREV_9271(ah) && ah->htc_reset_init) {
1293 ah->htc_reset_init = 0;
1294 REG_WRITE(ah,
1297 udelay(50);
1298 }
1299
1302
1305
1307 if (r)
1308 return r;
1309
1310 /* Setup MFP options for CCMP */
1312 /* Mask Retry(b11), PwrMgt(b12), MoreData(b13) to 0 in mgmt
1313 * frames when constructing CCMP AAD. */
1315 0xc7ff);
1316 ah->sw_mgmt_crypto = 0;
1317 } else if (AR_SREV_9160_10_OR_LATER(ah)) {
1318 /* Disable hardware crypto for management frames */
1323 ah->sw_mgmt_crypto = 1;
1324 } else
1325 ah->sw_mgmt_crypto = 1;
1326
1329
1331 ah->eep_ops->set_board_values(ah, chan);
1332
1334
1337 | macStaId1
1339 | (ah->config.
1340 ack_6mb ? AR_STA_ID1_ACKCTS_6MB : 0)
1341 | ah->sta_id1_defaults);
1343 REG_WRITE(ah, AR_DEF_ANTENNA, saveDefAntenna);
1345 REG_WRITE(ah, AR_ISR, ~0);
1347
1349
1351
1353 if (r)
1354 return r;
1355
1357
1359
1360 for (i = 0; i < AR_NUM_DCU; i++)
1361 REG_WRITE(ah, AR_DQCUMASK(i), 1 << i);
1362
1364
1365 ah->intr_txqs = 0;
1366 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++)
1368
1371
1372 if (ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
1373 ath9k_hw_cfg_gpio_input(ah, ah->rfkill_gpio);
1374
1376
1380 }
1381
1383
1385
1386 REG_WRITE(ah, AR_OBS, 8);
1387
1388 if (ah->config.rx_intr_mitigation) {
1391 }
1392
1393 if (ah->config.tx_intr_mitigation) {
1396 }
1397
1399
1400 if (!ath9k_hw_init_cal(ah, chan))
1401 return -EIO;
1402
1404
1406 REG_WRITE(ah, AR_CFG_LED, saveLedState | AR_CFG_SCLK_32KHZ);
1407
1409
1410 /*
1411 * For big endian systems turn on swapping for descriptors
1412 */
1413 if (AR_SREV_9100(ah)) {
1414 u32 mask;
1415 mask = REG_READ(ah, AR_CFG);
1416 if (mask & (AR_CFG_SWRB | AR_CFG_SWTB | AR_CFG_SWRG)) {
1417 DBG2("ath9k: "
1418 "CFG Byte Swap Set 0x%x\n", mask);
1419 } else {
1420 mask =
1422 REG_WRITE(ah, AR_CFG, mask);
1423 DBG2("ath9k: "
1424 "Setting CFG 0x%x\n", REG_READ(ah, AR_CFG));
1425 }
1426 } else {
1427 if (common->bus_ops->ath_bus_type == ATH_USB) {
1428 /* Configure AR9271 target WLAN */
1429 if (AR_SREV_9271(ah))
1431 else
1433 }
1434#if __BYTE_ORDER == __BIG_ENDIAN
1435 else if (AR_SREV_9340(ah))
1437 else
1439#endif
1440 }
1441
1444 }
1445
1447
1448 return 0;
1449}
1450
1451/******************************/
1452/* Power Management (Chipset) */
1453/******************************/
1454
1455/*
1456 * Notify Power Mgt is disabled in self-generated frames.
1457 * If requested, force chip to sleep.
1458 */
1459static void ath9k_set_power_sleep(struct ath_hw *ah, int setChip)
1460{
1462 if (setChip) {
1463 /*
1464 * Clear the RTC force wake bit to allow the
1465 * mac to go to sleep.
1466 */
1471
1472 /* Shutdown chip. Active low */
1473 if (!AR_SREV_5416(ah) && !AR_SREV_9271(ah))
1476 }
1477
1478 /* Clear Bit 14 of AR_WA after putting chip into Full Sleep mode. */
1481 ah->WARegVal & ~AR_WA_D3_L1_DISABLE);
1482}
1483
1484static int ath9k_hw_set_power_awake(struct ath_hw *ah, int setChip)
1485{
1486 u32 val;
1487 int i;
1488
1489 /* Set Bits 14 and 17 of AR_WA before powering on the chip. */
1491 REG_WRITE(ah, AR_WA, ah->WARegVal);
1492 udelay(10);
1493 }
1494
1495 if (setChip) {
1496 if ((REG_READ(ah, AR_RTC_STATUS) &
1499 ATH9K_RESET_POWER_ON) != 1) {
1500 return 0;
1501 }
1504 }
1505 if (AR_SREV_9100(ah))
1508
1511 udelay(50);
1512
1513 for (i = POWER_UP_TIME / 50; i > 0; i--) {
1515 if (val == AR_RTC_STATUS_ON)
1516 break;
1517 udelay(50);
1520 }
1521 if (i == 0) {
1522 DBG("ath9k: "
1523 "Failed to wakeup in %dus\n",
1524 POWER_UP_TIME / 20);
1525 return 0;
1526 }
1527 }
1528
1530
1531 return 1;
1532}
1533
1535{
1536 int status = 1, setChip = 1;
1537 static const char *modes[] = {
1538 "AWAKE",
1539 "FULL-SLEEP",
1540 "NETWORK SLEEP",
1541 "UNDEFINED"
1542 };
1543
1544 if (ah->power_mode == mode)
1545 return status;
1546
1547 DBG2("ath9k: %s -> %s\n",
1548 modes[ah->power_mode], modes[mode]);
1549
1550 switch (mode) {
1551 case ATH9K_PM_AWAKE:
1553 break;
1555 ath9k_set_power_sleep(ah, setChip);
1556 ah->chip_fullsleep = 1;
1557 break;
1558 default:
1559 DBG("ath9k: Unknown power mode %d\n", mode);
1560 return 0;
1561 }
1562 ah->power_mode = mode;
1563
1564 return status;
1565}
1566
1567/*******************/
1568/* HW Capabilities */
1569/*******************/
1570
1572{
1573 struct ath9k_hw_capabilities *pCap = &ah->caps;
1574 struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
1576
1577 u16 eeval;
1578 u8 ant_div_ctl1, tx_chainmask, rx_chainmask;
1579
1580 eeval = ah->eep_ops->get_eeprom(ah, EEP_REG_0);
1581 regulatory->current_rd = eeval;
1582
1583 eeval = ah->eep_ops->get_eeprom(ah, EEP_REG_1);
1585 eeval |= AR9285_RDEXT_DEFAULT;
1586 regulatory->current_rd_ext = eeval;
1587
1588 if (ah->hw_version.subvendorid == AR_SUBVENDOR_ID_NEW_A) {
1589 if (regulatory->current_rd == 0x64 ||
1590 regulatory->current_rd == 0x65)
1591 regulatory->current_rd += 5;
1592 else if (regulatory->current_rd == 0x41)
1593 regulatory->current_rd = 0x43;
1594 DBG2("ath9k: "
1595 "regdomain mapped to 0x%x\n", regulatory->current_rd);
1596 }
1597
1598 eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE);
1599 if ((eeval & (AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A)) == 0) {
1600 DBG("ath9k: "
1601 "no band has been marked as supported in EEPROM\n");
1602 return -EINVAL;
1603 }
1604
1605 if (eeval & AR5416_OPFLAGS_11A)
1606 pCap->hw_caps |= ATH9K_HW_CAP_5GHZ;
1607
1608 if (eeval & AR5416_OPFLAGS_11G)
1609 pCap->hw_caps |= ATH9K_HW_CAP_2GHZ;
1610
1611 pCap->tx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_TX_MASK);
1612 /*
1613 * For AR9271 we will temporarilly uses the rx chainmax as read from
1614 * the EEPROM.
1615 */
1616 if ((ah->hw_version.devid == AR5416_DEVID_PCI) &&
1617 !(eeval & AR5416_OPFLAGS_11A) &&
1618 !(AR_SREV_9271(ah)))
1619 /* CB71: GPIO 0 is pulled down to indicate 3 rx chains */
1620 pCap->rx_chainmask = ath9k_hw_gpio_get(ah, 0) ? 0x5 : 0x7;
1621 else if (AR_SREV_9100(ah))
1622 pCap->rx_chainmask = 0x7;
1623 else
1624 /* Use rx_chainmask from EEPROM. */
1625 pCap->rx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_RX_MASK);
1626
1627 ah->misc_mode |= AR_PCU_MIC_NEW_LOC_ENA;
1628
1629 /* enable key search for every frame in an aggregate */
1631 ah->misc_mode |= AR_PCU_ALWAYS_PERFORM_KEYSEARCH;
1632
1633 common->crypt_caps |= ATH_CRYPT_CAP_CIPHER_AESCCM;
1634
1635 pCap->hw_caps &= ~ATH9K_HW_CAP_HT;
1636
1637 if (AR_SREV_9271(ah))
1639 else if (AR_DEVID_7010(ah))
1641 else if (AR_SREV_9285_12_OR_LATER(ah))
1643 else if (AR_SREV_9280_20_OR_LATER(ah))
1645 else
1646 pCap->num_gpio_pins = AR_NUM_GPIO;
1647
1649 pCap->hw_caps |= ATH9K_HW_CAP_CST;
1651 } else {
1652 pCap->rts_aggr_limit = (8 * 1024);
1653 }
1654
1655 ah->rfsilent = ah->eep_ops->get_eeprom(ah, EEP_RF_SILENT);
1656 if (ah->rfsilent & EEP_RFSILENT_ENABLED) {
1657 ah->rfkill_gpio =
1658 MS(ah->rfsilent, EEP_RFSILENT_GPIO_SEL);
1659 ah->rfkill_polarity =
1660 MS(ah->rfsilent, EEP_RFSILENT_POLARITY);
1661
1663 }
1664
1666
1667 if (AR_SREV_9280(ah) || AR_SREV_9285(ah))
1669 else
1671
1674 if (!AR_SREV_9485(ah))
1675 pCap->hw_caps |= ATH9K_HW_CAP_LDPC;
1676
1679 pCap->rx_status_len = sizeof(struct ar9003_rxs);
1680 pCap->tx_desc_len = sizeof(struct ar9003_txc);
1681 pCap->txs_len = sizeof(struct ar9003_txs);
1682 if (!ah->config.paprd_disable &&
1683 ah->eep_ops->get_eeprom(ah, EEP_PAPRD))
1684 pCap->hw_caps |= ATH9K_HW_CAP_PAPRD;
1685 } else {
1686 pCap->tx_desc_len = sizeof(struct ath_desc);
1687 if (AR_SREV_9280_20(ah) &&
1688 ((ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV) <=
1690 ah->eep_ops->get_eeprom(ah, EEP_FSTCLK_5G)))
1692 }
1693
1696
1698 ah->ent_mode = REG_READ(ah, AR_ENT_OTP);
1699
1702
1703 if (AR_SREV_9285(ah))
1704 if (ah->eep_ops->get_eeprom(ah, EEP_MODAL_VER) >= 3) {
1705 ant_div_ctl1 =
1706 ah->eep_ops->get_eeprom(ah, EEP_ANT_DIV_CTL1);
1707 if ((ant_div_ctl1 & 0x1) && ((ant_div_ctl1 >> 3) & 0x1))
1709 }
1711 if (ah->eep_ops->get_eeprom(ah, EEP_CHAIN_MASK_REDUCE))
1712 pCap->hw_caps |= ATH9K_HW_CAP_APM;
1713 }
1714
1715
1716 if (AR_SREV_9485(ah)) {
1717 ant_div_ctl1 = ah->eep_ops->get_eeprom(ah, EEP_ANT_DIV_CTL1);
1718 /*
1719 * enable the diversity-combining algorithm only when
1720 * both enable_lna_div and enable_fast_div are set
1721 * Table for Diversity
1722 * ant_div_alt_lnaconf bit 0-1
1723 * ant_div_main_lnaconf bit 2-3
1724 * ant_div_alt_gaintb bit 4
1725 * ant_div_main_gaintb bit 5
1726 * enable_ant_div_lnadiv bit 6
1727 * enable_ant_fast_div bit 7
1728 */
1729 if ((ant_div_ctl1 >> 0x6) == 0x3)
1731 }
1732
1733 if (AR_SREV_9485_10(ah)) {
1734 pCap->pcie_lcr_extsync_en = 1;
1735 pCap->pcie_lcr_offset = 0x80;
1736 }
1737
1738 tx_chainmask = pCap->tx_chainmask;
1739 rx_chainmask = pCap->rx_chainmask;
1740 while (tx_chainmask || rx_chainmask) {
1741 if (tx_chainmask & BIT(0))
1742 pCap->max_txchains++;
1743 if (rx_chainmask & BIT(0))
1744 pCap->max_rxchains++;
1745
1746 tx_chainmask >>= 1;
1747 rx_chainmask >>= 1;
1748 }
1749
1750 return 0;
1751}
1752
1753/****************************/
1754/* GPIO / RFKILL / Antennae */
1755/****************************/
1756
1758 u32 gpio, u32 type)
1759{
1760 int addr;
1761 u32 gpio_shift, tmp;
1762
1763 if (gpio > 11)
1765 else if (gpio > 5)
1767 else
1769
1770 gpio_shift = (gpio % 6) * 5;
1771
1773 || (addr != AR_GPIO_OUTPUT_MUX1)) {
1774 REG_RMW(ah, addr, (type << gpio_shift),
1775 (0x1f << gpio_shift));
1776 } else {
1777 tmp = REG_READ(ah, addr);
1778 tmp = ((tmp & 0x1F0) << 1) | (tmp & ~0x1F0);
1779 tmp &= ~(0x1f << gpio_shift);
1780 tmp |= (type << gpio_shift);
1781 REG_WRITE(ah, addr, tmp);
1782 }
1783}
1784
1786{
1787 u32 gpio_shift;
1788
1789 if (AR_DEVID_7010(ah)) {
1790 gpio_shift = gpio;
1792 (AR7010_GPIO_OE_AS_INPUT << gpio_shift),
1793 (AR7010_GPIO_OE_MASK << gpio_shift));
1794 return;
1795 }
1796
1797 gpio_shift = gpio << 1;
1798 REG_RMW(ah,
1800 (AR_GPIO_OE_OUT_DRV_NO << gpio_shift),
1801 (AR_GPIO_OE_OUT_DRV << gpio_shift));
1802}
1803
1805{
1806#define MS_REG_READ(x, y) \
1807 (MS(REG_READ(ah, AR_GPIO_IN_OUT), x##_GPIO_IN_VAL) & (AR_GPIO_BIT(y)))
1808
1809 if (gpio >= ah->caps.num_gpio_pins)
1810 return 0xffffffff;
1811
1812 if (AR_DEVID_7010(ah)) {
1813 u32 val;
1815 return (MS(val, AR7010_GPIO_IN_VAL) & AR_GPIO_BIT(gpio)) == 0;
1816 } else if (AR_SREV_9300_20_OR_LATER(ah))
1818 AR_GPIO_BIT(gpio)) != 0;
1819 else if (AR_SREV_9271(ah))
1820 return MS_REG_READ(AR9271, gpio) != 0;
1821 else if (AR_SREV_9287_11_OR_LATER(ah))
1822 return MS_REG_READ(AR9287, gpio) != 0;
1823 else if (AR_SREV_9285_12_OR_LATER(ah))
1824 return MS_REG_READ(AR9285, gpio) != 0;
1825 else if (AR_SREV_9280_20_OR_LATER(ah))
1826 return MS_REG_READ(AR928X, gpio) != 0;
1827 else
1828 return MS_REG_READ(AR, gpio) != 0;
1829}
1830
1832 u32 ah_signal_type)
1833{
1834 u32 gpio_shift;
1835
1836 if (AR_DEVID_7010(ah)) {
1837 gpio_shift = gpio;
1839 (AR7010_GPIO_OE_AS_OUTPUT << gpio_shift),
1840 (AR7010_GPIO_OE_MASK << gpio_shift));
1841 return;
1842 }
1843
1844 ath9k_hw_gpio_cfg_output_mux(ah, gpio, ah_signal_type);
1845 gpio_shift = 2 * gpio;
1846 REG_RMW(ah,
1848 (AR_GPIO_OE_OUT_DRV_ALL << gpio_shift),
1849 (AR_GPIO_OE_OUT_DRV << gpio_shift));
1850}
1851
1853{
1854 if (AR_DEVID_7010(ah)) {
1855 val = val ? 0 : 1;
1856 REG_RMW(ah, AR7010_GPIO_OUT, ((val&1) << gpio),
1857 AR_GPIO_BIT(gpio));
1858 return;
1859 }
1860
1861 if (AR_SREV_9271(ah))
1862 val = ~val;
1863
1864 REG_RMW(ah, AR_GPIO_IN_OUT, ((val & 1) << gpio),
1865 AR_GPIO_BIT(gpio));
1866}
1867
1869{
1870 return REG_READ(ah, AR_DEF_ANTENNA) & 0x7;
1871}
1872
1873void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna)
1874{
1875 REG_WRITE(ah, AR_DEF_ANTENNA, (antenna & 0x7));
1876}
1877
1878/*********************/
1879/* General Operation */
1880/*********************/
1881
1883{
1885 u32 phybits = REG_READ(ah, AR_PHY_ERR);
1886
1887 if (phybits & AR_PHY_ERR_RADAR)
1891
1892 return bits;
1893}
1894
1896{
1897 u32 phybits;
1898
1900
1902
1903 phybits = 0;
1905 phybits |= AR_PHY_ERR_RADAR;
1908 REG_WRITE(ah, AR_PHY_ERR, phybits);
1909
1910 if (phybits)
1912 else
1914
1916}
1917
1919{
1921 return 0;
1922
1924 return 1;
1925}
1926
1928{
1930 return 0;
1931
1933 return 0;
1934
1936 return 1;
1937}
1938
1940{
1941 struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
1942 struct ath9k_channel *chan = ah->curchan;
1943 struct net80211_channel *channel = chan->chan;
1944
1945 regulatory->power_limit = min(limit, (u32) MAX_RATE_POWER);
1946
1947 ah->eep_ops->set_txpower(ah, chan,
1948 ath9k_regd_get_ctl(regulatory, chan),
1949 0,
1950 channel->maxpower * 2,
1952 (u32) regulatory->power_limit), test);
1953}
1954
1959
1960void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1)
1961{
1962 REG_WRITE(ah, AR_MCAST_FIL0, filter0);
1963 REG_WRITE(ah, AR_MCAST_FIL1, filter1);
1964}
1965
1967{
1969
1972 ((common->curaid & 0x3fff) << AR_BSS_ID1_AID_S));
1973}
1974
1976{
1977 u32 macmode;
1978
1979 macmode = 0;
1980
1981 REG_WRITE(ah, AR_2040_MODE, macmode);
1982}
1983
1984static struct {
1986 const char * name;
1987} ath_mac_bb_names[] = {
1988 /* Devices with external radios */
1989 { AR_SREV_VERSION_5416_PCI, "5416" },
1990 { AR_SREV_VERSION_5416_PCIE, "5418" },
1991 { AR_SREV_VERSION_9100, "9100" },
1992 { AR_SREV_VERSION_9160, "9160" },
1993 /* Single-chip solutions */
1994 { AR_SREV_VERSION_9280, "9280" },
1995 { AR_SREV_VERSION_9285, "9285" },
1996 { AR_SREV_VERSION_9287, "9287" },
1997 { AR_SREV_VERSION_9271, "9271" },
1998 { AR_SREV_VERSION_9300, "9300" },
1999 { AR_SREV_VERSION_9485, "9485" },
2001
2002/* For devices with external radios */
2003static struct {
2004 u16 version;
2005 const char * name;
2006} ath_rf_names[] = {
2007 { 0, "5133" },
2008 { AR_RAD5133_SREV_MAJOR, "5133" },
2009 { AR_RAD5122_SREV_MAJOR, "5122" },
2010 { AR_RAD2133_SREV_MAJOR, "2133" },
2011 { AR_RAD2122_SREV_MAJOR, "2122" }
2013
2014/*
2015 * Return the MAC/BB name. "????" is returned if the MAC/BB is unknown.
2016 */
2017static const char *ath9k_hw_mac_bb_name(u32 mac_bb_version)
2018{
2019 unsigned int i;
2020
2021 for (i=0; i<ARRAY_SIZE(ath_mac_bb_names); i++) {
2022 if (ath_mac_bb_names[i].version == mac_bb_version) {
2023 return ath_mac_bb_names[i].name;
2024 }
2025 }
2026
2027 return "????";
2028}
2029
2030/*
2031 * Return the RF name. "????" is returned if the RF is unknown.
2032 * Used for devices with external radios.
2033 */
2034static const char *ath9k_hw_rf_name(u16 rf_version)
2035{
2036 unsigned int i;
2037
2038 for (i=0; i<ARRAY_SIZE(ath_rf_names); i++) {
2039 if (ath_rf_names[i].version == rf_version) {
2040 return ath_rf_names[i].name;
2041 }
2042 }
2043
2044 return "????";
2045}
2046
2047void ath9k_hw_name(struct ath_hw *ah, char *hw_name, size_t len)
2048{
2049 int used;
2050
2051 /* chipsets >= AR9280 are single-chip */
2053 used = snprintf(hw_name, len,
2054 "Atheros AR%s Rev:%x",
2055 ath9k_hw_mac_bb_name(ah->hw_version.macVersion),
2056 ah->hw_version.macRev);
2057 }
2058 else {
2059 used = snprintf(hw_name, len,
2060 "Atheros AR%s MAC/BB Rev:%x AR%s RF Rev:%x",
2061 ath9k_hw_mac_bb_name(ah->hw_version.macVersion),
2062 ah->hw_version.macRev,
2063 ath9k_hw_rf_name((ah->hw_version.analog5GhzRev &
2065 ah->hw_version.phyRev);
2066 }
2067
2068 hw_name[used] = '\0';
2069}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
@ ATH9K_ANI_NOISE_IMMUNITY_LEVEL
Definition ani.h:83
@ ATH9K_ANI_ALL
Definition ani.h:91
@ ATH9K_ANI_MRC_CCK
Definition ani.h:90
void ath9k_hw_ani_setup(struct ath_hw *ah)
Definition ath9k_ani.c:649
void ath9k_hw_ani_init(struct ath_hw *ah)
Definition ath9k_ani.c:666
void ath9k_hw_reset_txstatus_ring(struct ath_hw *ah)
void ath9k_hw_set_rx_bufsize(struct ath_hw *ah, u16 buf_size)
signed char int8_t
Definition stdint.h:15
static volatile void * bits
Definition bitops.h:28
unsigned long retval
Definition xen.h:46
#define CHANNEL_ALL
Definition ath5k.h:649
#define CHANNEL_CCK
Definition ath5k.h:632
#define CHANNEL_CW_INT
Definition ath5k.h:630
#define CHANNEL_OFDM
Definition ath5k.h:633
#define IS_CHAN_B(_c)
Definition ath5k.h:660
#define CTL_11G
Definition eeprom.h:73
#define AR5416_OPFLAGS_11A
Definition eeprom.h:124
#define CTL_11A
Definition eeprom.h:71
#define EEP_RFSILENT_POLARITY
Definition eeprom.h:119
#define EEP_RFSILENT_GPIO_SEL
Definition eeprom.h:121
#define AR_EEPROM_MODAL_SPURS
Definition eeprom.h:26
#define AR5416_OPFLAGS_11G
Definition eeprom.h:125
#define AR9285_RDEXT_DEFAULT
Definition eeprom.h:100
#define EEP_RFSILENT_ENABLED
Definition eeprom.h:117
#define AR5416_EEP_MINOR_VER_16
Definition eeprom.h:138
@ EEP_RF_SILENT
Definition eeprom.h:236
@ EEP_REG_0
Definition eeprom.h:232
@ EEP_MINOR_REV
Definition eeprom.h:241
@ EEP_OL_PWRCTRL
Definition eeprom.h:246
@ EEP_MAC_MSW
Definition eeprom.h:229
@ EEP_MODAL_VER
Definition eeprom.h:259
@ EEP_RX_MASK
Definition eeprom.h:243
@ EEP_MAC_LSW
Definition eeprom.h:231
@ EEP_MAC_MID
Definition eeprom.h:230
@ EEP_FSTCLK_5G
Definition eeprom.h:244
@ EEP_PAPRD
Definition eeprom.h:258
@ EEP_OP_MODE
Definition eeprom.h:235
@ EEP_TX_MASK
Definition eeprom.h:242
@ EEP_REG_1
Definition eeprom.h:233
@ EEP_ANT_DIV_CTL1
Definition eeprom.h:260
@ EEP_CHAIN_MASK_REDUCE
Definition eeprom.h:261
#define CTRY_DEFAULT
Definition eeprom.h:38
#define CTL_11B
Definition eeprom.h:72
#define AR_GPIO_IN_OUT
Definition reg.h:995
#define AR_SREV_VERSION_5416_PCIE
Definition reg.h:768
#define AR_RIMT
Definition reg.h:65
#define AR_CFG_SWRB
Definition reg.h:36
#define AR_IMR_TXERR
Definition reg.h:270
#define AR_FTRIG_512B
Definition reg.h:97
#define AR_RTC_STATUS_M
Definition reg.h:1203
#define AR_SREV_VERSION_9485
Definition reg.h:794
#define AR_PHY_ERR
Definition reg.h:1628
#define AR_AHB_MODE
Definition reg.h:902
#define AR_RAD5122_SREV_MAJOR
Definition reg.h:899
#define AR_CFG_AP_ADHOC_INDICATION
Definition reg.h:38
#define AR_IMR_RXERR
Definition reg.h:264
#define AR_TIME_OUT
Definition reg.h:1462
#define AR_RTC_RC_WARM_RESET
Definition reg.h:1165
#define AR_CH0_BB_DPLL3_PHASE_SHIFT
Definition reg.h:1135
#define AR_CH0_DPLL2_KI
Definition reg.h:1123
#define AR_STA_ID0
Definition reg.h:1432
#define AR_SREV_VERSION_9280
Definition reg.h:776
#define AR_RXCFG
Definition reg.h:100
#define AR_SREV_VERSION
Definition reg.h:753
#define AR_SREV_9285_12_OR_LATER(_ah)
Definition reg.h:832
#define PLL3
Definition reg.h:1190
#define AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE
Definition reg.h:1832
#define AR_CH0_BB_DPLL2_PLL_PWD
Definition reg.h:1129
#define AR_SREV_VERSION_9271
Definition reg.h:789
#define AR_CFG_LED_MODE_SEL
Definition reg.h:664
#define AR_IMR_RXOK_HP
Definition reg.h:262
#define SQSUM_DVC_MASK
Definition reg.h:1194
#define AR_CFG_SWTD
Definition reg.h:33
#define AR_INTR_PRIO_ASYNC_MASK
Definition reg.h:1105
#define AR_SREV_9485_10(_ah)
Definition reg.h:870
#define AR_RXFIFO_CFG
Definition reg.h:1635
#define AR_2040_MODE
Definition reg.h:1818
#define AR_GPIO_JTAG_DISABLE
Definition reg.h:1058
#define AR9271_NUM_GPIO
Definition reg.h:991
#define AR_RTC_RC_COLD_RESET
Definition reg.h:1164
#define AR_SREV_9287_11_OR_LATER(_ah)
Definition reg.h:837
#define AR_OBS_BUS_1
Definition reg.h:1559
#define AR7010_GPIO_OE
Definition reg.h:1021
#define AR_MCAST_FIL1
Definition reg.h:1494
#define AR_PCIE_SERDES2
Definition reg.h:983
#define AR_RAD5133_SREV_MAJOR
Definition reg.h:897
#define AR_RC_HOSTIF
Definition reg.h:697
#define AR_RXBP_THRESH_HP
Definition reg.h:46
#define AR_RTC_RESET_EN
Definition reg.h:1198
#define AR_STA_ID1_ACKCTS_6MB
Definition reg.h:1444
#define AR_TIME_OUT_CTS
Definition reg.h:1465
#define AR_PCIE_SERDES
Definition reg.h:982
#define AR_PCU_ALWAYS_PERFORM_KEYSEARCH
Definition reg.h:1654
#define AR_RIMT_FIRST
Definition reg.h:68
#define AR_STA_ID1
Definition reg.h:1433
#define AR_SREV
Definition reg.h:747
#define AR_SREV_9280(_ah)
Definition reg.h:823
#define AR_CFG_LED_BLINK_THRESH_SEL
Definition reg.h:663
#define AR_NUM_DCU
Definition reg.h:484
#define AR_SREV_9285(_ah)
Definition reg.h:830
#define AR_RTC_DERIVED_CLK_PERIOD
Definition reg.h:1237
#define AR_STA_ID1_MCAST_KSRCH
Definition reg.h:1451
#define AR_RTC_FORCE_WAKE_ON_INT
Definition reg.h:1221
#define AR_ISR
Definition reg.h:172
#define AR_SREV_9280_20(_ah)
Definition reg.h:827
#define AR_INTR_PRIO_SYNC_MASK
Definition reg.h:1106
#define AR_STA_ID1_RTS_USE_DEF
Definition reg.h:1443
#define AR_INTR_PRIO_ASYNC_ENABLE
Definition reg.h:1107
#define AR_PHY_ERR_CCK_TIMING
Definition reg.h:1633
#define AR_CFG_LED_BLINK_SLOW
Definition reg.h:662
#define AR_SREV_ID
Definition reg.h:751
#define AR_WA_ASPM_TIMER_BASED_DISABLE
Definition reg.h:705
#define AR_SREV_VERSION_9100
Definition reg.h:772
#define AR_RTC_RC_MAC_WARM
Definition reg.h:1162
#define AR_SREV_9280_20_OR_LATER(_ah)
Definition reg.h:825
#define AR_GPIO_OE_OUT_DRV_ALL
Definition reg.h:1019
#define AR_RTC_FORCE_DERIVED_CLK
Definition reg.h:1215
#define AR9285_NUM_GPIO
Definition reg.h:989
#define AR_SREV_VERSION_5416_PCI
Definition reg.h:767
#define AR_GTXTO
Definition reg.h:153
#define AR_SREV_9100(ah)
Definition reg.h:811
#define AR_GPIO_OE_OUT_DRV_NO
Definition reg.h:1016
#define AR_D_GBL_IFS_SLOT
Definition reg.h:619
#define AR_RTC_FORCE_WAKE_EN
Definition reg.h:1220
#define AR_CH0_BB_DPLL1
Definition reg.h:1112
#define AR_IMR_S2
Definition reg.h:307
#define AR_GPIO_OUTPUT_MUX2
Definition reg.h:1078
#define AR_IMR_TXMINTR
Definition reg.h:290
#define AR_GPIO_OE_OUT
Definition reg.h:1013
#define AR_BSS_ID0
Definition reg.h:1453
#define AR_TIMT_LAST
Definition reg.h:60
#define AR_RTC_RC_MAC_COLD
Definition reg.h:1163
#define AR_CFG_SWRG
Definition reg.h:37
#define PLL4_MEAS_DONE
Definition reg.h:1193
#define AR_AES_MUTE_MASK1_FC_MGMT
Definition reg.h:1544
#define AR_SREV_VERSION_9160
Definition reg.h:773
#define AR_AHB_PREFETCH_RD_EN
Definition reg.h:907
#define AR_RIMT_LAST
Definition reg.h:66
#define PLL3_DO_MEAS_MASK
Definition reg.h:1191
#define AR_INTR_PRIO_SYNC_ENABLE
Definition reg.h:1104
#define AR_RXCFG_ZLFDMA
Definition reg.h:102
#define AR_RTC_RESET
Definition reg.h:1196
#define AR928X_NUM_GPIO
Definition reg.h:988
#define AR_CH0_BB_DPLL2_EN_NEGTRIG
Definition reg.h:1127
#define AR_IMR_TXURN
Definition reg.h:273
#define AR_CFG_LED
Definition reg.h:655
#define AR_SREV_VERSION_9287
Definition reg.h:784
#define AR_CH0_BB_DPLL2
Definition reg.h:1120
#define AR_GPIO_INPUT_EN_VAL
Definition reg.h:1041
#define AR_RAD2122_SREV_MAJOR
Definition reg.h:900
#define AR_STA_ID1_PWR_SAV
Definition reg.h:1437
#define AR_GPIO_OUTPUT_MUX1
Definition reg.h:1076
#define AR_SREV_9485(_ah)
Definition reg.h:868
#define AR_SREV_VERSION_9285
Definition reg.h:780
#define AR_STA_ID1_CRPT_MIC_ENABLE
Definition reg.h:1447
#define AR_NUM_QCU
Definition reg.h:360
#define AR_RXBP_THRESH
Definition reg.h:45
#define AR7010_NUM_GPIO
Definition reg.h:993
#define AR_RXCFG_DMASZ_128B
Definition reg.h:109
#define AR_STA_ID1_STA_AP
Definition reg.h:1435
#define AR_NUM_GPIO
Definition reg.h:987
#define AR_RTC_FORCE_WAKE
Definition reg.h:1218
#define AR_CH0_BB_DPLL3
Definition reg.h:1134
#define AR_RC_AHB
Definition reg.h:695
#define AR_CH0_DPLL2_KD
Definition reg.h:1125
#define AR_RTC_DERIVED_CLK
Definition reg.h:1235
#define AR7010_GPIO_OUT
Definition reg.h:1026
#define AR_IMR_RXOK_LP
Definition reg.h:263
#define AR_SREV_TYPE2_HOST_MODE
Definition reg.h:763
#define AR_GPIO_OE_OUT_DRV
Definition reg.h:1015
#define AR_RAD2133_SREV_MAJOR
Definition reg.h:898
#define AR_SREV_REVISION
Definition reg.h:755
#define AR_IMR
Definition reg.h:259
#define AR7010_GPIO_IN_VAL
Definition reg.h:1006
#define AR_RTC_STATUS_SHUTDOWN
Definition reg.h:1208
#define AR_STA_ID1_PRESERVE_SEQNUM
Definition reg.h:1449
#define AR_PHY_ERR_RADAR
Definition reg.h:1631
#define AR_STA_ID1_AR9100_BA_FIX
Definition reg.h:1442
#define AR_INTR_SYNC_MASK
Definition reg.h:971
#define AR_FTRIG_S
Definition reg.h:91
#define AR_SREV_9160(_ah)
Definition reg.h:816
#define AR_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT
Definition reg.h:1833
#define AR_IMR_RXORN
Definition reg.h:267
#define AR_CFG_SWRD
Definition reg.h:35
#define AR_PHY_ERR_OFDM_TIMING
Definition reg.h:1632
#define AR_CFG_LED_ASSOC_CTL
Definition reg.h:678
#define AR_FTRIG_256B
Definition reg.h:96
#define AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE
Definition reg.h:1829
#define AR7010_GPIO_OE_MASK
Definition reg.h:1022
#define AR_DEF_ANTENNA
Definition reg.h:1535
#define AR_CFG
Definition reg.h:32
#define AR_PCU_TXBUF_CTRL
Definition reg.h:1826
#define AR_SREV_9271(_ah)
Definition reg.h:854
#define AR_SREV_VERSION2
Definition reg.h:758
#define AR_SREV_VERSION_9300
Definition reg.h:792
#define AR9271_RESET_POWER_DOWN_CONTROL
Definition reg.h:1428
#define AR_SLP32_MODE
Definition reg.h:1796
#define AR7010_GPIO_OE_AS_INPUT
Definition reg.h:1024
#define AR_RXCFG_DMASZ_MASK
Definition reg.h:103
#define AR_BSS_ID1
Definition reg.h:1454
#define AR_CH0_BB_DPLL2_OUTDIV
Definition reg.h:1131
#define AR_SREV_VERSION_9340
Definition reg.h:797
#define AR_PCU_MIC_NEW_LOC_ENA
Definition reg.h:1643
#define AR_INTR_SYNC_CAUSE
Definition reg.h:923
#define AR_WA
Definition reg.h:699
#define AR_FTRIG
Definition reg.h:90
#define AR_RTC_SLEEP_CLK
Definition reg.h:1213
#define AR_TIMT
Definition reg.h:59
#define AR_SREV_TYPE2_S
Definition reg.h:761
#define AR_TXCFG
Definition reg.h:80
#define AR_OBS
Definition reg.h:1095
#define AR_GTXTO_TIMEOUT_LIMIT
Definition reg.h:155
#define AR_RTC_STATUS_ON
Definition reg.h:1209
#define AR_DQCUMASK(_i)
Definition reg.h:506
#define AR_RX_FILTER
Definition reg.h:1491
#define AR7010_GPIO_OE_AS_OUTPUT
Definition reg.h:1023
#define AR_PCU_MISC
Definition reg.h:1641
#define AR_TIME_OUT_ACK
Definition reg.h:1463
#define AR_PCU_MISC_MODE2
Definition reg.h:1831
#define AR_IMR_TXINTM
Definition reg.h:292
#define AR_AES_MUTE_MASK1
Definition reg.h:1542
#define AR_ENT_OTP
Definition reg.h:1108
#define AR_SREV_9160_10_OR_LATER(_ah)
Definition reg.h:818
#define AR_RADIO_SREV_MAJOR
Definition reg.h:896
#define PLL4
Definition reg.h:1192
#define AR_CH0_BB_DPLL1_NFRAC
Definition reg.h:1117
#define AR_TIMT_FIRST
Definition reg.h:62
#define AR_CH0_BB_DPLL1_NINI
Definition reg.h:1115
#define AR_RTC_PLL_CONTROL
Definition reg.h:1177
#define AR_RTC_RC_M
Definition reg.h:1161
#define AR_IMR_TXOK
Definition reg.h:268
#define AR_DEVID_7010(_ah)
Definition reg.h:892
#define AR9271_RADIO_RF_RST
Definition reg.h:1429
#define AR_STA_ID1_ADHOC
Definition reg.h:1436
#define AR_RSSI_THR
Definition reg.h:1469
#define AR_TXCFG_DMASZ_MASK
Definition reg.h:81
#define AR9271_GATE_MAC_CTL
Definition reg.h:1430
@ AR_INTR_SYNC_RADM_CPL_TIMEOUT
Definition reg.h:944
@ AR_INTR_SYNC_HOST1_FATAL
Definition reg.h:937
@ AR_INTR_SYNC_LOCAL_TIMEOUT
Definition reg.h:945
@ AR_INTR_SYNC_DEFAULT
Definition reg.h:953
#define AR_SREV_5416(_ah)
Definition reg.h:799
#define AR_CH0_BB_DPLL2_LOCAL_PLL
Definition reg.h:1121
#define AR_SLP32_INC
Definition reg.h:1804
#define AR_INTR_SYNC_ENABLE
Definition reg.h:927
#define AR_BSS_ID1_AID_S
Definition reg.h:1457
#define AR_SREV_9340(_ah)
Definition reg.h:879
#define AR_STA_ID1_KSRCH_MODE
Definition reg.h:1448
#define AR_CFG_SCLK_32KHZ
Definition reg.h:661
#define AR_MCAST_FIL0
Definition reg.h:1493
#define AR_RC
Definition reg.h:694
#define AR_WA_D3_L1_DISABLE
Definition reg.h:703
#define AR_CFG_SWTB
Definition reg.h:34
#define AR_SREV_REVISION2
Definition reg.h:764
#define AR_STA_ID1_BASE_RATE_11B
Definition reg.h:1445
#define AR_GPIO_OUTPUT_MUX3
Definition reg.h:1080
#define AR7010_GPIO_IN
Definition reg.h:1025
#define AR_RXBP_THRESH_LP
Definition reg.h:48
#define AR_PCU_TXBUF_CTRL_USABLE_SIZE
Definition reg.h:1828
#define AR_IMR_RXINTM
Definition reg.h:293
#define AR_IMR_RXMINTR
Definition reg.h:291
#define AR_IMR_RXOK
Definition reg.h:260
#define AR_CH0_BB_DPLL1_REFDIV
Definition reg.h:1113
#define AR9300_GPIO_IN_VAL
Definition reg.h:1010
#define AR_GPIO_IN
Definition reg.h:1009
#define AR_TXCFG_DMASZ_128B
Definition reg.h:87
#define AR_SREV_9300_20_OR_LATER(_ah)
Definition reg.h:865
#define AR_RTC_RC
Definition reg.h:1159
#define AR_RTC_STATUS
Definition reg.h:1200
void ar9002_hw_enable_wep_aggregation(struct ath_hw *ah)
int ar9002_hw_rf_claim(struct ath_hw *ah)
void ar9002_hw_update_async_fifo(struct ath_hw *ah)
void ar9002_hw_attach_ops(struct ath_hw *ah)
void ar9002_hw_cck_chan14_spread(struct ath_hw *ah)
void ar9002_hw_load_ani_reg(struct ath_hw *ah, struct ath9k_channel *chan)
void ar9002_hw_enable_async_fifo(struct ath_hw *ah)
void ar9003_hw_attach_ops(struct ath_hw *ah)
void ar9003_hw_disable_phy_restart(struct ath_hw *ah)
void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan)
void ath9k_hw_start_nfcal(struct ath_hw *ah, int update)
int ath9k_hw_getnf(struct ath_hw *ah, struct ath9k_channel *chan)
void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah, struct ath9k_channel *chan)
int ath9k_hw_eeprom_init(struct ath_hw *ah)
void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio, u32 ah_signal_type)
Definition ath9k_hw.c:1831
static int ath9k_hw_set_reset_power_on(struct ath_hw *ah)
Definition ath9k_hw.c:1050
u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan)
Definition ath9k_hw.c:869
static int ath9k_hw_channel_change(struct ath_hw *ah, struct ath9k_channel *chan)
Definition ath9k_hw.c:1130
static int ath9k_hw_set_global_txtimeout(struct ath_hw *ah, u32 tu)
Definition ath9k_hw.c:800
int ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode)
Definition ath9k_hw.c:1534
u32 version
Driver version.
Definition ath9k_hw.c:1985
void ath9k_hw_setopmode(struct ath_hw *ah)
Definition ath9k_hw.c:1955
void ath9k_hw_init_global_settings(struct ath_hw *ah)
Definition ath9k_hw.c:814
u32 ath9k_hw_reverse_bits(u32 val, u32 n)
Definition ath9k_hw.c:127
int ath9k_hw_disable(struct ath_hw *ah)
Definition ath9k_hw.c:1927
static int ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type)
Definition ath9k_hw.c:1090
int ath9k_hw_phy_disable(struct ath_hw *ah)
Definition ath9k_hw.c:1918
void ath9k_hw_get_channel_centers(struct ath_hw *ah __unused, struct ath9k_channel *chan, struct chan_centers *centers)
Definition ath9k_hw.c:191
static int ath9k_hw_init_macaddr(struct ath_hw *ah)
Definition ath9k_hw.c:381
void ath9k_hw_write_associd(struct ath_hw *ah)
Definition ath9k_hw.c:1966
void ath9k_hw_deinit(struct ath_hw *ah)
Definition ath9k_hw.c:852
int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, struct ath9k_hw_cal_data *caldata, int bChannelChange)
Definition ath9k_hw.c:1218
static void ath9k_set_power_sleep(struct ath_hw *ah, int setChip)
Definition ath9k_hw.c:1459
static void ath9k_hw_set_dma(struct ath_hw *ah)
Definition ath9k_hw.c:887
static void ath9k_hw_gpio_cfg_output_mux(struct ath_hw *ah, u32 gpio, u32 type)
Definition ath9k_hw.c:1757
static const char * ath9k_hw_mac_bb_name(u32 mac_bb_version)
Definition ath9k_hw.c:2017
static int ath9k_hw_chip_reset(struct ath_hw *ah, struct ath9k_channel *chan)
Definition ath9k_hw.c:1111
u32 ath9k_hw_getdefantenna(struct ath_hw *ah)
Definition ath9k_hw.c:1868
static int ath9k_hw_chip_test(struct ath_hw *ah)
Definition ath9k_hw.c:282
int ath9k_hw_init(struct ath_hw *ah)
Definition ath9k_hw.c:571
void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1)
Definition ath9k_hw.c:1960
void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna)
Definition ath9k_hw.c:1873
u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio)
Definition ath9k_hw.c:1804
int ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout)
Definition ath9k_hw.c:95
void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits)
Definition ath9k_hw.c:1895
static void ath9k_hw_disablepcie(struct ath_hw *ah)
Definition ath9k_hw.c:263
static void ath9k_hw_init_pll(struct ath_hw *ah, struct ath9k_channel *chan)
Definition ath9k_hw.c:623
void ath9k_hw_set11nmac2040(struct ath_hw *ah)
Definition ath9k_hw.c:1975
void ath9k_hw_cfg_gpio_input(struct ath_hw *ah, u32 gpio)
Definition ath9k_hw.c:1785
static int ath9k_hw_set_reset(struct ath_hw *ah, int type)
Definition ath9k_hw.c:983
static void ath9k_hw_set_operating_mode(struct ath_hw *ah)
Definition ath9k_hw.c:956
u32 ath9k_hw_getrxfilter(struct ath_hw *ah)
Definition ath9k_hw.c:1882
static void ath9k_hw_init_config(struct ath_hw *ah)
Definition ath9k_hw.c:331
void ath9k_hw_name(struct ath_hw *ah, char *hw_name, size_t len)
Definition ath9k_hw.c:2047
const char * name
Definition ath9k_hw.c:1986
#define MS_REG_READ(x, y)
static void ath9k_hw_setslottime(struct ath_hw *ah, u32 us)
Definition ath9k_hw.c:779
static void ath9k_hw_init_defaults(struct ath_hw *ah)
Definition ath9k_hw.c:358
void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, int test)
Definition ath9k_hw.c:1939
static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah)
Definition ath9k_hw.c:727
static void ath9k_hw_read_revisions(struct ath_hw *ah)
Definition ath9k_hw.c:225
u16 ath9k_hw_computetxtime(struct ath_hw *ah, u8 phy, int kbps, u32 frameLen, u16 rateix, int shortPreamble)
Definition ath9k_hw.c:139
u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah)
Definition ath9k_hw.c:611
static void ath9k_hw_set_clockrate(struct ath_hw *ah)
Definition ath9k_hw.c:70
int ath9k_hw_fill_cap_info(struct ath_hw *ah)
Definition ath9k_hw.c:1571
static const char * ath9k_hw_rf_name(u16 rf_version)
Definition ath9k_hw.c:2034
static u32 ath9k_hw_mac_to_clks(struct ath_hw *ah, u32 usecs)
Definition ath9k_hw.c:88
void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val)
Definition ath9k_hw.c:1852
static int __ath9k_hw_init(struct ath_hw *ah)
Definition ath9k_hw.c:452
static void ath9k_hw_init_mode_gain_regs(struct ath_hw *ah)
Definition ath9k_hw.c:49
static void ath9k_hw_set_cts_timeout(struct ath_hw *ah, u32 us)
Definition ath9k_hw.c:793
static void ath9k_hw_set_ack_timeout(struct ath_hw *ah, u32 us)
Definition ath9k_hw.c:786
static void ath9k_hw_ani_cache_ini_regs(struct ath_hw *ah)
Definition ath9k_hw.c:57
int ath9k_hw_check_alive(struct ath_hw *ah)
Definition ath9k_hw.c:1191
static u32 ath9k_hw_compute_pll_control(struct ath_hw *ah, struct ath9k_channel *chan)
Definition ath9k_hw.c:43
static int ath9k_hw_post_init(struct ath_hw *ah)
Definition ath9k_hw.c:402
static void ath9k_hw_init_cal_settings(struct ath_hw *ah)
Definition ath9k_hw.c:33
void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah __unused, u32 coef_scaled, u32 *coef_mantissa, u32 *coef_exponent)
Definition ath9k_hw.c:966
static struct @330141124141124302040353137243321263024222316177 ath_mac_bb_names[]
static void ath9k_hw_attach_ops(struct ath_hw *ah)
Definition ath9k_hw.c:443
static int ath9k_hw_set_power_awake(struct ath_hw *ah, int setChip)
Definition ath9k_hw.c:1484
static struct @275024210143261150251224202276224162315300327331 ath_rf_names[]
void ath9k_hw_write_array(struct ath_hw *ah, struct ar5416IniArray *array, int column, unsigned int *writecnt)
Definition ath9k_hw.c:113
static void ath9k_hw_apply_gpio_override(struct ath_hw *ah)
Definition ath9k_hw.c:1177
static void ath9k_hw_init_mode_regs(struct ath_hw *ah)
Definition ath9k_hw.c:38
u32 ath9k_hw_numtxpending(struct ath_hw *ah, u32 q)
Definition ath9k_mac.c:64
int ath9k_hw_resettxqueue(struct ath_hw *ah, u32 q)
Definition ath9k_mac.c:285
#define OFDM_PLCP_BITS
Definition ath9k_xmit.c:28
@ ATH_USB
Definition ath.h:129
#define BIT(nr)
Definition ath.h:34
static u16 get_unaligned_le16(const void *p)
Definition ath.h:85
static u32 get_unaligned_le32(const void *p)
Definition ath.h:89
@ ATH_HW_INITIALIZED
Definition ath.h:123
void ath_hw_setbssidmask(struct ath_common *common)
ath_hw_set_bssid_mask - filter out bssids we listen
Definition ath_hw.c:122
#define min(x, y)
Definition ath.h:36
@ ATH_CRYPT_CAP_CIPHER_AESCCM
Definition ath.h:150
#define DIV_ROUND_UP(n, d)
Definition ath.h:31
u32 ath_regd_get_band_ctl(struct ath_regulatory *reg, int band)
Definition ath_regd.c:586
#define INI_RA(iniarray, row, column)
Definition calib.h:46
void timeout(int)
ring len
Length.
Definition dwmac.h:226
uint32_t addr
Buffer address.
Definition dwmac.h:9
uint32_t array
Array number.
Definition edd.h:1
#define ARRAY_SIZE(x)
Definition efx_common.h:43
uint32_t type
Operating system type.
Definition ena.h:1
uint8_t status
Status.
Definition ena.h:5
uint16_t mode
Acceleration mode.
Definition ena.h:15
static int test
Definition epic100.c:73
#define __unused
Declare a variable or data structure as unused.
Definition compiler.h:573
#define DBG2(...)
Definition compiler.h:515
#define DBG(...)
Print a debugging message.
Definition compiler.h:498
static unsigned int count
Number of entries.
Definition dwmac.h:220
#define NET80211_BAND_2GHZ
The 2.4 GHz ISM band, unlicensed in most countries.
Definition net80211.h:45
#define NET80211_BAND_5GHZ
The band from 4.9 GHz to 5.7 GHz, which tends to be more restricted.
Definition net80211.h:47
#define EINVAL
Invalid argument.
Definition errno.h:429
#define EOPNOTSUPP
Operation not supported on socket.
Definition errno.h:605
#define EADDRNOTAVAIL
Address not available.
Definition errno.h:309
#define EIO
Input/output error.
Definition errno.h:434
#define ENODEV
No such device.
Definition errno.h:510
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
static void ath9k_hw_restore_chainmask(struct ath_hw *ah)
Definition hw-ops.h:234
static int ath9k_hw_init_cal(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw-ops.h:259
static void ath9k_hw_spur_mitigate_freq(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw-ops.h:149
static int ath9k_hw_rfbus_req(struct ath_hw *ah)
Definition hw-ops.h:224
static int ath9k_hw_rf_alloc_ext_banks(struct ath_hw *ah)
Definition hw-ops.h:155
static void ath9k_hw_rf_free_ext_banks(struct ath_hw *ah)
Definition hw-ops.h:163
static int ath9k_hw_rf_set_freq(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw-ops.h:143
static void ath9k_hw_set_channel_regs(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw-ops.h:187
static void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore, int power_off)
Definition hw-ops.h:27
static int ath9k_hw_process_ini(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw-ops.h:193
static void ath9k_hw_rfbus_done(struct ath_hw *ah)
Definition hw-ops.h:229
static void ath9k_hw_set_delta_slope(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw-ops.h:218
static void ath9k_hw_mark_phy_inactive(struct ath_hw *ah)
Definition hw-ops.h:213
static void ath9k_hw_init_bb(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw-ops.h:181
static void ath9k_hw_set_rfmode(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw-ops.h:207
#define ATH9K_CLOCK_RATE_CCK
Definition hw.h:993
#define AR9287_DEVID_PCI
Definition hw.h:50
#define IS_CHAN_G(_c)
Definition hw.h:356
#define AR_GPIO_OUTPUT_MUX_AS_OUTPUT
Definition hw.h:123
@ ATH9K_HW_CAP_ANT_DIV_COMB
Definition hw.h:193
@ ATH9K_HW_CAP_RAC_SUPPORTED
Definition hw.h:188
@ ATH9K_HW_CAP_AUTOSLEEP
Definition hw.h:185
@ ATH9K_HW_CAP_FASTCLOCK
Definition hw.h:190
@ ATH9K_HW_CAP_APM
Definition hw.h:196
@ ATH9K_HW_CAP_RFSILENT
Definition hw.h:183
@ ATH9K_HW_CAP_5GHZ
Definition hw.h:195
@ ATH9K_HW_CAP_LDPC
Definition hw.h:189
@ ATH9K_HW_CAP_HT
Definition hw.h:182
@ ATH9K_HW_CAP_CST
Definition hw.h:184
@ ATH9K_HW_CAP_SGI_20
Definition hw.h:191
@ ATH9K_HW_CAP_2GHZ
Definition hw.h:194
@ ATH9K_HW_CAP_4KB_SPLITTRANS
Definition hw.h:186
@ ATH9K_HW_CAP_PAPRD
Definition hw.h:192
#define AR5416_DEVID_PCIE
Definition hw.h:44
#define AH_TIME_QUANTUM
Definition hw.h:148
#define REGWRITE_BUFFER_FLUSH(_ah)
Definition hw.h:96
#define HT40_CHANNEL_CENTER_SHIFT
Definition hw.h:137
#define ATH9K_CLOCK_FAST_RATE_5GHZ_OFDM
Definition hw.h:996
#define AR9285_DEVID_PCIE
Definition hw.h:48
#define AR9300_DEVID_PCIE
Definition hw.h:52
static struct ath_regulatory * ath9k_hw_regulatory(struct ath_hw *ah)
Definition hw.h:875
@ ATH9K_RESET_POWER_ON
Definition hw.h:429
@ ATH9K_RESET_WARM
Definition hw.h:430
@ ATH9K_RESET_COLD
Definition hw.h:431
#define REG_WRITE(_ah, _reg, _val)
Definition hw.h:78
@ ATH9K_TP_SCALE_MAX
Definition hw.h:387
#define IS_CHAN_QUARTER_RATE(_c)
Definition hw.h:364
#define MS(_v, _f)
Definition hw.h:103
#define ATH9K_CLOCK_RATE_2GHZ_OFDM
Definition hw.h:995
#define AR5416_MAGIC
Definition hw.h:60
#define REG_READ(_ah, _reg)
Definition hw.h:81
#define AR9300_DEVID_AR9340
Definition hw.h:53
static struct ath_hw_private_ops * ath9k_hw_private_ops(struct ath_hw *ah)
Definition hw.h:880
#define ATH_AMPDU_LIMIT_MAX
Definition hw.h:69
#define IS_CHAN_HT40(_c)
Definition hw.h:373
#define AH_WAIT_TIMEOUT
Definition hw.h:146
#define REG_RMW_FIELD(_a, _r, _f, _v)
Definition hw.h:104
#define MAX_RATE_POWER
Definition hw.h:145
#define IS_CHAN_OFDM(_c)
Definition hw.h:360
#define AR5416_AR9100_DEVID
Definition hw.h:56
#define INIT_RSSI_THR
Definition hw.h:159
#define ATH9K_HW_RX_HP_QDEPTH
Definition hw.h:164
#define AR9280_DEVID_PCI
Definition hw.h:46
#define ENABLE_REGWRITE_BUFFER(_ah)
Definition hw.h:90
#define AR2427_DEVID_PCIE
Definition hw.h:49
#define COEF_SCALE_S
Definition hw.h:136
#define AR_GPIO_BIT(_gpio)
Definition hw.h:132
#define AR9300_DEVID_AR9485_PCIE
Definition hw.h:54
#define AR_SUBVENDOR_ID_NEW_A
Definition hw.h:59
#define ATH9K_HW_RX_LP_QDEPTH
Definition hw.h:165
#define AR_NO_SPUR
Definition hw.h:241
#define POWER_UP_TIME
Definition hw.h:150
#define IS_CHAN_HALF_RATE(_c)
Definition hw.h:363
#define AR5416_DEVID_PCI
Definition hw.h:43
#define ATH9K_CLOCK_RATE_5GHZ_OFDM
Definition hw.h:994
ath9k_power_mode
Definition hw.h:379
@ ATH9K_PM_UNDEFINED
Definition hw.h:383
@ ATH9K_PM_FULL_SLEEP
Definition hw.h:381
@ ATH9K_PM_AWAKE
Definition hw.h:380
#define CHANNEL_G_HT40PLUS
Definition hw.h:320
static struct ath_common * ath9k_hw_common(struct ath_hw *ah)
Definition hw.h:870
@ SER_REG_MODE_OFF
Definition hw.h:395
@ SER_REG_MODE_AUTO
Definition hw.h:397
@ SER_REG_MODE_ON
Definition hw.h:396
#define REG_CLR_BIT(_a, _r, _f)
Definition hw.h:110
#define CHANNEL_A_HT40PLUS
Definition hw.h:322
#define RTC_PLL_SETTLE_DELAY
Definition hw.h:135
#define REG_SET_BIT(_a, _r, _f)
Definition hw.h:108
#define IS_CHAN_HT(_c)
Definition hw.h:377
#define AR9280_DEVID_PCIE
Definition hw.h:47
#define INIT_CONFIG_STATUS
Definition hw.h:158
#define AR9160_DEVID_PCI
Definition hw.h:45
#define AR9287_DEVID_PCIE
Definition hw.h:51
#define REG_RMW(_ah, _reg, _set, _clr)
Definition hw.h:87
#define DO_DELAY(x)
Definition hw.h:113
struct ib_cm_common common
Definition ib_mad.h:0
#define u8
Definition igbvf_osdep.h:40
iPXE I/O API
void __asmcall int val
Definition setjmp.h:12
void * memset(void *dest, int character, size_t len) __nonnull
uint16_t limit
Limit.
Definition librm.h:1
unsigned long tmp
Definition linux_pci.h:65
#define OFDM_SIFS_TIME_QUARTER
Definition mac.h:66
#define CCK_SIFS_TIME
Definition mac.h:52
#define CCK_PREAMBLE_BITS
Definition mac.h:53
#define OFDM_SYMBOL_TIME_HALF
Definition mac.h:64
#define MAX_TX_FIFO_THRESHOLD
Definition mac.h:109
@ ATH9K_RX_FILTER_PHYRADAR
Definition mac.h:648
@ ATH9K_RX_FILTER_PHYERR
Definition mac.h:642
#define OFDM_SIFS_TIME
Definition mac.h:56
#define ATH9K_NUM_TX_QUEUES
Definition mac.h:581
#define OFDM_PREAMBLE_TIME_HALF
Definition mac.h:62
#define OFDM_SYMBOL_TIME_QUARTER
Definition mac.h:69
#define OFDM_SIFS_TIME_HALF
Definition mac.h:61
#define OFDM_SYMBOL_TIME
Definition mac.h:59
#define CCK_PLCP_BITS
Definition mac.h:54
#define OFDM_PREAMBLE_TIME
Definition mac.h:57
#define OFDM_PREAMBLE_TIME_QUARTER
Definition mac.h:67
static const uint8_t r[3][4]
MD4 shift amounts.
Definition md4.c:54
static unsigned int unsigned int reg
Definition myson.h:162
uint32_t channel
RNDIS channel.
Definition netvsc.h:3
struct option_descriptor set[0]
Definition nvo_cmd.c:112
#define AR_PHY_PLL_MODE
Definition phy.h:52
#define AR_PHY_BASE
Definition phy.h:27
#define AR_PHY_CHIP_ID
Definition phy.h:46
#define AR_PHY_PLL_CONTROL
Definition phy.h:51
uint8_t ah
Definition registers.h:1
u16 channel
Definition hw.h:350
u32 chanmode
Definition hw.h:352
struct net80211_channel * chan
Definition hw.h:348
u32 channelFlags
Definition hw.h:335
int pcie_lcr_extsync_en
Definition hw.h:213
struct ath_regulatory regulatory
Definition ath.h:224
u8 rx_chainmask
Definition ath.h:212
u8 tx_chainmask
Definition ath.h:211
void(* init_mode_regs)(struct ath_hw *ah)
Definition hw.h:556
void(* init_cal_settings)(struct ath_hw *ah)
Definition hw.h:553
void(* init_mode_gain_regs)(struct ath_hw *ah)
Definition hw.h:557
u32(* compute_pll_control)(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw.h:583
void(* ani_cache_ini_regs)(struct ath_hw *ah)
Definition hw.h:592
Definition hw.h:657
u16 country_code
Definition ath.h:140
u32 tp_scale
Definition ath.h:142
int16_t power_limit
Definition ath.h:145
u16 current_rd_ext
Definition ath.h:144
u16 current_rd
Definition ath.h:143
u16 ext_center
Definition hw.h:425
u16 ctl_center
Definition hw.h:424
u16 synth_center
Definition hw.h:423
A GPIO pin.
Definition gpio.h:18
An 802.11 RF channel.
Definition net80211.h:386
u8 band
The band with which this channel is associated.
Definition net80211.h:388
Structure encapsulating the complete state of an 802.11 device.
Definition net80211.h:787
struct net80211_channel channels[NET80211_MAX_CHANNELS]
A list of all possible channels we might use.
Definition net80211.h:806
u8 channel
The channel currently in use, as an index into the channels array.
Definition net80211.h:812
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition timer.c:61
#define u16
Definition vga.h:20
#define u32
Definition vga.h:21
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Definition vsprintf.c:383
printf() and friends