iPXE
ath5k_reset.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2004-2008 Reyk Floeter <reyk@openbsd.org>
3  * Copyright (c) 2006-2008 Nick Kossifidis <mickflemm@gmail.com>
4  * Copyright (c) 2007-2008 Luis Rodriguez <mcgrof@winlab.rutgers.edu>
5  * Copyright (c) 2007-2008 Pavel Roskin <proski@gnu.org>
6  * Copyright (c) 2007-2008 Jiri Slaby <jirislaby@gmail.com>
7  *
8  * Lightly modified for iPXE, July 2009, by Joshua Oreman <oremanj@rwcr.net>.
9  *
10  * Permission to use, copy, modify, and distribute this software for any
11  * purpose with or without fee is hereby granted, provided that the above
12  * copyright notice and this permission notice appear in all copies.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21  *
22  */
23 
24 FILE_LICENCE ( MIT );
25 FILE_SECBOOT ( FORBIDDEN );
26 
27 #define _ATH5K_RESET
28 
29 /*****************************\
30  Reset functions and helpers
31 \*****************************/
32 
33 #include <ipxe/pci.h> /* To determine if a card is pci-e */
34 #include <unistd.h>
35 
36 #include "ath5k.h"
37 #include "reg.h"
38 #include "base.h"
39 
40 /* Find last set bit; fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32 */
41 static int fls(int x)
42 {
43  int r = 32;
44 
45  if (!x)
46  return 0;
47  if (!(x & 0xffff0000u)) {
48  x <<= 16;
49  r -= 16;
50  }
51  if (!(x & 0xff000000u)) {
52  x <<= 8;
53  r -= 8;
54  }
55  if (!(x & 0xf0000000u)) {
56  x <<= 4;
57  r -= 4;
58  }
59  if (!(x & 0xc0000000u)) {
60  x <<= 2;
61  r -= 2;
62  }
63  if (!(x & 0x80000000u)) {
64  x <<= 1;
65  r -= 1;
66  }
67  return r;
68 }
69 
70 
71 /**
72  * ath5k_hw_write_ofdm_timings - set OFDM timings on AR5212
73  *
74  * @ah: the &struct ath5k_hw
75  * @channel: the currently set channel upon reset
76  *
77  * Write the delta slope coefficient (used on pilot tracking ?) for OFDM
78  * operation on the AR5212 upon reset. This is a helper for ath5k_hw_reset().
79  *
80  * Since delta slope is floating point we split it on its exponent and
81  * mantissa and provide these values on hw.
82  *
83  * For more infos i think this patent is related
84  * http://www.freepatentsonline.com/7184495.html
85  */
87  struct net80211_channel *channel)
88 {
89  /* Get exponent and mantissa and set it */
90  u32 coef_scaled, coef_exp, coef_man,
91  ds_coef_exp, ds_coef_man, clock;
92 
93  if (!(ah->ah_version == AR5K_AR5212) ||
94  !(channel->hw_value & CHANNEL_OFDM)) {
95  DBG("ath5k: attempt to set OFDM timings on non-OFDM channel\n");
96  return -EFAULT;
97  }
98 
99  /* Get coefficient
100  * ALGO: coef = (5 * clock * carrier_freq) / 2)
101  * we scale coef by shifting clock value by 24 for
102  * better precision since we use integers */
103  /* TODO: Half/quarter rate */
104  clock = ath5k_hw_htoclock(1, channel->hw_value & CHANNEL_TURBO);
105 
106  coef_scaled = ((5 * (clock << 24)) / 2) / channel->center_freq;
107 
108  /* Get exponent
109  * ALGO: coef_exp = 14 - highest set bit position */
110  coef_exp = fls(coef_scaled) - 1;
111 
112  /* Doesn't make sense if it's zero*/
113  if (!coef_scaled || !coef_exp)
114  return -EINVAL;
115 
116  /* Note: we've shifted coef_scaled by 24 */
117  coef_exp = 14 - (coef_exp - 24);
118 
119 
120  /* Get mantissa (significant digits)
121  * ALGO: coef_mant = floor(coef_scaled* 2^coef_exp+0.5) */
122  coef_man = coef_scaled +
123  (1 << (24 - coef_exp - 1));
124 
125  /* Calculate delta slope coefficient exponent
126  * and mantissa (remove scaling) and set them on hw */
127  ds_coef_man = coef_man >> (24 - coef_exp);
128  ds_coef_exp = coef_exp - 16;
129 
131  AR5K_PHY_TIMING_3_DSC_MAN, ds_coef_man);
133  AR5K_PHY_TIMING_3_DSC_EXP, ds_coef_exp);
134 
135  return 0;
136 }
137 
138 /**
139  * ath5k_hw_write_rate_duration - fill rate code to duration table
140  *
141  * @ah: the &struct ath5k_hw
142  * @mode: one of enum ath5k_driver_mode
143  *
144  * Write the rate code to duration table upon hw reset. This is a helper for
145  * ath5k_hw_reset(). It seems all this is doing is setting an ACK timeout on
146  * the hardware, based on current mode, for each rate. The rates which are
147  * capable of short preamble (802.11b rates 2Mbps, 5.5Mbps, and 11Mbps) have
148  * different rate code so we write their value twice (one for long preample
149  * and one for short).
150  *
151  * Note: Band doesn't matter here, if we set the values for OFDM it works
152  * on both a and g modes. So all we have to do is set values for all g rates
153  * that include all OFDM and CCK rates. If we operate in turbo or xr/half/
154  * quarter rate mode, we need to use another set of bitrates (that's why we
155  * need the mode parameter) but we don't handle these proprietary modes yet.
156  */
157 static inline void ath5k_hw_write_rate_duration(struct ath5k_hw *ah,
158  unsigned int mode __unused)
159 {
160  struct ath5k_softc *sc = ah->ah_sc;
161  u16 rate;
162  int i;
163 
164  /* Write rate duration table */
165  for (i = 0; i < sc->hwinfo->nr_rates[NET80211_BAND_2GHZ]; i++) {
166  u32 reg;
167  u16 tx_time;
168 
169  rate = sc->hwinfo->rates[NET80211_BAND_2GHZ][i];
170 
171  /* Set ACK timeout */
173 
174  /* An ACK frame consists of 10 bytes. If you add the FCS,
175  * it's 14 bytes. Note we use the control rate and not the
176  * actual rate for this rate. See mac80211 tx.c
177  * ieee80211_duration() for a brief description of
178  * what rate we should choose to TX ACKs. */
179  tx_time = net80211_duration(sc->dev, 14, rate);
180 
181  ath5k_hw_reg_write(ah, tx_time, reg);
182 
183  if (rate != 20 && rate != 55 && rate != 110)
184  continue;
185 
186  /*
187  * We're not distinguishing short preamble here,
188  * This is true, all we'll get is a longer value here
189  * which is not necessarilly bad.
190  */
191  ath5k_hw_reg_write(ah, tx_time,
192  reg + (AR5K_SET_SHORT_PREAMBLE << 2));
193  }
194 }
195 
196 /*
197  * Reset chipset
198  */
199 static int ath5k_hw_nic_reset(struct ath5k_hw *ah, u32 val)
200 {
201  int ret;
202  u32 mask = val ? val : ~0U;
203 
204  /* Read-and-clear RX Descriptor Pointer*/
206 
207  /*
208  * Reset the device and wait until success
209  */
211 
212  /* Wait at least 128 PCI clocks */
213  udelay(15);
214 
215  if (ah->ah_version == AR5K_AR5210) {
220  } else {
223  }
224 
225  ret = ath5k_hw_register_timeout(ah, AR5K_RESET_CTL, mask, val, 0);
226 
227  /*
228  * Reset configuration register (for hw byte-swap). Note that this
229  * is only set for big endian. We do the necessary magic in
230  * AR5K_INIT_CFG.
231  */
232  if ((val & AR5K_RESET_CTL_PCU) == 0)
234 
235  return ret;
236 }
237 
238 /*
239  * Sleep control
240  */
242 {
243  unsigned int i;
244  u32 staid, data;
245 
247  staid &= ~AR5K_STA_ID1_PWR_SV;
248 
249  /* Preserve sleep duration */
251  if (data & 0xffc00000)
252  data = 0;
253  else
254  data = data & 0xfffcffff;
255 
257  udelay(15);
258 
259  for (i = 50; i > 0; i--) {
260  /* Check if the chip did wake up */
262  AR5K_PCICFG_SPWR_DN) == 0)
263  break;
264 
265  /* Wait a bit and retry */
266  udelay(200);
268  }
269 
270  /* Fail if the chip didn't wake up */
271  if (i <= 0)
272  return -EIO;
273 
275 
276  return 0;
277 }
278 
279 /*
280  * Bring up MAC + PHY Chips and program PLL
281  * TODO: Half/Quarter rate support
282  */
283 int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, int initial __unused)
284 {
285  struct pci_device *pdev = ah->ah_sc->pdev;
286  u32 turbo, mode, clock, bus_flags;
287  int ret;
288 
289  turbo = 0;
290  mode = 0;
291  clock = 0;
292 
293  /* Wakeup the device */
294  ret = ath5k_hw_wake(ah);
295  if (ret) {
296  DBG("ath5k: failed to wake up the MAC chip\n");
297  return ret;
298  }
299 
300  if (ah->ah_version != AR5K_AR5210) {
301  /*
302  * Get channel mode flags
303  */
304 
305  if (ah->ah_radio >= AR5K_RF5112) {
307  clock = AR5K_PHY_PLL_RF5112;
308  } else {
309  mode = AR5K_PHY_MODE_RAD_RF5111; /*Zero*/
310  clock = AR5K_PHY_PLL_RF5111; /*Zero*/
311  }
312 
313  if (flags & CHANNEL_2GHZ) {
315  clock |= AR5K_PHY_PLL_44MHZ;
316 
317  if (flags & CHANNEL_CCK) {
319  } else if (flags & CHANNEL_OFDM) {
320  /* XXX Dynamic OFDM/CCK is not supported by the
321  * AR5211 so we set MOD_OFDM for plain g (no
322  * CCK headers) operation. We need to test
323  * this, 5211 might support ofdm-only g after
324  * all, there are also initial register values
325  * in the code for g mode (see initvals.c). */
326  if (ah->ah_version == AR5K_AR5211)
328  else
330  } else {
331  DBG("ath5k: invalid radio modulation mode\n");
332  return -EINVAL;
333  }
334  } else if (flags & CHANNEL_5GHZ) {
336 
337  if (ah->ah_radio == AR5K_RF5413)
338  clock = AR5K_PHY_PLL_40MHZ_5413;
339  else
340  clock |= AR5K_PHY_PLL_40MHZ;
341 
342  if (flags & CHANNEL_OFDM)
344  else {
345  DBG("ath5k: invalid radio modulation mode\n");
346  return -EINVAL;
347  }
348  } else {
349  DBG("ath5k: invalid radio frequency mode\n");
350  return -EINVAL;
351  }
352 
353  if (flags & CHANNEL_TURBO)
355  } else { /* Reset the device */
356 
357  /* ...enable Atheros turbo mode if requested */
358  if (flags & CHANNEL_TURBO)
361  }
362 
363  /* reseting PCI on PCI-E cards results card to hang
364  * and always return 0xffff... so we ingore that flag
365  * for PCI-E cards */
367  bus_flags = 0;
368  else
369  bus_flags = AR5K_RESET_CTL_PCI;
370 
371  /* Reset chipset */
372  if (ah->ah_version == AR5K_AR5210) {
376  mdelay(2);
377  } else {
379  AR5K_RESET_CTL_BASEBAND | bus_flags);
380  }
381  if (ret) {
382  DBG("ath5k: failed to reset the MAC chip\n");
383  return -EIO;
384  }
385 
386  /* ...wakeup again!*/
387  ret = ath5k_hw_wake(ah);
388  if (ret) {
389  DBG("ath5k: failed to resume the MAC chip\n");
390  return ret;
391  }
392 
393  /* ...final warm reset */
394  if (ath5k_hw_nic_reset(ah, 0)) {
395  DBG("ath5k: failed to warm reset the MAC chip\n");
396  return -EIO;
397  }
398 
399  if (ah->ah_version != AR5K_AR5210) {
400 
401  /* ...update PLL if needed */
402  if (ath5k_hw_reg_read(ah, AR5K_PHY_PLL) != clock) {
404  udelay(300);
405  }
406 
407  /* ...set the PHY operating mode */
410  }
411 
412  return 0;
413 }
414 
416  struct net80211_channel *channel)
417 {
418  u8 refclk_freq;
419 
420  if ((ah->ah_radio == AR5K_RF5112) ||
421  (ah->ah_radio == AR5K_RF5413) ||
422  (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4)))
423  refclk_freq = 40;
424  else
425  refclk_freq = 32;
426 
427  if ((channel->center_freq % refclk_freq != 0) &&
428  ((channel->center_freq % refclk_freq < 10) ||
429  (channel->center_freq % refclk_freq > 22)))
430  return 1;
431  else
432  return 0;
433 }
434 
435 /* TODO: Half/Quarter rate */
437  struct net80211_channel *channel)
438 {
439  if (ah->ah_version == AR5K_AR5212 &&
440  ah->ah_phy_revision >= AR5K_SREV_PHY_5212A) {
441 
442  /* Setup ADC control */
444  (AR5K_REG_SM(2,
446  AR5K_REG_SM(2,
451 
452 
453 
454  /* Disable barker RSSI threshold */
457 
460 
461  /* Set the mute mask */
462  ath5k_hw_reg_write(ah, 0x0000000f, AR5K_SEQ_MASK);
463  }
464 
465  /* Clear PHY_BLUETOOTH to allow RX_CLEAR line debug */
466  if (ah->ah_phy_revision >= AR5K_SREV_PHY_5212B)
468 
469  /* Enable DCU double buffering */
470  if (ah->ah_phy_revision > AR5K_SREV_PHY_5212B)
473 
474  /* Set DAC/ADC delays */
475  if (ah->ah_version == AR5K_AR5212) {
476  u32 scal;
477  if (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))
479  else if (ath5k_eeprom_is_hb63(ah))
481  else
482  scal = AR5K_PHY_SCAL_32MHZ;
484  }
485 
486  /* Set fast ADC */
487  if ((ah->ah_radio == AR5K_RF5413) ||
488  (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) {
489  u32 fast_adc = 1;
490 
491  if (channel->center_freq == 2462 ||
492  channel->center_freq == 2467)
493  fast_adc = 0;
494 
495  /* Only update if needed */
496  if (ath5k_hw_reg_read(ah, AR5K_PHY_FAST_ADC) != fast_adc)
497  ath5k_hw_reg_write(ah, fast_adc,
499  }
500 
501  /* Fix for first revision of the RF5112 RF chipset */
502  if (ah->ah_radio == AR5K_RF5112 &&
503  ah->ah_radio_5ghz_revision <
505  u32 data;
508  if (channel->hw_value & CHANNEL_5GHZ)
509  data = 0xffb81020;
510  else
511  data = 0xffb80d20;
513  }
514 
515  if (ah->ah_mac_srev < AR5K_SREV_AR5211) {
516  u32 usec_reg;
517  /* 5311 has different tx/rx latency masks
518  * from 5211, since we deal 5311 the same
519  * as 5211 when setting initvals, shift
520  * values here to their proper locations */
521  usec_reg = ath5k_hw_reg_read(ah, AR5K_USEC_5211);
522  ath5k_hw_reg_write(ah, usec_reg & (AR5K_USEC_1 |
523  AR5K_USEC_32 |
525  AR5K_REG_SM(29,
528  /* Clear QCU/DCU clock gating register */
530  /* Set DAC/ADC delays */
532  /* Enable PCU FIFO corruption ECO */
535  }
536 }
537 
539  struct net80211_channel *channel, u8 *ant, u8 ee_mode)
540 {
541  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
542  s16 cck_ofdm_pwr_delta;
543 
544  /* Adjust power delta for channel 14 */
545  if (channel->center_freq == 2484)
546  cck_ofdm_pwr_delta =
548  ee->ee_scaled_cck_delta) * 2) / 10;
549  else
550  cck_ofdm_pwr_delta =
551  (ee->ee_cck_ofdm_power_delta * 2) / 10;
552 
553  /* Set CCK to OFDM power delta on tx power
554  * adjustment register */
555  if (ah->ah_phy_revision >= AR5K_SREV_PHY_5212A) {
556  if (channel->hw_value == CHANNEL_G)
560  AR5K_REG_SM((cck_ofdm_pwr_delta * -1),
563  else
565  } else {
566  /* For older revs we scale power on sw during tx power
567  * setup */
568  ah->ah_txpower.txp_cck_ofdm_pwr_delta = cck_ofdm_pwr_delta;
569  ah->ah_txpower.txp_cck_ofdm_gainf_delta =
571  }
572 
573  /* Set antenna idle switch table */
576  (ah->ah_antenna[ee_mode][0] |
578 
579  /* Set antenna switch table */
580  ath5k_hw_reg_write(ah, ah->ah_antenna[ee_mode][ant[0]],
582  ath5k_hw_reg_write(ah, ah->ah_antenna[ee_mode][ant[1]],
584 
585  /* Noise floor threshold */
587  AR5K_PHY_NF_SVAL(ee->ee_noise_floor_thr[ee_mode]),
589 
590  if ((channel->hw_value & CHANNEL_TURBO) &&
591  (ah->ah_ee_version >= AR5K_EEPROM_VERSION_5_0)) {
592  /* Switch settling time (Turbo) */
595  ee->ee_switch_settling_turbo[ee_mode]);
596 
597  /* Tx/Rx attenuation (Turbo) */
600  ee->ee_atn_tx_rx_turbo[ee_mode]);
601 
602  /* ADC/PGA desired size (Turbo) */
605  ee->ee_adc_desired_size_turbo[ee_mode]);
606 
609  ee->ee_pga_desired_size_turbo[ee_mode]);
610 
611  /* Tx/Rx margin (Turbo) */
614  ee->ee_margin_tx_rx_turbo[ee_mode]);
615 
616  } else {
617  /* Switch settling time */
620  ee->ee_switch_settling[ee_mode]);
621 
622  /* Tx/Rx attenuation */
625  ee->ee_atn_tx_rx[ee_mode]);
626 
627  /* ADC/PGA desired size */
630  ee->ee_adc_desired_size[ee_mode]);
631 
634  ee->ee_pga_desired_size[ee_mode]);
635 
636  /* Tx/Rx margin */
637  if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_1)
640  ee->ee_margin_tx_rx[ee_mode]);
641  }
642 
643  /* XPA delays */
645  (ee->ee_tx_end2xpa_disable[ee_mode] << 24) |
646  (ee->ee_tx_end2xpa_disable[ee_mode] << 16) |
647  (ee->ee_tx_frm2xpa_enable[ee_mode] << 8) |
648  (ee->ee_tx_frm2xpa_enable[ee_mode]), AR5K_PHY_RF_CTL4);
649 
650  /* XLNA delay */
653  ee->ee_tx_end2xlna_enable[ee_mode]);
654 
655  /* Thresh64 (ANI) */
658  ee->ee_thr_62[ee_mode]);
659 
660 
661  /* False detect backoff for channels
662  * that have spur noise. Write the new
663  * cyclic power RSSI threshold. */
668  ee->ee_false_detect[ee_mode]);
669  else
673 
674  /* I/Q correction
675  * TODO: Per channel i/q infos ? */
678  (ee->ee_i_cal[ee_mode] << AR5K_PHY_IQ_CORR_Q_I_COFF_S) |
679  ee->ee_q_cal[ee_mode]);
680 
681  /* Heavy clipping -disable for now */
682  if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_5_1)
684 
685  return;
686 }
687 
688 /*
689  * Main reset function
690  */
692  struct net80211_channel *channel, int change_channel)
693 {
694  u32 s_seq[10], s_ant, s_led[3], staid1_flags;
695  u32 phy_tst1;
696  u8 mode, freq, ee_mode, ant[2];
697  int i, ret;
698 
699  s_ant = 0;
700  ee_mode = 0;
701  staid1_flags = 0;
702  freq = 0;
703  mode = 0;
704 
705  /*
706  * Save some registers before a reset
707  */
708  /*DCU/Antenna selection not available on 5210*/
709  if (ah->ah_version != AR5K_AR5210) {
710 
711  switch (channel->hw_value & CHANNEL_MODES) {
712  case CHANNEL_A:
714  freq = AR5K_INI_RFGAIN_5GHZ;
715  ee_mode = AR5K_EEPROM_MODE_11A;
716  break;
717  case CHANNEL_G:
719  freq = AR5K_INI_RFGAIN_2GHZ;
720  ee_mode = AR5K_EEPROM_MODE_11G;
721  break;
722  case CHANNEL_B:
724  freq = AR5K_INI_RFGAIN_2GHZ;
725  ee_mode = AR5K_EEPROM_MODE_11B;
726  break;
727  case CHANNEL_T:
729  freq = AR5K_INI_RFGAIN_5GHZ;
730  ee_mode = AR5K_EEPROM_MODE_11A;
731  break;
732  case CHANNEL_TG:
733  if (ah->ah_version == AR5K_AR5211) {
734  DBG("ath5k: TurboG not available on 5211\n");
735  return -EINVAL;
736  }
738  freq = AR5K_INI_RFGAIN_2GHZ;
739  ee_mode = AR5K_EEPROM_MODE_11G;
740  break;
741  case CHANNEL_XR:
742  if (ah->ah_version == AR5K_AR5211) {
743  DBG("ath5k: XR mode not available on 5211\n");
744  return -EINVAL;
745  }
746  mode = AR5K_MODE_XR;
747  freq = AR5K_INI_RFGAIN_5GHZ;
748  ee_mode = AR5K_EEPROM_MODE_11A;
749  break;
750  default:
751  DBG("ath5k: invalid channel (%d MHz)\n",
752  channel->center_freq);
753  return -EINVAL;
754  }
755 
756  if (change_channel) {
757  /*
758  * Save frame sequence count
759  * For revs. after Oahu, only save
760  * seq num for DCU 0 (Global seq num)
761  */
762  if (ah->ah_mac_srev < AR5K_SREV_AR5211) {
763 
764  for (i = 0; i < 10; i++)
765  s_seq[i] = ath5k_hw_reg_read(ah,
767 
768  } else {
769  s_seq[0] = ath5k_hw_reg_read(ah,
771  }
772  }
773 
774  /* Save default antenna */
776 
777  if (ah->ah_version == AR5K_AR5212) {
778  /* Since we are going to write rf buffer
779  * check if we have any pending gain_F
780  * optimization settings */
781  if (change_channel && ah->ah_rf_banks != NULL)
783  }
784  }
785 
786  /*GPIOs*/
787  s_led[0] = ath5k_hw_reg_read(ah, AR5K_PCICFG) &
789  s_led[1] = ath5k_hw_reg_read(ah, AR5K_GPIOCR);
790  s_led[2] = ath5k_hw_reg_read(ah, AR5K_GPIODO);
791 
792  /* AR5K_STA_ID1 flags, only preserve antenna
793  * settings and ack/cts rate mode */
794  staid1_flags = ath5k_hw_reg_read(ah, AR5K_STA_ID1) &
801 
802  /* Wakeup the device */
803  ret = ath5k_hw_nic_wakeup(ah, channel->hw_value, 0);
804  if (ret)
805  return ret;
806 
807  /* PHY access enable */
808  if (ah->ah_mac_srev >= AR5K_SREV_AR5211)
810  else
812  AR5K_PHY(0));
813 
814  /* Write initial settings */
815  ret = ath5k_hw_write_initvals(ah, mode, change_channel);
816  if (ret)
817  return ret;
818 
819  /*
820  * 5211/5212 Specific
821  */
822  if (ah->ah_version != AR5K_AR5210) {
823 
824  /*
825  * Write initial RF gain settings
826  * This should work for both 5111/5112
827  */
828  ret = ath5k_hw_rfgain_init(ah, freq);
829  if (ret)
830  return ret;
831 
832  mdelay(1);
833 
834  /*
835  * Tweak initval settings for revised
836  * chipsets and add some more config
837  * bits
838  */
840 
841  /*
842  * Set TX power (FIXME)
843  */
844  ret = ath5k_hw_txpower(ah, channel, ee_mode,
846  if (ret)
847  return ret;
848 
849  /* Write rate duration table only on AR5212 */
850  if (ah->ah_version == AR5K_AR5212)
852 
853  /*
854  * Write RF buffer
855  */
857  if (ret)
858  return ret;
859 
860 
861  /* Write OFDM timings on 5212*/
862  if (ah->ah_version == AR5K_AR5212 &&
863  channel->hw_value & CHANNEL_OFDM) {
865  if (ret)
866  return ret;
867  }
868 
869  /*Enable/disable 802.11b mode on 5111
870  (enable 2111 frequency converter + CCK)*/
871  if (ah->ah_radio == AR5K_RF5111) {
872  if (mode == AR5K_MODE_11B)
875  else
878  }
879 
880  /*
881  * In case a fixed antenna was set as default
882  * write the same settings on both AR5K_PHY_ANT_SWITCH_TABLE
883  * registers.
884  */
885  if (s_ant != 0) {
886  if (s_ant == AR5K_ANT_FIXED_A) /* 1 - Main */
887  ant[0] = ant[1] = AR5K_ANT_FIXED_A;
888  else /* 2 - Aux */
889  ant[0] = ant[1] = AR5K_ANT_FIXED_B;
890  } else {
891  ant[0] = AR5K_ANT_FIXED_A;
892  ant[1] = AR5K_ANT_FIXED_B;
893  }
894 
895  /* Commit values from EEPROM */
897 
898  } else {
899  /*
900  * For 5210 we do all initialization using
901  * initvals, so we don't have to modify
902  * any settings (5210 also only supports
903  * a/aturbo modes)
904  */
905  mdelay(1);
906  /* Disable phy and wait */
908  mdelay(1);
909  }
910 
911  /*
912  * Restore saved values
913  */
914 
915  /*DCU/Antenna selection not available on 5210*/
916  if (ah->ah_version != AR5K_AR5210) {
917 
918  if (change_channel) {
919  if (ah->ah_mac_srev < AR5K_SREV_AR5211) {
920  for (i = 0; i < 10; i++)
921  ath5k_hw_reg_write(ah, s_seq[i],
923  } else {
924  ath5k_hw_reg_write(ah, s_seq[0],
926  }
927  }
928 
930  }
931 
932  /* Ledstate */
933  AR5K_REG_ENABLE_BITS(ah, AR5K_PCICFG, s_led[0]);
934 
935  /* Gpio settings */
936  ath5k_hw_reg_write(ah, s_led[1], AR5K_GPIOCR);
937  ath5k_hw_reg_write(ah, s_led[2], AR5K_GPIODO);
938 
939  /* Restore sta_id flags and preserve our mac address*/
940  ath5k_hw_reg_write(ah, AR5K_LOW_ID(ah->ah_sta_id),
941  AR5K_STA_ID0);
942  ath5k_hw_reg_write(ah, staid1_flags | AR5K_HIGH_ID(ah->ah_sta_id),
943  AR5K_STA_ID1);
944 
945 
946  /*
947  * Configure PCU
948  */
949 
950  /* Restore bssid and bssid mask */
951  /* XXX: add ah->aid once mac80211 gives this to us */
952  ath5k_hw_set_associd(ah, ah->ah_bssid, 0);
953 
954  /* Set PCU config */
956 
957  /* Clear any pending interrupts
958  * PISR/SISR Not available on 5210 */
959  if (ah->ah_version != AR5K_AR5210)
960  ath5k_hw_reg_write(ah, 0xffffffff, AR5K_PISR);
961 
962  /* Set RSSI/BRSSI thresholds
963  *
964  * Note: If we decide to set this value
965  * dynamicaly, have in mind that when AR5K_RSSI_THR
966  * register is read it might return 0x40 if we haven't
967  * wrote anything to it plus BMISS RSSI threshold is zeroed.
968  * So doing a save/restore procedure here isn't the right
969  * choice. Instead store it on ath5k_hw */
973  AR5K_RSSI_THR);
974 
975  /* MIC QoS support */
976  if (ah->ah_mac_srev >= AR5K_SREV_AR2413) {
977  ath5k_hw_reg_write(ah, 0x000100aa, AR5K_MIC_QOS_CTL);
978  ath5k_hw_reg_write(ah, 0x00003210, AR5K_MIC_QOS_SEL);
979  }
980 
981  /* QoS NOACK Policy */
982  if (ah->ah_version == AR5K_AR5212) {
988  }
989 
990 
991  /*
992  * Configure PHY
993  */
994 
995  /* Set channel on PHY */
996  ret = ath5k_hw_channel(ah, channel);
997  if (ret)
998  return ret;
999 
1000  /*
1001  * Enable the PHY and wait until completion
1002  * This includes BaseBand and Synthesizer
1003  * activation.
1004  */
1006 
1007  /*
1008  * On 5211+ read activation -> rx delay
1009  * and use it.
1010  *
1011  * TODO: Half/quarter rate support
1012  */
1013  if (ah->ah_version != AR5K_AR5210) {
1014  u32 delay;
1017  delay = (channel->hw_value & CHANNEL_CCK) ?
1018  ((delay << 2) / 22) : (delay / 10);
1019 
1020  udelay(100 + (2 * delay));
1021  } else {
1022  mdelay(1);
1023  }
1024 
1025  /*
1026  * Perform ADC test to see if baseband is ready
1027  * Set tx hold and check adc test register
1028  */
1029  phy_tst1 = ath5k_hw_reg_read(ah, AR5K_PHY_TST1);
1031  for (i = 0; i <= 20; i++) {
1032  if (!(ath5k_hw_reg_read(ah, AR5K_PHY_ADC_TEST) & 0x10))
1033  break;
1034  udelay(200);
1035  }
1036  ath5k_hw_reg_write(ah, phy_tst1, AR5K_PHY_TST1);
1037 
1038  /*
1039  * Start automatic gain control calibration
1040  *
1041  * During AGC calibration RX path is re-routed to
1042  * a power detector so we don't receive anything.
1043  *
1044  * This method is used to calibrate some static offsets
1045  * used together with on-the fly I/Q calibration (the
1046  * one performed via ath5k_hw_phy_calibrate), that doesn't
1047  * interrupt rx path.
1048  *
1049  * While rx path is re-routed to the power detector we also
1050  * start a noise floor calibration, to measure the
1051  * card's noise floor (the noise we measure when we are not
1052  * transmiting or receiving anything).
1053  *
1054  * If we are in a noisy environment AGC calibration may time
1055  * out and/or noise floor calibration might timeout.
1056  */
1059 
1060  /* At the same time start I/Q calibration for QAM constellation
1061  * -no need for CCK- */
1062  ah->ah_calibration = 0;
1063  if (!(mode == AR5K_MODE_11B)) {
1064  ah->ah_calibration = 1;
1068  AR5K_PHY_IQ_RUN);
1069  }
1070 
1071  /* Wait for gain calibration to finish (we check for I/Q calibration
1072  * during ath5k_phy_calibrate) */
1073  if (ath5k_hw_register_timeout(ah, AR5K_PHY_AGCCTL,
1074  AR5K_PHY_AGCCTL_CAL, 0, 0)) {
1075  DBG("ath5k: gain calibration timeout (%d MHz)\n",
1076  channel->center_freq);
1077  }
1078 
1079  /*
1080  * If we run NF calibration before AGC, it always times out.
1081  * Binary HAL starts NF and AGC calibration at the same time
1082  * and only waits for AGC to finish. Also if AGC or NF cal.
1083  * times out, reset doesn't fail on binary HAL. I believe
1084  * that's wrong because since rx path is routed to a detector,
1085  * if cal. doesn't finish we won't have RX. Sam's HAL for AR5210/5211
1086  * enables noise floor calibration after offset calibration and if noise
1087  * floor calibration fails, reset fails. I believe that's
1088  * a better approach, we just need to find a polling interval
1089  * that suits best, even if reset continues we need to make
1090  * sure that rx path is ready.
1091  */
1093 
1094 
1095  /*
1096  * Configure QCUs/DCUs
1097  */
1098 
1099  /* TODO: HW Compression support for data queues */
1100  /* TODO: Burst prefetch for data queues */
1101 
1102  /*
1103  * Reset queues and start beacon timers at the end of the reset routine
1104  * This also sets QCU mask on each DCU for 1:1 qcu to dcu mapping
1105  * Note: If we want we can assign multiple qcus on one dcu.
1106  */
1107  ret = ath5k_hw_reset_tx_queue(ah);
1108  if (ret) {
1109  DBG("ath5k: failed to reset TX queue\n");
1110  return ret;
1111  }
1112 
1113  /*
1114  * Configure DMA/Interrupts
1115  */
1116 
1117  /*
1118  * Set Rx/Tx DMA Configuration
1119  *
1120  * Set standard DMA size (128). Note that
1121  * a DMA size of 512 causes rx overruns and tx errors
1122  * on pci-e cards (tested on 5424 but since rx overruns
1123  * also occur on 5416/5418 with madwifi we set 128
1124  * for all PCI-E cards to be safe).
1125  *
1126  * XXX: need to check 5210 for this
1127  * TODO: Check out tx triger level, it's always 64 on dumps but I
1128  * guess we can tweak it and see how it goes ;-)
1129  */
1130  if (ah->ah_version != AR5K_AR5210) {
1135  }
1136 
1137  /* Pre-enable interrupts on 5211/5212*/
1138  if (ah->ah_version != AR5K_AR5210)
1139  ath5k_hw_set_imr(ah, ah->ah_imr);
1140 
1141  /*
1142  * Setup RFKill interrupt if rfkill flag is set on eeprom.
1143  * TODO: Use gpio pin and polarity infos from eeprom
1144  * TODO: Handle this in ath5k_intr because it'll result
1145  * a nasty interrupt storm.
1146  */
1147 #if 0
1148  if (AR5K_EEPROM_HDR_RFKILL(ah->ah_capabilities.cap_eeprom.ee_header)) {
1150  ah->ah_gpio[0] = ath5k_hw_get_gpio(ah, 0);
1151  if (ah->ah_gpio[0] == 0)
1152  ath5k_hw_set_gpio_intr(ah, 0, 1);
1153  else
1154  ath5k_hw_set_gpio_intr(ah, 0, 0);
1155  }
1156 #endif
1157 
1158  /*
1159  * Disable beacons and reset the register
1160  */
1163 
1164  return 0;
1165 }
1166 
1167 #undef _ATH5K_RESET
#define AR5K_PHY_SHIFT_5GHZ
Definition: reg.h:1886
#define AR5K_PHY_ADC_CTL_INBUFGAIN_OFF
Definition: reg.h:1950
#define AR5K_QOS_NOACK_BYTE_OFFSET
Definition: reg.h:1709
uint16_t u16
Definition: stdint.h:22
#define AR5K_TXCFG_SDMAMR
Definition: reg.h:172
#define AR5K_PHY_RX_DELAY_M
Definition: reg.h:2181
#define AR5K_PHY_SETTLING
Definition: reg.h:1977
#define EINVAL
Invalid argument.
Definition: errno.h:429
#define AR5K_PHY_MODE_RAD_RF5112
Definition: reg.h:2515
#define AR5K_TUNE_RSSI_THRES
Definition: ath5k.h:174
#define AR5K_PHY_FRAME_CTL
Definition: reg.h:2275
#define AR5K_RATE_DUR(_n)
Definition: reg.h:1794
int16_t s16
Definition: stdint.h:21
#define AR5K_PHY_TIMING_3
Definition: reg.h:1920
#define AR5K_PHY_TX_PWR_ADJ
Definition: reg.h:2300
static unsigned int unsigned int reg
Definition: myson.h:162
#define AR5K_MIC_QOS_CTL
Definition: reg.h:1734
#define AR5K_TXCFG_DCU_DBL_BUF_DIS
Definition: reg.h:192
#define AR5K_EEPROM_VERSION_5_1
Definition: eeprom.h:61
#define AR5K_EEPROM_MODE_11G
Definition: eeprom.h:66
void __asmcall int val
Definition: setjmp.h:12
u16 ee_thr_62[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:409
int pci_find_capability(struct pci_device *pci, int cap)
Look for a PCI capability.
Definition: pciextra.c:39
#define AR5K_INIT_CFG
Definition: ath5k.h:207
s8 ee_adc_desired_size_turbo[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:447
#define AR5K_PHY_TST1_TXHOLD
Definition: reg.h:1910
#define AR5K_EEPROM_MODE_11A
Definition: eeprom.h:64
#define AR5K_BEACON_ENABLE
Definition: reg.h:1250
#define AR5K_PHY_IQ_CORR_ENABLE
Definition: reg.h:2196
#define AR5K_BEACON_RESET_TSF
Definition: reg.h:1251
#define AR5K_BEACON
Definition: reg.h:1244
#define AR5K_PHY_PLL_40MHZ
Definition: reg.h:2105
FILE_LICENCE(MIT)
uint16_t mode
Acceleration mode.
Definition: ena.h:26
int ath5k_hw_wake(struct ath5k_hw *ah)
Definition: ath5k_reset.c:241
#define AR5K_INI_RFGAIN_5GHZ
Definition: ath5k.h:141
#define AR5K_PHY_PLL_44MHZ
Definition: reg.h:2110
#define AR5K_PHY_TIMING_3_DSC_MAN
Definition: reg.h:1921
u16 ee_false_detect[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:420
#define AR5K_INIT_CYCRSSI_THR1
Definition: ath5k.h:211
int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, int initial __unused)
Definition: ath5k_reset.c:283
#define AR5K_PCICFG_LEDSTATE
Definition: reg.h:911
#define AR5K_SEQ_MASK
Definition: reg.h:1489
static unsigned int x
Definition: pixbuf.h:63
#define AR5K_PHY_DESIRED_SIZE_ADC
Definition: reg.h:2000
#define AR5K_PHY_AGCCTL_CAL
Definition: reg.h:2031
#define AR5K_GPIODO
Definition: reg.h:948
#define AR5K_SREV_PHY_5212B
Definition: ath5k.h:330
u16 net80211_duration(struct net80211_device *dev, int bytes, u16 rate)
Calculate one frame's contribution to 802.11 duration field.
Definition: net80211.c:442
#define AR5K_PCICFG
Definition: reg.h:882
#define AR5K_PHY_RF_CTL4
Definition: reg.h:1958
#define AR5K_PHY_BLUETOOTH
Definition: reg.h:2559
#define AR5K_PHY_IQ
Definition: reg.h:2192
#define AR5K_TXCFG
Definition: reg.h:171
void ath5k_hw_set_gpio_intr(struct ath5k_hw *ah, unsigned int gpio, u32 interrupt_level)
Definition: ath5k_gpio.c:99
int ath5k_hw_rfgain_init(struct ath5k_hw *ah, unsigned int freq)
Definition: ath5k_phy.c:453
#define AR5K_SREV_AR2417
Definition: ath5k.h:307
#define AR5K_PHY_MODE_MOD_DYN
Definition: reg.h:2512
s16 ee_noise_floor_thr[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:444
#define AR5K_PHY_GAIN
Definition: reg.h:1986
int ath5k_eeprom_is_hb63(struct ath5k_hw *ah)
#define AR5K_STA_ID0
Definition: reg.h:1124
int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah)
Definition: ath5k_qcu.c:98
void ath5k_hw_set_associd(struct ath5k_hw *ah, const u8 *bssid, u16 assoc_id)
ath5k_hw_set_associd - Set BSSID for association
Definition: ath5k_pcu.c:229
#define CHANNEL_A
Definition: ath5k.h:640
u16 ee_tx_end2xlna_enable[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:406
int ath5k_hw_reset(struct ath5k_hw *ah, struct net80211_channel *channel, int change_channel)
Definition: ath5k_reset.c:691
#define AR5K_PHY_SCAL
Definition: reg.h:2091
#define AR5K_PHY_NF_SVAL(_n)
Definition: reg.h:2044
ath5k_hw_get_isr - Get interrupt status
Definition: ath5k.h:955
#define AR5K_USEC_RX_LATENCY_5210
Definition: reg.h:1236
#define AR5K_PHY_PLL
Definition: reg.h:2099
#define AR5K_PHY_NFTHRES
Definition: reg.h:2347
#define AR5K_QOS_NOACK_BIT_OFFSET
Definition: reg.h:1707
#define AR5K_LOW_ID(_a)
Definition: ath5k.h:154
#define CHANNEL_CCK
Definition: ath5k.h:632
#define NET80211_BAND_2GHZ
The 2.4 GHz ISM band, unlicensed in most countries.
Definition: net80211.h:45
#define AR5K_TUNE_DEFAULT_TXPOWER
Definition: ath5k.h:194
#define AR5K_PHY_SCAL_32MHZ_HB63
Definition: reg.h:2094
#define AR5K_RESET_CTL_PCI
Definition: reg.h:848
#define AR5K_USEC_1
Definition: reg.h:1226
u16 rates[NET80211_NR_BANDS][NET80211_MAX_RATES]
List of transmission rates supported by the card, indexed by band.
Definition: net80211.h:508
int ath5k_hw_noise_floor_calibration(struct ath5k_hw *ah, short freq)
ath5k_hw_noise_floor_calibration - perform PHY noise floor calibration
Definition: ath5k_phy.c:1128
#define AR5K_PHY_PLL_RF5112
Definition: reg.h:2114
#define AR5K_PHY_ANT_CTL_TXRX_EN
Definition: reg.h:2171
int ath5k_hw_rfregs_init(struct ath5k_hw *ah, struct net80211_channel *channel, unsigned int mode)
Definition: ath5k_phy.c:515
s8 ee_adc_desired_size[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:445
#define AR5K_STA_ID1_BASE_RATE_11B
Definition: reg.h:1145
#define AR5K_HIGH_ID(_a)
Definition: ath5k.h:158
#define AR5K_PHY_AGCCTL
Definition: reg.h:2030
#define CHANNEL_G
Definition: ath5k.h:642
#define AR5K_PHY_ADC_CTL
Definition: reg.h:1949
#define AR5K_REG_WRITE_BITS(ah, _reg, _flags, _val)
Definition: ath5k.h:98
#define AR5K_PHY_ANT_SWITCH_TABLE_1
Definition: reg.h:2342
static unsigned int ath5k_hw_htoclock(unsigned int usec, int turbo)
Definition: ath5k.h:1199
#define __unused
Declare a variable or data structure as unused.
Definition: compiler.h:573
#define AR5K_STA_ID1
Definition: reg.h:1130
#define AR5K_STA_ID1_SELFGEN_DEF_ANT
Definition: reg.h:1146
#define AR5K_RESET_CTL_MAC
Definition: reg.h:846
int nr_rates[NET80211_NR_BANDS]
Number of supported rates, indexed by band.
Definition: net80211.h:511
#define AR5K_GPIOCR
Definition: reg.h:935
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:61
#define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1
Definition: reg.h:2214
#define AR5K_RESET_CTL
Definition: reg.h:842
#define CHANNEL_XR
Definition: ath5k.h:638
#define AR5K_PHY_GAIN_2GHZ_MARGIN_TXRX
Definition: reg.h:2544
#define AR5K_PISR
Definition: reg.h:288
#define AR5K_PHY_TURBO_MODE
Definition: reg.h:1899
int ath5k_hw_channel(struct ath5k_hw *ah, struct net80211_channel *channel)
Definition: ath5k_phy.c:1049
#define AR5K_MIC_QOS_SEL
Definition: reg.h:1741
#define AR5K_USEC_32
Definition: reg.h:1228
static void ath5k_hw_tweak_initval_settings(struct ath5k_hw *ah, struct net80211_channel *channel)
Definition: ath5k_reset.c:436
uint32_t channel
RNDIS channel.
Definition: netvsc.h:14
#define AR5K_PHY_SCAL_32MHZ
Definition: reg.h:2092
#define EFAULT
Bad address.
Definition: errno.h:394
#define AR5K_PHY_TURBO
Definition: reg.h:1898
static int ath5k_hw_nic_reset(struct ath5k_hw *ah, u32 val)
Definition: ath5k_reset.c:199
#define AR5K_PHY_NF
Definition: reg.h:2039
#define AR5K_QOS_NOACK_2BIT_VALUES
Definition: reg.h:1705
int ath5k_hw_set_gpio_input(struct ath5k_hw *ah, u32 gpio)
Definition: ath5k_gpio.c:35
#define AR5K_STA_ID1_PWR_SV
Definition: reg.h:1134
#define AR5K_RESET_CTL_PCU
Definition: reg.h:843
#define AR5K_EEPROM_VERSION_5_0
Definition: eeprom.h:60
#define AR5K_PHY_MODE_MOD_CCK
Definition: reg.h:2508
#define AR5K_STA_ID1_RTS_DEF_ANTENNA
Definition: reg.h:1143
uint8_t flags
Flags.
Definition: ena.h:18
#define AR5K_PHY_MODE_FREQ_5GHZ
Definition: reg.h:2510
static int ath5k_hw_chan_has_spur_noise(struct ath5k_hw *ah, struct net80211_channel *channel)
Definition: ath5k_reset.c:415
u16 ee_tx_end2xpa_disable[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:407
#define AR5K_PHY_MODE
Definition: reg.h:2505
#define AR5K_PHY_ANT_CTL
Definition: reg.h:2170
#define AR5K_RSSI_THR_BMISS_S
Definition: reg.h:1192
#define AR5K_QUEUE_DCU_SEQNUM(_q)
Definition: reg.h:759
PCI bus.
A PCI device.
Definition: pci.h:211
#define AR5K_PHY_FAST_ADC
Definition: reg.h:2557
u16 ee_margin_tx_rx_turbo[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:416
#define AR5K_SREV_AR2413
Definition: ath5k.h:298
#define AR5K_SET_SHORT_PREAMBLE
Definition: ath5k.h:728
#define AR5K_EEPROM_VERSION_4_1
Definition: eeprom.h:52
An 802.11 RF channel.
Definition: net80211.h:385
u16 ee_scaled_cck_delta
Definition: eeprom.h:393
#define AR5K_PHY_MODE_RAD_RF5111
Definition: reg.h:2514
#define CHANNEL_TURBO
Definition: ath5k.h:631
#define AR5K_PHY_MODE_MOD_OFDM
Definition: reg.h:2507
#define AR5K_DEFAULT_ANTENNA
Definition: reg.h:1478
#define AR5K_PHY_HEAVY_CLIP_ENABLE
Definition: reg.h:2477
#define AR5K_EEPROM_MODE_11B
Definition: eeprom.h:65
enum ath5k_int ath5k_hw_set_imr(struct ath5k_hw *ah, enum ath5k_int new_mask)
ath5k_hw_set_imr - Set interrupt mask
Definition: ath5k_dma.c:549
#define CHANNEL_OFDM
Definition: ath5k.h:633
#define AR5K_PHY_DAG_CCK_CTL_EN_RSSI_THR
Definition: reg.h:2553
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define AR5K_QOS_NOACK
Definition: reg.h:1704
#define AR5K_DIAG_SW_ECO_ENABLE
Definition: reg.h:1422
#define AR5K_PHY_SETTLING_SWITCH
Definition: reg.h:1980
#define AR5K_USEC_TX_LATENCY_5211
Definition: reg.h:1230
u16 ee_i_cal[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:396
#define AR5K_PHY_ADC_TEST
Definition: reg.h:2436
#define AR5K_SLEEP_CTL
Definition: reg.h:853
#define AR5K_PHY_ACT_DISABLE
Definition: reg.h:1936
u16 ee_tx_frm2xpa_enable[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:408
#define PCI_CAP_ID_EXP
PCI Express.
Definition: pci.h:98
#define AR5K_QCUDCU_CLKGT
Definition: reg.h:275
#define AR5K_TXCFG_B_MODE
Definition: reg.h:174
#define AR5K_RSSI_THR
Definition: reg.h:1184
#define AR5K_PHY_TURBO_SHORT
Definition: reg.h:1900
s8 ee_pga_desired_size[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:446
#define AR5K_EEPROM_HDR_RFKILL(_v)
Definition: eeprom.h:75
#define AR5K_PHY_ADC_CTL_PWD_ADC_OFF
Definition: reg.h:1954
#define AR5K_TUNE_BMISS_THRES
Definition: ath5k.h:180
#define AR5K_PHY_TST1
Definition: reg.h:1908
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
Definition: timer.c:79
#define AR5K_REG_DISABLE_BITS(ah, _reg, _flags)
Definition: ath5k.h:109
#define AR5K_PHY_DESIRED_SIZE_PGA
Definition: reg.h:2002
u16 ee_switch_settling_turbo[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:415
#define CHANNEL_T
Definition: ath5k.h:643
struct net80211_hw_info * hwinfo
Definition: base.h:94
FILE_SECBOOT(FORBIDDEN)
#define AR5K_PHY_ANT_CTL_SWTABLE_IDLE
Definition: reg.h:2174
#define AR5K_PHY_IQ_CAL_NUM_LOG_MAX
Definition: reg.h:2197
int ath5k_hw_set_opmode(struct ath5k_hw *ah)
ath5k_hw_set_opmode - Set PCU operating mode
Definition: ath5k_pcu.c:49
#define AR5K_DIAG_SW_5211
Definition: reg.h:1393
#define AR5K_SREV_RAD_5112A
Definition: ath5k.h:314
#define AR5K_PHY_IQ_CORR_Q_I_COFF_S
Definition: reg.h:2195
#define AR5K_PHY(_n)
Definition: reg.h:1863
#define AR5K_PHY_TIMING_3_DSC_EXP
Definition: reg.h:1923
#define AR5K_STA_ID1_DESC_ANTENNA
Definition: reg.h:1142
#define AR5K_INI_RFGAIN_2GHZ
Definition: ath5k.h:142
uint16_t delay
Forward delay.
Definition: stp.h:41
#define AR5K_RXDP
Definition: reg.h:67
#define AR5K_PHY_PLL_RF5111
Definition: reg.h:2113
#define CHANNEL_5GHZ
Definition: ath5k.h:635
u16 ee_margin_tx_rx[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:414
u16 ee_cck_ofdm_power_delta
Definition: eeprom.h:392
#define EIO
Input/output error.
Definition: errno.h:434
#define AR5K_PHY_PLL_40MHZ_5413
Definition: reg.h:2104
int ath5k_bitrate_to_hw_rix(int bitrate)
Definition: ath5k.c:719
#define AR5K_STA_ID1_DEFAULT_ANTENNA
Definition: reg.h:1141
u16 ee_atn_tx_rx[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:402
u16 ee_atn_tx_rx_turbo[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:417
uint8_t data[48]
Additional event data.
Definition: ena.h:22
#define AR5K_PHY_RF_CTL3_TXE2XLNA_ON
Definition: reg.h:1946
static int ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah, struct net80211_channel *channel)
ath5k_hw_write_ofdm_timings - set OFDM timings on AR5212
Definition: ath5k_reset.c:86
#define AR5K_PHY_NF_THRESH62
Definition: reg.h:2045
#define AR5K_PHY_ANT_SWITCH_TABLE_0
Definition: reg.h:2341
#define AR5K_PHY_TX_PWR_ADJ_CCK_GAIN_DELTA
Definition: reg.h:2301
enum ath5k_rfgain ath5k_hw_gainf_calibrate(struct ath5k_hw *ah)
Definition: ath5k_phy.c:390
#define AR5K_PHY_ADC_CTL_INBUFGAIN_ON
Definition: reg.h:1955
#define AR5K_PHY_SCAL_32MHZ_2417
Definition: reg.h:2093
#define AR5K_PCICFG_SPWR_DN
Definition: reg.h:902
#define AR5K_PHY_TX_PWR_ADJ_CCK_PCDAC_INDEX
Definition: reg.h:2303
#define CHANNEL_MODES
Definition: ath5k.h:653
#define AR5K_PHY_GAIN_2GHZ
Definition: reg.h:2543
uint8_t ah
Definition: registers.h:85
struct net80211_device * dev
Definition: base.h:92
#define AR5K_PHY_CCKTXCTL_WORLD
Definition: reg.h:2524
#define AR5K_SREV_PHY_5212A
Definition: ath5k.h:329
#define AR5K_RXCFG
Definition: reg.h:198
static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah, struct net80211_channel *channel, u8 *ant, u8 ee_mode)
Definition: ath5k_reset.c:538
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
#define AR5K_PHY_DAG_CCK_CTL
Definition: reg.h:2552
#define AR5K_RESET_CTL_PHY
Definition: reg.h:847
#define AR5K_SREV_AR5211
Definition: ath5k.h:294
#define AR5K_USEC_5211
Definition: reg.h:1223
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define AR5K_CFG
Definition: reg.h:72
#define CHANNEL_B
Definition: ath5k.h:641
#define CHANNEL_2GHZ
Definition: ath5k.h:634
#define AR5K_PHY_DESIRED_SIZE
Definition: reg.h:1999
#define AR5K_RESET_CTL_DMA
Definition: reg.h:844
int ath5k_hw_txpower(struct ath5k_hw *ah, struct net80211_channel *channel, u8 ee_mode, u8 txpower)
Definition: ath5k_phy.c:2475
#define AR5K_PHY_DAG_CCK_CTL_RSSI_THR
Definition: reg.h:2554
u16 ee_cck_ofdm_gain_delta
Definition: eeprom.h:391
#define AR5K_PHY_MODE_FREQ_2GHZ
Definition: reg.h:2511
#define AR5K_PHY_CCKTXCTL
Definition: reg.h:2523
#define AR5K_PHY_IQ_RUN
Definition: reg.h:2199
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
u16 ee_switch_settling[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:401
#define AR5K_PHY_GAIN_TXRX_ATTEN
Definition: reg.h:1987
#define AR5K_PHY_RX_DELAY
Definition: reg.h:2180
int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, int change_channel)
#define AR5K_PHY_ADC_CTL_PWD_DAC_OFF
Definition: reg.h:1952
#define CHANNEL_TG
Definition: ath5k.h:644
static void ath5k_hw_write_rate_duration(struct ath5k_hw *ah, unsigned int mode __unused)
ath5k_hw_write_rate_duration - fill rate code to duration table
Definition: ath5k_reset.c:157
#define AR5K_PHY_RF_CTL3
Definition: reg.h:1945
#define AR5K_STA_ID1_ACKCTS_6MB
Definition: reg.h:1144
static int fls(int x)
Definition: ath5k_reset.c:41
u32 ath5k_hw_get_gpio(struct ath5k_hw *ah, u32 gpio)
Definition: ath5k_gpio.c:65
uint8_t u8
Definition: stdint.h:20
uint32_t u32
Definition: stdint.h:24
#define AR5K_PHY_ACT_ENABLE
Definition: reg.h:1935
u16 ee_q_cal[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:397
#define AR5K_RXCFG_SDMAMW
Definition: reg.h:199
s8 ee_pga_desired_size_turbo[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:448
#define AR5K_RESET_CTL_BASEBAND
Definition: reg.h:845
#define AR5K_REG_ENABLE_BITS(ah, _reg, _flags)
Definition: ath5k.h:106
#define AR5K_PHY_ACT
Definition: reg.h:1934
static const uint8_t r[3][4]
MD4 shift amounts.
Definition: md4.c:54
#define AR5K_REG_SM(_val, _flags)
Definition: ath5k.h:86
#define AR5K_PHY_OFDM_SELFCORR
Definition: reg.h:2212