1203c4805SLuis R. Rodriguez /* 2203c4805SLuis R. Rodriguez * Copyright (c) 2008-2009 Atheros Communications Inc. 3203c4805SLuis R. Rodriguez * 4203c4805SLuis R. Rodriguez * Permission to use, copy, modify, and/or distribute this software for any 5203c4805SLuis R. Rodriguez * purpose with or without fee is hereby granted, provided that the above 6203c4805SLuis R. Rodriguez * copyright notice and this permission notice appear in all copies. 7203c4805SLuis R. Rodriguez * 8203c4805SLuis R. Rodriguez * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9203c4805SLuis R. Rodriguez * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10203c4805SLuis R. Rodriguez * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11203c4805SLuis R. Rodriguez * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12203c4805SLuis R. Rodriguez * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13203c4805SLuis R. Rodriguez * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14203c4805SLuis R. Rodriguez * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15203c4805SLuis R. Rodriguez */ 16203c4805SLuis R. Rodriguez 17203c4805SLuis R. Rodriguez #ifndef EEPROM_H 18203c4805SLuis R. Rodriguez #define EEPROM_H 19203c4805SLuis R. Rodriguez 205bb12791SLuis R. Rodriguez #include "../ath.h" 21d3236553SJohannes Berg #include <net/cfg80211.h> 2215c9ee7aSSenthil Balasubramanian #include "ar9003_eeprom.h" 23203c4805SLuis R. Rodriguez 24203c4805SLuis R. Rodriguez #define AH_USE_EEPROM 0x1 25203c4805SLuis R. Rodriguez 26203c4805SLuis R. Rodriguez #ifdef __BIG_ENDIAN 27203c4805SLuis R. Rodriguez #define AR5416_EEPROM_MAGIC 0x5aa5 28203c4805SLuis R. Rodriguez #else 29203c4805SLuis R. Rodriguez #define AR5416_EEPROM_MAGIC 0xa55a 30203c4805SLuis R. Rodriguez #endif 31203c4805SLuis R. Rodriguez 32203c4805SLuis R. Rodriguez #define CTRY_DEBUG 0x1ff 33203c4805SLuis R. Rodriguez #define CTRY_DEFAULT 0 34203c4805SLuis R. Rodriguez 35203c4805SLuis R. Rodriguez #define AR_EEPROM_EEPCAP_COMPRESS_DIS 0x0001 36203c4805SLuis R. Rodriguez #define AR_EEPROM_EEPCAP_AES_DIS 0x0002 37203c4805SLuis R. Rodriguez #define AR_EEPROM_EEPCAP_FASTFRAME_DIS 0x0004 38203c4805SLuis R. Rodriguez #define AR_EEPROM_EEPCAP_BURST_DIS 0x0008 39203c4805SLuis R. Rodriguez #define AR_EEPROM_EEPCAP_MAXQCU 0x01F0 40203c4805SLuis R. Rodriguez #define AR_EEPROM_EEPCAP_MAXQCU_S 4 41203c4805SLuis R. Rodriguez #define AR_EEPROM_EEPCAP_HEAVY_CLIP_EN 0x0200 42203c4805SLuis R. Rodriguez #define AR_EEPROM_EEPCAP_KC_ENTRIES 0xF000 43203c4805SLuis R. Rodriguez #define AR_EEPROM_EEPCAP_KC_ENTRIES_S 12 44203c4805SLuis R. Rodriguez 45203c4805SLuis R. Rodriguez #define AR_EEPROM_EEREGCAP_EN_FCC_MIDBAND 0x0040 46203c4805SLuis R. Rodriguez #define AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN 0x0080 47203c4805SLuis R. Rodriguez #define AR_EEPROM_EEREGCAP_EN_KK_U2 0x0100 48203c4805SLuis R. Rodriguez #define AR_EEPROM_EEREGCAP_EN_KK_MIDBAND 0x0200 49203c4805SLuis R. Rodriguez #define AR_EEPROM_EEREGCAP_EN_KK_U1_ODD 0x0400 50203c4805SLuis R. Rodriguez #define AR_EEPROM_EEREGCAP_EN_KK_NEW_11A 0x0800 51203c4805SLuis R. Rodriguez 52203c4805SLuis R. Rodriguez #define AR_EEPROM_EEREGCAP_EN_KK_U1_ODD_PRE4_0 0x4000 53203c4805SLuis R. Rodriguez #define AR_EEPROM_EEREGCAP_EN_KK_NEW_11A_PRE4_0 0x8000 54203c4805SLuis R. Rodriguez 55203c4805SLuis R. Rodriguez #define AR5416_EEPROM_MAGIC_OFFSET 0x0 56203c4805SLuis R. Rodriguez #define AR5416_EEPROM_S 2 57203c4805SLuis R. Rodriguez #define AR5416_EEPROM_OFFSET 0x2000 58203c4805SLuis R. Rodriguez #define AR5416_EEPROM_MAX 0xae0 59203c4805SLuis R. Rodriguez 60203c4805SLuis R. Rodriguez #define AR5416_EEPROM_START_ADDR \ 61203c4805SLuis R. Rodriguez (AR_SREV_9100(ah)) ? 0x1fff1000 : 0x503f1200 62203c4805SLuis R. Rodriguez 63203c4805SLuis R. Rodriguez #define SD_NO_CTL 0xE0 64203c4805SLuis R. Rodriguez #define NO_CTL 0xff 65203c4805SLuis R. Rodriguez #define CTL_MODE_M 7 66203c4805SLuis R. Rodriguez #define CTL_11A 0 67203c4805SLuis R. Rodriguez #define CTL_11B 1 68203c4805SLuis R. Rodriguez #define CTL_11G 2 69203c4805SLuis R. Rodriguez #define CTL_2GHT20 5 70203c4805SLuis R. Rodriguez #define CTL_5GHT20 6 71203c4805SLuis R. Rodriguez #define CTL_2GHT40 7 72203c4805SLuis R. Rodriguez #define CTL_5GHT40 8 73203c4805SLuis R. Rodriguez 74203c4805SLuis R. Rodriguez #define EXT_ADDITIVE (0x8000) 75203c4805SLuis R. Rodriguez #define CTL_11A_EXT (CTL_11A | EXT_ADDITIVE) 76203c4805SLuis R. Rodriguez #define CTL_11G_EXT (CTL_11G | EXT_ADDITIVE) 77203c4805SLuis R. Rodriguez #define CTL_11B_EXT (CTL_11B | EXT_ADDITIVE) 78203c4805SLuis R. Rodriguez 79203c4805SLuis R. Rodriguez #define SUB_NUM_CTL_MODES_AT_5G_40 2 80203c4805SLuis R. Rodriguez #define SUB_NUM_CTL_MODES_AT_2G_40 3 81203c4805SLuis R. Rodriguez 82203c4805SLuis R. Rodriguez #define INCREASE_MAXPOW_BY_TWO_CHAIN 6 /* 10*log10(2)*2 */ 83203c4805SLuis R. Rodriguez #define INCREASE_MAXPOW_BY_THREE_CHAIN 10 /* 10*log10(3)*2 */ 84203c4805SLuis R. Rodriguez 85203c4805SLuis R. Rodriguez /* 86203c4805SLuis R. Rodriguez * For AR9285 and later chipsets, the following bits are not being programmed 87203c4805SLuis R. Rodriguez * in EEPROM and so need to be enabled always. 88203c4805SLuis R. Rodriguez * 89203c4805SLuis R. Rodriguez * Bit 0: en_fcc_mid 90203c4805SLuis R. Rodriguez * Bit 1: en_jap_mid 91203c4805SLuis R. Rodriguez * Bit 2: en_fcc_dfs_ht40 92203c4805SLuis R. Rodriguez * Bit 3: en_jap_ht40 93203c4805SLuis R. Rodriguez * Bit 4: en_jap_dfs_ht40 94203c4805SLuis R. Rodriguez */ 95203c4805SLuis R. Rodriguez #define AR9285_RDEXT_DEFAULT 0x1F 96203c4805SLuis R. Rodriguez 97203c4805SLuis R. Rodriguez #define ATH9K_POW_SM(_r, _s) (((_r) & 0x3f) << (_s)) 98203c4805SLuis R. Rodriguez #define FREQ2FBIN(x, y) ((y) ? ((x) - 2300) : (((x) - 4800) / 5)) 99203c4805SLuis R. Rodriguez #define ath9k_hw_use_flash(_ah) (!(_ah->ah_flags & AH_USE_EEPROM)) 100203c4805SLuis R. Rodriguez 101203c4805SLuis R. Rodriguez #define AR5416_VER_MASK (eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) 102203c4805SLuis R. Rodriguez #define OLC_FOR_AR9280_20_LATER (AR_SREV_9280_20_OR_LATER(ah) && \ 103203c4805SLuis R. Rodriguez ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) 104ac88b6ecSVivek Natarajan #define OLC_FOR_AR9287_10_LATER (AR_SREV_9287_10_OR_LATER(ah) && \ 105ac88b6ecSVivek Natarajan ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) 106203c4805SLuis R. Rodriguez 107203c4805SLuis R. Rodriguez #define AR_EEPROM_RFSILENT_GPIO_SEL 0x001c 108203c4805SLuis R. Rodriguez #define AR_EEPROM_RFSILENT_GPIO_SEL_S 2 109203c4805SLuis R. Rodriguez #define AR_EEPROM_RFSILENT_POLARITY 0x0002 110203c4805SLuis R. Rodriguez #define AR_EEPROM_RFSILENT_POLARITY_S 1 111203c4805SLuis R. Rodriguez 112203c4805SLuis R. Rodriguez #define EEP_RFSILENT_ENABLED 0x0001 113203c4805SLuis R. Rodriguez #define EEP_RFSILENT_ENABLED_S 0 114203c4805SLuis R. Rodriguez #define EEP_RFSILENT_POLARITY 0x0002 115203c4805SLuis R. Rodriguez #define EEP_RFSILENT_POLARITY_S 1 116203c4805SLuis R. Rodriguez #define EEP_RFSILENT_GPIO_SEL 0x001c 117203c4805SLuis R. Rodriguez #define EEP_RFSILENT_GPIO_SEL_S 2 118203c4805SLuis R. Rodriguez 119203c4805SLuis R. Rodriguez #define AR5416_OPFLAGS_11A 0x01 120203c4805SLuis R. Rodriguez #define AR5416_OPFLAGS_11G 0x02 121203c4805SLuis R. Rodriguez #define AR5416_OPFLAGS_N_5G_HT40 0x04 122203c4805SLuis R. Rodriguez #define AR5416_OPFLAGS_N_2G_HT40 0x08 123203c4805SLuis R. Rodriguez #define AR5416_OPFLAGS_N_5G_HT20 0x10 124203c4805SLuis R. Rodriguez #define AR5416_OPFLAGS_N_2G_HT20 0x20 125203c4805SLuis R. Rodriguez 126203c4805SLuis R. Rodriguez #define AR5416_EEP_NO_BACK_VER 0x1 127203c4805SLuis R. Rodriguez #define AR5416_EEP_VER 0xE 128203c4805SLuis R. Rodriguez #define AR5416_EEP_VER_MINOR_MASK 0x0FFF 129203c4805SLuis R. Rodriguez #define AR5416_EEP_MINOR_VER_2 0x2 130203c4805SLuis R. Rodriguez #define AR5416_EEP_MINOR_VER_3 0x3 131203c4805SLuis R. Rodriguez #define AR5416_EEP_MINOR_VER_7 0x7 132203c4805SLuis R. Rodriguez #define AR5416_EEP_MINOR_VER_9 0x9 133203c4805SLuis R. Rodriguez #define AR5416_EEP_MINOR_VER_16 0x10 134203c4805SLuis R. Rodriguez #define AR5416_EEP_MINOR_VER_17 0x11 135203c4805SLuis R. Rodriguez #define AR5416_EEP_MINOR_VER_19 0x13 136203c4805SLuis R. Rodriguez #define AR5416_EEP_MINOR_VER_20 0x14 137e41f0bfcSSenthil Balasubramanian #define AR5416_EEP_MINOR_VER_21 0x15 138203c4805SLuis R. Rodriguez #define AR5416_EEP_MINOR_VER_22 0x16 139203c4805SLuis R. Rodriguez 140203c4805SLuis R. Rodriguez #define AR5416_NUM_5G_CAL_PIERS 8 141203c4805SLuis R. Rodriguez #define AR5416_NUM_2G_CAL_PIERS 4 142203c4805SLuis R. Rodriguez #define AR5416_NUM_5G_20_TARGET_POWERS 8 143203c4805SLuis R. Rodriguez #define AR5416_NUM_5G_40_TARGET_POWERS 8 144203c4805SLuis R. Rodriguez #define AR5416_NUM_2G_CCK_TARGET_POWERS 3 145203c4805SLuis R. Rodriguez #define AR5416_NUM_2G_20_TARGET_POWERS 4 146203c4805SLuis R. Rodriguez #define AR5416_NUM_2G_40_TARGET_POWERS 4 147203c4805SLuis R. Rodriguez #define AR5416_NUM_CTLS 24 148203c4805SLuis R. Rodriguez #define AR5416_NUM_BAND_EDGES 8 149203c4805SLuis R. Rodriguez #define AR5416_NUM_PD_GAINS 4 150203c4805SLuis R. Rodriguez #define AR5416_PD_GAINS_IN_MASK 4 151203c4805SLuis R. Rodriguez #define AR5416_PD_GAIN_ICEPTS 5 152203c4805SLuis R. Rodriguez #define AR5416_EEPROM_MODAL_SPURS 5 153203c4805SLuis R. Rodriguez #define AR5416_MAX_RATE_POWER 63 154203c4805SLuis R. Rodriguez #define AR5416_NUM_PDADC_VALUES 128 155203c4805SLuis R. Rodriguez #define AR5416_BCHAN_UNUSED 0xFF 156203c4805SLuis R. Rodriguez #define AR5416_MAX_PWR_RANGE_IN_HALF_DB 64 157203c4805SLuis R. Rodriguez #define AR5416_MAX_CHAINS 3 158df23acaaSLuis R. Rodriguez #define AR9300_MAX_CHAINS 3 159e41f0bfcSSenthil Balasubramanian #define AR5416_PWR_TABLE_OFFSET_DB -5 160203c4805SLuis R. Rodriguez 161203c4805SLuis R. Rodriguez /* Rx gain type values */ 162203c4805SLuis R. Rodriguez #define AR5416_EEP_RXGAIN_23DB_BACKOFF 0 163203c4805SLuis R. Rodriguez #define AR5416_EEP_RXGAIN_13DB_BACKOFF 1 164203c4805SLuis R. Rodriguez #define AR5416_EEP_RXGAIN_ORIG 2 165203c4805SLuis R. Rodriguez 166203c4805SLuis R. Rodriguez /* Tx gain type values */ 167203c4805SLuis R. Rodriguez #define AR5416_EEP_TXGAIN_ORIGINAL 0 168203c4805SLuis R. Rodriguez #define AR5416_EEP_TXGAIN_HIGH_POWER 1 169203c4805SLuis R. Rodriguez 170203c4805SLuis R. Rodriguez #define AR5416_EEP4K_START_LOC 64 171203c4805SLuis R. Rodriguez #define AR5416_EEP4K_NUM_2G_CAL_PIERS 3 172203c4805SLuis R. Rodriguez #define AR5416_EEP4K_NUM_2G_CCK_TARGET_POWERS 3 173203c4805SLuis R. Rodriguez #define AR5416_EEP4K_NUM_2G_20_TARGET_POWERS 3 174203c4805SLuis R. Rodriguez #define AR5416_EEP4K_NUM_2G_40_TARGET_POWERS 3 175203c4805SLuis R. Rodriguez #define AR5416_EEP4K_NUM_CTLS 12 176203c4805SLuis R. Rodriguez #define AR5416_EEP4K_NUM_BAND_EDGES 4 177203c4805SLuis R. Rodriguez #define AR5416_EEP4K_NUM_PD_GAINS 2 178203c4805SLuis R. Rodriguez #define AR5416_EEP4K_PD_GAINS_IN_MASK 4 179203c4805SLuis R. Rodriguez #define AR5416_EEP4K_PD_GAIN_ICEPTS 5 180203c4805SLuis R. Rodriguez #define AR5416_EEP4K_MAX_CHAINS 1 181203c4805SLuis R. Rodriguez 182203c4805SLuis R. Rodriguez #define AR9280_TX_GAIN_TABLE_SIZE 22 183203c4805SLuis R. Rodriguez 184ac88b6ecSVivek Natarajan #define AR9287_EEP_VER 0xE 185ac88b6ecSVivek Natarajan #define AR9287_EEP_VER_MINOR_MASK 0xFFF 186ac88b6ecSVivek Natarajan #define AR9287_EEP_MINOR_VER_1 0x1 187ac88b6ecSVivek Natarajan #define AR9287_EEP_MINOR_VER_2 0x2 188ac88b6ecSVivek Natarajan #define AR9287_EEP_MINOR_VER_3 0x3 189ac88b6ecSVivek Natarajan #define AR9287_EEP_MINOR_VER AR9287_EEP_MINOR_VER_3 190ac88b6ecSVivek Natarajan #define AR9287_EEP_MINOR_VER_b AR9287_EEP_MINOR_VER 191ac88b6ecSVivek Natarajan #define AR9287_EEP_NO_BACK_VER AR9287_EEP_MINOR_VER_1 192ac88b6ecSVivek Natarajan 193ac88b6ecSVivek Natarajan #define AR9287_EEP_START_LOC 128 194ac88b6ecSVivek Natarajan #define AR9287_NUM_2G_CAL_PIERS 3 195ac88b6ecSVivek Natarajan #define AR9287_NUM_2G_CCK_TARGET_POWERS 3 196ac88b6ecSVivek Natarajan #define AR9287_NUM_2G_20_TARGET_POWERS 3 197ac88b6ecSVivek Natarajan #define AR9287_NUM_2G_40_TARGET_POWERS 3 198ac88b6ecSVivek Natarajan #define AR9287_NUM_CTLS 12 199ac88b6ecSVivek Natarajan #define AR9287_NUM_BAND_EDGES 4 200ac88b6ecSVivek Natarajan #define AR9287_NUM_PD_GAINS 4 201ac88b6ecSVivek Natarajan #define AR9287_PD_GAINS_IN_MASK 4 202ac88b6ecSVivek Natarajan #define AR9287_PD_GAIN_ICEPTS 1 203ac88b6ecSVivek Natarajan #define AR9287_EEPROM_MODAL_SPURS 5 204ac88b6ecSVivek Natarajan #define AR9287_MAX_RATE_POWER 63 205ac88b6ecSVivek Natarajan #define AR9287_NUM_PDADC_VALUES 128 206ac88b6ecSVivek Natarajan #define AR9287_NUM_RATES 16 207ac88b6ecSVivek Natarajan #define AR9287_BCHAN_UNUSED 0xFF 208ac88b6ecSVivek Natarajan #define AR9287_MAX_PWR_RANGE_IN_HALF_DB 64 209ac88b6ecSVivek Natarajan #define AR9287_OPFLAGS_11A 0x01 210ac88b6ecSVivek Natarajan #define AR9287_OPFLAGS_11G 0x02 211ac88b6ecSVivek Natarajan #define AR9287_OPFLAGS_2G_HT40 0x08 212ac88b6ecSVivek Natarajan #define AR9287_OPFLAGS_2G_HT20 0x20 213ac88b6ecSVivek Natarajan #define AR9287_OPFLAGS_5G_HT40 0x04 214ac88b6ecSVivek Natarajan #define AR9287_OPFLAGS_5G_HT20 0x10 215ac88b6ecSVivek Natarajan #define AR9287_EEPMISC_BIG_ENDIAN 0x01 216ac88b6ecSVivek Natarajan #define AR9287_EEPMISC_WOW 0x02 217ac88b6ecSVivek Natarajan #define AR9287_MAX_CHAINS 2 218ac88b6ecSVivek Natarajan #define AR9287_ANT_16S 32 219ac88b6ecSVivek Natarajan #define AR9287_custdatasize 20 220ac88b6ecSVivek Natarajan 221ac88b6ecSVivek Natarajan #define AR9287_NUM_ANT_CHAIN_FIELDS 6 222ac88b6ecSVivek Natarajan #define AR9287_NUM_ANT_COMMON_FIELDS 4 223ac88b6ecSVivek Natarajan #define AR9287_SIZE_ANT_CHAIN_FIELD 2 224ac88b6ecSVivek Natarajan #define AR9287_SIZE_ANT_COMMON_FIELD 4 225ac88b6ecSVivek Natarajan #define AR9287_ANT_CHAIN_MASK 0x3 226ac88b6ecSVivek Natarajan #define AR9287_ANT_COMMON_MASK 0xf 227ac88b6ecSVivek Natarajan #define AR9287_CHAIN_0_IDX 0 228ac88b6ecSVivek Natarajan #define AR9287_CHAIN_1_IDX 1 229ac88b6ecSVivek Natarajan #define AR9287_DATA_SZ 32 230ac88b6ecSVivek Natarajan 231ac88b6ecSVivek Natarajan #define AR9287_PWR_TABLE_OFFSET_DB -5 232ac88b6ecSVivek Natarajan 233ac88b6ecSVivek Natarajan #define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1) 234ac88b6ecSVivek Natarajan 235203c4805SLuis R. Rodriguez enum eeprom_param { 236203c4805SLuis R. Rodriguez EEP_NFTHRESH_5, 237203c4805SLuis R. Rodriguez EEP_NFTHRESH_2, 238203c4805SLuis R. Rodriguez EEP_MAC_MSW, 239203c4805SLuis R. Rodriguez EEP_MAC_MID, 240203c4805SLuis R. Rodriguez EEP_MAC_LSW, 241203c4805SLuis R. Rodriguez EEP_REG_0, 242203c4805SLuis R. Rodriguez EEP_REG_1, 243203c4805SLuis R. Rodriguez EEP_OP_CAP, 244203c4805SLuis R. Rodriguez EEP_OP_MODE, 245203c4805SLuis R. Rodriguez EEP_RF_SILENT, 246203c4805SLuis R. Rodriguez EEP_OB_5, 247203c4805SLuis R. Rodriguez EEP_DB_5, 248203c4805SLuis R. Rodriguez EEP_OB_2, 249203c4805SLuis R. Rodriguez EEP_DB_2, 250203c4805SLuis R. Rodriguez EEP_MINOR_REV, 251203c4805SLuis R. Rodriguez EEP_TX_MASK, 252203c4805SLuis R. Rodriguez EEP_RX_MASK, 25315c9ee7aSSenthil Balasubramanian EEP_FSTCLK_5G, 254203c4805SLuis R. Rodriguez EEP_RXGAIN_TYPE, 255203c4805SLuis R. Rodriguez EEP_OL_PWRCTRL, 25615c9ee7aSSenthil Balasubramanian EEP_TXGAIN_TYPE, 257203c4805SLuis R. Rodriguez EEP_RC_CHAIN_MASK, 258203c4805SLuis R. Rodriguez EEP_DAC_HPWR_5G, 259ac88b6ecSVivek Natarajan EEP_FRAC_N_5G, 260ac88b6ecSVivek Natarajan EEP_DEV_TYPE, 261ac88b6ecSVivek Natarajan EEP_TEMPSENSE_SLOPE, 262ac88b6ecSVivek Natarajan EEP_TEMPSENSE_SLOPE_PAL_ON, 26315c9ee7aSSenthil Balasubramanian EEP_PWR_TABLE_OFFSET, 26415c9ee7aSSenthil Balasubramanian EEP_DRIVE_STRENGTH, 26515c9ee7aSSenthil Balasubramanian EEP_INTERNAL_REGULATOR, 26615c9ee7aSSenthil Balasubramanian EEP_SWREG 267203c4805SLuis R. Rodriguez }; 268203c4805SLuis R. Rodriguez 269203c4805SLuis R. Rodriguez enum ar5416_rates { 270203c4805SLuis R. Rodriguez rate6mb, rate9mb, rate12mb, rate18mb, 271203c4805SLuis R. Rodriguez rate24mb, rate36mb, rate48mb, rate54mb, 272203c4805SLuis R. Rodriguez rate1l, rate2l, rate2s, rate5_5l, 273203c4805SLuis R. Rodriguez rate5_5s, rate11l, rate11s, rateXr, 274203c4805SLuis R. Rodriguez rateHt20_0, rateHt20_1, rateHt20_2, rateHt20_3, 275203c4805SLuis R. Rodriguez rateHt20_4, rateHt20_5, rateHt20_6, rateHt20_7, 276203c4805SLuis R. Rodriguez rateHt40_0, rateHt40_1, rateHt40_2, rateHt40_3, 277203c4805SLuis R. Rodriguez rateHt40_4, rateHt40_5, rateHt40_6, rateHt40_7, 278203c4805SLuis R. Rodriguez rateDupCck, rateDupOfdm, rateExtCck, rateExtOfdm, 279203c4805SLuis R. Rodriguez Ar5416RateSize 280203c4805SLuis R. Rodriguez }; 281203c4805SLuis R. Rodriguez 282203c4805SLuis R. Rodriguez enum ath9k_hal_freq_band { 283203c4805SLuis R. Rodriguez ATH9K_HAL_FREQ_BAND_5GHZ = 0, 284203c4805SLuis R. Rodriguez ATH9K_HAL_FREQ_BAND_2GHZ = 1 285203c4805SLuis R. Rodriguez }; 286203c4805SLuis R. Rodriguez 287203c4805SLuis R. Rodriguez struct base_eep_header { 288203c4805SLuis R. Rodriguez u16 length; 289203c4805SLuis R. Rodriguez u16 checksum; 290203c4805SLuis R. Rodriguez u16 version; 291203c4805SLuis R. Rodriguez u8 opCapFlags; 292203c4805SLuis R. Rodriguez u8 eepMisc; 293203c4805SLuis R. Rodriguez u16 regDmn[2]; 294203c4805SLuis R. Rodriguez u8 macAddr[6]; 295203c4805SLuis R. Rodriguez u8 rxMask; 296203c4805SLuis R. Rodriguez u8 txMask; 297203c4805SLuis R. Rodriguez u16 rfSilent; 298203c4805SLuis R. Rodriguez u16 blueToothOptions; 299203c4805SLuis R. Rodriguez u16 deviceCap; 300203c4805SLuis R. Rodriguez u32 binBuildNumber; 301203c4805SLuis R. Rodriguez u8 deviceType; 302203c4805SLuis R. Rodriguez u8 pwdclkind; 303*5b75d0fcSFelix Fietkau u8 fastClk5g; 304*5b75d0fcSFelix Fietkau u8 divChain; 305203c4805SLuis R. Rodriguez u8 rxGainType; 306203c4805SLuis R. Rodriguez u8 dacHiPwrMode_5G; 307203c4805SLuis R. Rodriguez u8 openLoopPwrCntl; 308203c4805SLuis R. Rodriguez u8 dacLpMode; 309203c4805SLuis R. Rodriguez u8 txGainType; 310203c4805SLuis R. Rodriguez u8 rcChainMask; 311203c4805SLuis R. Rodriguez u8 desiredScaleCCK; 312e41f0bfcSSenthil Balasubramanian u8 pwr_table_offset; 313203c4805SLuis R. Rodriguez u8 frac_n_5g; 314203c4805SLuis R. Rodriguez u8 futureBase_3[21]; 315203c4805SLuis R. Rodriguez } __packed; 316203c4805SLuis R. Rodriguez 317203c4805SLuis R. Rodriguez struct base_eep_header_4k { 318203c4805SLuis R. Rodriguez u16 length; 319203c4805SLuis R. Rodriguez u16 checksum; 320203c4805SLuis R. Rodriguez u16 version; 321203c4805SLuis R. Rodriguez u8 opCapFlags; 322203c4805SLuis R. Rodriguez u8 eepMisc; 323203c4805SLuis R. Rodriguez u16 regDmn[2]; 324203c4805SLuis R. Rodriguez u8 macAddr[6]; 325203c4805SLuis R. Rodriguez u8 rxMask; 326203c4805SLuis R. Rodriguez u8 txMask; 327203c4805SLuis R. Rodriguez u16 rfSilent; 328203c4805SLuis R. Rodriguez u16 blueToothOptions; 329203c4805SLuis R. Rodriguez u16 deviceCap; 330203c4805SLuis R. Rodriguez u32 binBuildNumber; 331203c4805SLuis R. Rodriguez u8 deviceType; 332203c4805SLuis R. Rodriguez u8 txGainType; 333203c4805SLuis R. Rodriguez } __packed; 334203c4805SLuis R. Rodriguez 335203c4805SLuis R. Rodriguez 336203c4805SLuis R. Rodriguez struct spur_chan { 337203c4805SLuis R. Rodriguez u16 spurChan; 338203c4805SLuis R. Rodriguez u8 spurRangeLow; 339203c4805SLuis R. Rodriguez u8 spurRangeHigh; 340203c4805SLuis R. Rodriguez } __packed; 341203c4805SLuis R. Rodriguez 342203c4805SLuis R. Rodriguez struct modal_eep_header { 343203c4805SLuis R. Rodriguez u32 antCtrlChain[AR5416_MAX_CHAINS]; 344203c4805SLuis R. Rodriguez u32 antCtrlCommon; 345203c4805SLuis R. Rodriguez u8 antennaGainCh[AR5416_MAX_CHAINS]; 346203c4805SLuis R. Rodriguez u8 switchSettling; 347203c4805SLuis R. Rodriguez u8 txRxAttenCh[AR5416_MAX_CHAINS]; 348203c4805SLuis R. Rodriguez u8 rxTxMarginCh[AR5416_MAX_CHAINS]; 349203c4805SLuis R. Rodriguez u8 adcDesiredSize; 350203c4805SLuis R. Rodriguez u8 pgaDesiredSize; 351203c4805SLuis R. Rodriguez u8 xlnaGainCh[AR5416_MAX_CHAINS]; 352203c4805SLuis R. Rodriguez u8 txEndToXpaOff; 353203c4805SLuis R. Rodriguez u8 txEndToRxOn; 354203c4805SLuis R. Rodriguez u8 txFrameToXpaOn; 355203c4805SLuis R. Rodriguez u8 thresh62; 356203c4805SLuis R. Rodriguez u8 noiseFloorThreshCh[AR5416_MAX_CHAINS]; 357203c4805SLuis R. Rodriguez u8 xpdGain; 358203c4805SLuis R. Rodriguez u8 xpd; 359203c4805SLuis R. Rodriguez u8 iqCalICh[AR5416_MAX_CHAINS]; 360203c4805SLuis R. Rodriguez u8 iqCalQCh[AR5416_MAX_CHAINS]; 361203c4805SLuis R. Rodriguez u8 pdGainOverlap; 362203c4805SLuis R. Rodriguez u8 ob; 363203c4805SLuis R. Rodriguez u8 db; 364203c4805SLuis R. Rodriguez u8 xpaBiasLvl; 365203c4805SLuis R. Rodriguez u8 pwrDecreaseFor2Chain; 366203c4805SLuis R. Rodriguez u8 pwrDecreaseFor3Chain; 367203c4805SLuis R. Rodriguez u8 txFrameToDataStart; 368203c4805SLuis R. Rodriguez u8 txFrameToPaOn; 369203c4805SLuis R. Rodriguez u8 ht40PowerIncForPdadc; 370203c4805SLuis R. Rodriguez u8 bswAtten[AR5416_MAX_CHAINS]; 371203c4805SLuis R. Rodriguez u8 bswMargin[AR5416_MAX_CHAINS]; 372203c4805SLuis R. Rodriguez u8 swSettleHt40; 373203c4805SLuis R. Rodriguez u8 xatten2Db[AR5416_MAX_CHAINS]; 374203c4805SLuis R. Rodriguez u8 xatten2Margin[AR5416_MAX_CHAINS]; 375203c4805SLuis R. Rodriguez u8 ob_ch1; 376203c4805SLuis R. Rodriguez u8 db_ch1; 377203c4805SLuis R. Rodriguez u8 useAnt1:1, 378203c4805SLuis R. Rodriguez force_xpaon:1, 379203c4805SLuis R. Rodriguez local_bias:1, 380203c4805SLuis R. Rodriguez femBandSelectUsed:1, xlnabufin:1, xlnaisel:2, xlnabufmode:1; 381203c4805SLuis R. Rodriguez u8 miscBits; 382203c4805SLuis R. Rodriguez u16 xpaBiasLvlFreq[3]; 383203c4805SLuis R. Rodriguez u8 futureModal[6]; 384203c4805SLuis R. Rodriguez 385203c4805SLuis R. Rodriguez struct spur_chan spurChans[AR5416_EEPROM_MODAL_SPURS]; 386203c4805SLuis R. Rodriguez } __packed; 387203c4805SLuis R. Rodriguez 388203c4805SLuis R. Rodriguez struct calDataPerFreqOpLoop { 389203c4805SLuis R. Rodriguez u8 pwrPdg[2][5]; 390203c4805SLuis R. Rodriguez u8 vpdPdg[2][5]; 391203c4805SLuis R. Rodriguez u8 pcdac[2][5]; 392203c4805SLuis R. Rodriguez u8 empty[2][5]; 393203c4805SLuis R. Rodriguez } __packed; 394203c4805SLuis R. Rodriguez 395203c4805SLuis R. Rodriguez struct modal_eep_4k_header { 396203c4805SLuis R. Rodriguez u32 antCtrlChain[AR5416_EEP4K_MAX_CHAINS]; 397203c4805SLuis R. Rodriguez u32 antCtrlCommon; 398203c4805SLuis R. Rodriguez u8 antennaGainCh[AR5416_EEP4K_MAX_CHAINS]; 399203c4805SLuis R. Rodriguez u8 switchSettling; 400203c4805SLuis R. Rodriguez u8 txRxAttenCh[AR5416_EEP4K_MAX_CHAINS]; 401203c4805SLuis R. Rodriguez u8 rxTxMarginCh[AR5416_EEP4K_MAX_CHAINS]; 402203c4805SLuis R. Rodriguez u8 adcDesiredSize; 403203c4805SLuis R. Rodriguez u8 pgaDesiredSize; 404203c4805SLuis R. Rodriguez u8 xlnaGainCh[AR5416_EEP4K_MAX_CHAINS]; 405203c4805SLuis R. Rodriguez u8 txEndToXpaOff; 406203c4805SLuis R. Rodriguez u8 txEndToRxOn; 407203c4805SLuis R. Rodriguez u8 txFrameToXpaOn; 408203c4805SLuis R. Rodriguez u8 thresh62; 409203c4805SLuis R. Rodriguez u8 noiseFloorThreshCh[AR5416_EEP4K_MAX_CHAINS]; 410203c4805SLuis R. Rodriguez u8 xpdGain; 411203c4805SLuis R. Rodriguez u8 xpd; 412203c4805SLuis R. Rodriguez u8 iqCalICh[AR5416_EEP4K_MAX_CHAINS]; 413203c4805SLuis R. Rodriguez u8 iqCalQCh[AR5416_EEP4K_MAX_CHAINS]; 414203c4805SLuis R. Rodriguez u8 pdGainOverlap; 4157f63845fSSujith #ifdef __BIG_ENDIAN_BITFIELD 4167f63845fSSujith u8 ob_1:4, ob_0:4; 4177f63845fSSujith u8 db1_1:4, db1_0:4; 4187f63845fSSujith #else 4197f63845fSSujith u8 ob_0:4, ob_1:4; 4207f63845fSSujith u8 db1_0:4, db1_1:4; 4217f63845fSSujith #endif 422203c4805SLuis R. Rodriguez u8 xpaBiasLvl; 423203c4805SLuis R. Rodriguez u8 txFrameToDataStart; 424203c4805SLuis R. Rodriguez u8 txFrameToPaOn; 425203c4805SLuis R. Rodriguez u8 ht40PowerIncForPdadc; 426203c4805SLuis R. Rodriguez u8 bswAtten[AR5416_EEP4K_MAX_CHAINS]; 427203c4805SLuis R. Rodriguez u8 bswMargin[AR5416_EEP4K_MAX_CHAINS]; 428203c4805SLuis R. Rodriguez u8 swSettleHt40; 429203c4805SLuis R. Rodriguez u8 xatten2Db[AR5416_EEP4K_MAX_CHAINS]; 430203c4805SLuis R. Rodriguez u8 xatten2Margin[AR5416_EEP4K_MAX_CHAINS]; 4317f63845fSSujith #ifdef __BIG_ENDIAN_BITFIELD 4327f63845fSSujith u8 db2_1:4, db2_0:4; 4337f63845fSSujith #else 4347f63845fSSujith u8 db2_0:4, db2_1:4; 4357f63845fSSujith #endif 436203c4805SLuis R. Rodriguez u8 version; 4377f63845fSSujith #ifdef __BIG_ENDIAN_BITFIELD 4387f63845fSSujith u8 ob_3:4, ob_2:4; 4397f63845fSSujith u8 antdiv_ctl1:4, ob_4:4; 4407f63845fSSujith u8 db1_3:4, db1_2:4; 4417f63845fSSujith u8 antdiv_ctl2:4, db1_4:4; 4427f63845fSSujith u8 db2_2:4, db2_3:4; 4437f63845fSSujith u8 reserved:4, db2_4:4; 4447f63845fSSujith #else 4457f63845fSSujith u8 ob_2:4, ob_3:4; 4467f63845fSSujith u8 ob_4:4, antdiv_ctl1:4; 4477f63845fSSujith u8 db1_2:4, db1_3:4; 4487f63845fSSujith u8 db1_4:4, antdiv_ctl2:4; 4497f63845fSSujith u8 db2_2:4, db2_3:4; 4507f63845fSSujith u8 db2_4:4, reserved:4; 4517f63845fSSujith #endif 452203c4805SLuis R. Rodriguez u8 futureModal[4]; 453203c4805SLuis R. Rodriguez struct spur_chan spurChans[AR5416_EEPROM_MODAL_SPURS]; 454203c4805SLuis R. Rodriguez } __packed; 455203c4805SLuis R. Rodriguez 456ac88b6ecSVivek Natarajan struct base_eep_ar9287_header { 457ac88b6ecSVivek Natarajan u16 length; 458ac88b6ecSVivek Natarajan u16 checksum; 459ac88b6ecSVivek Natarajan u16 version; 460ac88b6ecSVivek Natarajan u8 opCapFlags; 461ac88b6ecSVivek Natarajan u8 eepMisc; 462ac88b6ecSVivek Natarajan u16 regDmn[2]; 463ac88b6ecSVivek Natarajan u8 macAddr[6]; 464ac88b6ecSVivek Natarajan u8 rxMask; 465ac88b6ecSVivek Natarajan u8 txMask; 466ac88b6ecSVivek Natarajan u16 rfSilent; 467ac88b6ecSVivek Natarajan u16 blueToothOptions; 468ac88b6ecSVivek Natarajan u16 deviceCap; 469ac88b6ecSVivek Natarajan u32 binBuildNumber; 470ac88b6ecSVivek Natarajan u8 deviceType; 471ac88b6ecSVivek Natarajan u8 openLoopPwrCntl; 472ac88b6ecSVivek Natarajan int8_t pwrTableOffset; 473ac88b6ecSVivek Natarajan int8_t tempSensSlope; 474ac88b6ecSVivek Natarajan int8_t tempSensSlopePalOn; 475ac88b6ecSVivek Natarajan u8 futureBase[29]; 476ac88b6ecSVivek Natarajan } __packed; 477ac88b6ecSVivek Natarajan 478ac88b6ecSVivek Natarajan struct modal_eep_ar9287_header { 479ac88b6ecSVivek Natarajan u32 antCtrlChain[AR9287_MAX_CHAINS]; 480ac88b6ecSVivek Natarajan u32 antCtrlCommon; 481ac88b6ecSVivek Natarajan int8_t antennaGainCh[AR9287_MAX_CHAINS]; 482ac88b6ecSVivek Natarajan u8 switchSettling; 483ac88b6ecSVivek Natarajan u8 txRxAttenCh[AR9287_MAX_CHAINS]; 484ac88b6ecSVivek Natarajan u8 rxTxMarginCh[AR9287_MAX_CHAINS]; 485ac88b6ecSVivek Natarajan int8_t adcDesiredSize; 486ac88b6ecSVivek Natarajan u8 txEndToXpaOff; 487ac88b6ecSVivek Natarajan u8 txEndToRxOn; 488ac88b6ecSVivek Natarajan u8 txFrameToXpaOn; 489ac88b6ecSVivek Natarajan u8 thresh62; 490ac88b6ecSVivek Natarajan int8_t noiseFloorThreshCh[AR9287_MAX_CHAINS]; 491ac88b6ecSVivek Natarajan u8 xpdGain; 492ac88b6ecSVivek Natarajan u8 xpd; 493ac88b6ecSVivek Natarajan int8_t iqCalICh[AR9287_MAX_CHAINS]; 494ac88b6ecSVivek Natarajan int8_t iqCalQCh[AR9287_MAX_CHAINS]; 495ac88b6ecSVivek Natarajan u8 pdGainOverlap; 496ac88b6ecSVivek Natarajan u8 xpaBiasLvl; 497ac88b6ecSVivek Natarajan u8 txFrameToDataStart; 498ac88b6ecSVivek Natarajan u8 txFrameToPaOn; 499ac88b6ecSVivek Natarajan u8 ht40PowerIncForPdadc; 500ac88b6ecSVivek Natarajan u8 bswAtten[AR9287_MAX_CHAINS]; 501ac88b6ecSVivek Natarajan u8 bswMargin[AR9287_MAX_CHAINS]; 502ac88b6ecSVivek Natarajan u8 swSettleHt40; 503ac88b6ecSVivek Natarajan u8 version; 504ac88b6ecSVivek Natarajan u8 db1; 505ac88b6ecSVivek Natarajan u8 db2; 506ac88b6ecSVivek Natarajan u8 ob_cck; 507ac88b6ecSVivek Natarajan u8 ob_psk; 508ac88b6ecSVivek Natarajan u8 ob_qam; 509ac88b6ecSVivek Natarajan u8 ob_pal_off; 510ac88b6ecSVivek Natarajan u8 futureModal[30]; 511ac88b6ecSVivek Natarajan struct spur_chan spurChans[AR9287_EEPROM_MODAL_SPURS]; 512ac88b6ecSVivek Natarajan } __packed; 513ac88b6ecSVivek Natarajan 514203c4805SLuis R. Rodriguez struct cal_data_per_freq { 515203c4805SLuis R. Rodriguez u8 pwrPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; 516203c4805SLuis R. Rodriguez u8 vpdPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; 517203c4805SLuis R. Rodriguez } __packed; 518203c4805SLuis R. Rodriguez 519203c4805SLuis R. Rodriguez struct cal_data_per_freq_4k { 520203c4805SLuis R. Rodriguez u8 pwrPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_EEP4K_PD_GAIN_ICEPTS]; 521203c4805SLuis R. Rodriguez u8 vpdPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_EEP4K_PD_GAIN_ICEPTS]; 522203c4805SLuis R. Rodriguez } __packed; 523203c4805SLuis R. Rodriguez 524203c4805SLuis R. Rodriguez struct cal_target_power_leg { 525203c4805SLuis R. Rodriguez u8 bChannel; 526203c4805SLuis R. Rodriguez u8 tPow2x[4]; 527203c4805SLuis R. Rodriguez } __packed; 528203c4805SLuis R. Rodriguez 529203c4805SLuis R. Rodriguez struct cal_target_power_ht { 530203c4805SLuis R. Rodriguez u8 bChannel; 531203c4805SLuis R. Rodriguez u8 tPow2x[8]; 532203c4805SLuis R. Rodriguez } __packed; 533203c4805SLuis R. Rodriguez 534203c4805SLuis R. Rodriguez 535203c4805SLuis R. Rodriguez #ifdef __BIG_ENDIAN_BITFIELD 536203c4805SLuis R. Rodriguez struct cal_ctl_edges { 537203c4805SLuis R. Rodriguez u8 bChannel; 538203c4805SLuis R. Rodriguez u8 flag:2, tPower:6; 539203c4805SLuis R. Rodriguez } __packed; 540203c4805SLuis R. Rodriguez #else 541203c4805SLuis R. Rodriguez struct cal_ctl_edges { 542203c4805SLuis R. Rodriguez u8 bChannel; 543203c4805SLuis R. Rodriguez u8 tPower:6, flag:2; 544203c4805SLuis R. Rodriguez } __packed; 545203c4805SLuis R. Rodriguez #endif 546203c4805SLuis R. Rodriguez 547ac88b6ecSVivek Natarajan struct cal_data_op_loop_ar9287 { 548ac88b6ecSVivek Natarajan u8 pwrPdg[2][5]; 549ac88b6ecSVivek Natarajan u8 vpdPdg[2][5]; 550ac88b6ecSVivek Natarajan u8 pcdac[2][5]; 551ac88b6ecSVivek Natarajan u8 empty[2][5]; 552ac88b6ecSVivek Natarajan } __packed; 553ac88b6ecSVivek Natarajan 554ac88b6ecSVivek Natarajan struct cal_data_per_freq_ar9287 { 555ac88b6ecSVivek Natarajan u8 pwrPdg[AR9287_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS]; 556ac88b6ecSVivek Natarajan u8 vpdPdg[AR9287_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS]; 557ac88b6ecSVivek Natarajan } __packed; 558ac88b6ecSVivek Natarajan 559ac88b6ecSVivek Natarajan union cal_data_per_freq_ar9287_u { 560ac88b6ecSVivek Natarajan struct cal_data_op_loop_ar9287 calDataOpen; 561ac88b6ecSVivek Natarajan struct cal_data_per_freq_ar9287 calDataClose; 562ac88b6ecSVivek Natarajan } __packed; 563ac88b6ecSVivek Natarajan 564ac88b6ecSVivek Natarajan struct cal_ctl_data_ar9287 { 565ac88b6ecSVivek Natarajan struct cal_ctl_edges 566ac88b6ecSVivek Natarajan ctlEdges[AR9287_MAX_CHAINS][AR9287_NUM_BAND_EDGES]; 567ac88b6ecSVivek Natarajan } __packed; 568ac88b6ecSVivek Natarajan 569203c4805SLuis R. Rodriguez struct cal_ctl_data { 570203c4805SLuis R. Rodriguez struct cal_ctl_edges 571203c4805SLuis R. Rodriguez ctlEdges[AR5416_MAX_CHAINS][AR5416_NUM_BAND_EDGES]; 572203c4805SLuis R. Rodriguez } __packed; 573203c4805SLuis R. Rodriguez 574203c4805SLuis R. Rodriguez struct cal_ctl_data_4k { 575203c4805SLuis R. Rodriguez struct cal_ctl_edges 576203c4805SLuis R. Rodriguez ctlEdges[AR5416_EEP4K_MAX_CHAINS][AR5416_EEP4K_NUM_BAND_EDGES]; 577203c4805SLuis R. Rodriguez } __packed; 578203c4805SLuis R. Rodriguez 579203c4805SLuis R. Rodriguez struct ar5416_eeprom_def { 580203c4805SLuis R. Rodriguez struct base_eep_header baseEepHeader; 581203c4805SLuis R. Rodriguez u8 custData[64]; 582203c4805SLuis R. Rodriguez struct modal_eep_header modalHeader[2]; 583203c4805SLuis R. Rodriguez u8 calFreqPier5G[AR5416_NUM_5G_CAL_PIERS]; 584203c4805SLuis R. Rodriguez u8 calFreqPier2G[AR5416_NUM_2G_CAL_PIERS]; 585203c4805SLuis R. Rodriguez struct cal_data_per_freq 586203c4805SLuis R. Rodriguez calPierData5G[AR5416_MAX_CHAINS][AR5416_NUM_5G_CAL_PIERS]; 587203c4805SLuis R. Rodriguez struct cal_data_per_freq 588203c4805SLuis R. Rodriguez calPierData2G[AR5416_MAX_CHAINS][AR5416_NUM_2G_CAL_PIERS]; 589203c4805SLuis R. Rodriguez struct cal_target_power_leg 590203c4805SLuis R. Rodriguez calTargetPower5G[AR5416_NUM_5G_20_TARGET_POWERS]; 591203c4805SLuis R. Rodriguez struct cal_target_power_ht 592203c4805SLuis R. Rodriguez calTargetPower5GHT20[AR5416_NUM_5G_20_TARGET_POWERS]; 593203c4805SLuis R. Rodriguez struct cal_target_power_ht 594203c4805SLuis R. Rodriguez calTargetPower5GHT40[AR5416_NUM_5G_40_TARGET_POWERS]; 595203c4805SLuis R. Rodriguez struct cal_target_power_leg 596203c4805SLuis R. Rodriguez calTargetPowerCck[AR5416_NUM_2G_CCK_TARGET_POWERS]; 597203c4805SLuis R. Rodriguez struct cal_target_power_leg 598203c4805SLuis R. Rodriguez calTargetPower2G[AR5416_NUM_2G_20_TARGET_POWERS]; 599203c4805SLuis R. Rodriguez struct cal_target_power_ht 600203c4805SLuis R. Rodriguez calTargetPower2GHT20[AR5416_NUM_2G_20_TARGET_POWERS]; 601203c4805SLuis R. Rodriguez struct cal_target_power_ht 602203c4805SLuis R. Rodriguez calTargetPower2GHT40[AR5416_NUM_2G_40_TARGET_POWERS]; 603203c4805SLuis R. Rodriguez u8 ctlIndex[AR5416_NUM_CTLS]; 604203c4805SLuis R. Rodriguez struct cal_ctl_data ctlData[AR5416_NUM_CTLS]; 605203c4805SLuis R. Rodriguez u8 padding; 606203c4805SLuis R. Rodriguez } __packed; 607203c4805SLuis R. Rodriguez 608203c4805SLuis R. Rodriguez struct ar5416_eeprom_4k { 609203c4805SLuis R. Rodriguez struct base_eep_header_4k baseEepHeader; 610203c4805SLuis R. Rodriguez u8 custData[20]; 611203c4805SLuis R. Rodriguez struct modal_eep_4k_header modalHeader; 612203c4805SLuis R. Rodriguez u8 calFreqPier2G[AR5416_EEP4K_NUM_2G_CAL_PIERS]; 613203c4805SLuis R. Rodriguez struct cal_data_per_freq_4k 614203c4805SLuis R. Rodriguez calPierData2G[AR5416_EEP4K_MAX_CHAINS][AR5416_EEP4K_NUM_2G_CAL_PIERS]; 615203c4805SLuis R. Rodriguez struct cal_target_power_leg 616203c4805SLuis R. Rodriguez calTargetPowerCck[AR5416_EEP4K_NUM_2G_CCK_TARGET_POWERS]; 617203c4805SLuis R. Rodriguez struct cal_target_power_leg 618203c4805SLuis R. Rodriguez calTargetPower2G[AR5416_EEP4K_NUM_2G_20_TARGET_POWERS]; 619203c4805SLuis R. Rodriguez struct cal_target_power_ht 620203c4805SLuis R. Rodriguez calTargetPower2GHT20[AR5416_EEP4K_NUM_2G_20_TARGET_POWERS]; 621203c4805SLuis R. Rodriguez struct cal_target_power_ht 622203c4805SLuis R. Rodriguez calTargetPower2GHT40[AR5416_EEP4K_NUM_2G_40_TARGET_POWERS]; 623203c4805SLuis R. Rodriguez u8 ctlIndex[AR5416_EEP4K_NUM_CTLS]; 624203c4805SLuis R. Rodriguez struct cal_ctl_data_4k ctlData[AR5416_EEP4K_NUM_CTLS]; 625203c4805SLuis R. Rodriguez u8 padding; 626203c4805SLuis R. Rodriguez } __packed; 627203c4805SLuis R. Rodriguez 628475f5989SLuis R. Rodriguez struct ar9287_eeprom { 629ac88b6ecSVivek Natarajan struct base_eep_ar9287_header baseEepHeader; 630ac88b6ecSVivek Natarajan u8 custData[AR9287_DATA_SZ]; 631ac88b6ecSVivek Natarajan struct modal_eep_ar9287_header modalHeader; 632ac88b6ecSVivek Natarajan u8 calFreqPier2G[AR9287_NUM_2G_CAL_PIERS]; 633ac88b6ecSVivek Natarajan union cal_data_per_freq_ar9287_u 634ac88b6ecSVivek Natarajan calPierData2G[AR9287_MAX_CHAINS][AR9287_NUM_2G_CAL_PIERS]; 635ac88b6ecSVivek Natarajan struct cal_target_power_leg 636ac88b6ecSVivek Natarajan calTargetPowerCck[AR9287_NUM_2G_CCK_TARGET_POWERS]; 637ac88b6ecSVivek Natarajan struct cal_target_power_leg 638ac88b6ecSVivek Natarajan calTargetPower2G[AR9287_NUM_2G_20_TARGET_POWERS]; 639ac88b6ecSVivek Natarajan struct cal_target_power_ht 640ac88b6ecSVivek Natarajan calTargetPower2GHT20[AR9287_NUM_2G_20_TARGET_POWERS]; 641ac88b6ecSVivek Natarajan struct cal_target_power_ht 642ac88b6ecSVivek Natarajan calTargetPower2GHT40[AR9287_NUM_2G_40_TARGET_POWERS]; 643ac88b6ecSVivek Natarajan u8 ctlIndex[AR9287_NUM_CTLS]; 644ac88b6ecSVivek Natarajan struct cal_ctl_data_ar9287 ctlData[AR9287_NUM_CTLS]; 645ac88b6ecSVivek Natarajan u8 padding; 646ac88b6ecSVivek Natarajan } __packed; 647ac88b6ecSVivek Natarajan 648203c4805SLuis R. Rodriguez enum reg_ext_bitmap { 649ebb90cfcSSenthil Balasubramanian REG_EXT_FCC_MIDBAND = 0, 650203c4805SLuis R. Rodriguez REG_EXT_JAPAN_MIDBAND = 1, 651203c4805SLuis R. Rodriguez REG_EXT_FCC_DFS_HT40 = 2, 652203c4805SLuis R. Rodriguez REG_EXT_JAPAN_NONDFS_HT40 = 3, 653203c4805SLuis R. Rodriguez REG_EXT_JAPAN_DFS_HT40 = 4 654203c4805SLuis R. Rodriguez }; 655203c4805SLuis R. Rodriguez 656203c4805SLuis R. Rodriguez struct ath9k_country_entry { 657203c4805SLuis R. Rodriguez u16 countryCode; 658203c4805SLuis R. Rodriguez u16 regDmnEnum; 659203c4805SLuis R. Rodriguez u16 regDmn5G; 660203c4805SLuis R. Rodriguez u16 regDmn2G; 661203c4805SLuis R. Rodriguez u8 isMultidomain; 662203c4805SLuis R. Rodriguez u8 iso[3]; 663203c4805SLuis R. Rodriguez }; 664203c4805SLuis R. Rodriguez 665203c4805SLuis R. Rodriguez struct eeprom_ops { 666203c4805SLuis R. Rodriguez int (*check_eeprom)(struct ath_hw *hw); 667203c4805SLuis R. Rodriguez u32 (*get_eeprom)(struct ath_hw *hw, enum eeprom_param param); 668203c4805SLuis R. Rodriguez bool (*fill_eeprom)(struct ath_hw *hw); 669203c4805SLuis R. Rodriguez int (*get_eeprom_ver)(struct ath_hw *hw); 670203c4805SLuis R. Rodriguez int (*get_eeprom_rev)(struct ath_hw *hw); 671203c4805SLuis R. Rodriguez u8 (*get_num_ant_config)(struct ath_hw *hw, enum ieee80211_band band); 672203c4805SLuis R. Rodriguez u16 (*get_eeprom_antenna_cfg)(struct ath_hw *hw, 673203c4805SLuis R. Rodriguez struct ath9k_channel *chan); 674203c4805SLuis R. Rodriguez void (*set_board_values)(struct ath_hw *hw, struct ath9k_channel *chan); 675203c4805SLuis R. Rodriguez void (*set_addac)(struct ath_hw *hw, struct ath9k_channel *chan); 6768fbff4b8SVasanthakumar Thiagarajan void (*set_txpower)(struct ath_hw *hw, struct ath9k_channel *chan, 677203c4805SLuis R. Rodriguez u16 cfgCtl, u8 twiceAntennaReduction, 678203c4805SLuis R. Rodriguez u8 twiceMaxRegulatoryPower, u8 powerLimit); 679203c4805SLuis R. Rodriguez u16 (*get_spur_channel)(struct ath_hw *ah, u16 i, bool is2GHz); 680203c4805SLuis R. Rodriguez }; 681203c4805SLuis R. Rodriguez 682b5aec950SSujith void ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask, 683b5aec950SSujith u32 shift, u32 val); 684b5aec950SSujith int16_t ath9k_hw_interpolate(u16 target, u16 srcLeft, u16 srcRight, 685b5aec950SSujith int16_t targetLeft, 686b5aec950SSujith int16_t targetRight); 687b5aec950SSujith bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize, 688b5aec950SSujith u16 *indexL, u16 *indexR); 6895bb12791SLuis R. Rodriguez bool ath9k_hw_nvram_read(struct ath_common *common, u32 off, u16 *data); 690b5aec950SSujith void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList, 691b5aec950SSujith u8 *pVpdList, u16 numIntercepts, 692b5aec950SSujith u8 *pRetVpdList); 693b5aec950SSujith void ath9k_hw_get_legacy_target_powers(struct ath_hw *ah, 694b5aec950SSujith struct ath9k_channel *chan, 695b5aec950SSujith struct cal_target_power_leg *powInfo, 696b5aec950SSujith u16 numChannels, 697b5aec950SSujith struct cal_target_power_leg *pNewPower, 698b5aec950SSujith u16 numRates, bool isExtTarget); 699b5aec950SSujith void ath9k_hw_get_target_powers(struct ath_hw *ah, 700b5aec950SSujith struct ath9k_channel *chan, 701b5aec950SSujith struct cal_target_power_ht *powInfo, 702b5aec950SSujith u16 numChannels, 703b5aec950SSujith struct cal_target_power_ht *pNewPower, 704b5aec950SSujith u16 numRates, bool isHt40Target); 705b5aec950SSujith u16 ath9k_hw_get_max_edge_power(u16 freq, struct cal_ctl_edges *pRdEdgesPower, 706b5aec950SSujith bool is2GHz, int num_band_edges); 707b5aec950SSujith int ath9k_hw_eeprom_init(struct ath_hw *ah); 708b5aec950SSujith 709203c4805SLuis R. Rodriguez #define ar5416_get_ntxchains(_txchainmask) \ 710203c4805SLuis R. Rodriguez (((_txchainmask >> 2) & 1) + \ 711203c4805SLuis R. Rodriguez ((_txchainmask >> 1) & 1) + (_txchainmask & 1)) 712203c4805SLuis R. Rodriguez 713b5aec950SSujith extern const struct eeprom_ops eep_def_ops; 714b5aec950SSujith extern const struct eeprom_ops eep_4k_ops; 7150b8f6f2bSLuis R. Rodriguez extern const struct eeprom_ops eep_ar9287_ops; 71615c9ee7aSSenthil Balasubramanian extern const struct eeprom_ops eep_ar9287_ops; 71715c9ee7aSSenthil Balasubramanian extern const struct eeprom_ops eep_ar9300_ops; 718203c4805SLuis R. Rodriguez 719203c4805SLuis R. Rodriguez #endif /* EEPROM_H */ 720