Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 1 | /* |
Sujith | cee075a | 2009-03-13 09:07:23 +0530 | [diff] [blame] | 2 | * Copyright (c) 2008-2009 Atheros Communications Inc. |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 3 | * |
| 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 |
| 6 | * copyright notice and this permission notice appear in all copies. |
| 7 | * |
| 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | */ |
| 16 | |
| 17 | #ifndef EEPROM_H |
| 18 | #define EEPROM_H |
| 19 | |
Felix Fietkau | 4ddfcd7 | 2010-12-12 00:51:08 +0100 | [diff] [blame] | 20 | #define AR_EEPROM_MODAL_SPURS 5 |
| 21 | |
Luis R. Rodriguez | 5bb1279 | 2009-09-14 00:55:09 -0700 | [diff] [blame] | 22 | #include "../ath.h" |
Johannes Berg | d323655 | 2009-04-20 14:31:42 +0200 | [diff] [blame] | 23 | #include <net/cfg80211.h> |
Senthil Balasubramanian | 15c9ee7 | 2010-04-15 17:39:14 -0400 | [diff] [blame] | 24 | #include "ar9003_eeprom.h" |
Bob Copeland | 3a702e4 | 2009-03-30 22:30:29 -0400 | [diff] [blame] | 25 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 26 | #define AH_USE_EEPROM 0x1 |
| 27 | |
| 28 | #ifdef __BIG_ENDIAN |
| 29 | #define AR5416_EEPROM_MAGIC 0x5aa5 |
| 30 | #else |
| 31 | #define AR5416_EEPROM_MAGIC 0xa55a |
| 32 | #endif |
| 33 | |
| 34 | #define CTRY_DEBUG 0x1ff |
| 35 | #define CTRY_DEFAULT 0 |
| 36 | |
| 37 | #define AR_EEPROM_EEPCAP_COMPRESS_DIS 0x0001 |
| 38 | #define AR_EEPROM_EEPCAP_AES_DIS 0x0002 |
| 39 | #define AR_EEPROM_EEPCAP_FASTFRAME_DIS 0x0004 |
| 40 | #define AR_EEPROM_EEPCAP_BURST_DIS 0x0008 |
| 41 | #define AR_EEPROM_EEPCAP_MAXQCU 0x01F0 |
| 42 | #define AR_EEPROM_EEPCAP_MAXQCU_S 4 |
| 43 | #define AR_EEPROM_EEPCAP_HEAVY_CLIP_EN 0x0200 |
| 44 | #define AR_EEPROM_EEPCAP_KC_ENTRIES 0xF000 |
| 45 | #define AR_EEPROM_EEPCAP_KC_ENTRIES_S 12 |
| 46 | |
| 47 | #define AR_EEPROM_EEREGCAP_EN_FCC_MIDBAND 0x0040 |
| 48 | #define AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN 0x0080 |
| 49 | #define AR_EEPROM_EEREGCAP_EN_KK_U2 0x0100 |
| 50 | #define AR_EEPROM_EEREGCAP_EN_KK_MIDBAND 0x0200 |
| 51 | #define AR_EEPROM_EEREGCAP_EN_KK_U1_ODD 0x0400 |
| 52 | #define AR_EEPROM_EEREGCAP_EN_KK_NEW_11A 0x0800 |
| 53 | |
| 54 | #define AR_EEPROM_EEREGCAP_EN_KK_U1_ODD_PRE4_0 0x4000 |
| 55 | #define AR_EEPROM_EEREGCAP_EN_KK_NEW_11A_PRE4_0 0x8000 |
| 56 | |
| 57 | #define AR5416_EEPROM_MAGIC_OFFSET 0x0 |
| 58 | #define AR5416_EEPROM_S 2 |
| 59 | #define AR5416_EEPROM_OFFSET 0x2000 |
| 60 | #define AR5416_EEPROM_MAX 0xae0 |
| 61 | |
| 62 | #define AR5416_EEPROM_START_ADDR \ |
| 63 | (AR_SREV_9100(ah)) ? 0x1fff1000 : 0x503f1200 |
| 64 | |
| 65 | #define SD_NO_CTL 0xE0 |
| 66 | #define NO_CTL 0xff |
Luis R. Rodriguez | 9048797 | 2010-08-30 19:26:33 -0400 | [diff] [blame] | 67 | #define CTL_MODE_M 0xf |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 68 | #define CTL_11A 0 |
| 69 | #define CTL_11B 1 |
| 70 | #define CTL_11G 2 |
| 71 | #define CTL_2GHT20 5 |
| 72 | #define CTL_5GHT20 6 |
| 73 | #define CTL_2GHT40 7 |
| 74 | #define CTL_5GHT40 8 |
| 75 | |
| 76 | #define EXT_ADDITIVE (0x8000) |
| 77 | #define CTL_11A_EXT (CTL_11A | EXT_ADDITIVE) |
| 78 | #define CTL_11G_EXT (CTL_11G | EXT_ADDITIVE) |
| 79 | #define CTL_11B_EXT (CTL_11B | EXT_ADDITIVE) |
| 80 | |
| 81 | #define SUB_NUM_CTL_MODES_AT_5G_40 2 |
| 82 | #define SUB_NUM_CTL_MODES_AT_2G_40 3 |
| 83 | |
Sujith | e421c7b | 2009-02-12 10:06:36 +0530 | [diff] [blame] | 84 | #define INCREASE_MAXPOW_BY_TWO_CHAIN 6 /* 10*log10(2)*2 */ |
| 85 | #define INCREASE_MAXPOW_BY_THREE_CHAIN 10 /* 10*log10(3)*2 */ |
| 86 | |
Sujith | fec0de1 | 2009-02-12 10:06:43 +0530 | [diff] [blame] | 87 | /* |
| 88 | * For AR9285 and later chipsets, the following bits are not being programmed |
| 89 | * in EEPROM and so need to be enabled always. |
| 90 | * |
| 91 | * Bit 0: en_fcc_mid |
| 92 | * Bit 1: en_jap_mid |
| 93 | * Bit 2: en_fcc_dfs_ht40 |
| 94 | * Bit 3: en_jap_ht40 |
| 95 | * Bit 4: en_jap_dfs_ht40 |
| 96 | */ |
| 97 | #define AR9285_RDEXT_DEFAULT 0x1F |
| 98 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 99 | #define ATH9K_POW_SM(_r, _s) (((_r) & 0x3f) << (_s)) |
| 100 | #define FREQ2FBIN(x, y) ((y) ? ((x) - 2300) : (((x) - 4800) / 5)) |
| 101 | #define ath9k_hw_use_flash(_ah) (!(_ah->ah_flags & AH_USE_EEPROM)) |
| 102 | |
Sujith | 355363f | 2009-03-13 08:56:02 +0530 | [diff] [blame] | 103 | #define AR5416_VER_MASK (eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) |
Sujith | d9ae96d | 2009-02-20 15:13:13 +0530 | [diff] [blame] | 104 | #define OLC_FOR_AR9280_20_LATER (AR_SREV_9280_20_OR_LATER(ah) && \ |
| 105 | ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) |
Felix Fietkau | a42acef | 2010-09-22 12:34:54 +0200 | [diff] [blame] | 106 | #define OLC_FOR_AR9287_10_LATER (AR_SREV_9287_11_OR_LATER(ah) && \ |
Vivek Natarajan | ac88b6e | 2009-07-23 10:59:57 +0530 | [diff] [blame] | 107 | ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) |
Sujith | d9ae96d | 2009-02-20 15:13:13 +0530 | [diff] [blame] | 108 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 109 | #define AR_EEPROM_RFSILENT_GPIO_SEL 0x001c |
| 110 | #define AR_EEPROM_RFSILENT_GPIO_SEL_S 2 |
| 111 | #define AR_EEPROM_RFSILENT_POLARITY 0x0002 |
| 112 | #define AR_EEPROM_RFSILENT_POLARITY_S 1 |
| 113 | |
| 114 | #define EEP_RFSILENT_ENABLED 0x0001 |
| 115 | #define EEP_RFSILENT_ENABLED_S 0 |
| 116 | #define EEP_RFSILENT_POLARITY 0x0002 |
| 117 | #define EEP_RFSILENT_POLARITY_S 1 |
| 118 | #define EEP_RFSILENT_GPIO_SEL 0x001c |
| 119 | #define EEP_RFSILENT_GPIO_SEL_S 2 |
| 120 | |
| 121 | #define AR5416_OPFLAGS_11A 0x01 |
| 122 | #define AR5416_OPFLAGS_11G 0x02 |
| 123 | #define AR5416_OPFLAGS_N_5G_HT40 0x04 |
| 124 | #define AR5416_OPFLAGS_N_2G_HT40 0x08 |
| 125 | #define AR5416_OPFLAGS_N_5G_HT20 0x10 |
| 126 | #define AR5416_OPFLAGS_N_2G_HT20 0x20 |
| 127 | |
| 128 | #define AR5416_EEP_NO_BACK_VER 0x1 |
| 129 | #define AR5416_EEP_VER 0xE |
| 130 | #define AR5416_EEP_VER_MINOR_MASK 0x0FFF |
| 131 | #define AR5416_EEP_MINOR_VER_2 0x2 |
| 132 | #define AR5416_EEP_MINOR_VER_3 0x3 |
| 133 | #define AR5416_EEP_MINOR_VER_7 0x7 |
| 134 | #define AR5416_EEP_MINOR_VER_9 0x9 |
| 135 | #define AR5416_EEP_MINOR_VER_16 0x10 |
| 136 | #define AR5416_EEP_MINOR_VER_17 0x11 |
| 137 | #define AR5416_EEP_MINOR_VER_19 0x13 |
| 138 | #define AR5416_EEP_MINOR_VER_20 0x14 |
Senthil Balasubramanian | e41f0bf | 2009-09-18 15:08:20 +0530 | [diff] [blame] | 139 | #define AR5416_EEP_MINOR_VER_21 0x15 |
Sujith | 06d0f06 | 2009-02-12 10:06:45 +0530 | [diff] [blame] | 140 | #define AR5416_EEP_MINOR_VER_22 0x16 |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 141 | |
| 142 | #define AR5416_NUM_5G_CAL_PIERS 8 |
| 143 | #define AR5416_NUM_2G_CAL_PIERS 4 |
| 144 | #define AR5416_NUM_5G_20_TARGET_POWERS 8 |
| 145 | #define AR5416_NUM_5G_40_TARGET_POWERS 8 |
| 146 | #define AR5416_NUM_2G_CCK_TARGET_POWERS 3 |
| 147 | #define AR5416_NUM_2G_20_TARGET_POWERS 4 |
| 148 | #define AR5416_NUM_2G_40_TARGET_POWERS 4 |
| 149 | #define AR5416_NUM_CTLS 24 |
| 150 | #define AR5416_NUM_BAND_EDGES 8 |
| 151 | #define AR5416_NUM_PD_GAINS 4 |
| 152 | #define AR5416_PD_GAINS_IN_MASK 4 |
| 153 | #define AR5416_PD_GAIN_ICEPTS 5 |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 154 | #define AR5416_NUM_PDADC_VALUES 128 |
| 155 | #define AR5416_BCHAN_UNUSED 0xFF |
| 156 | #define AR5416_MAX_PWR_RANGE_IN_HALF_DB 64 |
| 157 | #define AR5416_MAX_CHAINS 3 |
Luis R. Rodriguez | df23aca | 2010-04-15 17:39:11 -0400 | [diff] [blame] | 158 | #define AR9300_MAX_CHAINS 3 |
Senthil Balasubramanian | e41f0bf | 2009-09-18 15:08:20 +0530 | [diff] [blame] | 159 | #define AR5416_PWR_TABLE_OFFSET_DB -5 |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 160 | |
| 161 | /* Rx gain type values */ |
| 162 | #define AR5416_EEP_RXGAIN_23DB_BACKOFF 0 |
| 163 | #define AR5416_EEP_RXGAIN_13DB_BACKOFF 1 |
| 164 | #define AR5416_EEP_RXGAIN_ORIG 2 |
| 165 | |
| 166 | /* Tx gain type values */ |
| 167 | #define AR5416_EEP_TXGAIN_ORIGINAL 0 |
| 168 | #define AR5416_EEP_TXGAIN_HIGH_POWER 1 |
| 169 | |
| 170 | #define AR5416_EEP4K_START_LOC 64 |
| 171 | #define AR5416_EEP4K_NUM_2G_CAL_PIERS 3 |
| 172 | #define AR5416_EEP4K_NUM_2G_CCK_TARGET_POWERS 3 |
| 173 | #define AR5416_EEP4K_NUM_2G_20_TARGET_POWERS 3 |
| 174 | #define AR5416_EEP4K_NUM_2G_40_TARGET_POWERS 3 |
| 175 | #define AR5416_EEP4K_NUM_CTLS 12 |
| 176 | #define AR5416_EEP4K_NUM_BAND_EDGES 4 |
| 177 | #define AR5416_EEP4K_NUM_PD_GAINS 2 |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 178 | #define AR5416_EEP4K_MAX_CHAINS 1 |
| 179 | |
Senthil Balasubramanian | 8bd1d07 | 2009-02-12 13:57:03 +0530 | [diff] [blame] | 180 | #define AR9280_TX_GAIN_TABLE_SIZE 22 |
| 181 | |
Vivek Natarajan | ac88b6e | 2009-07-23 10:59:57 +0530 | [diff] [blame] | 182 | #define AR9287_EEP_VER 0xE |
| 183 | #define AR9287_EEP_VER_MINOR_MASK 0xFFF |
| 184 | #define AR9287_EEP_MINOR_VER_1 0x1 |
| 185 | #define AR9287_EEP_MINOR_VER_2 0x2 |
| 186 | #define AR9287_EEP_MINOR_VER_3 0x3 |
| 187 | #define AR9287_EEP_MINOR_VER AR9287_EEP_MINOR_VER_3 |
| 188 | #define AR9287_EEP_MINOR_VER_b AR9287_EEP_MINOR_VER |
| 189 | #define AR9287_EEP_NO_BACK_VER AR9287_EEP_MINOR_VER_1 |
| 190 | |
| 191 | #define AR9287_EEP_START_LOC 128 |
Rajkumar Manoharan | ca6cff1 | 2010-08-13 18:36:40 +0530 | [diff] [blame] | 192 | #define AR9287_HTC_EEP_START_LOC 256 |
Vivek Natarajan | ac88b6e | 2009-07-23 10:59:57 +0530 | [diff] [blame] | 193 | #define AR9287_NUM_2G_CAL_PIERS 3 |
| 194 | #define AR9287_NUM_2G_CCK_TARGET_POWERS 3 |
| 195 | #define AR9287_NUM_2G_20_TARGET_POWERS 3 |
| 196 | #define AR9287_NUM_2G_40_TARGET_POWERS 3 |
| 197 | #define AR9287_NUM_CTLS 12 |
| 198 | #define AR9287_NUM_BAND_EDGES 4 |
Vivek Natarajan | ac88b6e | 2009-07-23 10:59:57 +0530 | [diff] [blame] | 199 | #define AR9287_PD_GAIN_ICEPTS 1 |
Vivek Natarajan | ac88b6e | 2009-07-23 10:59:57 +0530 | [diff] [blame] | 200 | #define AR9287_EEPMISC_BIG_ENDIAN 0x01 |
| 201 | #define AR9287_EEPMISC_WOW 0x02 |
| 202 | #define AR9287_MAX_CHAINS 2 |
| 203 | #define AR9287_ANT_16S 32 |
Vivek Natarajan | ac88b6e | 2009-07-23 10:59:57 +0530 | [diff] [blame] | 204 | |
Vivek Natarajan | ac88b6e | 2009-07-23 10:59:57 +0530 | [diff] [blame] | 205 | #define AR9287_DATA_SZ 32 |
| 206 | |
| 207 | #define AR9287_PWR_TABLE_OFFSET_DB -5 |
| 208 | |
| 209 | #define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1) |
| 210 | |
Felix Fietkau | e702ba1 | 2010-12-01 19:07:46 +0100 | [diff] [blame] | 211 | #define CTL_EDGE_TPOWER(_ctl) ((_ctl) & 0x3f) |
| 212 | #define CTL_EDGE_FLAGS(_ctl) (((_ctl) >> 6) & 0x03) |
| 213 | |
Felix Fietkau | f67e07e | 2010-12-01 19:07:47 +0100 | [diff] [blame] | 214 | #define LNA_CTL_BUF_MODE BIT(0) |
| 215 | #define LNA_CTL_ISEL_LO BIT(1) |
| 216 | #define LNA_CTL_ISEL_HI BIT(2) |
| 217 | #define LNA_CTL_BUF_IN BIT(3) |
| 218 | #define LNA_CTL_FEM_BAND BIT(4) |
| 219 | #define LNA_CTL_LOCAL_BIAS BIT(5) |
| 220 | #define LNA_CTL_FORCE_XPA BIT(6) |
| 221 | #define LNA_CTL_USE_ANT1 BIT(7) |
| 222 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 223 | enum eeprom_param { |
| 224 | EEP_NFTHRESH_5, |
| 225 | EEP_NFTHRESH_2, |
| 226 | EEP_MAC_MSW, |
| 227 | EEP_MAC_MID, |
| 228 | EEP_MAC_LSW, |
| 229 | EEP_REG_0, |
| 230 | EEP_REG_1, |
| 231 | EEP_OP_CAP, |
| 232 | EEP_OP_MODE, |
| 233 | EEP_RF_SILENT, |
| 234 | EEP_OB_5, |
| 235 | EEP_DB_5, |
| 236 | EEP_OB_2, |
| 237 | EEP_DB_2, |
| 238 | EEP_MINOR_REV, |
| 239 | EEP_TX_MASK, |
| 240 | EEP_RX_MASK, |
Senthil Balasubramanian | 15c9ee7 | 2010-04-15 17:39:14 -0400 | [diff] [blame] | 241 | EEP_FSTCLK_5G, |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 242 | EEP_RXGAIN_TYPE, |
Senthil Balasubramanian | 8bd1d07 | 2009-02-12 13:57:03 +0530 | [diff] [blame] | 243 | EEP_OL_PWRCTRL, |
Senthil Balasubramanian | 15c9ee7 | 2010-04-15 17:39:14 -0400 | [diff] [blame] | 244 | EEP_TXGAIN_TYPE, |
Senthil Balasubramanian | 8bd1d07 | 2009-02-12 13:57:03 +0530 | [diff] [blame] | 245 | EEP_RC_CHAIN_MASK, |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 246 | EEP_DAC_HPWR_5G, |
Vivek Natarajan | ac88b6e | 2009-07-23 10:59:57 +0530 | [diff] [blame] | 247 | EEP_FRAC_N_5G, |
| 248 | EEP_DEV_TYPE, |
| 249 | EEP_TEMPSENSE_SLOPE, |
| 250 | EEP_TEMPSENSE_SLOPE_PAL_ON, |
Senthil Balasubramanian | 15c9ee7 | 2010-04-15 17:39:14 -0400 | [diff] [blame] | 251 | EEP_PWR_TABLE_OFFSET, |
| 252 | EEP_DRIVE_STRENGTH, |
| 253 | EEP_INTERNAL_REGULATOR, |
Felix Fietkau | 4935250 | 2010-06-12 00:33:59 -0400 | [diff] [blame] | 254 | EEP_SWREG, |
| 255 | EEP_PAPRD, |
Vasanthakumar Thiagarajan | 754dc53 | 2010-09-02 01:34:41 -0700 | [diff] [blame] | 256 | EEP_MODAL_VER, |
| 257 | EEP_ANT_DIV_CTL1, |
Mohammed Shafi Shajakhan | ea066d5 | 2010-11-23 20:42:27 +0530 | [diff] [blame] | 258 | EEP_CHAIN_MASK_REDUCE |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 259 | }; |
| 260 | |
| 261 | enum ar5416_rates { |
| 262 | rate6mb, rate9mb, rate12mb, rate18mb, |
| 263 | rate24mb, rate36mb, rate48mb, rate54mb, |
| 264 | rate1l, rate2l, rate2s, rate5_5l, |
| 265 | rate5_5s, rate11l, rate11s, rateXr, |
| 266 | rateHt20_0, rateHt20_1, rateHt20_2, rateHt20_3, |
| 267 | rateHt20_4, rateHt20_5, rateHt20_6, rateHt20_7, |
| 268 | rateHt40_0, rateHt40_1, rateHt40_2, rateHt40_3, |
| 269 | rateHt40_4, rateHt40_5, rateHt40_6, rateHt40_7, |
| 270 | rateDupCck, rateDupOfdm, rateExtCck, rateExtOfdm, |
| 271 | Ar5416RateSize |
| 272 | }; |
| 273 | |
| 274 | enum ath9k_hal_freq_band { |
| 275 | ATH9K_HAL_FREQ_BAND_5GHZ = 0, |
| 276 | ATH9K_HAL_FREQ_BAND_2GHZ = 1 |
| 277 | }; |
| 278 | |
| 279 | struct base_eep_header { |
| 280 | u16 length; |
| 281 | u16 checksum; |
| 282 | u16 version; |
| 283 | u8 opCapFlags; |
| 284 | u8 eepMisc; |
| 285 | u16 regDmn[2]; |
| 286 | u8 macAddr[6]; |
| 287 | u8 rxMask; |
| 288 | u8 txMask; |
| 289 | u16 rfSilent; |
| 290 | u16 blueToothOptions; |
| 291 | u16 deviceCap; |
| 292 | u32 binBuildNumber; |
| 293 | u8 deviceType; |
| 294 | u8 pwdclkind; |
Felix Fietkau | 5b75d0f | 2010-04-26 15:04:34 -0400 | [diff] [blame] | 295 | u8 fastClk5g; |
| 296 | u8 divChain; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 297 | u8 rxGainType; |
| 298 | u8 dacHiPwrMode_5G; |
Senthil Balasubramanian | 8bd1d07 | 2009-02-12 13:57:03 +0530 | [diff] [blame] | 299 | u8 openLoopPwrCntl; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 300 | u8 dacLpMode; |
| 301 | u8 txGainType; |
| 302 | u8 rcChainMask; |
| 303 | u8 desiredScaleCCK; |
Senthil Balasubramanian | e41f0bf | 2009-09-18 15:08:20 +0530 | [diff] [blame] | 304 | u8 pwr_table_offset; |
Sujith | 06d0f06 | 2009-02-12 10:06:45 +0530 | [diff] [blame] | 305 | u8 frac_n_5g; |
| 306 | u8 futureBase_3[21]; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 307 | } __packed; |
| 308 | |
| 309 | struct base_eep_header_4k { |
| 310 | u16 length; |
| 311 | u16 checksum; |
| 312 | u16 version; |
| 313 | u8 opCapFlags; |
| 314 | u8 eepMisc; |
| 315 | u16 regDmn[2]; |
| 316 | u8 macAddr[6]; |
| 317 | u8 rxMask; |
| 318 | u8 txMask; |
| 319 | u16 rfSilent; |
| 320 | u16 blueToothOptions; |
| 321 | u16 deviceCap; |
| 322 | u32 binBuildNumber; |
| 323 | u8 deviceType; |
Senthil Balasubramanian | 4e84516 | 2009-03-06 11:24:10 +0530 | [diff] [blame] | 324 | u8 txGainType; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 325 | } __packed; |
| 326 | |
| 327 | |
| 328 | struct spur_chan { |
| 329 | u16 spurChan; |
| 330 | u8 spurRangeLow; |
| 331 | u8 spurRangeHigh; |
| 332 | } __packed; |
| 333 | |
| 334 | struct modal_eep_header { |
| 335 | u32 antCtrlChain[AR5416_MAX_CHAINS]; |
| 336 | u32 antCtrlCommon; |
| 337 | u8 antennaGainCh[AR5416_MAX_CHAINS]; |
| 338 | u8 switchSettling; |
| 339 | u8 txRxAttenCh[AR5416_MAX_CHAINS]; |
| 340 | u8 rxTxMarginCh[AR5416_MAX_CHAINS]; |
| 341 | u8 adcDesiredSize; |
| 342 | u8 pgaDesiredSize; |
| 343 | u8 xlnaGainCh[AR5416_MAX_CHAINS]; |
| 344 | u8 txEndToXpaOff; |
| 345 | u8 txEndToRxOn; |
| 346 | u8 txFrameToXpaOn; |
| 347 | u8 thresh62; |
| 348 | u8 noiseFloorThreshCh[AR5416_MAX_CHAINS]; |
| 349 | u8 xpdGain; |
| 350 | u8 xpd; |
| 351 | u8 iqCalICh[AR5416_MAX_CHAINS]; |
| 352 | u8 iqCalQCh[AR5416_MAX_CHAINS]; |
| 353 | u8 pdGainOverlap; |
| 354 | u8 ob; |
| 355 | u8 db; |
| 356 | u8 xpaBiasLvl; |
| 357 | u8 pwrDecreaseFor2Chain; |
| 358 | u8 pwrDecreaseFor3Chain; |
| 359 | u8 txFrameToDataStart; |
| 360 | u8 txFrameToPaOn; |
| 361 | u8 ht40PowerIncForPdadc; |
| 362 | u8 bswAtten[AR5416_MAX_CHAINS]; |
| 363 | u8 bswMargin[AR5416_MAX_CHAINS]; |
| 364 | u8 swSettleHt40; |
| 365 | u8 xatten2Db[AR5416_MAX_CHAINS]; |
| 366 | u8 xatten2Margin[AR5416_MAX_CHAINS]; |
| 367 | u8 ob_ch1; |
| 368 | u8 db_ch1; |
Felix Fietkau | f67e07e | 2010-12-01 19:07:47 +0100 | [diff] [blame] | 369 | u8 lna_ctl; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 370 | u8 miscBits; |
| 371 | u16 xpaBiasLvlFreq[3]; |
| 372 | u8 futureModal[6]; |
| 373 | |
Felix Fietkau | 4ddfcd7 | 2010-12-12 00:51:08 +0100 | [diff] [blame] | 374 | struct spur_chan spurChans[AR_EEPROM_MODAL_SPURS]; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 375 | } __packed; |
| 376 | |
Senthil Balasubramanian | 8bd1d07 | 2009-02-12 13:57:03 +0530 | [diff] [blame] | 377 | struct calDataPerFreqOpLoop { |
| 378 | u8 pwrPdg[2][5]; |
| 379 | u8 vpdPdg[2][5]; |
| 380 | u8 pcdac[2][5]; |
| 381 | u8 empty[2][5]; |
| 382 | } __packed; |
| 383 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 384 | struct modal_eep_4k_header { |
Sujith | c16c9d0 | 2009-08-07 09:45:11 +0530 | [diff] [blame] | 385 | u32 antCtrlChain[AR5416_EEP4K_MAX_CHAINS]; |
| 386 | u32 antCtrlCommon; |
| 387 | u8 antennaGainCh[AR5416_EEP4K_MAX_CHAINS]; |
| 388 | u8 switchSettling; |
| 389 | u8 txRxAttenCh[AR5416_EEP4K_MAX_CHAINS]; |
| 390 | u8 rxTxMarginCh[AR5416_EEP4K_MAX_CHAINS]; |
| 391 | u8 adcDesiredSize; |
| 392 | u8 pgaDesiredSize; |
| 393 | u8 xlnaGainCh[AR5416_EEP4K_MAX_CHAINS]; |
| 394 | u8 txEndToXpaOff; |
| 395 | u8 txEndToRxOn; |
| 396 | u8 txFrameToXpaOn; |
| 397 | u8 thresh62; |
| 398 | u8 noiseFloorThreshCh[AR5416_EEP4K_MAX_CHAINS]; |
| 399 | u8 xpdGain; |
| 400 | u8 xpd; |
| 401 | u8 iqCalICh[AR5416_EEP4K_MAX_CHAINS]; |
| 402 | u8 iqCalQCh[AR5416_EEP4K_MAX_CHAINS]; |
| 403 | u8 pdGainOverlap; |
Sujith | 7f63845 | 2009-08-07 09:45:23 +0530 | [diff] [blame] | 404 | #ifdef __BIG_ENDIAN_BITFIELD |
| 405 | u8 ob_1:4, ob_0:4; |
| 406 | u8 db1_1:4, db1_0:4; |
| 407 | #else |
| 408 | u8 ob_0:4, ob_1:4; |
| 409 | u8 db1_0:4, db1_1:4; |
| 410 | #endif |
Sujith | c16c9d0 | 2009-08-07 09:45:11 +0530 | [diff] [blame] | 411 | u8 xpaBiasLvl; |
| 412 | u8 txFrameToDataStart; |
| 413 | u8 txFrameToPaOn; |
| 414 | u8 ht40PowerIncForPdadc; |
| 415 | u8 bswAtten[AR5416_EEP4K_MAX_CHAINS]; |
| 416 | u8 bswMargin[AR5416_EEP4K_MAX_CHAINS]; |
| 417 | u8 swSettleHt40; |
| 418 | u8 xatten2Db[AR5416_EEP4K_MAX_CHAINS]; |
| 419 | u8 xatten2Margin[AR5416_EEP4K_MAX_CHAINS]; |
Sujith | 7f63845 | 2009-08-07 09:45:23 +0530 | [diff] [blame] | 420 | #ifdef __BIG_ENDIAN_BITFIELD |
| 421 | u8 db2_1:4, db2_0:4; |
| 422 | #else |
| 423 | u8 db2_0:4, db2_1:4; |
| 424 | #endif |
Sujith | c16c9d0 | 2009-08-07 09:45:11 +0530 | [diff] [blame] | 425 | u8 version; |
Sujith | 7f63845 | 2009-08-07 09:45:23 +0530 | [diff] [blame] | 426 | #ifdef __BIG_ENDIAN_BITFIELD |
| 427 | u8 ob_3:4, ob_2:4; |
| 428 | u8 antdiv_ctl1:4, ob_4:4; |
| 429 | u8 db1_3:4, db1_2:4; |
| 430 | u8 antdiv_ctl2:4, db1_4:4; |
| 431 | u8 db2_2:4, db2_3:4; |
| 432 | u8 reserved:4, db2_4:4; |
| 433 | #else |
| 434 | u8 ob_2:4, ob_3:4; |
| 435 | u8 ob_4:4, antdiv_ctl1:4; |
| 436 | u8 db1_2:4, db1_3:4; |
| 437 | u8 db1_4:4, antdiv_ctl2:4; |
| 438 | u8 db2_2:4, db2_3:4; |
| 439 | u8 db2_4:4, reserved:4; |
| 440 | #endif |
Sujith | c16c9d0 | 2009-08-07 09:45:11 +0530 | [diff] [blame] | 441 | u8 futureModal[4]; |
Felix Fietkau | 4ddfcd7 | 2010-12-12 00:51:08 +0100 | [diff] [blame] | 442 | struct spur_chan spurChans[AR_EEPROM_MODAL_SPURS]; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 443 | } __packed; |
| 444 | |
Vivek Natarajan | ac88b6e | 2009-07-23 10:59:57 +0530 | [diff] [blame] | 445 | struct base_eep_ar9287_header { |
Sujith | c16c9d0 | 2009-08-07 09:45:11 +0530 | [diff] [blame] | 446 | u16 length; |
| 447 | u16 checksum; |
| 448 | u16 version; |
| 449 | u8 opCapFlags; |
| 450 | u8 eepMisc; |
| 451 | u16 regDmn[2]; |
| 452 | u8 macAddr[6]; |
| 453 | u8 rxMask; |
| 454 | u8 txMask; |
| 455 | u16 rfSilent; |
| 456 | u16 blueToothOptions; |
| 457 | u16 deviceCap; |
| 458 | u32 binBuildNumber; |
| 459 | u8 deviceType; |
| 460 | u8 openLoopPwrCntl; |
| 461 | int8_t pwrTableOffset; |
| 462 | int8_t tempSensSlope; |
| 463 | int8_t tempSensSlopePalOn; |
| 464 | u8 futureBase[29]; |
Vivek Natarajan | ac88b6e | 2009-07-23 10:59:57 +0530 | [diff] [blame] | 465 | } __packed; |
| 466 | |
| 467 | struct modal_eep_ar9287_header { |
Sujith | c16c9d0 | 2009-08-07 09:45:11 +0530 | [diff] [blame] | 468 | u32 antCtrlChain[AR9287_MAX_CHAINS]; |
| 469 | u32 antCtrlCommon; |
| 470 | int8_t antennaGainCh[AR9287_MAX_CHAINS]; |
| 471 | u8 switchSettling; |
| 472 | u8 txRxAttenCh[AR9287_MAX_CHAINS]; |
| 473 | u8 rxTxMarginCh[AR9287_MAX_CHAINS]; |
| 474 | int8_t adcDesiredSize; |
| 475 | u8 txEndToXpaOff; |
| 476 | u8 txEndToRxOn; |
| 477 | u8 txFrameToXpaOn; |
| 478 | u8 thresh62; |
| 479 | int8_t noiseFloorThreshCh[AR9287_MAX_CHAINS]; |
| 480 | u8 xpdGain; |
| 481 | u8 xpd; |
| 482 | int8_t iqCalICh[AR9287_MAX_CHAINS]; |
| 483 | int8_t iqCalQCh[AR9287_MAX_CHAINS]; |
| 484 | u8 pdGainOverlap; |
| 485 | u8 xpaBiasLvl; |
| 486 | u8 txFrameToDataStart; |
| 487 | u8 txFrameToPaOn; |
| 488 | u8 ht40PowerIncForPdadc; |
| 489 | u8 bswAtten[AR9287_MAX_CHAINS]; |
| 490 | u8 bswMargin[AR9287_MAX_CHAINS]; |
| 491 | u8 swSettleHt40; |
| 492 | u8 version; |
| 493 | u8 db1; |
| 494 | u8 db2; |
| 495 | u8 ob_cck; |
| 496 | u8 ob_psk; |
| 497 | u8 ob_qam; |
| 498 | u8 ob_pal_off; |
| 499 | u8 futureModal[30]; |
Felix Fietkau | 4ddfcd7 | 2010-12-12 00:51:08 +0100 | [diff] [blame] | 500 | struct spur_chan spurChans[AR_EEPROM_MODAL_SPURS]; |
Vivek Natarajan | ac88b6e | 2009-07-23 10:59:57 +0530 | [diff] [blame] | 501 | } __packed; |
| 502 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 503 | struct cal_data_per_freq { |
| 504 | u8 pwrPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; |
| 505 | u8 vpdPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; |
| 506 | } __packed; |
| 507 | |
| 508 | struct cal_data_per_freq_4k { |
Felix Fietkau | 4ddfcd7 | 2010-12-12 00:51:08 +0100 | [diff] [blame] | 509 | u8 pwrPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; |
| 510 | u8 vpdPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 511 | } __packed; |
| 512 | |
| 513 | struct cal_target_power_leg { |
| 514 | u8 bChannel; |
| 515 | u8 tPow2x[4]; |
| 516 | } __packed; |
| 517 | |
| 518 | struct cal_target_power_ht { |
| 519 | u8 bChannel; |
| 520 | u8 tPow2x[8]; |
| 521 | } __packed; |
| 522 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 523 | struct cal_ctl_edges { |
| 524 | u8 bChannel; |
Felix Fietkau | e702ba1 | 2010-12-01 19:07:46 +0100 | [diff] [blame] | 525 | u8 ctl; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 526 | } __packed; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 527 | |
Vivek Natarajan | ac88b6e | 2009-07-23 10:59:57 +0530 | [diff] [blame] | 528 | struct cal_data_op_loop_ar9287 { |
| 529 | u8 pwrPdg[2][5]; |
| 530 | u8 vpdPdg[2][5]; |
| 531 | u8 pcdac[2][5]; |
| 532 | u8 empty[2][5]; |
| 533 | } __packed; |
| 534 | |
Vivek Natarajan | ac88b6e | 2009-07-23 10:59:57 +0530 | [diff] [blame] | 535 | struct cal_data_per_freq_ar9287 { |
Felix Fietkau | 4ddfcd7 | 2010-12-12 00:51:08 +0100 | [diff] [blame] | 536 | u8 pwrPdg[AR5416_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS]; |
| 537 | u8 vpdPdg[AR5416_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS]; |
Vivek Natarajan | ac88b6e | 2009-07-23 10:59:57 +0530 | [diff] [blame] | 538 | } __packed; |
| 539 | |
| 540 | union cal_data_per_freq_ar9287_u { |
| 541 | struct cal_data_op_loop_ar9287 calDataOpen; |
| 542 | struct cal_data_per_freq_ar9287 calDataClose; |
| 543 | } __packed; |
| 544 | |
| 545 | struct cal_ctl_data_ar9287 { |
| 546 | struct cal_ctl_edges |
| 547 | ctlEdges[AR9287_MAX_CHAINS][AR9287_NUM_BAND_EDGES]; |
| 548 | } __packed; |
| 549 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 550 | struct cal_ctl_data { |
| 551 | struct cal_ctl_edges |
| 552 | ctlEdges[AR5416_MAX_CHAINS][AR5416_NUM_BAND_EDGES]; |
| 553 | } __packed; |
| 554 | |
| 555 | struct cal_ctl_data_4k { |
| 556 | struct cal_ctl_edges |
| 557 | ctlEdges[AR5416_EEP4K_MAX_CHAINS][AR5416_EEP4K_NUM_BAND_EDGES]; |
| 558 | } __packed; |
| 559 | |
| 560 | struct ar5416_eeprom_def { |
| 561 | struct base_eep_header baseEepHeader; |
| 562 | u8 custData[64]; |
| 563 | struct modal_eep_header modalHeader[2]; |
| 564 | u8 calFreqPier5G[AR5416_NUM_5G_CAL_PIERS]; |
| 565 | u8 calFreqPier2G[AR5416_NUM_2G_CAL_PIERS]; |
| 566 | struct cal_data_per_freq |
| 567 | calPierData5G[AR5416_MAX_CHAINS][AR5416_NUM_5G_CAL_PIERS]; |
| 568 | struct cal_data_per_freq |
| 569 | calPierData2G[AR5416_MAX_CHAINS][AR5416_NUM_2G_CAL_PIERS]; |
| 570 | struct cal_target_power_leg |
| 571 | calTargetPower5G[AR5416_NUM_5G_20_TARGET_POWERS]; |
| 572 | struct cal_target_power_ht |
| 573 | calTargetPower5GHT20[AR5416_NUM_5G_20_TARGET_POWERS]; |
| 574 | struct cal_target_power_ht |
| 575 | calTargetPower5GHT40[AR5416_NUM_5G_40_TARGET_POWERS]; |
| 576 | struct cal_target_power_leg |
| 577 | calTargetPowerCck[AR5416_NUM_2G_CCK_TARGET_POWERS]; |
| 578 | struct cal_target_power_leg |
| 579 | calTargetPower2G[AR5416_NUM_2G_20_TARGET_POWERS]; |
| 580 | struct cal_target_power_ht |
| 581 | calTargetPower2GHT20[AR5416_NUM_2G_20_TARGET_POWERS]; |
| 582 | struct cal_target_power_ht |
| 583 | calTargetPower2GHT40[AR5416_NUM_2G_40_TARGET_POWERS]; |
| 584 | u8 ctlIndex[AR5416_NUM_CTLS]; |
| 585 | struct cal_ctl_data ctlData[AR5416_NUM_CTLS]; |
| 586 | u8 padding; |
| 587 | } __packed; |
| 588 | |
| 589 | struct ar5416_eeprom_4k { |
| 590 | struct base_eep_header_4k baseEepHeader; |
| 591 | u8 custData[20]; |
| 592 | struct modal_eep_4k_header modalHeader; |
| 593 | u8 calFreqPier2G[AR5416_EEP4K_NUM_2G_CAL_PIERS]; |
| 594 | struct cal_data_per_freq_4k |
| 595 | calPierData2G[AR5416_EEP4K_MAX_CHAINS][AR5416_EEP4K_NUM_2G_CAL_PIERS]; |
| 596 | struct cal_target_power_leg |
| 597 | calTargetPowerCck[AR5416_EEP4K_NUM_2G_CCK_TARGET_POWERS]; |
| 598 | struct cal_target_power_leg |
| 599 | calTargetPower2G[AR5416_EEP4K_NUM_2G_20_TARGET_POWERS]; |
| 600 | struct cal_target_power_ht |
| 601 | calTargetPower2GHT20[AR5416_EEP4K_NUM_2G_20_TARGET_POWERS]; |
| 602 | struct cal_target_power_ht |
| 603 | calTargetPower2GHT40[AR5416_EEP4K_NUM_2G_40_TARGET_POWERS]; |
| 604 | u8 ctlIndex[AR5416_EEP4K_NUM_CTLS]; |
| 605 | struct cal_ctl_data_4k ctlData[AR5416_EEP4K_NUM_CTLS]; |
| 606 | u8 padding; |
| 607 | } __packed; |
| 608 | |
Luis R. Rodriguez | 475f598 | 2009-08-03 17:31:25 -0400 | [diff] [blame] | 609 | struct ar9287_eeprom { |
Sujith | c16c9d0 | 2009-08-07 09:45:11 +0530 | [diff] [blame] | 610 | struct base_eep_ar9287_header baseEepHeader; |
Vivek Natarajan | ac88b6e | 2009-07-23 10:59:57 +0530 | [diff] [blame] | 611 | u8 custData[AR9287_DATA_SZ]; |
| 612 | struct modal_eep_ar9287_header modalHeader; |
| 613 | u8 calFreqPier2G[AR9287_NUM_2G_CAL_PIERS]; |
| 614 | union cal_data_per_freq_ar9287_u |
Sujith | c16c9d0 | 2009-08-07 09:45:11 +0530 | [diff] [blame] | 615 | calPierData2G[AR9287_MAX_CHAINS][AR9287_NUM_2G_CAL_PIERS]; |
Vivek Natarajan | ac88b6e | 2009-07-23 10:59:57 +0530 | [diff] [blame] | 616 | struct cal_target_power_leg |
Sujith | c16c9d0 | 2009-08-07 09:45:11 +0530 | [diff] [blame] | 617 | calTargetPowerCck[AR9287_NUM_2G_CCK_TARGET_POWERS]; |
Vivek Natarajan | ac88b6e | 2009-07-23 10:59:57 +0530 | [diff] [blame] | 618 | struct cal_target_power_leg |
Sujith | c16c9d0 | 2009-08-07 09:45:11 +0530 | [diff] [blame] | 619 | calTargetPower2G[AR9287_NUM_2G_20_TARGET_POWERS]; |
Vivek Natarajan | ac88b6e | 2009-07-23 10:59:57 +0530 | [diff] [blame] | 620 | struct cal_target_power_ht |
Sujith | c16c9d0 | 2009-08-07 09:45:11 +0530 | [diff] [blame] | 621 | calTargetPower2GHT20[AR9287_NUM_2G_20_TARGET_POWERS]; |
Vivek Natarajan | ac88b6e | 2009-07-23 10:59:57 +0530 | [diff] [blame] | 622 | struct cal_target_power_ht |
Sujith | c16c9d0 | 2009-08-07 09:45:11 +0530 | [diff] [blame] | 623 | calTargetPower2GHT40[AR9287_NUM_2G_40_TARGET_POWERS]; |
Vivek Natarajan | ac88b6e | 2009-07-23 10:59:57 +0530 | [diff] [blame] | 624 | u8 ctlIndex[AR9287_NUM_CTLS]; |
| 625 | struct cal_ctl_data_ar9287 ctlData[AR9287_NUM_CTLS]; |
| 626 | u8 padding; |
| 627 | } __packed; |
| 628 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 629 | enum reg_ext_bitmap { |
Senthil Balasubramanian | ebb90cf | 2009-09-18 15:07:33 +0530 | [diff] [blame] | 630 | REG_EXT_FCC_MIDBAND = 0, |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 631 | REG_EXT_JAPAN_MIDBAND = 1, |
| 632 | REG_EXT_FCC_DFS_HT40 = 2, |
| 633 | REG_EXT_JAPAN_NONDFS_HT40 = 3, |
| 634 | REG_EXT_JAPAN_DFS_HT40 = 4 |
| 635 | }; |
| 636 | |
| 637 | struct ath9k_country_entry { |
| 638 | u16 countryCode; |
| 639 | u16 regDmnEnum; |
| 640 | u16 regDmn5G; |
| 641 | u16 regDmn2G; |
| 642 | u8 isMultidomain; |
| 643 | u8 iso[3]; |
| 644 | }; |
| 645 | |
Sujith | e153789 | 2009-02-09 13:27:15 +0530 | [diff] [blame] | 646 | struct eeprom_ops { |
| 647 | int (*check_eeprom)(struct ath_hw *hw); |
| 648 | u32 (*get_eeprom)(struct ath_hw *hw, enum eeprom_param param); |
| 649 | bool (*fill_eeprom)(struct ath_hw *hw); |
| 650 | int (*get_eeprom_ver)(struct ath_hw *hw); |
| 651 | int (*get_eeprom_rev)(struct ath_hw *hw); |
Sujith | d650915 | 2009-03-13 08:56:05 +0530 | [diff] [blame] | 652 | void (*set_board_values)(struct ath_hw *hw, struct ath9k_channel *chan); |
Sujith | e153789 | 2009-02-09 13:27:15 +0530 | [diff] [blame] | 653 | void (*set_addac)(struct ath_hw *hw, struct ath9k_channel *chan); |
Vasanthakumar Thiagarajan | 8fbff4b | 2009-05-08 17:54:51 -0700 | [diff] [blame] | 654 | void (*set_txpower)(struct ath_hw *hw, struct ath9k_channel *chan, |
Sujith | e153789 | 2009-02-09 13:27:15 +0530 | [diff] [blame] | 655 | u16 cfgCtl, u8 twiceAntennaReduction, |
Felix Fietkau | de40f31 | 2010-10-20 03:08:53 +0200 | [diff] [blame] | 656 | u8 twiceMaxRegulatoryPower, u8 powerLimit, |
| 657 | bool test); |
Sujith | e153789 | 2009-02-09 13:27:15 +0530 | [diff] [blame] | 658 | u16 (*get_spur_channel)(struct ath_hw *ah, u16 i, bool is2GHz); |
| 659 | }; |
| 660 | |
Sujith | 79d7f4b | 2010-06-01 15:14:06 +0530 | [diff] [blame] | 661 | void ath9k_hw_analog_shift_regwrite(struct ath_hw *ah, u32 reg, u32 val); |
Sujith | b5aec95 | 2009-08-07 09:45:15 +0530 | [diff] [blame] | 662 | void ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask, |
| 663 | u32 shift, u32 val); |
| 664 | int16_t ath9k_hw_interpolate(u16 target, u16 srcLeft, u16 srcRight, |
| 665 | int16_t targetLeft, |
| 666 | int16_t targetRight); |
| 667 | bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize, |
| 668 | u16 *indexL, u16 *indexR); |
Luis R. Rodriguez | 5bb1279 | 2009-09-14 00:55:09 -0700 | [diff] [blame] | 669 | bool ath9k_hw_nvram_read(struct ath_common *common, u32 off, u16 *data); |
Sujith | b5aec95 | 2009-08-07 09:45:15 +0530 | [diff] [blame] | 670 | void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList, |
| 671 | u8 *pVpdList, u16 numIntercepts, |
| 672 | u8 *pRetVpdList); |
| 673 | void ath9k_hw_get_legacy_target_powers(struct ath_hw *ah, |
| 674 | struct ath9k_channel *chan, |
| 675 | struct cal_target_power_leg *powInfo, |
| 676 | u16 numChannels, |
| 677 | struct cal_target_power_leg *pNewPower, |
| 678 | u16 numRates, bool isExtTarget); |
| 679 | void ath9k_hw_get_target_powers(struct ath_hw *ah, |
| 680 | struct ath9k_channel *chan, |
| 681 | struct cal_target_power_ht *powInfo, |
| 682 | u16 numChannels, |
| 683 | struct cal_target_power_ht *pNewPower, |
| 684 | u16 numRates, bool isHt40Target); |
| 685 | u16 ath9k_hw_get_max_edge_power(u16 freq, struct cal_ctl_edges *pRdEdgesPower, |
| 686 | bool is2GHz, int num_band_edges); |
Sujith | a55f858 | 2010-06-01 15:14:07 +0530 | [diff] [blame] | 687 | void ath9k_hw_update_regulatory_maxpower(struct ath_hw *ah); |
Sujith | b5aec95 | 2009-08-07 09:45:15 +0530 | [diff] [blame] | 688 | int ath9k_hw_eeprom_init(struct ath_hw *ah); |
| 689 | |
Felix Fietkau | 115277a | 2010-12-12 00:51:09 +0100 | [diff] [blame] | 690 | void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah, |
| 691 | struct ath9k_channel *chan, |
| 692 | void *pRawDataSet, |
| 693 | u8 *bChans, u16 availPiers, |
| 694 | u16 tPdGainOverlap, |
| 695 | u16 *pPdGainBoundaries, u8 *pPDADCValues, |
| 696 | u16 numXpdGains); |
| 697 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 698 | #define ar5416_get_ntxchains(_txchainmask) \ |
Sujith | f74df6f | 2009-02-09 13:27:24 +0530 | [diff] [blame] | 699 | (((_txchainmask >> 2) & 1) + \ |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 700 | ((_txchainmask >> 1) & 1) + (_txchainmask & 1)) |
| 701 | |
Sujith | b5aec95 | 2009-08-07 09:45:15 +0530 | [diff] [blame] | 702 | extern const struct eeprom_ops eep_def_ops; |
| 703 | extern const struct eeprom_ops eep_4k_ops; |
Luis R. Rodriguez | 0b8f6f2b1 | 2010-04-15 17:39:12 -0400 | [diff] [blame] | 704 | extern const struct eeprom_ops eep_ar9287_ops; |
Senthil Balasubramanian | 15c9ee7 | 2010-04-15 17:39:14 -0400 | [diff] [blame] | 705 | extern const struct eeprom_ops eep_ar9287_ops; |
| 706 | extern const struct eeprom_ops eep_ar9300_ops; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 707 | |
| 708 | #endif /* EEPROM_H */ |