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 6590487974SLuis R. Rodriguez #define CTL_MODE_M 0xf 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)) 104a42acef0SFelix Fietkau #define OLC_FOR_AR9287_10_LATER (AR_SREV_9287_11_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 194ca6cff1fSRajkumar Manoharan #define AR9287_HTC_EEP_START_LOC 256 195ac88b6ecSVivek Natarajan #define AR9287_NUM_2G_CAL_PIERS 3 196ac88b6ecSVivek Natarajan #define AR9287_NUM_2G_CCK_TARGET_POWERS 3 197ac88b6ecSVivek Natarajan #define AR9287_NUM_2G_20_TARGET_POWERS 3 198ac88b6ecSVivek Natarajan #define AR9287_NUM_2G_40_TARGET_POWERS 3 199ac88b6ecSVivek Natarajan #define AR9287_NUM_CTLS 12 200ac88b6ecSVivek Natarajan #define AR9287_NUM_BAND_EDGES 4 201ac88b6ecSVivek Natarajan #define AR9287_NUM_PD_GAINS 4 202ac88b6ecSVivek Natarajan #define AR9287_PD_GAINS_IN_MASK 4 203ac88b6ecSVivek Natarajan #define AR9287_PD_GAIN_ICEPTS 1 204ac88b6ecSVivek Natarajan #define AR9287_EEPROM_MODAL_SPURS 5 205ac88b6ecSVivek Natarajan #define AR9287_MAX_RATE_POWER 63 206ac88b6ecSVivek Natarajan #define AR9287_NUM_PDADC_VALUES 128 207ac88b6ecSVivek Natarajan #define AR9287_NUM_RATES 16 208ac88b6ecSVivek Natarajan #define AR9287_BCHAN_UNUSED 0xFF 209ac88b6ecSVivek Natarajan #define AR9287_MAX_PWR_RANGE_IN_HALF_DB 64 210ac88b6ecSVivek Natarajan #define AR9287_OPFLAGS_11A 0x01 211ac88b6ecSVivek Natarajan #define AR9287_OPFLAGS_11G 0x02 212ac88b6ecSVivek Natarajan #define AR9287_OPFLAGS_2G_HT40 0x08 213ac88b6ecSVivek Natarajan #define AR9287_OPFLAGS_2G_HT20 0x20 214ac88b6ecSVivek Natarajan #define AR9287_OPFLAGS_5G_HT40 0x04 215ac88b6ecSVivek Natarajan #define AR9287_OPFLAGS_5G_HT20 0x10 216ac88b6ecSVivek Natarajan #define AR9287_EEPMISC_BIG_ENDIAN 0x01 217ac88b6ecSVivek Natarajan #define AR9287_EEPMISC_WOW 0x02 218ac88b6ecSVivek Natarajan #define AR9287_MAX_CHAINS 2 219ac88b6ecSVivek Natarajan #define AR9287_ANT_16S 32 220ac88b6ecSVivek Natarajan #define AR9287_custdatasize 20 221ac88b6ecSVivek Natarajan 222ac88b6ecSVivek Natarajan #define AR9287_NUM_ANT_CHAIN_FIELDS 6 223ac88b6ecSVivek Natarajan #define AR9287_NUM_ANT_COMMON_FIELDS 4 224ac88b6ecSVivek Natarajan #define AR9287_SIZE_ANT_CHAIN_FIELD 2 225ac88b6ecSVivek Natarajan #define AR9287_SIZE_ANT_COMMON_FIELD 4 226ac88b6ecSVivek Natarajan #define AR9287_ANT_CHAIN_MASK 0x3 227ac88b6ecSVivek Natarajan #define AR9287_ANT_COMMON_MASK 0xf 228ac88b6ecSVivek Natarajan #define AR9287_CHAIN_0_IDX 0 229ac88b6ecSVivek Natarajan #define AR9287_CHAIN_1_IDX 1 230ac88b6ecSVivek Natarajan #define AR9287_DATA_SZ 32 231ac88b6ecSVivek Natarajan 232ac88b6ecSVivek Natarajan #define AR9287_PWR_TABLE_OFFSET_DB -5 233ac88b6ecSVivek Natarajan 234ac88b6ecSVivek Natarajan #define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1) 235ac88b6ecSVivek Natarajan 236*e702ba18SFelix Fietkau #define CTL_EDGE_TPOWER(_ctl) ((_ctl) & 0x3f) 237*e702ba18SFelix Fietkau #define CTL_EDGE_FLAGS(_ctl) (((_ctl) >> 6) & 0x03) 238*e702ba18SFelix Fietkau 239203c4805SLuis R. Rodriguez enum eeprom_param { 240203c4805SLuis R. Rodriguez EEP_NFTHRESH_5, 241203c4805SLuis R. Rodriguez EEP_NFTHRESH_2, 242203c4805SLuis R. Rodriguez EEP_MAC_MSW, 243203c4805SLuis R. Rodriguez EEP_MAC_MID, 244203c4805SLuis R. Rodriguez EEP_MAC_LSW, 245203c4805SLuis R. Rodriguez EEP_REG_0, 246203c4805SLuis R. Rodriguez EEP_REG_1, 247203c4805SLuis R. Rodriguez EEP_OP_CAP, 248203c4805SLuis R. Rodriguez EEP_OP_MODE, 249203c4805SLuis R. Rodriguez EEP_RF_SILENT, 250203c4805SLuis R. Rodriguez EEP_OB_5, 251203c4805SLuis R. Rodriguez EEP_DB_5, 252203c4805SLuis R. Rodriguez EEP_OB_2, 253203c4805SLuis R. Rodriguez EEP_DB_2, 254203c4805SLuis R. Rodriguez EEP_MINOR_REV, 255203c4805SLuis R. Rodriguez EEP_TX_MASK, 256203c4805SLuis R. Rodriguez EEP_RX_MASK, 25715c9ee7aSSenthil Balasubramanian EEP_FSTCLK_5G, 258203c4805SLuis R. Rodriguez EEP_RXGAIN_TYPE, 259203c4805SLuis R. Rodriguez EEP_OL_PWRCTRL, 26015c9ee7aSSenthil Balasubramanian EEP_TXGAIN_TYPE, 261203c4805SLuis R. Rodriguez EEP_RC_CHAIN_MASK, 262203c4805SLuis R. Rodriguez EEP_DAC_HPWR_5G, 263ac88b6ecSVivek Natarajan EEP_FRAC_N_5G, 264ac88b6ecSVivek Natarajan EEP_DEV_TYPE, 265ac88b6ecSVivek Natarajan EEP_TEMPSENSE_SLOPE, 266ac88b6ecSVivek Natarajan EEP_TEMPSENSE_SLOPE_PAL_ON, 26715c9ee7aSSenthil Balasubramanian EEP_PWR_TABLE_OFFSET, 26815c9ee7aSSenthil Balasubramanian EEP_DRIVE_STRENGTH, 26915c9ee7aSSenthil Balasubramanian EEP_INTERNAL_REGULATOR, 2704935250aSFelix Fietkau EEP_SWREG, 2714935250aSFelix Fietkau EEP_PAPRD, 272754dc536SVasanthakumar Thiagarajan EEP_MODAL_VER, 273754dc536SVasanthakumar Thiagarajan EEP_ANT_DIV_CTL1, 274203c4805SLuis R. Rodriguez }; 275203c4805SLuis R. Rodriguez 276203c4805SLuis R. Rodriguez enum ar5416_rates { 277203c4805SLuis R. Rodriguez rate6mb, rate9mb, rate12mb, rate18mb, 278203c4805SLuis R. Rodriguez rate24mb, rate36mb, rate48mb, rate54mb, 279203c4805SLuis R. Rodriguez rate1l, rate2l, rate2s, rate5_5l, 280203c4805SLuis R. Rodriguez rate5_5s, rate11l, rate11s, rateXr, 281203c4805SLuis R. Rodriguez rateHt20_0, rateHt20_1, rateHt20_2, rateHt20_3, 282203c4805SLuis R. Rodriguez rateHt20_4, rateHt20_5, rateHt20_6, rateHt20_7, 283203c4805SLuis R. Rodriguez rateHt40_0, rateHt40_1, rateHt40_2, rateHt40_3, 284203c4805SLuis R. Rodriguez rateHt40_4, rateHt40_5, rateHt40_6, rateHt40_7, 285203c4805SLuis R. Rodriguez rateDupCck, rateDupOfdm, rateExtCck, rateExtOfdm, 286203c4805SLuis R. Rodriguez Ar5416RateSize 287203c4805SLuis R. Rodriguez }; 288203c4805SLuis R. Rodriguez 289203c4805SLuis R. Rodriguez enum ath9k_hal_freq_band { 290203c4805SLuis R. Rodriguez ATH9K_HAL_FREQ_BAND_5GHZ = 0, 291203c4805SLuis R. Rodriguez ATH9K_HAL_FREQ_BAND_2GHZ = 1 292203c4805SLuis R. Rodriguez }; 293203c4805SLuis R. Rodriguez 294203c4805SLuis R. Rodriguez struct base_eep_header { 295203c4805SLuis R. Rodriguez u16 length; 296203c4805SLuis R. Rodriguez u16 checksum; 297203c4805SLuis R. Rodriguez u16 version; 298203c4805SLuis R. Rodriguez u8 opCapFlags; 299203c4805SLuis R. Rodriguez u8 eepMisc; 300203c4805SLuis R. Rodriguez u16 regDmn[2]; 301203c4805SLuis R. Rodriguez u8 macAddr[6]; 302203c4805SLuis R. Rodriguez u8 rxMask; 303203c4805SLuis R. Rodriguez u8 txMask; 304203c4805SLuis R. Rodriguez u16 rfSilent; 305203c4805SLuis R. Rodriguez u16 blueToothOptions; 306203c4805SLuis R. Rodriguez u16 deviceCap; 307203c4805SLuis R. Rodriguez u32 binBuildNumber; 308203c4805SLuis R. Rodriguez u8 deviceType; 309203c4805SLuis R. Rodriguez u8 pwdclkind; 3105b75d0fcSFelix Fietkau u8 fastClk5g; 3115b75d0fcSFelix Fietkau u8 divChain; 312203c4805SLuis R. Rodriguez u8 rxGainType; 313203c4805SLuis R. Rodriguez u8 dacHiPwrMode_5G; 314203c4805SLuis R. Rodriguez u8 openLoopPwrCntl; 315203c4805SLuis R. Rodriguez u8 dacLpMode; 316203c4805SLuis R. Rodriguez u8 txGainType; 317203c4805SLuis R. Rodriguez u8 rcChainMask; 318203c4805SLuis R. Rodriguez u8 desiredScaleCCK; 319e41f0bfcSSenthil Balasubramanian u8 pwr_table_offset; 320203c4805SLuis R. Rodriguez u8 frac_n_5g; 321203c4805SLuis R. Rodriguez u8 futureBase_3[21]; 322203c4805SLuis R. Rodriguez } __packed; 323203c4805SLuis R. Rodriguez 324203c4805SLuis R. Rodriguez struct base_eep_header_4k { 325203c4805SLuis R. Rodriguez u16 length; 326203c4805SLuis R. Rodriguez u16 checksum; 327203c4805SLuis R. Rodriguez u16 version; 328203c4805SLuis R. Rodriguez u8 opCapFlags; 329203c4805SLuis R. Rodriguez u8 eepMisc; 330203c4805SLuis R. Rodriguez u16 regDmn[2]; 331203c4805SLuis R. Rodriguez u8 macAddr[6]; 332203c4805SLuis R. Rodriguez u8 rxMask; 333203c4805SLuis R. Rodriguez u8 txMask; 334203c4805SLuis R. Rodriguez u16 rfSilent; 335203c4805SLuis R. Rodriguez u16 blueToothOptions; 336203c4805SLuis R. Rodriguez u16 deviceCap; 337203c4805SLuis R. Rodriguez u32 binBuildNumber; 338203c4805SLuis R. Rodriguez u8 deviceType; 339203c4805SLuis R. Rodriguez u8 txGainType; 340203c4805SLuis R. Rodriguez } __packed; 341203c4805SLuis R. Rodriguez 342203c4805SLuis R. Rodriguez 343203c4805SLuis R. Rodriguez struct spur_chan { 344203c4805SLuis R. Rodriguez u16 spurChan; 345203c4805SLuis R. Rodriguez u8 spurRangeLow; 346203c4805SLuis R. Rodriguez u8 spurRangeHigh; 347203c4805SLuis R. Rodriguez } __packed; 348203c4805SLuis R. Rodriguez 349203c4805SLuis R. Rodriguez struct modal_eep_header { 350203c4805SLuis R. Rodriguez u32 antCtrlChain[AR5416_MAX_CHAINS]; 351203c4805SLuis R. Rodriguez u32 antCtrlCommon; 352203c4805SLuis R. Rodriguez u8 antennaGainCh[AR5416_MAX_CHAINS]; 353203c4805SLuis R. Rodriguez u8 switchSettling; 354203c4805SLuis R. Rodriguez u8 txRxAttenCh[AR5416_MAX_CHAINS]; 355203c4805SLuis R. Rodriguez u8 rxTxMarginCh[AR5416_MAX_CHAINS]; 356203c4805SLuis R. Rodriguez u8 adcDesiredSize; 357203c4805SLuis R. Rodriguez u8 pgaDesiredSize; 358203c4805SLuis R. Rodriguez u8 xlnaGainCh[AR5416_MAX_CHAINS]; 359203c4805SLuis R. Rodriguez u8 txEndToXpaOff; 360203c4805SLuis R. Rodriguez u8 txEndToRxOn; 361203c4805SLuis R. Rodriguez u8 txFrameToXpaOn; 362203c4805SLuis R. Rodriguez u8 thresh62; 363203c4805SLuis R. Rodriguez u8 noiseFloorThreshCh[AR5416_MAX_CHAINS]; 364203c4805SLuis R. Rodriguez u8 xpdGain; 365203c4805SLuis R. Rodriguez u8 xpd; 366203c4805SLuis R. Rodriguez u8 iqCalICh[AR5416_MAX_CHAINS]; 367203c4805SLuis R. Rodriguez u8 iqCalQCh[AR5416_MAX_CHAINS]; 368203c4805SLuis R. Rodriguez u8 pdGainOverlap; 369203c4805SLuis R. Rodriguez u8 ob; 370203c4805SLuis R. Rodriguez u8 db; 371203c4805SLuis R. Rodriguez u8 xpaBiasLvl; 372203c4805SLuis R. Rodriguez u8 pwrDecreaseFor2Chain; 373203c4805SLuis R. Rodriguez u8 pwrDecreaseFor3Chain; 374203c4805SLuis R. Rodriguez u8 txFrameToDataStart; 375203c4805SLuis R. Rodriguez u8 txFrameToPaOn; 376203c4805SLuis R. Rodriguez u8 ht40PowerIncForPdadc; 377203c4805SLuis R. Rodriguez u8 bswAtten[AR5416_MAX_CHAINS]; 378203c4805SLuis R. Rodriguez u8 bswMargin[AR5416_MAX_CHAINS]; 379203c4805SLuis R. Rodriguez u8 swSettleHt40; 380203c4805SLuis R. Rodriguez u8 xatten2Db[AR5416_MAX_CHAINS]; 381203c4805SLuis R. Rodriguez u8 xatten2Margin[AR5416_MAX_CHAINS]; 382203c4805SLuis R. Rodriguez u8 ob_ch1; 383203c4805SLuis R. Rodriguez u8 db_ch1; 384203c4805SLuis R. Rodriguez u8 useAnt1:1, 385203c4805SLuis R. Rodriguez force_xpaon:1, 386203c4805SLuis R. Rodriguez local_bias:1, 387203c4805SLuis R. Rodriguez femBandSelectUsed:1, xlnabufin:1, xlnaisel:2, xlnabufmode:1; 388203c4805SLuis R. Rodriguez u8 miscBits; 389203c4805SLuis R. Rodriguez u16 xpaBiasLvlFreq[3]; 390203c4805SLuis R. Rodriguez u8 futureModal[6]; 391203c4805SLuis R. Rodriguez 392203c4805SLuis R. Rodriguez struct spur_chan spurChans[AR5416_EEPROM_MODAL_SPURS]; 393203c4805SLuis R. Rodriguez } __packed; 394203c4805SLuis R. Rodriguez 395203c4805SLuis R. Rodriguez struct calDataPerFreqOpLoop { 396203c4805SLuis R. Rodriguez u8 pwrPdg[2][5]; 397203c4805SLuis R. Rodriguez u8 vpdPdg[2][5]; 398203c4805SLuis R. Rodriguez u8 pcdac[2][5]; 399203c4805SLuis R. Rodriguez u8 empty[2][5]; 400203c4805SLuis R. Rodriguez } __packed; 401203c4805SLuis R. Rodriguez 402203c4805SLuis R. Rodriguez struct modal_eep_4k_header { 403203c4805SLuis R. Rodriguez u32 antCtrlChain[AR5416_EEP4K_MAX_CHAINS]; 404203c4805SLuis R. Rodriguez u32 antCtrlCommon; 405203c4805SLuis R. Rodriguez u8 antennaGainCh[AR5416_EEP4K_MAX_CHAINS]; 406203c4805SLuis R. Rodriguez u8 switchSettling; 407203c4805SLuis R. Rodriguez u8 txRxAttenCh[AR5416_EEP4K_MAX_CHAINS]; 408203c4805SLuis R. Rodriguez u8 rxTxMarginCh[AR5416_EEP4K_MAX_CHAINS]; 409203c4805SLuis R. Rodriguez u8 adcDesiredSize; 410203c4805SLuis R. Rodriguez u8 pgaDesiredSize; 411203c4805SLuis R. Rodriguez u8 xlnaGainCh[AR5416_EEP4K_MAX_CHAINS]; 412203c4805SLuis R. Rodriguez u8 txEndToXpaOff; 413203c4805SLuis R. Rodriguez u8 txEndToRxOn; 414203c4805SLuis R. Rodriguez u8 txFrameToXpaOn; 415203c4805SLuis R. Rodriguez u8 thresh62; 416203c4805SLuis R. Rodriguez u8 noiseFloorThreshCh[AR5416_EEP4K_MAX_CHAINS]; 417203c4805SLuis R. Rodriguez u8 xpdGain; 418203c4805SLuis R. Rodriguez u8 xpd; 419203c4805SLuis R. Rodriguez u8 iqCalICh[AR5416_EEP4K_MAX_CHAINS]; 420203c4805SLuis R. Rodriguez u8 iqCalQCh[AR5416_EEP4K_MAX_CHAINS]; 421203c4805SLuis R. Rodriguez u8 pdGainOverlap; 4227f63845fSSujith #ifdef __BIG_ENDIAN_BITFIELD 4237f63845fSSujith u8 ob_1:4, ob_0:4; 4247f63845fSSujith u8 db1_1:4, db1_0:4; 4257f63845fSSujith #else 4267f63845fSSujith u8 ob_0:4, ob_1:4; 4277f63845fSSujith u8 db1_0:4, db1_1:4; 4287f63845fSSujith #endif 429203c4805SLuis R. Rodriguez u8 xpaBiasLvl; 430203c4805SLuis R. Rodriguez u8 txFrameToDataStart; 431203c4805SLuis R. Rodriguez u8 txFrameToPaOn; 432203c4805SLuis R. Rodriguez u8 ht40PowerIncForPdadc; 433203c4805SLuis R. Rodriguez u8 bswAtten[AR5416_EEP4K_MAX_CHAINS]; 434203c4805SLuis R. Rodriguez u8 bswMargin[AR5416_EEP4K_MAX_CHAINS]; 435203c4805SLuis R. Rodriguez u8 swSettleHt40; 436203c4805SLuis R. Rodriguez u8 xatten2Db[AR5416_EEP4K_MAX_CHAINS]; 437203c4805SLuis R. Rodriguez u8 xatten2Margin[AR5416_EEP4K_MAX_CHAINS]; 4387f63845fSSujith #ifdef __BIG_ENDIAN_BITFIELD 4397f63845fSSujith u8 db2_1:4, db2_0:4; 4407f63845fSSujith #else 4417f63845fSSujith u8 db2_0:4, db2_1:4; 4427f63845fSSujith #endif 443203c4805SLuis R. Rodriguez u8 version; 4447f63845fSSujith #ifdef __BIG_ENDIAN_BITFIELD 4457f63845fSSujith u8 ob_3:4, ob_2:4; 4467f63845fSSujith u8 antdiv_ctl1:4, ob_4:4; 4477f63845fSSujith u8 db1_3:4, db1_2:4; 4487f63845fSSujith u8 antdiv_ctl2:4, db1_4:4; 4497f63845fSSujith u8 db2_2:4, db2_3:4; 4507f63845fSSujith u8 reserved:4, db2_4:4; 4517f63845fSSujith #else 4527f63845fSSujith u8 ob_2:4, ob_3:4; 4537f63845fSSujith u8 ob_4:4, antdiv_ctl1:4; 4547f63845fSSujith u8 db1_2:4, db1_3:4; 4557f63845fSSujith u8 db1_4:4, antdiv_ctl2:4; 4567f63845fSSujith u8 db2_2:4, db2_3:4; 4577f63845fSSujith u8 db2_4:4, reserved:4; 4587f63845fSSujith #endif 459203c4805SLuis R. Rodriguez u8 futureModal[4]; 460203c4805SLuis R. Rodriguez struct spur_chan spurChans[AR5416_EEPROM_MODAL_SPURS]; 461203c4805SLuis R. Rodriguez } __packed; 462203c4805SLuis R. Rodriguez 463ac88b6ecSVivek Natarajan struct base_eep_ar9287_header { 464ac88b6ecSVivek Natarajan u16 length; 465ac88b6ecSVivek Natarajan u16 checksum; 466ac88b6ecSVivek Natarajan u16 version; 467ac88b6ecSVivek Natarajan u8 opCapFlags; 468ac88b6ecSVivek Natarajan u8 eepMisc; 469ac88b6ecSVivek Natarajan u16 regDmn[2]; 470ac88b6ecSVivek Natarajan u8 macAddr[6]; 471ac88b6ecSVivek Natarajan u8 rxMask; 472ac88b6ecSVivek Natarajan u8 txMask; 473ac88b6ecSVivek Natarajan u16 rfSilent; 474ac88b6ecSVivek Natarajan u16 blueToothOptions; 475ac88b6ecSVivek Natarajan u16 deviceCap; 476ac88b6ecSVivek Natarajan u32 binBuildNumber; 477ac88b6ecSVivek Natarajan u8 deviceType; 478ac88b6ecSVivek Natarajan u8 openLoopPwrCntl; 479ac88b6ecSVivek Natarajan int8_t pwrTableOffset; 480ac88b6ecSVivek Natarajan int8_t tempSensSlope; 481ac88b6ecSVivek Natarajan int8_t tempSensSlopePalOn; 482ac88b6ecSVivek Natarajan u8 futureBase[29]; 483ac88b6ecSVivek Natarajan } __packed; 484ac88b6ecSVivek Natarajan 485ac88b6ecSVivek Natarajan struct modal_eep_ar9287_header { 486ac88b6ecSVivek Natarajan u32 antCtrlChain[AR9287_MAX_CHAINS]; 487ac88b6ecSVivek Natarajan u32 antCtrlCommon; 488ac88b6ecSVivek Natarajan int8_t antennaGainCh[AR9287_MAX_CHAINS]; 489ac88b6ecSVivek Natarajan u8 switchSettling; 490ac88b6ecSVivek Natarajan u8 txRxAttenCh[AR9287_MAX_CHAINS]; 491ac88b6ecSVivek Natarajan u8 rxTxMarginCh[AR9287_MAX_CHAINS]; 492ac88b6ecSVivek Natarajan int8_t adcDesiredSize; 493ac88b6ecSVivek Natarajan u8 txEndToXpaOff; 494ac88b6ecSVivek Natarajan u8 txEndToRxOn; 495ac88b6ecSVivek Natarajan u8 txFrameToXpaOn; 496ac88b6ecSVivek Natarajan u8 thresh62; 497ac88b6ecSVivek Natarajan int8_t noiseFloorThreshCh[AR9287_MAX_CHAINS]; 498ac88b6ecSVivek Natarajan u8 xpdGain; 499ac88b6ecSVivek Natarajan u8 xpd; 500ac88b6ecSVivek Natarajan int8_t iqCalICh[AR9287_MAX_CHAINS]; 501ac88b6ecSVivek Natarajan int8_t iqCalQCh[AR9287_MAX_CHAINS]; 502ac88b6ecSVivek Natarajan u8 pdGainOverlap; 503ac88b6ecSVivek Natarajan u8 xpaBiasLvl; 504ac88b6ecSVivek Natarajan u8 txFrameToDataStart; 505ac88b6ecSVivek Natarajan u8 txFrameToPaOn; 506ac88b6ecSVivek Natarajan u8 ht40PowerIncForPdadc; 507ac88b6ecSVivek Natarajan u8 bswAtten[AR9287_MAX_CHAINS]; 508ac88b6ecSVivek Natarajan u8 bswMargin[AR9287_MAX_CHAINS]; 509ac88b6ecSVivek Natarajan u8 swSettleHt40; 510ac88b6ecSVivek Natarajan u8 version; 511ac88b6ecSVivek Natarajan u8 db1; 512ac88b6ecSVivek Natarajan u8 db2; 513ac88b6ecSVivek Natarajan u8 ob_cck; 514ac88b6ecSVivek Natarajan u8 ob_psk; 515ac88b6ecSVivek Natarajan u8 ob_qam; 516ac88b6ecSVivek Natarajan u8 ob_pal_off; 517ac88b6ecSVivek Natarajan u8 futureModal[30]; 518ac88b6ecSVivek Natarajan struct spur_chan spurChans[AR9287_EEPROM_MODAL_SPURS]; 519ac88b6ecSVivek Natarajan } __packed; 520ac88b6ecSVivek Natarajan 521203c4805SLuis R. Rodriguez struct cal_data_per_freq { 522203c4805SLuis R. Rodriguez u8 pwrPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; 523203c4805SLuis R. Rodriguez u8 vpdPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; 524203c4805SLuis R. Rodriguez } __packed; 525203c4805SLuis R. Rodriguez 526203c4805SLuis R. Rodriguez struct cal_data_per_freq_4k { 527203c4805SLuis R. Rodriguez u8 pwrPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_EEP4K_PD_GAIN_ICEPTS]; 528203c4805SLuis R. Rodriguez u8 vpdPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_EEP4K_PD_GAIN_ICEPTS]; 529203c4805SLuis R. Rodriguez } __packed; 530203c4805SLuis R. Rodriguez 531203c4805SLuis R. Rodriguez struct cal_target_power_leg { 532203c4805SLuis R. Rodriguez u8 bChannel; 533203c4805SLuis R. Rodriguez u8 tPow2x[4]; 534203c4805SLuis R. Rodriguez } __packed; 535203c4805SLuis R. Rodriguez 536203c4805SLuis R. Rodriguez struct cal_target_power_ht { 537203c4805SLuis R. Rodriguez u8 bChannel; 538203c4805SLuis R. Rodriguez u8 tPow2x[8]; 539203c4805SLuis R. Rodriguez } __packed; 540203c4805SLuis R. Rodriguez 541203c4805SLuis R. Rodriguez struct cal_ctl_edges { 542203c4805SLuis R. Rodriguez u8 bChannel; 543*e702ba18SFelix Fietkau u8 ctl; 544203c4805SLuis R. Rodriguez } __packed; 545203c4805SLuis R. Rodriguez 546ac88b6ecSVivek Natarajan struct cal_data_op_loop_ar9287 { 547ac88b6ecSVivek Natarajan u8 pwrPdg[2][5]; 548ac88b6ecSVivek Natarajan u8 vpdPdg[2][5]; 549ac88b6ecSVivek Natarajan u8 pcdac[2][5]; 550ac88b6ecSVivek Natarajan u8 empty[2][5]; 551ac88b6ecSVivek Natarajan } __packed; 552ac88b6ecSVivek Natarajan 553ac88b6ecSVivek Natarajan struct cal_data_per_freq_ar9287 { 554ac88b6ecSVivek Natarajan u8 pwrPdg[AR9287_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS]; 555ac88b6ecSVivek Natarajan u8 vpdPdg[AR9287_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS]; 556ac88b6ecSVivek Natarajan } __packed; 557ac88b6ecSVivek Natarajan 558ac88b6ecSVivek Natarajan union cal_data_per_freq_ar9287_u { 559ac88b6ecSVivek Natarajan struct cal_data_op_loop_ar9287 calDataOpen; 560ac88b6ecSVivek Natarajan struct cal_data_per_freq_ar9287 calDataClose; 561ac88b6ecSVivek Natarajan } __packed; 562ac88b6ecSVivek Natarajan 563ac88b6ecSVivek Natarajan struct cal_ctl_data_ar9287 { 564ac88b6ecSVivek Natarajan struct cal_ctl_edges 565ac88b6ecSVivek Natarajan ctlEdges[AR9287_MAX_CHAINS][AR9287_NUM_BAND_EDGES]; 566ac88b6ecSVivek Natarajan } __packed; 567ac88b6ecSVivek Natarajan 568203c4805SLuis R. Rodriguez struct cal_ctl_data { 569203c4805SLuis R. Rodriguez struct cal_ctl_edges 570203c4805SLuis R. Rodriguez ctlEdges[AR5416_MAX_CHAINS][AR5416_NUM_BAND_EDGES]; 571203c4805SLuis R. Rodriguez } __packed; 572203c4805SLuis R. Rodriguez 573203c4805SLuis R. Rodriguez struct cal_ctl_data_4k { 574203c4805SLuis R. Rodriguez struct cal_ctl_edges 575203c4805SLuis R. Rodriguez ctlEdges[AR5416_EEP4K_MAX_CHAINS][AR5416_EEP4K_NUM_BAND_EDGES]; 576203c4805SLuis R. Rodriguez } __packed; 577203c4805SLuis R. Rodriguez 578203c4805SLuis R. Rodriguez struct ar5416_eeprom_def { 579203c4805SLuis R. Rodriguez struct base_eep_header baseEepHeader; 580203c4805SLuis R. Rodriguez u8 custData[64]; 581203c4805SLuis R. Rodriguez struct modal_eep_header modalHeader[2]; 582203c4805SLuis R. Rodriguez u8 calFreqPier5G[AR5416_NUM_5G_CAL_PIERS]; 583203c4805SLuis R. Rodriguez u8 calFreqPier2G[AR5416_NUM_2G_CAL_PIERS]; 584203c4805SLuis R. Rodriguez struct cal_data_per_freq 585203c4805SLuis R. Rodriguez calPierData5G[AR5416_MAX_CHAINS][AR5416_NUM_5G_CAL_PIERS]; 586203c4805SLuis R. Rodriguez struct cal_data_per_freq 587203c4805SLuis R. Rodriguez calPierData2G[AR5416_MAX_CHAINS][AR5416_NUM_2G_CAL_PIERS]; 588203c4805SLuis R. Rodriguez struct cal_target_power_leg 589203c4805SLuis R. Rodriguez calTargetPower5G[AR5416_NUM_5G_20_TARGET_POWERS]; 590203c4805SLuis R. Rodriguez struct cal_target_power_ht 591203c4805SLuis R. Rodriguez calTargetPower5GHT20[AR5416_NUM_5G_20_TARGET_POWERS]; 592203c4805SLuis R. Rodriguez struct cal_target_power_ht 593203c4805SLuis R. Rodriguez calTargetPower5GHT40[AR5416_NUM_5G_40_TARGET_POWERS]; 594203c4805SLuis R. Rodriguez struct cal_target_power_leg 595203c4805SLuis R. Rodriguez calTargetPowerCck[AR5416_NUM_2G_CCK_TARGET_POWERS]; 596203c4805SLuis R. Rodriguez struct cal_target_power_leg 597203c4805SLuis R. Rodriguez calTargetPower2G[AR5416_NUM_2G_20_TARGET_POWERS]; 598203c4805SLuis R. Rodriguez struct cal_target_power_ht 599203c4805SLuis R. Rodriguez calTargetPower2GHT20[AR5416_NUM_2G_20_TARGET_POWERS]; 600203c4805SLuis R. Rodriguez struct cal_target_power_ht 601203c4805SLuis R. Rodriguez calTargetPower2GHT40[AR5416_NUM_2G_40_TARGET_POWERS]; 602203c4805SLuis R. Rodriguez u8 ctlIndex[AR5416_NUM_CTLS]; 603203c4805SLuis R. Rodriguez struct cal_ctl_data ctlData[AR5416_NUM_CTLS]; 604203c4805SLuis R. Rodriguez u8 padding; 605203c4805SLuis R. Rodriguez } __packed; 606203c4805SLuis R. Rodriguez 607203c4805SLuis R. Rodriguez struct ar5416_eeprom_4k { 608203c4805SLuis R. Rodriguez struct base_eep_header_4k baseEepHeader; 609203c4805SLuis R. Rodriguez u8 custData[20]; 610203c4805SLuis R. Rodriguez struct modal_eep_4k_header modalHeader; 611203c4805SLuis R. Rodriguez u8 calFreqPier2G[AR5416_EEP4K_NUM_2G_CAL_PIERS]; 612203c4805SLuis R. Rodriguez struct cal_data_per_freq_4k 613203c4805SLuis R. Rodriguez calPierData2G[AR5416_EEP4K_MAX_CHAINS][AR5416_EEP4K_NUM_2G_CAL_PIERS]; 614203c4805SLuis R. Rodriguez struct cal_target_power_leg 615203c4805SLuis R. Rodriguez calTargetPowerCck[AR5416_EEP4K_NUM_2G_CCK_TARGET_POWERS]; 616203c4805SLuis R. Rodriguez struct cal_target_power_leg 617203c4805SLuis R. Rodriguez calTargetPower2G[AR5416_EEP4K_NUM_2G_20_TARGET_POWERS]; 618203c4805SLuis R. Rodriguez struct cal_target_power_ht 619203c4805SLuis R. Rodriguez calTargetPower2GHT20[AR5416_EEP4K_NUM_2G_20_TARGET_POWERS]; 620203c4805SLuis R. Rodriguez struct cal_target_power_ht 621203c4805SLuis R. Rodriguez calTargetPower2GHT40[AR5416_EEP4K_NUM_2G_40_TARGET_POWERS]; 622203c4805SLuis R. Rodriguez u8 ctlIndex[AR5416_EEP4K_NUM_CTLS]; 623203c4805SLuis R. Rodriguez struct cal_ctl_data_4k ctlData[AR5416_EEP4K_NUM_CTLS]; 624203c4805SLuis R. Rodriguez u8 padding; 625203c4805SLuis R. Rodriguez } __packed; 626203c4805SLuis R. Rodriguez 627475f5989SLuis R. Rodriguez struct ar9287_eeprom { 628ac88b6ecSVivek Natarajan struct base_eep_ar9287_header baseEepHeader; 629ac88b6ecSVivek Natarajan u8 custData[AR9287_DATA_SZ]; 630ac88b6ecSVivek Natarajan struct modal_eep_ar9287_header modalHeader; 631ac88b6ecSVivek Natarajan u8 calFreqPier2G[AR9287_NUM_2G_CAL_PIERS]; 632ac88b6ecSVivek Natarajan union cal_data_per_freq_ar9287_u 633ac88b6ecSVivek Natarajan calPierData2G[AR9287_MAX_CHAINS][AR9287_NUM_2G_CAL_PIERS]; 634ac88b6ecSVivek Natarajan struct cal_target_power_leg 635ac88b6ecSVivek Natarajan calTargetPowerCck[AR9287_NUM_2G_CCK_TARGET_POWERS]; 636ac88b6ecSVivek Natarajan struct cal_target_power_leg 637ac88b6ecSVivek Natarajan calTargetPower2G[AR9287_NUM_2G_20_TARGET_POWERS]; 638ac88b6ecSVivek Natarajan struct cal_target_power_ht 639ac88b6ecSVivek Natarajan calTargetPower2GHT20[AR9287_NUM_2G_20_TARGET_POWERS]; 640ac88b6ecSVivek Natarajan struct cal_target_power_ht 641ac88b6ecSVivek Natarajan calTargetPower2GHT40[AR9287_NUM_2G_40_TARGET_POWERS]; 642ac88b6ecSVivek Natarajan u8 ctlIndex[AR9287_NUM_CTLS]; 643ac88b6ecSVivek Natarajan struct cal_ctl_data_ar9287 ctlData[AR9287_NUM_CTLS]; 644ac88b6ecSVivek Natarajan u8 padding; 645ac88b6ecSVivek Natarajan } __packed; 646ac88b6ecSVivek Natarajan 647203c4805SLuis R. Rodriguez enum reg_ext_bitmap { 648ebb90cfcSSenthil Balasubramanian REG_EXT_FCC_MIDBAND = 0, 649203c4805SLuis R. Rodriguez REG_EXT_JAPAN_MIDBAND = 1, 650203c4805SLuis R. Rodriguez REG_EXT_FCC_DFS_HT40 = 2, 651203c4805SLuis R. Rodriguez REG_EXT_JAPAN_NONDFS_HT40 = 3, 652203c4805SLuis R. Rodriguez REG_EXT_JAPAN_DFS_HT40 = 4 653203c4805SLuis R. Rodriguez }; 654203c4805SLuis R. Rodriguez 655203c4805SLuis R. Rodriguez struct ath9k_country_entry { 656203c4805SLuis R. Rodriguez u16 countryCode; 657203c4805SLuis R. Rodriguez u16 regDmnEnum; 658203c4805SLuis R. Rodriguez u16 regDmn5G; 659203c4805SLuis R. Rodriguez u16 regDmn2G; 660203c4805SLuis R. Rodriguez u8 isMultidomain; 661203c4805SLuis R. Rodriguez u8 iso[3]; 662203c4805SLuis R. Rodriguez }; 663203c4805SLuis R. Rodriguez 664203c4805SLuis R. Rodriguez struct eeprom_ops { 665203c4805SLuis R. Rodriguez int (*check_eeprom)(struct ath_hw *hw); 666203c4805SLuis R. Rodriguez u32 (*get_eeprom)(struct ath_hw *hw, enum eeprom_param param); 667203c4805SLuis R. Rodriguez bool (*fill_eeprom)(struct ath_hw *hw); 668203c4805SLuis R. Rodriguez int (*get_eeprom_ver)(struct ath_hw *hw); 669203c4805SLuis R. Rodriguez int (*get_eeprom_rev)(struct ath_hw *hw); 670f799a301SRajkumar Manoharan u8 (*get_num_ant_config)(struct ath_hw *hw, 671f799a301SRajkumar Manoharan enum ath9k_hal_freq_band band); 672601e0cb1SFelix Fietkau u32 (*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 68279d7f4bcSSujith void ath9k_hw_analog_shift_regwrite(struct ath_hw *ah, u32 reg, u32 val); 683b5aec950SSujith void ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask, 684b5aec950SSujith u32 shift, u32 val); 685b5aec950SSujith int16_t ath9k_hw_interpolate(u16 target, u16 srcLeft, u16 srcRight, 686b5aec950SSujith int16_t targetLeft, 687b5aec950SSujith int16_t targetRight); 688b5aec950SSujith bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize, 689b5aec950SSujith u16 *indexL, u16 *indexR); 6905bb12791SLuis R. Rodriguez bool ath9k_hw_nvram_read(struct ath_common *common, u32 off, u16 *data); 691b5aec950SSujith void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList, 692b5aec950SSujith u8 *pVpdList, u16 numIntercepts, 693b5aec950SSujith u8 *pRetVpdList); 694b5aec950SSujith void ath9k_hw_get_legacy_target_powers(struct ath_hw *ah, 695b5aec950SSujith struct ath9k_channel *chan, 696b5aec950SSujith struct cal_target_power_leg *powInfo, 697b5aec950SSujith u16 numChannels, 698b5aec950SSujith struct cal_target_power_leg *pNewPower, 699b5aec950SSujith u16 numRates, bool isExtTarget); 700b5aec950SSujith void ath9k_hw_get_target_powers(struct ath_hw *ah, 701b5aec950SSujith struct ath9k_channel *chan, 702b5aec950SSujith struct cal_target_power_ht *powInfo, 703b5aec950SSujith u16 numChannels, 704b5aec950SSujith struct cal_target_power_ht *pNewPower, 705b5aec950SSujith u16 numRates, bool isHt40Target); 706b5aec950SSujith u16 ath9k_hw_get_max_edge_power(u16 freq, struct cal_ctl_edges *pRdEdgesPower, 707b5aec950SSujith bool is2GHz, int num_band_edges); 708a55f8588SSujith void ath9k_hw_update_regulatory_maxpower(struct ath_hw *ah); 709b5aec950SSujith int ath9k_hw_eeprom_init(struct ath_hw *ah); 710b5aec950SSujith 711203c4805SLuis R. Rodriguez #define ar5416_get_ntxchains(_txchainmask) \ 712203c4805SLuis R. Rodriguez (((_txchainmask >> 2) & 1) + \ 713203c4805SLuis R. Rodriguez ((_txchainmask >> 1) & 1) + (_txchainmask & 1)) 714203c4805SLuis R. Rodriguez 715b5aec950SSujith extern const struct eeprom_ops eep_def_ops; 716b5aec950SSujith extern const struct eeprom_ops eep_4k_ops; 7170b8f6f2bSLuis R. Rodriguez extern const struct eeprom_ops eep_ar9287_ops; 71815c9ee7aSSenthil Balasubramanian extern const struct eeprom_ops eep_ar9287_ops; 71915c9ee7aSSenthil Balasubramanian extern const struct eeprom_ops eep_ar9300_ops; 720203c4805SLuis R. Rodriguez 721203c4805SLuis R. Rodriguez #endif /* EEPROM_H */ 722