diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/eeprom.h')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/eeprom.h | 103 |
1 files changed, 46 insertions, 57 deletions
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h index 0b09db0f8e7d..de99c0da52e4 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom.h +++ b/drivers/net/wireless/ath/ath9k/eeprom.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2008-2009 Atheros Communications Inc. | 2 | * Copyright (c) 2008-2011 Atheros Communications Inc. |
3 | * | 3 | * |
4 | * Permission to use, copy, modify, and/or distribute this software for any | 4 | * Permission to use, copy, modify, and/or distribute this software for any |
5 | * purpose with or without fee is hereby granted, provided that the above | 5 | * purpose with or without fee is hereby granted, provided that the above |
@@ -17,12 +17,12 @@ | |||
17 | #ifndef EEPROM_H | 17 | #ifndef EEPROM_H |
18 | #define EEPROM_H | 18 | #define EEPROM_H |
19 | 19 | ||
20 | #define AR_EEPROM_MODAL_SPURS 5 | ||
21 | |||
20 | #include "../ath.h" | 22 | #include "../ath.h" |
21 | #include <net/cfg80211.h> | 23 | #include <net/cfg80211.h> |
22 | #include "ar9003_eeprom.h" | 24 | #include "ar9003_eeprom.h" |
23 | 25 | ||
24 | #define AH_USE_EEPROM 0x1 | ||
25 | |||
26 | #ifdef __BIG_ENDIAN | 26 | #ifdef __BIG_ENDIAN |
27 | #define AR5416_EEPROM_MAGIC 0x5aa5 | 27 | #define AR5416_EEPROM_MAGIC 0x5aa5 |
28 | #else | 28 | #else |
@@ -101,7 +101,7 @@ | |||
101 | #define AR5416_VER_MASK (eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) | 101 | #define AR5416_VER_MASK (eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) |
102 | #define OLC_FOR_AR9280_20_LATER (AR_SREV_9280_20_OR_LATER(ah) && \ | 102 | #define OLC_FOR_AR9280_20_LATER (AR_SREV_9280_20_OR_LATER(ah) && \ |
103 | ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) | 103 | ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) |
104 | #define OLC_FOR_AR9287_10_LATER (AR_SREV_9287_10_OR_LATER(ah) && \ | 104 | #define OLC_FOR_AR9287_10_LATER (AR_SREV_9287_11_OR_LATER(ah) && \ |
105 | ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) | 105 | ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) |
106 | 106 | ||
107 | #define AR_EEPROM_RFSILENT_GPIO_SEL 0x001c | 107 | #define AR_EEPROM_RFSILENT_GPIO_SEL 0x001c |
@@ -149,8 +149,6 @@ | |||
149 | #define AR5416_NUM_PD_GAINS 4 | 149 | #define AR5416_NUM_PD_GAINS 4 |
150 | #define AR5416_PD_GAINS_IN_MASK 4 | 150 | #define AR5416_PD_GAINS_IN_MASK 4 |
151 | #define AR5416_PD_GAIN_ICEPTS 5 | 151 | #define AR5416_PD_GAIN_ICEPTS 5 |
152 | #define AR5416_EEPROM_MODAL_SPURS 5 | ||
153 | #define AR5416_MAX_RATE_POWER 63 | ||
154 | #define AR5416_NUM_PDADC_VALUES 128 | 152 | #define AR5416_NUM_PDADC_VALUES 128 |
155 | #define AR5416_BCHAN_UNUSED 0xFF | 153 | #define AR5416_BCHAN_UNUSED 0xFF |
156 | #define AR5416_MAX_PWR_RANGE_IN_HALF_DB 64 | 154 | #define AR5416_MAX_PWR_RANGE_IN_HALF_DB 64 |
@@ -175,8 +173,6 @@ | |||
175 | #define AR5416_EEP4K_NUM_CTLS 12 | 173 | #define AR5416_EEP4K_NUM_CTLS 12 |
176 | #define AR5416_EEP4K_NUM_BAND_EDGES 4 | 174 | #define AR5416_EEP4K_NUM_BAND_EDGES 4 |
177 | #define AR5416_EEP4K_NUM_PD_GAINS 2 | 175 | #define AR5416_EEP4K_NUM_PD_GAINS 2 |
178 | #define AR5416_EEP4K_PD_GAINS_IN_MASK 4 | ||
179 | #define AR5416_EEP4K_PD_GAIN_ICEPTS 5 | ||
180 | #define AR5416_EEP4K_MAX_CHAINS 1 | 176 | #define AR5416_EEP4K_MAX_CHAINS 1 |
181 | 177 | ||
182 | #define AR9280_TX_GAIN_TABLE_SIZE 22 | 178 | #define AR9280_TX_GAIN_TABLE_SIZE 22 |
@@ -198,41 +194,30 @@ | |||
198 | #define AR9287_NUM_2G_40_TARGET_POWERS 3 | 194 | #define AR9287_NUM_2G_40_TARGET_POWERS 3 |
199 | #define AR9287_NUM_CTLS 12 | 195 | #define AR9287_NUM_CTLS 12 |
200 | #define AR9287_NUM_BAND_EDGES 4 | 196 | #define AR9287_NUM_BAND_EDGES 4 |
201 | #define AR9287_NUM_PD_GAINS 4 | ||
202 | #define AR9287_PD_GAINS_IN_MASK 4 | ||
203 | #define AR9287_PD_GAIN_ICEPTS 1 | 197 | #define AR9287_PD_GAIN_ICEPTS 1 |
204 | #define AR9287_EEPROM_MODAL_SPURS 5 | ||
205 | #define AR9287_MAX_RATE_POWER 63 | ||
206 | #define AR9287_NUM_PDADC_VALUES 128 | ||
207 | #define AR9287_NUM_RATES 16 | ||
208 | #define AR9287_BCHAN_UNUSED 0xFF | ||
209 | #define AR9287_MAX_PWR_RANGE_IN_HALF_DB 64 | ||
210 | #define AR9287_OPFLAGS_11A 0x01 | ||
211 | #define AR9287_OPFLAGS_11G 0x02 | ||
212 | #define AR9287_OPFLAGS_2G_HT40 0x08 | ||
213 | #define AR9287_OPFLAGS_2G_HT20 0x20 | ||
214 | #define AR9287_OPFLAGS_5G_HT40 0x04 | ||
215 | #define AR9287_OPFLAGS_5G_HT20 0x10 | ||
216 | #define AR9287_EEPMISC_BIG_ENDIAN 0x01 | 198 | #define AR9287_EEPMISC_BIG_ENDIAN 0x01 |
217 | #define AR9287_EEPMISC_WOW 0x02 | 199 | #define AR9287_EEPMISC_WOW 0x02 |
218 | #define AR9287_MAX_CHAINS 2 | 200 | #define AR9287_MAX_CHAINS 2 |
219 | #define AR9287_ANT_16S 32 | 201 | #define AR9287_ANT_16S 32 |
220 | #define AR9287_custdatasize 20 | 202 | |
221 | |||
222 | #define AR9287_NUM_ANT_CHAIN_FIELDS 6 | ||
223 | #define AR9287_NUM_ANT_COMMON_FIELDS 4 | ||
224 | #define AR9287_SIZE_ANT_CHAIN_FIELD 2 | ||
225 | #define AR9287_SIZE_ANT_COMMON_FIELD 4 | ||
226 | #define AR9287_ANT_CHAIN_MASK 0x3 | ||
227 | #define AR9287_ANT_COMMON_MASK 0xf | ||
228 | #define AR9287_CHAIN_0_IDX 0 | ||
229 | #define AR9287_CHAIN_1_IDX 1 | ||
230 | #define AR9287_DATA_SZ 32 | 203 | #define AR9287_DATA_SZ 32 |
231 | 204 | ||
232 | #define AR9287_PWR_TABLE_OFFSET_DB -5 | 205 | #define AR9287_PWR_TABLE_OFFSET_DB -5 |
233 | 206 | ||
234 | #define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1) | 207 | #define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1) |
235 | 208 | ||
209 | #define CTL_EDGE_TPOWER(_ctl) ((_ctl) & 0x3f) | ||
210 | #define CTL_EDGE_FLAGS(_ctl) (((_ctl) >> 6) & 0x03) | ||
211 | |||
212 | #define LNA_CTL_BUF_MODE BIT(0) | ||
213 | #define LNA_CTL_ISEL_LO BIT(1) | ||
214 | #define LNA_CTL_ISEL_HI BIT(2) | ||
215 | #define LNA_CTL_BUF_IN BIT(3) | ||
216 | #define LNA_CTL_FEM_BAND BIT(4) | ||
217 | #define LNA_CTL_LOCAL_BIAS BIT(5) | ||
218 | #define LNA_CTL_FORCE_XPA BIT(6) | ||
219 | #define LNA_CTL_USE_ANT1 BIT(7) | ||
220 | |||
236 | enum eeprom_param { | 221 | enum eeprom_param { |
237 | EEP_NFTHRESH_5, | 222 | EEP_NFTHRESH_5, |
238 | EEP_NFTHRESH_2, | 223 | EEP_NFTHRESH_2, |
@@ -266,6 +251,9 @@ enum eeprom_param { | |||
266 | EEP_INTERNAL_REGULATOR, | 251 | EEP_INTERNAL_REGULATOR, |
267 | EEP_SWREG, | 252 | EEP_SWREG, |
268 | EEP_PAPRD, | 253 | EEP_PAPRD, |
254 | EEP_MODAL_VER, | ||
255 | EEP_ANT_DIV_CTL1, | ||
256 | EEP_CHAIN_MASK_REDUCE | ||
269 | }; | 257 | }; |
270 | 258 | ||
271 | enum ar5416_rates { | 259 | enum ar5416_rates { |
@@ -376,15 +364,12 @@ struct modal_eep_header { | |||
376 | u8 xatten2Margin[AR5416_MAX_CHAINS]; | 364 | u8 xatten2Margin[AR5416_MAX_CHAINS]; |
377 | u8 ob_ch1; | 365 | u8 ob_ch1; |
378 | u8 db_ch1; | 366 | u8 db_ch1; |
379 | u8 useAnt1:1, | 367 | u8 lna_ctl; |
380 | force_xpaon:1, | ||
381 | local_bias:1, | ||
382 | femBandSelectUsed:1, xlnabufin:1, xlnaisel:2, xlnabufmode:1; | ||
383 | u8 miscBits; | 368 | u8 miscBits; |
384 | u16 xpaBiasLvlFreq[3]; | 369 | u16 xpaBiasLvlFreq[3]; |
385 | u8 futureModal[6]; | 370 | u8 futureModal[6]; |
386 | 371 | ||
387 | struct spur_chan spurChans[AR5416_EEPROM_MODAL_SPURS]; | 372 | struct spur_chan spurChans[AR_EEPROM_MODAL_SPURS]; |
388 | } __packed; | 373 | } __packed; |
389 | 374 | ||
390 | struct calDataPerFreqOpLoop { | 375 | struct calDataPerFreqOpLoop { |
@@ -451,8 +436,12 @@ struct modal_eep_4k_header { | |||
451 | u8 db2_2:4, db2_3:4; | 436 | u8 db2_2:4, db2_3:4; |
452 | u8 db2_4:4, reserved:4; | 437 | u8 db2_4:4, reserved:4; |
453 | #endif | 438 | #endif |
454 | u8 futureModal[4]; | 439 | u8 tx_diversity; |
455 | struct spur_chan spurChans[AR5416_EEPROM_MODAL_SPURS]; | 440 | u8 flc_pwr_thresh; |
441 | u8 bb_scale_smrt_antenna; | ||
442 | #define EEP_4K_BB_DESIRED_SCALE_MASK 0x1f | ||
443 | u8 futureModal[1]; | ||
444 | struct spur_chan spurChans[AR_EEPROM_MODAL_SPURS]; | ||
456 | } __packed; | 445 | } __packed; |
457 | 446 | ||
458 | struct base_eep_ar9287_header { | 447 | struct base_eep_ar9287_header { |
@@ -510,7 +499,7 @@ struct modal_eep_ar9287_header { | |||
510 | u8 ob_qam; | 499 | u8 ob_qam; |
511 | u8 ob_pal_off; | 500 | u8 ob_pal_off; |
512 | u8 futureModal[30]; | 501 | u8 futureModal[30]; |
513 | struct spur_chan spurChans[AR9287_EEPROM_MODAL_SPURS]; | 502 | struct spur_chan spurChans[AR_EEPROM_MODAL_SPURS]; |
514 | } __packed; | 503 | } __packed; |
515 | 504 | ||
516 | struct cal_data_per_freq { | 505 | struct cal_data_per_freq { |
@@ -519,8 +508,8 @@ struct cal_data_per_freq { | |||
519 | } __packed; | 508 | } __packed; |
520 | 509 | ||
521 | struct cal_data_per_freq_4k { | 510 | struct cal_data_per_freq_4k { |
522 | u8 pwrPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_EEP4K_PD_GAIN_ICEPTS]; | 511 | u8 pwrPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; |
523 | u8 vpdPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_EEP4K_PD_GAIN_ICEPTS]; | 512 | u8 vpdPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; |
524 | } __packed; | 513 | } __packed; |
525 | 514 | ||
526 | struct cal_target_power_leg { | 515 | struct cal_target_power_leg { |
@@ -533,18 +522,10 @@ struct cal_target_power_ht { | |||
533 | u8 tPow2x[8]; | 522 | u8 tPow2x[8]; |
534 | } __packed; | 523 | } __packed; |
535 | 524 | ||
536 | |||
537 | #ifdef __BIG_ENDIAN_BITFIELD | ||
538 | struct cal_ctl_edges { | 525 | struct cal_ctl_edges { |
539 | u8 bChannel; | 526 | u8 bChannel; |
540 | u8 flag:2, tPower:6; | 527 | u8 ctl; |
541 | } __packed; | 528 | } __packed; |
542 | #else | ||
543 | struct cal_ctl_edges { | ||
544 | u8 bChannel; | ||
545 | u8 tPower:6, flag:2; | ||
546 | } __packed; | ||
547 | #endif | ||
548 | 529 | ||
549 | struct cal_data_op_loop_ar9287 { | 530 | struct cal_data_op_loop_ar9287 { |
550 | u8 pwrPdg[2][5]; | 531 | u8 pwrPdg[2][5]; |
@@ -554,8 +535,8 @@ struct cal_data_op_loop_ar9287 { | |||
554 | } __packed; | 535 | } __packed; |
555 | 536 | ||
556 | struct cal_data_per_freq_ar9287 { | 537 | struct cal_data_per_freq_ar9287 { |
557 | u8 pwrPdg[AR9287_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS]; | 538 | u8 pwrPdg[AR5416_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS]; |
558 | u8 vpdPdg[AR9287_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS]; | 539 | u8 vpdPdg[AR5416_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS]; |
559 | } __packed; | 540 | } __packed; |
560 | 541 | ||
561 | union cal_data_per_freq_ar9287_u { | 542 | union cal_data_per_freq_ar9287_u { |
@@ -670,14 +651,12 @@ struct eeprom_ops { | |||
670 | bool (*fill_eeprom)(struct ath_hw *hw); | 651 | bool (*fill_eeprom)(struct ath_hw *hw); |
671 | int (*get_eeprom_ver)(struct ath_hw *hw); | 652 | int (*get_eeprom_ver)(struct ath_hw *hw); |
672 | int (*get_eeprom_rev)(struct ath_hw *hw); | 653 | int (*get_eeprom_rev)(struct ath_hw *hw); |
673 | u8 (*get_num_ant_config)(struct ath_hw *hw, enum ieee80211_band band); | ||
674 | u32 (*get_eeprom_antenna_cfg)(struct ath_hw *hw, | ||
675 | struct ath9k_channel *chan); | ||
676 | void (*set_board_values)(struct ath_hw *hw, struct ath9k_channel *chan); | 654 | void (*set_board_values)(struct ath_hw *hw, struct ath9k_channel *chan); |
677 | void (*set_addac)(struct ath_hw *hw, struct ath9k_channel *chan); | 655 | void (*set_addac)(struct ath_hw *hw, struct ath9k_channel *chan); |
678 | void (*set_txpower)(struct ath_hw *hw, struct ath9k_channel *chan, | 656 | void (*set_txpower)(struct ath_hw *hw, struct ath9k_channel *chan, |
679 | u16 cfgCtl, u8 twiceAntennaReduction, | 657 | u16 cfgCtl, u8 twiceAntennaReduction, |
680 | u8 twiceMaxRegulatoryPower, u8 powerLimit); | 658 | u8 twiceMaxRegulatoryPower, u8 powerLimit, |
659 | bool test); | ||
681 | u16 (*get_spur_channel)(struct ath_hw *ah, u16 i, bool is2GHz); | 660 | u16 (*get_spur_channel)(struct ath_hw *ah, u16 i, bool is2GHz); |
682 | }; | 661 | }; |
683 | 662 | ||
@@ -690,6 +669,8 @@ int16_t ath9k_hw_interpolate(u16 target, u16 srcLeft, u16 srcRight, | |||
690 | bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize, | 669 | bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize, |
691 | u16 *indexL, u16 *indexR); | 670 | u16 *indexL, u16 *indexR); |
692 | bool ath9k_hw_nvram_read(struct ath_common *common, u32 off, u16 *data); | 671 | bool ath9k_hw_nvram_read(struct ath_common *common, u32 off, u16 *data); |
672 | void ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data, | ||
673 | int eep_start_loc, int size); | ||
693 | void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList, | 674 | void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList, |
694 | u8 *pVpdList, u16 numIntercepts, | 675 | u8 *pVpdList, u16 numIntercepts, |
695 | u8 *pRetVpdList); | 676 | u8 *pRetVpdList); |
@@ -710,6 +691,14 @@ u16 ath9k_hw_get_max_edge_power(u16 freq, struct cal_ctl_edges *pRdEdgesPower, | |||
710 | void ath9k_hw_update_regulatory_maxpower(struct ath_hw *ah); | 691 | void ath9k_hw_update_regulatory_maxpower(struct ath_hw *ah); |
711 | int ath9k_hw_eeprom_init(struct ath_hw *ah); | 692 | int ath9k_hw_eeprom_init(struct ath_hw *ah); |
712 | 693 | ||
694 | void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah, | ||
695 | struct ath9k_channel *chan, | ||
696 | void *pRawDataSet, | ||
697 | u8 *bChans, u16 availPiers, | ||
698 | u16 tPdGainOverlap, | ||
699 | u16 *pPdGainBoundaries, u8 *pPDADCValues, | ||
700 | u16 numXpdGains); | ||
701 | |||
713 | #define ar5416_get_ntxchains(_txchainmask) \ | 702 | #define ar5416_get_ntxchains(_txchainmask) \ |
714 | (((_txchainmask >> 2) & 1) + \ | 703 | (((_txchainmask >> 2) & 1) + \ |
715 | ((_txchainmask >> 1) & 1) + (_txchainmask & 1)) | 704 | ((_txchainmask >> 1) & 1) + (_txchainmask & 1)) |