162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * Copyright (c) 2008-2011 Atheros Communications Inc. 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any 562306a36Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above 662306a36Sopenharmony_ci * copyright notice and this permission notice appear in all copies. 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 962306a36Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 1062306a36Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 1162306a36Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1262306a36Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 1362306a36Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 1462306a36Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1562306a36Sopenharmony_ci */ 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci#ifndef EEPROM_H 1862306a36Sopenharmony_ci#define EEPROM_H 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci#define AR_EEPROM_MODAL_SPURS 5 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci#include "../ath.h" 2362306a36Sopenharmony_ci#include <net/cfg80211.h> 2462306a36Sopenharmony_ci#include "ar9003_eeprom.h" 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci/* helpers to swap EEPROM fields, which are stored as __le16 or __le32. Since 2762306a36Sopenharmony_ci * we are 100% sure about it we __force these to u16/u32 for the swab calls to 2862306a36Sopenharmony_ci * silence the sparse checks. These macros are used when we have a Big Endian 2962306a36Sopenharmony_ci * EEPROM (according to AR5416_EEPMISC_BIG_ENDIAN) and need to convert the 3062306a36Sopenharmony_ci * fields to __le16/__le32. 3162306a36Sopenharmony_ci */ 3262306a36Sopenharmony_ci#define EEPROM_FIELD_SWAB16(field) \ 3362306a36Sopenharmony_ci (field = (__force __le16)swab16((__force u16)field)) 3462306a36Sopenharmony_ci#define EEPROM_FIELD_SWAB32(field) \ 3562306a36Sopenharmony_ci (field = (__force __le32)swab32((__force u32)field)) 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci#ifdef __BIG_ENDIAN 3862306a36Sopenharmony_ci#define AR5416_EEPROM_MAGIC 0x5aa5 3962306a36Sopenharmony_ci#else 4062306a36Sopenharmony_ci#define AR5416_EEPROM_MAGIC 0xa55a 4162306a36Sopenharmony_ci#endif 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci#define CTRY_DEBUG 0x1ff 4462306a36Sopenharmony_ci#define CTRY_DEFAULT 0 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci#define AR_EEPROM_EEPCAP_COMPRESS_DIS 0x0001 4762306a36Sopenharmony_ci#define AR_EEPROM_EEPCAP_AES_DIS 0x0002 4862306a36Sopenharmony_ci#define AR_EEPROM_EEPCAP_FASTFRAME_DIS 0x0004 4962306a36Sopenharmony_ci#define AR_EEPROM_EEPCAP_BURST_DIS 0x0008 5062306a36Sopenharmony_ci#define AR_EEPROM_EEPCAP_MAXQCU 0x01F0 5162306a36Sopenharmony_ci#define AR_EEPROM_EEPCAP_MAXQCU_S 4 5262306a36Sopenharmony_ci#define AR_EEPROM_EEPCAP_HEAVY_CLIP_EN 0x0200 5362306a36Sopenharmony_ci#define AR_EEPROM_EEPCAP_KC_ENTRIES 0xF000 5462306a36Sopenharmony_ci#define AR_EEPROM_EEPCAP_KC_ENTRIES_S 12 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci#define AR_EEPROM_EEREGCAP_EN_FCC_MIDBAND 0x0040 5762306a36Sopenharmony_ci#define AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN 0x0080 5862306a36Sopenharmony_ci#define AR_EEPROM_EEREGCAP_EN_KK_U2 0x0100 5962306a36Sopenharmony_ci#define AR_EEPROM_EEREGCAP_EN_KK_MIDBAND 0x0200 6062306a36Sopenharmony_ci#define AR_EEPROM_EEREGCAP_EN_KK_U1_ODD 0x0400 6162306a36Sopenharmony_ci#define AR_EEPROM_EEREGCAP_EN_KK_NEW_11A 0x0800 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_ci#define AR_EEPROM_EEREGCAP_EN_KK_U1_ODD_PRE4_0 0x4000 6462306a36Sopenharmony_ci#define AR_EEPROM_EEREGCAP_EN_KK_NEW_11A_PRE4_0 0x8000 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci#define AR5416_EEPROM_MAGIC_OFFSET 0x0 6762306a36Sopenharmony_ci#define AR5416_EEPROM_S 2 6862306a36Sopenharmony_ci#define AR5416_EEPROM_OFFSET 0x2000 6962306a36Sopenharmony_ci#define AR5416_EEPROM_MAX 0xae0 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ci#define AR5416_EEPROM_START_ADDR(_ah) \ 7262306a36Sopenharmony_ci (AR_SREV_9100(_ah)) ? 0x1fff1000 : 0x503f1200 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci#define SD_NO_CTL 0xE0 7562306a36Sopenharmony_ci#define NO_CTL 0xff 7662306a36Sopenharmony_ci#define CTL_MODE_M 0xf 7762306a36Sopenharmony_ci#define CTL_11A 0 7862306a36Sopenharmony_ci#define CTL_11B 1 7962306a36Sopenharmony_ci#define CTL_11G 2 8062306a36Sopenharmony_ci#define CTL_2GHT20 5 8162306a36Sopenharmony_ci#define CTL_5GHT20 6 8262306a36Sopenharmony_ci#define CTL_2GHT40 7 8362306a36Sopenharmony_ci#define CTL_5GHT40 8 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_ci#define EXT_ADDITIVE (0x8000) 8662306a36Sopenharmony_ci#define CTL_11A_EXT (CTL_11A | EXT_ADDITIVE) 8762306a36Sopenharmony_ci#define CTL_11G_EXT (CTL_11G | EXT_ADDITIVE) 8862306a36Sopenharmony_ci#define CTL_11B_EXT (CTL_11B | EXT_ADDITIVE) 8962306a36Sopenharmony_ci 9062306a36Sopenharmony_ci#define SUB_NUM_CTL_MODES_AT_5G_40 2 9162306a36Sopenharmony_ci#define SUB_NUM_CTL_MODES_AT_2G_40 3 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci#define POWER_CORRECTION_FOR_TWO_CHAIN 6 /* 10*log10(2)*2 */ 9462306a36Sopenharmony_ci#define POWER_CORRECTION_FOR_THREE_CHAIN 10 /* 10*log10(3)*2 */ 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci/* 9762306a36Sopenharmony_ci * For AR9285 and later chipsets, the following bits are not being programmed 9862306a36Sopenharmony_ci * in EEPROM and so need to be enabled always. 9962306a36Sopenharmony_ci * 10062306a36Sopenharmony_ci * Bit 0: en_fcc_mid 10162306a36Sopenharmony_ci * Bit 1: en_jap_mid 10262306a36Sopenharmony_ci * Bit 2: en_fcc_dfs_ht40 10362306a36Sopenharmony_ci * Bit 3: en_jap_ht40 10462306a36Sopenharmony_ci * Bit 4: en_jap_dfs_ht40 10562306a36Sopenharmony_ci */ 10662306a36Sopenharmony_ci#define AR9285_RDEXT_DEFAULT 0x1F 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ci#define ATH9K_POW_SM(_r, _s) (((_r) & 0x3f) << (_s)) 10962306a36Sopenharmony_ci#define FREQ2FBIN(x, y) (u8)((y) ? ((x) - 2300) : (((x) - 4800) / 5)) 11062306a36Sopenharmony_ci#define FBIN2FREQ(x, y) ((y) ? (2300 + x) : (4800 + 5 * x)) 11162306a36Sopenharmony_ci#define ath9k_hw_use_flash(_ah) (!(_ah->ah_flags & AH_USE_EEPROM)) 11262306a36Sopenharmony_ci 11362306a36Sopenharmony_ci#define OLC_FOR_AR9280_20_LATER(_ah) (AR_SREV_9280_20_OR_LATER(_ah) && \ 11462306a36Sopenharmony_ci _ah->eep_ops->get_eeprom(_ah, EEP_OL_PWRCTRL)) 11562306a36Sopenharmony_ci#define OLC_FOR_AR9287_10_LATER(_ah) (AR_SREV_9287_11_OR_LATER(_ah) && \ 11662306a36Sopenharmony_ci _ah->eep_ops->get_eeprom(_ah, EEP_OL_PWRCTRL)) 11762306a36Sopenharmony_ci 11862306a36Sopenharmony_ci#define EEP_RFSILENT_ENABLED 0x0001 11962306a36Sopenharmony_ci#define EEP_RFSILENT_ENABLED_S 0 12062306a36Sopenharmony_ci#define EEP_RFSILENT_POLARITY 0x0002 12162306a36Sopenharmony_ci#define EEP_RFSILENT_POLARITY_S 1 12262306a36Sopenharmony_ci#define EEP_RFSILENT_GPIO_SEL ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x00fc : 0x001c) 12362306a36Sopenharmony_ci#define EEP_RFSILENT_GPIO_SEL_S 2 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_ci#define AR5416_OPFLAGS_11A 0x01 12662306a36Sopenharmony_ci#define AR5416_OPFLAGS_11G 0x02 12762306a36Sopenharmony_ci#define AR5416_OPFLAGS_N_5G_HT40 0x04 12862306a36Sopenharmony_ci#define AR5416_OPFLAGS_N_2G_HT40 0x08 12962306a36Sopenharmony_ci#define AR5416_OPFLAGS_N_5G_HT20 0x10 13062306a36Sopenharmony_ci#define AR5416_OPFLAGS_N_2G_HT20 0x20 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci#define AR5416_EEP_NO_BACK_VER 0x1 13362306a36Sopenharmony_ci#define AR5416_EEP_VER 0xE 13462306a36Sopenharmony_ci#define AR5416_EEP_VER_MAJOR_SHIFT 12 13562306a36Sopenharmony_ci#define AR5416_EEP_VER_MAJOR_MASK 0xF000 13662306a36Sopenharmony_ci#define AR5416_EEP_VER_MINOR_MASK 0x0FFF 13762306a36Sopenharmony_ci#define AR5416_EEP_MINOR_VER_2 0x2 13862306a36Sopenharmony_ci#define AR5416_EEP_MINOR_VER_3 0x3 13962306a36Sopenharmony_ci#define AR5416_EEP_MINOR_VER_7 0x7 14062306a36Sopenharmony_ci#define AR5416_EEP_MINOR_VER_9 0x9 14162306a36Sopenharmony_ci#define AR5416_EEP_MINOR_VER_16 0x10 14262306a36Sopenharmony_ci#define AR5416_EEP_MINOR_VER_17 0x11 14362306a36Sopenharmony_ci#define AR5416_EEP_MINOR_VER_19 0x13 14462306a36Sopenharmony_ci#define AR5416_EEP_MINOR_VER_20 0x14 14562306a36Sopenharmony_ci#define AR5416_EEP_MINOR_VER_21 0x15 14662306a36Sopenharmony_ci#define AR5416_EEP_MINOR_VER_22 0x16 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ci#define AR5416_NUM_5G_CAL_PIERS 8 14962306a36Sopenharmony_ci#define AR5416_NUM_2G_CAL_PIERS 4 15062306a36Sopenharmony_ci#define AR5416_NUM_5G_20_TARGET_POWERS 8 15162306a36Sopenharmony_ci#define AR5416_NUM_5G_40_TARGET_POWERS 8 15262306a36Sopenharmony_ci#define AR5416_NUM_2G_CCK_TARGET_POWERS 3 15362306a36Sopenharmony_ci#define AR5416_NUM_2G_20_TARGET_POWERS 4 15462306a36Sopenharmony_ci#define AR5416_NUM_2G_40_TARGET_POWERS 4 15562306a36Sopenharmony_ci#define AR5416_NUM_CTLS 24 15662306a36Sopenharmony_ci#define AR5416_NUM_BAND_EDGES 8 15762306a36Sopenharmony_ci#define AR5416_NUM_PD_GAINS 4 15862306a36Sopenharmony_ci#define AR5416_PD_GAINS_IN_MASK 4 15962306a36Sopenharmony_ci#define AR5416_PD_GAIN_ICEPTS 5 16062306a36Sopenharmony_ci#define AR5416_NUM_PDADC_VALUES 128 16162306a36Sopenharmony_ci#define AR5416_BCHAN_UNUSED 0xFF 16262306a36Sopenharmony_ci#define AR5416_MAX_PWR_RANGE_IN_HALF_DB 64 16362306a36Sopenharmony_ci#define AR5416_MAX_CHAINS 3 16462306a36Sopenharmony_ci#define AR9300_MAX_CHAINS 3 16562306a36Sopenharmony_ci#define AR5416_PWR_TABLE_OFFSET_DB -5 16662306a36Sopenharmony_ci 16762306a36Sopenharmony_ci/* Rx gain type values */ 16862306a36Sopenharmony_ci#define AR5416_EEP_RXGAIN_23DB_BACKOFF 0 16962306a36Sopenharmony_ci#define AR5416_EEP_RXGAIN_13DB_BACKOFF 1 17062306a36Sopenharmony_ci#define AR5416_EEP_RXGAIN_ORIG 2 17162306a36Sopenharmony_ci 17262306a36Sopenharmony_ci/* Tx gain type values */ 17362306a36Sopenharmony_ci#define AR5416_EEP_TXGAIN_ORIGINAL 0 17462306a36Sopenharmony_ci#define AR5416_EEP_TXGAIN_HIGH_POWER 1 17562306a36Sopenharmony_ci 17662306a36Sopenharmony_ci/* Endianness of EEPROM content */ 17762306a36Sopenharmony_ci#define AR5416_EEPMISC_BIG_ENDIAN 0x01 17862306a36Sopenharmony_ci 17962306a36Sopenharmony_ci#define AR5416_EEP4K_START_LOC 64 18062306a36Sopenharmony_ci#define AR5416_EEP4K_NUM_2G_CAL_PIERS 3 18162306a36Sopenharmony_ci#define AR5416_EEP4K_NUM_2G_CCK_TARGET_POWERS 3 18262306a36Sopenharmony_ci#define AR5416_EEP4K_NUM_2G_20_TARGET_POWERS 3 18362306a36Sopenharmony_ci#define AR5416_EEP4K_NUM_2G_40_TARGET_POWERS 3 18462306a36Sopenharmony_ci#define AR5416_EEP4K_NUM_CTLS 12 18562306a36Sopenharmony_ci#define AR5416_EEP4K_NUM_BAND_EDGES 4 18662306a36Sopenharmony_ci#define AR5416_EEP4K_NUM_PD_GAINS 2 18762306a36Sopenharmony_ci#define AR5416_EEP4K_MAX_CHAINS 1 18862306a36Sopenharmony_ci 18962306a36Sopenharmony_ci#define AR9280_TX_GAIN_TABLE_SIZE 22 19062306a36Sopenharmony_ci 19162306a36Sopenharmony_ci#define AR9287_EEP_VER 0xE 19262306a36Sopenharmony_ci#define AR9287_EEP_MINOR_VER_1 0x1 19362306a36Sopenharmony_ci#define AR9287_EEP_MINOR_VER_2 0x2 19462306a36Sopenharmony_ci#define AR9287_EEP_MINOR_VER_3 0x3 19562306a36Sopenharmony_ci#define AR9287_EEP_MINOR_VER AR9287_EEP_MINOR_VER_3 19662306a36Sopenharmony_ci#define AR9287_EEP_MINOR_VER_b AR9287_EEP_MINOR_VER 19762306a36Sopenharmony_ci#define AR9287_EEP_NO_BACK_VER AR9287_EEP_MINOR_VER_1 19862306a36Sopenharmony_ci 19962306a36Sopenharmony_ci#define AR9287_EEP_START_LOC 128 20062306a36Sopenharmony_ci#define AR9287_HTC_EEP_START_LOC 256 20162306a36Sopenharmony_ci#define AR9287_NUM_2G_CAL_PIERS 3 20262306a36Sopenharmony_ci#define AR9287_NUM_2G_CCK_TARGET_POWERS 3 20362306a36Sopenharmony_ci#define AR9287_NUM_2G_20_TARGET_POWERS 3 20462306a36Sopenharmony_ci#define AR9287_NUM_2G_40_TARGET_POWERS 3 20562306a36Sopenharmony_ci#define AR9287_NUM_CTLS 12 20662306a36Sopenharmony_ci#define AR9287_NUM_BAND_EDGES 4 20762306a36Sopenharmony_ci#define AR9287_PD_GAIN_ICEPTS 1 20862306a36Sopenharmony_ci#define AR9287_EEPMISC_WOW 0x02 20962306a36Sopenharmony_ci#define AR9287_MAX_CHAINS 2 21062306a36Sopenharmony_ci#define AR9287_ANT_16S 32 21162306a36Sopenharmony_ci 21262306a36Sopenharmony_ci#define AR9287_DATA_SZ 32 21362306a36Sopenharmony_ci 21462306a36Sopenharmony_ci#define AR9287_PWR_TABLE_OFFSET_DB -5 21562306a36Sopenharmony_ci 21662306a36Sopenharmony_ci#define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1) 21762306a36Sopenharmony_ci 21862306a36Sopenharmony_ci#define CTL_EDGE_TPOWER(_ctl) ((_ctl) & 0x3f) 21962306a36Sopenharmony_ci#define CTL_EDGE_FLAGS(_ctl) (((_ctl) >> 6) & 0x03) 22062306a36Sopenharmony_ci 22162306a36Sopenharmony_ci#define LNA_CTL_BUF_MODE BIT(0) 22262306a36Sopenharmony_ci#define LNA_CTL_ISEL_LO BIT(1) 22362306a36Sopenharmony_ci#define LNA_CTL_ISEL_HI BIT(2) 22462306a36Sopenharmony_ci#define LNA_CTL_BUF_IN BIT(3) 22562306a36Sopenharmony_ci#define LNA_CTL_FEM_BAND BIT(4) 22662306a36Sopenharmony_ci#define LNA_CTL_LOCAL_BIAS BIT(5) 22762306a36Sopenharmony_ci#define LNA_CTL_FORCE_XPA BIT(6) 22862306a36Sopenharmony_ci#define LNA_CTL_USE_ANT1 BIT(7) 22962306a36Sopenharmony_ci 23062306a36Sopenharmony_cienum eeprom_param { 23162306a36Sopenharmony_ci EEP_NFTHRESH_5, 23262306a36Sopenharmony_ci EEP_NFTHRESH_2, 23362306a36Sopenharmony_ci EEP_MAC_MSW, 23462306a36Sopenharmony_ci EEP_MAC_MID, 23562306a36Sopenharmony_ci EEP_MAC_LSW, 23662306a36Sopenharmony_ci EEP_REG_0, 23762306a36Sopenharmony_ci EEP_OP_CAP, 23862306a36Sopenharmony_ci EEP_OP_MODE, 23962306a36Sopenharmony_ci EEP_RF_SILENT, 24062306a36Sopenharmony_ci EEP_OB_5, 24162306a36Sopenharmony_ci EEP_DB_5, 24262306a36Sopenharmony_ci EEP_OB_2, 24362306a36Sopenharmony_ci EEP_DB_2, 24462306a36Sopenharmony_ci EEP_TX_MASK, 24562306a36Sopenharmony_ci EEP_RX_MASK, 24662306a36Sopenharmony_ci EEP_FSTCLK_5G, 24762306a36Sopenharmony_ci EEP_RXGAIN_TYPE, 24862306a36Sopenharmony_ci EEP_OL_PWRCTRL, 24962306a36Sopenharmony_ci EEP_TXGAIN_TYPE, 25062306a36Sopenharmony_ci EEP_RC_CHAIN_MASK, 25162306a36Sopenharmony_ci EEP_DAC_HPWR_5G, 25262306a36Sopenharmony_ci EEP_FRAC_N_5G, 25362306a36Sopenharmony_ci EEP_DEV_TYPE, 25462306a36Sopenharmony_ci EEP_TEMPSENSE_SLOPE, 25562306a36Sopenharmony_ci EEP_TEMPSENSE_SLOPE_PAL_ON, 25662306a36Sopenharmony_ci EEP_PWR_TABLE_OFFSET, 25762306a36Sopenharmony_ci EEP_PAPRD, 25862306a36Sopenharmony_ci EEP_MODAL_VER, 25962306a36Sopenharmony_ci EEP_ANT_DIV_CTL1, 26062306a36Sopenharmony_ci EEP_CHAIN_MASK_REDUCE, 26162306a36Sopenharmony_ci EEP_ANTENNA_GAIN_2G, 26262306a36Sopenharmony_ci EEP_ANTENNA_GAIN_5G, 26362306a36Sopenharmony_ci}; 26462306a36Sopenharmony_ci 26562306a36Sopenharmony_cienum ar5416_rates { 26662306a36Sopenharmony_ci rate6mb, rate9mb, rate12mb, rate18mb, 26762306a36Sopenharmony_ci rate24mb, rate36mb, rate48mb, rate54mb, 26862306a36Sopenharmony_ci rate1l, rate2l, rate2s, rate5_5l, 26962306a36Sopenharmony_ci rate5_5s, rate11l, rate11s, rateXr, 27062306a36Sopenharmony_ci rateHt20_0, rateHt20_1, rateHt20_2, rateHt20_3, 27162306a36Sopenharmony_ci rateHt20_4, rateHt20_5, rateHt20_6, rateHt20_7, 27262306a36Sopenharmony_ci rateHt40_0, rateHt40_1, rateHt40_2, rateHt40_3, 27362306a36Sopenharmony_ci rateHt40_4, rateHt40_5, rateHt40_6, rateHt40_7, 27462306a36Sopenharmony_ci rateDupCck, rateDupOfdm, rateExtCck, rateExtOfdm, 27562306a36Sopenharmony_ci Ar5416RateSize 27662306a36Sopenharmony_ci}; 27762306a36Sopenharmony_ci 27862306a36Sopenharmony_cienum ath9k_hal_freq_band { 27962306a36Sopenharmony_ci ATH9K_HAL_FREQ_BAND_5GHZ = 0, 28062306a36Sopenharmony_ci ATH9K_HAL_FREQ_BAND_2GHZ = 1 28162306a36Sopenharmony_ci}; 28262306a36Sopenharmony_ci 28362306a36Sopenharmony_cistruct base_eep_header { 28462306a36Sopenharmony_ci __le16 length; 28562306a36Sopenharmony_ci __le16 checksum; 28662306a36Sopenharmony_ci __le16 version; 28762306a36Sopenharmony_ci u8 opCapFlags; 28862306a36Sopenharmony_ci u8 eepMisc; 28962306a36Sopenharmony_ci __le16 regDmn[2]; 29062306a36Sopenharmony_ci u8 macAddr[6]; 29162306a36Sopenharmony_ci u8 rxMask; 29262306a36Sopenharmony_ci u8 txMask; 29362306a36Sopenharmony_ci __le16 rfSilent; 29462306a36Sopenharmony_ci __le16 blueToothOptions; 29562306a36Sopenharmony_ci __le16 deviceCap; 29662306a36Sopenharmony_ci __le32 binBuildNumber; 29762306a36Sopenharmony_ci u8 deviceType; 29862306a36Sopenharmony_ci u8 pwdclkind; 29962306a36Sopenharmony_ci u8 fastClk5g; 30062306a36Sopenharmony_ci u8 divChain; 30162306a36Sopenharmony_ci u8 rxGainType; 30262306a36Sopenharmony_ci u8 dacHiPwrMode_5G; 30362306a36Sopenharmony_ci u8 openLoopPwrCntl; 30462306a36Sopenharmony_ci u8 dacLpMode; 30562306a36Sopenharmony_ci u8 txGainType; 30662306a36Sopenharmony_ci u8 rcChainMask; 30762306a36Sopenharmony_ci u8 desiredScaleCCK; 30862306a36Sopenharmony_ci u8 pwr_table_offset; 30962306a36Sopenharmony_ci u8 frac_n_5g; 31062306a36Sopenharmony_ci u8 futureBase_3[21]; 31162306a36Sopenharmony_ci} __packed; 31262306a36Sopenharmony_ci 31362306a36Sopenharmony_cistruct base_eep_header_4k { 31462306a36Sopenharmony_ci __le16 length; 31562306a36Sopenharmony_ci __le16 checksum; 31662306a36Sopenharmony_ci __le16 version; 31762306a36Sopenharmony_ci u8 opCapFlags; 31862306a36Sopenharmony_ci u8 eepMisc; 31962306a36Sopenharmony_ci __le16 regDmn[2]; 32062306a36Sopenharmony_ci u8 macAddr[6]; 32162306a36Sopenharmony_ci u8 rxMask; 32262306a36Sopenharmony_ci u8 txMask; 32362306a36Sopenharmony_ci __le16 rfSilent; 32462306a36Sopenharmony_ci __le16 blueToothOptions; 32562306a36Sopenharmony_ci __le16 deviceCap; 32662306a36Sopenharmony_ci __le32 binBuildNumber; 32762306a36Sopenharmony_ci u8 deviceType; 32862306a36Sopenharmony_ci u8 txGainType; 32962306a36Sopenharmony_ci} __packed; 33062306a36Sopenharmony_ci 33162306a36Sopenharmony_ci 33262306a36Sopenharmony_cistruct spur_chan { 33362306a36Sopenharmony_ci __le16 spurChan; 33462306a36Sopenharmony_ci u8 spurRangeLow; 33562306a36Sopenharmony_ci u8 spurRangeHigh; 33662306a36Sopenharmony_ci} __packed; 33762306a36Sopenharmony_ci 33862306a36Sopenharmony_cistruct modal_eep_header { 33962306a36Sopenharmony_ci __le32 antCtrlChain[AR5416_MAX_CHAINS]; 34062306a36Sopenharmony_ci __le32 antCtrlCommon; 34162306a36Sopenharmony_ci u8 antennaGainCh[AR5416_MAX_CHAINS]; 34262306a36Sopenharmony_ci u8 switchSettling; 34362306a36Sopenharmony_ci u8 txRxAttenCh[AR5416_MAX_CHAINS]; 34462306a36Sopenharmony_ci u8 rxTxMarginCh[AR5416_MAX_CHAINS]; 34562306a36Sopenharmony_ci u8 adcDesiredSize; 34662306a36Sopenharmony_ci u8 pgaDesiredSize; 34762306a36Sopenharmony_ci u8 xlnaGainCh[AR5416_MAX_CHAINS]; 34862306a36Sopenharmony_ci u8 txEndToXpaOff; 34962306a36Sopenharmony_ci u8 txEndToRxOn; 35062306a36Sopenharmony_ci u8 txFrameToXpaOn; 35162306a36Sopenharmony_ci u8 thresh62; 35262306a36Sopenharmony_ci u8 noiseFloorThreshCh[AR5416_MAX_CHAINS]; 35362306a36Sopenharmony_ci u8 xpdGain; 35462306a36Sopenharmony_ci u8 xpd; 35562306a36Sopenharmony_ci u8 iqCalICh[AR5416_MAX_CHAINS]; 35662306a36Sopenharmony_ci u8 iqCalQCh[AR5416_MAX_CHAINS]; 35762306a36Sopenharmony_ci u8 pdGainOverlap; 35862306a36Sopenharmony_ci u8 ob; 35962306a36Sopenharmony_ci u8 db; 36062306a36Sopenharmony_ci u8 xpaBiasLvl; 36162306a36Sopenharmony_ci u8 pwrDecreaseFor2Chain; 36262306a36Sopenharmony_ci u8 pwrDecreaseFor3Chain; 36362306a36Sopenharmony_ci u8 txFrameToDataStart; 36462306a36Sopenharmony_ci u8 txFrameToPaOn; 36562306a36Sopenharmony_ci u8 ht40PowerIncForPdadc; 36662306a36Sopenharmony_ci u8 bswAtten[AR5416_MAX_CHAINS]; 36762306a36Sopenharmony_ci u8 bswMargin[AR5416_MAX_CHAINS]; 36862306a36Sopenharmony_ci u8 swSettleHt40; 36962306a36Sopenharmony_ci u8 xatten2Db[AR5416_MAX_CHAINS]; 37062306a36Sopenharmony_ci u8 xatten2Margin[AR5416_MAX_CHAINS]; 37162306a36Sopenharmony_ci u8 ob_ch1; 37262306a36Sopenharmony_ci u8 db_ch1; 37362306a36Sopenharmony_ci u8 lna_ctl; 37462306a36Sopenharmony_ci u8 miscBits; 37562306a36Sopenharmony_ci __le16 xpaBiasLvlFreq[3]; 37662306a36Sopenharmony_ci u8 futureModal[6]; 37762306a36Sopenharmony_ci 37862306a36Sopenharmony_ci struct spur_chan spurChans[AR_EEPROM_MODAL_SPURS]; 37962306a36Sopenharmony_ci} __packed; 38062306a36Sopenharmony_ci 38162306a36Sopenharmony_cistruct calDataPerFreqOpLoop { 38262306a36Sopenharmony_ci u8 pwrPdg[2][5]; 38362306a36Sopenharmony_ci u8 vpdPdg[2][5]; 38462306a36Sopenharmony_ci u8 pcdac[2][5]; 38562306a36Sopenharmony_ci u8 empty[2][5]; 38662306a36Sopenharmony_ci} __packed; 38762306a36Sopenharmony_ci 38862306a36Sopenharmony_cistruct modal_eep_4k_header { 38962306a36Sopenharmony_ci __le32 antCtrlChain[AR5416_EEP4K_MAX_CHAINS]; 39062306a36Sopenharmony_ci __le32 antCtrlCommon; 39162306a36Sopenharmony_ci u8 antennaGainCh[AR5416_EEP4K_MAX_CHAINS]; 39262306a36Sopenharmony_ci u8 switchSettling; 39362306a36Sopenharmony_ci u8 txRxAttenCh[AR5416_EEP4K_MAX_CHAINS]; 39462306a36Sopenharmony_ci u8 rxTxMarginCh[AR5416_EEP4K_MAX_CHAINS]; 39562306a36Sopenharmony_ci u8 adcDesiredSize; 39662306a36Sopenharmony_ci u8 pgaDesiredSize; 39762306a36Sopenharmony_ci u8 xlnaGainCh[AR5416_EEP4K_MAX_CHAINS]; 39862306a36Sopenharmony_ci u8 txEndToXpaOff; 39962306a36Sopenharmony_ci u8 txEndToRxOn; 40062306a36Sopenharmony_ci u8 txFrameToXpaOn; 40162306a36Sopenharmony_ci u8 thresh62; 40262306a36Sopenharmony_ci u8 noiseFloorThreshCh[AR5416_EEP4K_MAX_CHAINS]; 40362306a36Sopenharmony_ci u8 xpdGain; 40462306a36Sopenharmony_ci u8 xpd; 40562306a36Sopenharmony_ci u8 iqCalICh[AR5416_EEP4K_MAX_CHAINS]; 40662306a36Sopenharmony_ci u8 iqCalQCh[AR5416_EEP4K_MAX_CHAINS]; 40762306a36Sopenharmony_ci u8 pdGainOverlap; 40862306a36Sopenharmony_ci#ifdef __BIG_ENDIAN_BITFIELD 40962306a36Sopenharmony_ci u8 ob_1:4, ob_0:4; 41062306a36Sopenharmony_ci u8 db1_1:4, db1_0:4; 41162306a36Sopenharmony_ci#else 41262306a36Sopenharmony_ci u8 ob_0:4, ob_1:4; 41362306a36Sopenharmony_ci u8 db1_0:4, db1_1:4; 41462306a36Sopenharmony_ci#endif 41562306a36Sopenharmony_ci u8 xpaBiasLvl; 41662306a36Sopenharmony_ci u8 txFrameToDataStart; 41762306a36Sopenharmony_ci u8 txFrameToPaOn; 41862306a36Sopenharmony_ci u8 ht40PowerIncForPdadc; 41962306a36Sopenharmony_ci u8 bswAtten[AR5416_EEP4K_MAX_CHAINS]; 42062306a36Sopenharmony_ci u8 bswMargin[AR5416_EEP4K_MAX_CHAINS]; 42162306a36Sopenharmony_ci u8 swSettleHt40; 42262306a36Sopenharmony_ci u8 xatten2Db[AR5416_EEP4K_MAX_CHAINS]; 42362306a36Sopenharmony_ci u8 xatten2Margin[AR5416_EEP4K_MAX_CHAINS]; 42462306a36Sopenharmony_ci#ifdef __BIG_ENDIAN_BITFIELD 42562306a36Sopenharmony_ci u8 db2_1:4, db2_0:4; 42662306a36Sopenharmony_ci#else 42762306a36Sopenharmony_ci u8 db2_0:4, db2_1:4; 42862306a36Sopenharmony_ci#endif 42962306a36Sopenharmony_ci u8 version; 43062306a36Sopenharmony_ci#ifdef __BIG_ENDIAN_BITFIELD 43162306a36Sopenharmony_ci u8 ob_3:4, ob_2:4; 43262306a36Sopenharmony_ci u8 antdiv_ctl1:4, ob_4:4; 43362306a36Sopenharmony_ci u8 db1_3:4, db1_2:4; 43462306a36Sopenharmony_ci u8 antdiv_ctl2:4, db1_4:4; 43562306a36Sopenharmony_ci u8 db2_2:4, db2_3:4; 43662306a36Sopenharmony_ci u8 reserved:4, db2_4:4; 43762306a36Sopenharmony_ci#else 43862306a36Sopenharmony_ci u8 ob_2:4, ob_3:4; 43962306a36Sopenharmony_ci u8 ob_4:4, antdiv_ctl1:4; 44062306a36Sopenharmony_ci u8 db1_2:4, db1_3:4; 44162306a36Sopenharmony_ci u8 db1_4:4, antdiv_ctl2:4; 44262306a36Sopenharmony_ci u8 db2_2:4, db2_3:4; 44362306a36Sopenharmony_ci u8 db2_4:4, reserved:4; 44462306a36Sopenharmony_ci#endif 44562306a36Sopenharmony_ci u8 tx_diversity; 44662306a36Sopenharmony_ci u8 flc_pwr_thresh; 44762306a36Sopenharmony_ci u8 bb_scale_smrt_antenna; 44862306a36Sopenharmony_ci#define EEP_4K_BB_DESIRED_SCALE_MASK 0x1f 44962306a36Sopenharmony_ci u8 futureModal[1]; 45062306a36Sopenharmony_ci struct spur_chan spurChans[AR_EEPROM_MODAL_SPURS]; 45162306a36Sopenharmony_ci} __packed; 45262306a36Sopenharmony_ci 45362306a36Sopenharmony_cistruct base_eep_ar9287_header { 45462306a36Sopenharmony_ci __le16 length; 45562306a36Sopenharmony_ci __le16 checksum; 45662306a36Sopenharmony_ci __le16 version; 45762306a36Sopenharmony_ci u8 opCapFlags; 45862306a36Sopenharmony_ci u8 eepMisc; 45962306a36Sopenharmony_ci __le16 regDmn[2]; 46062306a36Sopenharmony_ci u8 macAddr[6]; 46162306a36Sopenharmony_ci u8 rxMask; 46262306a36Sopenharmony_ci u8 txMask; 46362306a36Sopenharmony_ci __le16 rfSilent; 46462306a36Sopenharmony_ci __le16 blueToothOptions; 46562306a36Sopenharmony_ci __le16 deviceCap; 46662306a36Sopenharmony_ci __le32 binBuildNumber; 46762306a36Sopenharmony_ci u8 deviceType; 46862306a36Sopenharmony_ci u8 openLoopPwrCntl; 46962306a36Sopenharmony_ci int8_t pwrTableOffset; 47062306a36Sopenharmony_ci int8_t tempSensSlope; 47162306a36Sopenharmony_ci int8_t tempSensSlopePalOn; 47262306a36Sopenharmony_ci u8 futureBase[29]; 47362306a36Sopenharmony_ci} __packed; 47462306a36Sopenharmony_ci 47562306a36Sopenharmony_cistruct modal_eep_ar9287_header { 47662306a36Sopenharmony_ci __le32 antCtrlChain[AR9287_MAX_CHAINS]; 47762306a36Sopenharmony_ci __le32 antCtrlCommon; 47862306a36Sopenharmony_ci int8_t antennaGainCh[AR9287_MAX_CHAINS]; 47962306a36Sopenharmony_ci u8 switchSettling; 48062306a36Sopenharmony_ci u8 txRxAttenCh[AR9287_MAX_CHAINS]; 48162306a36Sopenharmony_ci u8 rxTxMarginCh[AR9287_MAX_CHAINS]; 48262306a36Sopenharmony_ci int8_t adcDesiredSize; 48362306a36Sopenharmony_ci u8 txEndToXpaOff; 48462306a36Sopenharmony_ci u8 txEndToRxOn; 48562306a36Sopenharmony_ci u8 txFrameToXpaOn; 48662306a36Sopenharmony_ci u8 thresh62; 48762306a36Sopenharmony_ci int8_t noiseFloorThreshCh[AR9287_MAX_CHAINS]; 48862306a36Sopenharmony_ci u8 xpdGain; 48962306a36Sopenharmony_ci u8 xpd; 49062306a36Sopenharmony_ci int8_t iqCalICh[AR9287_MAX_CHAINS]; 49162306a36Sopenharmony_ci int8_t iqCalQCh[AR9287_MAX_CHAINS]; 49262306a36Sopenharmony_ci u8 pdGainOverlap; 49362306a36Sopenharmony_ci u8 xpaBiasLvl; 49462306a36Sopenharmony_ci u8 txFrameToDataStart; 49562306a36Sopenharmony_ci u8 txFrameToPaOn; 49662306a36Sopenharmony_ci u8 ht40PowerIncForPdadc; 49762306a36Sopenharmony_ci u8 bswAtten[AR9287_MAX_CHAINS]; 49862306a36Sopenharmony_ci u8 bswMargin[AR9287_MAX_CHAINS]; 49962306a36Sopenharmony_ci u8 swSettleHt40; 50062306a36Sopenharmony_ci u8 version; 50162306a36Sopenharmony_ci u8 db1; 50262306a36Sopenharmony_ci u8 db2; 50362306a36Sopenharmony_ci u8 ob_cck; 50462306a36Sopenharmony_ci u8 ob_psk; 50562306a36Sopenharmony_ci u8 ob_qam; 50662306a36Sopenharmony_ci u8 ob_pal_off; 50762306a36Sopenharmony_ci u8 futureModal[30]; 50862306a36Sopenharmony_ci struct spur_chan spurChans[AR_EEPROM_MODAL_SPURS]; 50962306a36Sopenharmony_ci} __packed; 51062306a36Sopenharmony_ci 51162306a36Sopenharmony_cistruct cal_data_per_freq { 51262306a36Sopenharmony_ci u8 pwrPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; 51362306a36Sopenharmony_ci u8 vpdPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; 51462306a36Sopenharmony_ci} __packed; 51562306a36Sopenharmony_ci 51662306a36Sopenharmony_cistruct cal_data_per_freq_4k { 51762306a36Sopenharmony_ci u8 pwrPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; 51862306a36Sopenharmony_ci u8 vpdPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; 51962306a36Sopenharmony_ci} __packed; 52062306a36Sopenharmony_ci 52162306a36Sopenharmony_cistruct cal_target_power_leg { 52262306a36Sopenharmony_ci u8 bChannel; 52362306a36Sopenharmony_ci u8 tPow2x[4]; 52462306a36Sopenharmony_ci} __packed; 52562306a36Sopenharmony_ci 52662306a36Sopenharmony_cistruct cal_target_power_ht { 52762306a36Sopenharmony_ci u8 bChannel; 52862306a36Sopenharmony_ci u8 tPow2x[8]; 52962306a36Sopenharmony_ci} __packed; 53062306a36Sopenharmony_ci 53162306a36Sopenharmony_cistruct cal_ctl_edges { 53262306a36Sopenharmony_ci u8 bChannel; 53362306a36Sopenharmony_ci u8 ctl; 53462306a36Sopenharmony_ci} __packed; 53562306a36Sopenharmony_ci 53662306a36Sopenharmony_cistruct cal_data_op_loop_ar9287 { 53762306a36Sopenharmony_ci u8 pwrPdg[2][5]; 53862306a36Sopenharmony_ci u8 vpdPdg[2][5]; 53962306a36Sopenharmony_ci u8 pcdac[2][5]; 54062306a36Sopenharmony_ci u8 empty[2][5]; 54162306a36Sopenharmony_ci} __packed; 54262306a36Sopenharmony_ci 54362306a36Sopenharmony_cistruct cal_data_per_freq_ar9287 { 54462306a36Sopenharmony_ci u8 pwrPdg[AR5416_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS]; 54562306a36Sopenharmony_ci u8 vpdPdg[AR5416_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS]; 54662306a36Sopenharmony_ci} __packed; 54762306a36Sopenharmony_ci 54862306a36Sopenharmony_ciunion cal_data_per_freq_ar9287_u { 54962306a36Sopenharmony_ci struct cal_data_op_loop_ar9287 calDataOpen; 55062306a36Sopenharmony_ci struct cal_data_per_freq_ar9287 calDataClose; 55162306a36Sopenharmony_ci} __packed; 55262306a36Sopenharmony_ci 55362306a36Sopenharmony_cistruct cal_ctl_data_ar9287 { 55462306a36Sopenharmony_ci struct cal_ctl_edges 55562306a36Sopenharmony_ci ctlEdges[AR9287_MAX_CHAINS][AR9287_NUM_BAND_EDGES]; 55662306a36Sopenharmony_ci} __packed; 55762306a36Sopenharmony_ci 55862306a36Sopenharmony_cistruct cal_ctl_data { 55962306a36Sopenharmony_ci struct cal_ctl_edges 56062306a36Sopenharmony_ci ctlEdges[AR5416_MAX_CHAINS][AR5416_NUM_BAND_EDGES]; 56162306a36Sopenharmony_ci} __packed; 56262306a36Sopenharmony_ci 56362306a36Sopenharmony_cistruct cal_ctl_data_4k { 56462306a36Sopenharmony_ci struct cal_ctl_edges 56562306a36Sopenharmony_ci ctlEdges[AR5416_EEP4K_MAX_CHAINS][AR5416_EEP4K_NUM_BAND_EDGES]; 56662306a36Sopenharmony_ci} __packed; 56762306a36Sopenharmony_ci 56862306a36Sopenharmony_cistruct ar5416_eeprom_def { 56962306a36Sopenharmony_ci struct base_eep_header baseEepHeader; 57062306a36Sopenharmony_ci u8 custData[64]; 57162306a36Sopenharmony_ci struct modal_eep_header modalHeader[2]; 57262306a36Sopenharmony_ci u8 calFreqPier5G[AR5416_NUM_5G_CAL_PIERS]; 57362306a36Sopenharmony_ci u8 calFreqPier2G[AR5416_NUM_2G_CAL_PIERS]; 57462306a36Sopenharmony_ci struct cal_data_per_freq 57562306a36Sopenharmony_ci calPierData5G[AR5416_MAX_CHAINS][AR5416_NUM_5G_CAL_PIERS]; 57662306a36Sopenharmony_ci struct cal_data_per_freq 57762306a36Sopenharmony_ci calPierData2G[AR5416_MAX_CHAINS][AR5416_NUM_2G_CAL_PIERS]; 57862306a36Sopenharmony_ci struct cal_target_power_leg 57962306a36Sopenharmony_ci calTargetPower5G[AR5416_NUM_5G_20_TARGET_POWERS]; 58062306a36Sopenharmony_ci struct cal_target_power_ht 58162306a36Sopenharmony_ci calTargetPower5GHT20[AR5416_NUM_5G_20_TARGET_POWERS]; 58262306a36Sopenharmony_ci struct cal_target_power_ht 58362306a36Sopenharmony_ci calTargetPower5GHT40[AR5416_NUM_5G_40_TARGET_POWERS]; 58462306a36Sopenharmony_ci struct cal_target_power_leg 58562306a36Sopenharmony_ci calTargetPowerCck[AR5416_NUM_2G_CCK_TARGET_POWERS]; 58662306a36Sopenharmony_ci struct cal_target_power_leg 58762306a36Sopenharmony_ci calTargetPower2G[AR5416_NUM_2G_20_TARGET_POWERS]; 58862306a36Sopenharmony_ci struct cal_target_power_ht 58962306a36Sopenharmony_ci calTargetPower2GHT20[AR5416_NUM_2G_20_TARGET_POWERS]; 59062306a36Sopenharmony_ci struct cal_target_power_ht 59162306a36Sopenharmony_ci calTargetPower2GHT40[AR5416_NUM_2G_40_TARGET_POWERS]; 59262306a36Sopenharmony_ci u8 ctlIndex[AR5416_NUM_CTLS]; 59362306a36Sopenharmony_ci struct cal_ctl_data ctlData[AR5416_NUM_CTLS]; 59462306a36Sopenharmony_ci u8 padding; 59562306a36Sopenharmony_ci} __packed; 59662306a36Sopenharmony_ci 59762306a36Sopenharmony_cistruct ar5416_eeprom_4k { 59862306a36Sopenharmony_ci struct base_eep_header_4k baseEepHeader; 59962306a36Sopenharmony_ci u8 custData[20]; 60062306a36Sopenharmony_ci struct modal_eep_4k_header modalHeader; 60162306a36Sopenharmony_ci u8 calFreqPier2G[AR5416_EEP4K_NUM_2G_CAL_PIERS]; 60262306a36Sopenharmony_ci struct cal_data_per_freq_4k 60362306a36Sopenharmony_ci calPierData2G[AR5416_EEP4K_MAX_CHAINS][AR5416_EEP4K_NUM_2G_CAL_PIERS]; 60462306a36Sopenharmony_ci struct cal_target_power_leg 60562306a36Sopenharmony_ci calTargetPowerCck[AR5416_EEP4K_NUM_2G_CCK_TARGET_POWERS]; 60662306a36Sopenharmony_ci struct cal_target_power_leg 60762306a36Sopenharmony_ci calTargetPower2G[AR5416_EEP4K_NUM_2G_20_TARGET_POWERS]; 60862306a36Sopenharmony_ci struct cal_target_power_ht 60962306a36Sopenharmony_ci calTargetPower2GHT20[AR5416_EEP4K_NUM_2G_20_TARGET_POWERS]; 61062306a36Sopenharmony_ci struct cal_target_power_ht 61162306a36Sopenharmony_ci calTargetPower2GHT40[AR5416_EEP4K_NUM_2G_40_TARGET_POWERS]; 61262306a36Sopenharmony_ci u8 ctlIndex[AR5416_EEP4K_NUM_CTLS]; 61362306a36Sopenharmony_ci struct cal_ctl_data_4k ctlData[AR5416_EEP4K_NUM_CTLS]; 61462306a36Sopenharmony_ci u8 padding; 61562306a36Sopenharmony_ci} __packed; 61662306a36Sopenharmony_ci 61762306a36Sopenharmony_cistruct ar9287_eeprom { 61862306a36Sopenharmony_ci struct base_eep_ar9287_header baseEepHeader; 61962306a36Sopenharmony_ci u8 custData[AR9287_DATA_SZ]; 62062306a36Sopenharmony_ci struct modal_eep_ar9287_header modalHeader; 62162306a36Sopenharmony_ci u8 calFreqPier2G[AR9287_NUM_2G_CAL_PIERS]; 62262306a36Sopenharmony_ci union cal_data_per_freq_ar9287_u 62362306a36Sopenharmony_ci calPierData2G[AR9287_MAX_CHAINS][AR9287_NUM_2G_CAL_PIERS]; 62462306a36Sopenharmony_ci struct cal_target_power_leg 62562306a36Sopenharmony_ci calTargetPowerCck[AR9287_NUM_2G_CCK_TARGET_POWERS]; 62662306a36Sopenharmony_ci struct cal_target_power_leg 62762306a36Sopenharmony_ci calTargetPower2G[AR9287_NUM_2G_20_TARGET_POWERS]; 62862306a36Sopenharmony_ci struct cal_target_power_ht 62962306a36Sopenharmony_ci calTargetPower2GHT20[AR9287_NUM_2G_20_TARGET_POWERS]; 63062306a36Sopenharmony_ci struct cal_target_power_ht 63162306a36Sopenharmony_ci calTargetPower2GHT40[AR9287_NUM_2G_40_TARGET_POWERS]; 63262306a36Sopenharmony_ci u8 ctlIndex[AR9287_NUM_CTLS]; 63362306a36Sopenharmony_ci struct cal_ctl_data_ar9287 ctlData[AR9287_NUM_CTLS]; 63462306a36Sopenharmony_ci u8 padding; 63562306a36Sopenharmony_ci} __packed; 63662306a36Sopenharmony_ci 63762306a36Sopenharmony_cienum reg_ext_bitmap { 63862306a36Sopenharmony_ci REG_EXT_FCC_MIDBAND = 0, 63962306a36Sopenharmony_ci REG_EXT_JAPAN_MIDBAND = 1, 64062306a36Sopenharmony_ci REG_EXT_FCC_DFS_HT40 = 2, 64162306a36Sopenharmony_ci REG_EXT_JAPAN_NONDFS_HT40 = 3, 64262306a36Sopenharmony_ci REG_EXT_JAPAN_DFS_HT40 = 4 64362306a36Sopenharmony_ci}; 64462306a36Sopenharmony_ci 64562306a36Sopenharmony_cistruct ath9k_country_entry { 64662306a36Sopenharmony_ci u16 countryCode; 64762306a36Sopenharmony_ci u16 regDmnEnum; 64862306a36Sopenharmony_ci u16 regDmn5G; 64962306a36Sopenharmony_ci u16 regDmn2G; 65062306a36Sopenharmony_ci u8 isMultidomain; 65162306a36Sopenharmony_ci u8 iso[3]; 65262306a36Sopenharmony_ci}; 65362306a36Sopenharmony_ci 65462306a36Sopenharmony_cistruct eeprom_ops { 65562306a36Sopenharmony_ci int (*check_eeprom)(struct ath_hw *hw); 65662306a36Sopenharmony_ci u32 (*get_eeprom)(struct ath_hw *hw, enum eeprom_param param); 65762306a36Sopenharmony_ci bool (*fill_eeprom)(struct ath_hw *hw); 65862306a36Sopenharmony_ci u32 (*dump_eeprom)(struct ath_hw *hw, bool dump_base_hdr, u8 *buf, 65962306a36Sopenharmony_ci u32 len, u32 size); 66062306a36Sopenharmony_ci int (*get_eeprom_ver)(struct ath_hw *hw); 66162306a36Sopenharmony_ci int (*get_eeprom_rev)(struct ath_hw *hw); 66262306a36Sopenharmony_ci void (*set_board_values)(struct ath_hw *hw, struct ath9k_channel *chan); 66362306a36Sopenharmony_ci void (*set_addac)(struct ath_hw *hw, struct ath9k_channel *chan); 66462306a36Sopenharmony_ci void (*set_txpower)(struct ath_hw *hw, struct ath9k_channel *chan, 66562306a36Sopenharmony_ci u16 cfgCtl, u8 twiceAntennaReduction, 66662306a36Sopenharmony_ci u8 powerLimit, bool test); 66762306a36Sopenharmony_ci u16 (*get_spur_channel)(struct ath_hw *ah, u16 i, bool is2GHz); 66862306a36Sopenharmony_ci u8 (*get_eepmisc)(struct ath_hw *ah); 66962306a36Sopenharmony_ci}; 67062306a36Sopenharmony_ci 67162306a36Sopenharmony_civoid ath9k_hw_analog_shift_regwrite(struct ath_hw *ah, u32 reg, u32 val); 67262306a36Sopenharmony_civoid ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask, 67362306a36Sopenharmony_ci u32 shift, u32 val); 67462306a36Sopenharmony_ciint16_t ath9k_hw_interpolate(u16 target, u16 srcLeft, u16 srcRight, 67562306a36Sopenharmony_ci int16_t targetLeft, 67662306a36Sopenharmony_ci int16_t targetRight); 67762306a36Sopenharmony_cibool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize, 67862306a36Sopenharmony_ci u16 *indexL, u16 *indexR); 67962306a36Sopenharmony_cibool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data); 68062306a36Sopenharmony_ciint ath9k_hw_nvram_swap_data(struct ath_hw *ah, bool *swap_needed, int size); 68162306a36Sopenharmony_cibool ath9k_hw_nvram_validate_checksum(struct ath_hw *ah, int size); 68262306a36Sopenharmony_cibool ath9k_hw_nvram_check_version(struct ath_hw *ah, int version, int minrev); 68362306a36Sopenharmony_civoid ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data, 68462306a36Sopenharmony_ci int eep_start_loc, int size); 68562306a36Sopenharmony_civoid ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList, 68662306a36Sopenharmony_ci u8 *pVpdList, u16 numIntercepts, 68762306a36Sopenharmony_ci u8 *pRetVpdList); 68862306a36Sopenharmony_civoid ath9k_hw_get_legacy_target_powers(struct ath_hw *ah, 68962306a36Sopenharmony_ci struct ath9k_channel *chan, 69062306a36Sopenharmony_ci struct cal_target_power_leg *powInfo, 69162306a36Sopenharmony_ci u16 numChannels, 69262306a36Sopenharmony_ci struct cal_target_power_leg *pNewPower, 69362306a36Sopenharmony_ci u16 numRates, bool isExtTarget); 69462306a36Sopenharmony_civoid ath9k_hw_get_target_powers(struct ath_hw *ah, 69562306a36Sopenharmony_ci struct ath9k_channel *chan, 69662306a36Sopenharmony_ci struct cal_target_power_ht *powInfo, 69762306a36Sopenharmony_ci u16 numChannels, 69862306a36Sopenharmony_ci struct cal_target_power_ht *pNewPower, 69962306a36Sopenharmony_ci u16 numRates, bool isHt40Target); 70062306a36Sopenharmony_ciu16 ath9k_hw_get_max_edge_power(u16 freq, struct cal_ctl_edges *pRdEdgesPower, 70162306a36Sopenharmony_ci bool is2GHz, int num_band_edges); 70262306a36Sopenharmony_ciu16 ath9k_hw_get_scaled_power(struct ath_hw *ah, u16 power_limit, 70362306a36Sopenharmony_ci u8 antenna_reduction); 70462306a36Sopenharmony_civoid ath9k_hw_update_regulatory_maxpower(struct ath_hw *ah); 70562306a36Sopenharmony_ciint ath9k_hw_eeprom_init(struct ath_hw *ah); 70662306a36Sopenharmony_ci 70762306a36Sopenharmony_civoid ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah, 70862306a36Sopenharmony_ci struct ath9k_channel *chan, 70962306a36Sopenharmony_ci void *pRawDataSet, 71062306a36Sopenharmony_ci u8 *bChans, u16 availPiers, 71162306a36Sopenharmony_ci u16 tPdGainOverlap, 71262306a36Sopenharmony_ci u16 *pPdGainBoundaries, u8 *pPDADCValues, 71362306a36Sopenharmony_ci u16 numXpdGains); 71462306a36Sopenharmony_ci 71562306a36Sopenharmony_cistatic inline u16 ath9k_hw_fbin2freq(u8 fbin, bool is2GHz) 71662306a36Sopenharmony_ci{ 71762306a36Sopenharmony_ci if (fbin == AR5416_BCHAN_UNUSED) 71862306a36Sopenharmony_ci return fbin; 71962306a36Sopenharmony_ci 72062306a36Sopenharmony_ci return (u16) ((is2GHz) ? (2300 + fbin) : (4800 + 5 * fbin)); 72162306a36Sopenharmony_ci} 72262306a36Sopenharmony_ci 72362306a36Sopenharmony_ci#define ar5416_get_ntxchains(_txchainmask) \ 72462306a36Sopenharmony_ci (((_txchainmask >> 2) & 1) + \ 72562306a36Sopenharmony_ci ((_txchainmask >> 1) & 1) + (_txchainmask & 1)) 72662306a36Sopenharmony_ci 72762306a36Sopenharmony_ciextern const struct eeprom_ops eep_def_ops; 72862306a36Sopenharmony_ciextern const struct eeprom_ops eep_4k_ops; 72962306a36Sopenharmony_ciextern const struct eeprom_ops eep_ar9287_ops; 73062306a36Sopenharmony_ciextern const struct eeprom_ops eep_ar9287_ops; 73162306a36Sopenharmony_ciextern const struct eeprom_ops eep_ar9300_ops; 73262306a36Sopenharmony_ci 73362306a36Sopenharmony_ci#endif /* EEPROM_H */ 734