18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright (c) 2008-2011 Atheros Communications Inc. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any 58c2ecf20Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above 68c2ecf20Sopenharmony_ci * copyright notice and this permission notice appear in all copies. 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 98c2ecf20Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 108c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 118c2ecf20Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 128c2ecf20Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 138c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 148c2ecf20Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 158c2ecf20Sopenharmony_ci */ 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#ifndef EEPROM_H 188c2ecf20Sopenharmony_ci#define EEPROM_H 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define AR_EEPROM_MODAL_SPURS 5 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#include "../ath.h" 238c2ecf20Sopenharmony_ci#include <net/cfg80211.h> 248c2ecf20Sopenharmony_ci#include "ar9003_eeprom.h" 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* helpers to swap EEPROM fields, which are stored as __le16 or __le32. Since 278c2ecf20Sopenharmony_ci * we are 100% sure about it we __force these to u16/u32 for the swab calls to 288c2ecf20Sopenharmony_ci * silence the sparse checks. These macros are used when we have a Big Endian 298c2ecf20Sopenharmony_ci * EEPROM (according to AR5416_EEPMISC_BIG_ENDIAN) and need to convert the 308c2ecf20Sopenharmony_ci * fields to __le16/__le32. 318c2ecf20Sopenharmony_ci */ 328c2ecf20Sopenharmony_ci#define EEPROM_FIELD_SWAB16(field) \ 338c2ecf20Sopenharmony_ci (field = (__force __le16)swab16((__force u16)field)) 348c2ecf20Sopenharmony_ci#define EEPROM_FIELD_SWAB32(field) \ 358c2ecf20Sopenharmony_ci (field = (__force __le32)swab32((__force u32)field)) 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#ifdef __BIG_ENDIAN 388c2ecf20Sopenharmony_ci#define AR5416_EEPROM_MAGIC 0x5aa5 398c2ecf20Sopenharmony_ci#else 408c2ecf20Sopenharmony_ci#define AR5416_EEPROM_MAGIC 0xa55a 418c2ecf20Sopenharmony_ci#endif 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#define CTRY_DEBUG 0x1ff 448c2ecf20Sopenharmony_ci#define CTRY_DEFAULT 0 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#define AR_EEPROM_EEPCAP_COMPRESS_DIS 0x0001 478c2ecf20Sopenharmony_ci#define AR_EEPROM_EEPCAP_AES_DIS 0x0002 488c2ecf20Sopenharmony_ci#define AR_EEPROM_EEPCAP_FASTFRAME_DIS 0x0004 498c2ecf20Sopenharmony_ci#define AR_EEPROM_EEPCAP_BURST_DIS 0x0008 508c2ecf20Sopenharmony_ci#define AR_EEPROM_EEPCAP_MAXQCU 0x01F0 518c2ecf20Sopenharmony_ci#define AR_EEPROM_EEPCAP_MAXQCU_S 4 528c2ecf20Sopenharmony_ci#define AR_EEPROM_EEPCAP_HEAVY_CLIP_EN 0x0200 538c2ecf20Sopenharmony_ci#define AR_EEPROM_EEPCAP_KC_ENTRIES 0xF000 548c2ecf20Sopenharmony_ci#define AR_EEPROM_EEPCAP_KC_ENTRIES_S 12 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci#define AR_EEPROM_EEREGCAP_EN_FCC_MIDBAND 0x0040 578c2ecf20Sopenharmony_ci#define AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN 0x0080 588c2ecf20Sopenharmony_ci#define AR_EEPROM_EEREGCAP_EN_KK_U2 0x0100 598c2ecf20Sopenharmony_ci#define AR_EEPROM_EEREGCAP_EN_KK_MIDBAND 0x0200 608c2ecf20Sopenharmony_ci#define AR_EEPROM_EEREGCAP_EN_KK_U1_ODD 0x0400 618c2ecf20Sopenharmony_ci#define AR_EEPROM_EEREGCAP_EN_KK_NEW_11A 0x0800 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci#define AR_EEPROM_EEREGCAP_EN_KK_U1_ODD_PRE4_0 0x4000 648c2ecf20Sopenharmony_ci#define AR_EEPROM_EEREGCAP_EN_KK_NEW_11A_PRE4_0 0x8000 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci#define AR5416_EEPROM_MAGIC_OFFSET 0x0 678c2ecf20Sopenharmony_ci#define AR5416_EEPROM_S 2 688c2ecf20Sopenharmony_ci#define AR5416_EEPROM_OFFSET 0x2000 698c2ecf20Sopenharmony_ci#define AR5416_EEPROM_MAX 0xae0 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci#define AR5416_EEPROM_START_ADDR \ 728c2ecf20Sopenharmony_ci (AR_SREV_9100(ah)) ? 0x1fff1000 : 0x503f1200 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci#define SD_NO_CTL 0xE0 758c2ecf20Sopenharmony_ci#define NO_CTL 0xff 768c2ecf20Sopenharmony_ci#define CTL_MODE_M 0xf 778c2ecf20Sopenharmony_ci#define CTL_11A 0 788c2ecf20Sopenharmony_ci#define CTL_11B 1 798c2ecf20Sopenharmony_ci#define CTL_11G 2 808c2ecf20Sopenharmony_ci#define CTL_2GHT20 5 818c2ecf20Sopenharmony_ci#define CTL_5GHT20 6 828c2ecf20Sopenharmony_ci#define CTL_2GHT40 7 838c2ecf20Sopenharmony_ci#define CTL_5GHT40 8 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci#define EXT_ADDITIVE (0x8000) 868c2ecf20Sopenharmony_ci#define CTL_11A_EXT (CTL_11A | EXT_ADDITIVE) 878c2ecf20Sopenharmony_ci#define CTL_11G_EXT (CTL_11G | EXT_ADDITIVE) 888c2ecf20Sopenharmony_ci#define CTL_11B_EXT (CTL_11B | EXT_ADDITIVE) 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci#define SUB_NUM_CTL_MODES_AT_5G_40 2 918c2ecf20Sopenharmony_ci#define SUB_NUM_CTL_MODES_AT_2G_40 3 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci#define POWER_CORRECTION_FOR_TWO_CHAIN 6 /* 10*log10(2)*2 */ 948c2ecf20Sopenharmony_ci#define POWER_CORRECTION_FOR_THREE_CHAIN 10 /* 10*log10(3)*2 */ 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci/* 978c2ecf20Sopenharmony_ci * For AR9285 and later chipsets, the following bits are not being programmed 988c2ecf20Sopenharmony_ci * in EEPROM and so need to be enabled always. 998c2ecf20Sopenharmony_ci * 1008c2ecf20Sopenharmony_ci * Bit 0: en_fcc_mid 1018c2ecf20Sopenharmony_ci * Bit 1: en_jap_mid 1028c2ecf20Sopenharmony_ci * Bit 2: en_fcc_dfs_ht40 1038c2ecf20Sopenharmony_ci * Bit 3: en_jap_ht40 1048c2ecf20Sopenharmony_ci * Bit 4: en_jap_dfs_ht40 1058c2ecf20Sopenharmony_ci */ 1068c2ecf20Sopenharmony_ci#define AR9285_RDEXT_DEFAULT 0x1F 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci#define ATH9K_POW_SM(_r, _s) (((_r) & 0x3f) << (_s)) 1098c2ecf20Sopenharmony_ci#define FREQ2FBIN(x, y) (u8)((y) ? ((x) - 2300) : (((x) - 4800) / 5)) 1108c2ecf20Sopenharmony_ci#define FBIN2FREQ(x, y) ((y) ? (2300 + x) : (4800 + 5 * x)) 1118c2ecf20Sopenharmony_ci#define ath9k_hw_use_flash(_ah) (!(_ah->ah_flags & AH_USE_EEPROM)) 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci#define OLC_FOR_AR9280_20_LATER (AR_SREV_9280_20_OR_LATER(ah) && \ 1148c2ecf20Sopenharmony_ci ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) 1158c2ecf20Sopenharmony_ci#define OLC_FOR_AR9287_10_LATER (AR_SREV_9287_11_OR_LATER(ah) && \ 1168c2ecf20Sopenharmony_ci ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci#define EEP_RFSILENT_ENABLED 0x0001 1198c2ecf20Sopenharmony_ci#define EEP_RFSILENT_ENABLED_S 0 1208c2ecf20Sopenharmony_ci#define EEP_RFSILENT_POLARITY 0x0002 1218c2ecf20Sopenharmony_ci#define EEP_RFSILENT_POLARITY_S 1 1228c2ecf20Sopenharmony_ci#define EEP_RFSILENT_GPIO_SEL ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x00fc : 0x001c) 1238c2ecf20Sopenharmony_ci#define EEP_RFSILENT_GPIO_SEL_S 2 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci#define AR5416_OPFLAGS_11A 0x01 1268c2ecf20Sopenharmony_ci#define AR5416_OPFLAGS_11G 0x02 1278c2ecf20Sopenharmony_ci#define AR5416_OPFLAGS_N_5G_HT40 0x04 1288c2ecf20Sopenharmony_ci#define AR5416_OPFLAGS_N_2G_HT40 0x08 1298c2ecf20Sopenharmony_ci#define AR5416_OPFLAGS_N_5G_HT20 0x10 1308c2ecf20Sopenharmony_ci#define AR5416_OPFLAGS_N_2G_HT20 0x20 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci#define AR5416_EEP_NO_BACK_VER 0x1 1338c2ecf20Sopenharmony_ci#define AR5416_EEP_VER 0xE 1348c2ecf20Sopenharmony_ci#define AR5416_EEP_VER_MAJOR_SHIFT 12 1358c2ecf20Sopenharmony_ci#define AR5416_EEP_VER_MAJOR_MASK 0xF000 1368c2ecf20Sopenharmony_ci#define AR5416_EEP_VER_MINOR_MASK 0x0FFF 1378c2ecf20Sopenharmony_ci#define AR5416_EEP_MINOR_VER_2 0x2 1388c2ecf20Sopenharmony_ci#define AR5416_EEP_MINOR_VER_3 0x3 1398c2ecf20Sopenharmony_ci#define AR5416_EEP_MINOR_VER_7 0x7 1408c2ecf20Sopenharmony_ci#define AR5416_EEP_MINOR_VER_9 0x9 1418c2ecf20Sopenharmony_ci#define AR5416_EEP_MINOR_VER_16 0x10 1428c2ecf20Sopenharmony_ci#define AR5416_EEP_MINOR_VER_17 0x11 1438c2ecf20Sopenharmony_ci#define AR5416_EEP_MINOR_VER_19 0x13 1448c2ecf20Sopenharmony_ci#define AR5416_EEP_MINOR_VER_20 0x14 1458c2ecf20Sopenharmony_ci#define AR5416_EEP_MINOR_VER_21 0x15 1468c2ecf20Sopenharmony_ci#define AR5416_EEP_MINOR_VER_22 0x16 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci#define AR5416_NUM_5G_CAL_PIERS 8 1498c2ecf20Sopenharmony_ci#define AR5416_NUM_2G_CAL_PIERS 4 1508c2ecf20Sopenharmony_ci#define AR5416_NUM_5G_20_TARGET_POWERS 8 1518c2ecf20Sopenharmony_ci#define AR5416_NUM_5G_40_TARGET_POWERS 8 1528c2ecf20Sopenharmony_ci#define AR5416_NUM_2G_CCK_TARGET_POWERS 3 1538c2ecf20Sopenharmony_ci#define AR5416_NUM_2G_20_TARGET_POWERS 4 1548c2ecf20Sopenharmony_ci#define AR5416_NUM_2G_40_TARGET_POWERS 4 1558c2ecf20Sopenharmony_ci#define AR5416_NUM_CTLS 24 1568c2ecf20Sopenharmony_ci#define AR5416_NUM_BAND_EDGES 8 1578c2ecf20Sopenharmony_ci#define AR5416_NUM_PD_GAINS 4 1588c2ecf20Sopenharmony_ci#define AR5416_PD_GAINS_IN_MASK 4 1598c2ecf20Sopenharmony_ci#define AR5416_PD_GAIN_ICEPTS 5 1608c2ecf20Sopenharmony_ci#define AR5416_NUM_PDADC_VALUES 128 1618c2ecf20Sopenharmony_ci#define AR5416_BCHAN_UNUSED 0xFF 1628c2ecf20Sopenharmony_ci#define AR5416_MAX_PWR_RANGE_IN_HALF_DB 64 1638c2ecf20Sopenharmony_ci#define AR5416_MAX_CHAINS 3 1648c2ecf20Sopenharmony_ci#define AR9300_MAX_CHAINS 3 1658c2ecf20Sopenharmony_ci#define AR5416_PWR_TABLE_OFFSET_DB -5 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ci/* Rx gain type values */ 1688c2ecf20Sopenharmony_ci#define AR5416_EEP_RXGAIN_23DB_BACKOFF 0 1698c2ecf20Sopenharmony_ci#define AR5416_EEP_RXGAIN_13DB_BACKOFF 1 1708c2ecf20Sopenharmony_ci#define AR5416_EEP_RXGAIN_ORIG 2 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci/* Tx gain type values */ 1738c2ecf20Sopenharmony_ci#define AR5416_EEP_TXGAIN_ORIGINAL 0 1748c2ecf20Sopenharmony_ci#define AR5416_EEP_TXGAIN_HIGH_POWER 1 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci/* Endianness of EEPROM content */ 1778c2ecf20Sopenharmony_ci#define AR5416_EEPMISC_BIG_ENDIAN 0x01 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_ci#define AR5416_EEP4K_START_LOC 64 1808c2ecf20Sopenharmony_ci#define AR5416_EEP4K_NUM_2G_CAL_PIERS 3 1818c2ecf20Sopenharmony_ci#define AR5416_EEP4K_NUM_2G_CCK_TARGET_POWERS 3 1828c2ecf20Sopenharmony_ci#define AR5416_EEP4K_NUM_2G_20_TARGET_POWERS 3 1838c2ecf20Sopenharmony_ci#define AR5416_EEP4K_NUM_2G_40_TARGET_POWERS 3 1848c2ecf20Sopenharmony_ci#define AR5416_EEP4K_NUM_CTLS 12 1858c2ecf20Sopenharmony_ci#define AR5416_EEP4K_NUM_BAND_EDGES 4 1868c2ecf20Sopenharmony_ci#define AR5416_EEP4K_NUM_PD_GAINS 2 1878c2ecf20Sopenharmony_ci#define AR5416_EEP4K_MAX_CHAINS 1 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci#define AR9280_TX_GAIN_TABLE_SIZE 22 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_ci#define AR9287_EEP_VER 0xE 1928c2ecf20Sopenharmony_ci#define AR9287_EEP_MINOR_VER_1 0x1 1938c2ecf20Sopenharmony_ci#define AR9287_EEP_MINOR_VER_2 0x2 1948c2ecf20Sopenharmony_ci#define AR9287_EEP_MINOR_VER_3 0x3 1958c2ecf20Sopenharmony_ci#define AR9287_EEP_MINOR_VER AR9287_EEP_MINOR_VER_3 1968c2ecf20Sopenharmony_ci#define AR9287_EEP_MINOR_VER_b AR9287_EEP_MINOR_VER 1978c2ecf20Sopenharmony_ci#define AR9287_EEP_NO_BACK_VER AR9287_EEP_MINOR_VER_1 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ci#define AR9287_EEP_START_LOC 128 2008c2ecf20Sopenharmony_ci#define AR9287_HTC_EEP_START_LOC 256 2018c2ecf20Sopenharmony_ci#define AR9287_NUM_2G_CAL_PIERS 3 2028c2ecf20Sopenharmony_ci#define AR9287_NUM_2G_CCK_TARGET_POWERS 3 2038c2ecf20Sopenharmony_ci#define AR9287_NUM_2G_20_TARGET_POWERS 3 2048c2ecf20Sopenharmony_ci#define AR9287_NUM_2G_40_TARGET_POWERS 3 2058c2ecf20Sopenharmony_ci#define AR9287_NUM_CTLS 12 2068c2ecf20Sopenharmony_ci#define AR9287_NUM_BAND_EDGES 4 2078c2ecf20Sopenharmony_ci#define AR9287_PD_GAIN_ICEPTS 1 2088c2ecf20Sopenharmony_ci#define AR9287_EEPMISC_WOW 0x02 2098c2ecf20Sopenharmony_ci#define AR9287_MAX_CHAINS 2 2108c2ecf20Sopenharmony_ci#define AR9287_ANT_16S 32 2118c2ecf20Sopenharmony_ci 2128c2ecf20Sopenharmony_ci#define AR9287_DATA_SZ 32 2138c2ecf20Sopenharmony_ci 2148c2ecf20Sopenharmony_ci#define AR9287_PWR_TABLE_OFFSET_DB -5 2158c2ecf20Sopenharmony_ci 2168c2ecf20Sopenharmony_ci#define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1) 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_ci#define CTL_EDGE_TPOWER(_ctl) ((_ctl) & 0x3f) 2198c2ecf20Sopenharmony_ci#define CTL_EDGE_FLAGS(_ctl) (((_ctl) >> 6) & 0x03) 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_ci#define LNA_CTL_BUF_MODE BIT(0) 2228c2ecf20Sopenharmony_ci#define LNA_CTL_ISEL_LO BIT(1) 2238c2ecf20Sopenharmony_ci#define LNA_CTL_ISEL_HI BIT(2) 2248c2ecf20Sopenharmony_ci#define LNA_CTL_BUF_IN BIT(3) 2258c2ecf20Sopenharmony_ci#define LNA_CTL_FEM_BAND BIT(4) 2268c2ecf20Sopenharmony_ci#define LNA_CTL_LOCAL_BIAS BIT(5) 2278c2ecf20Sopenharmony_ci#define LNA_CTL_FORCE_XPA BIT(6) 2288c2ecf20Sopenharmony_ci#define LNA_CTL_USE_ANT1 BIT(7) 2298c2ecf20Sopenharmony_ci 2308c2ecf20Sopenharmony_cienum eeprom_param { 2318c2ecf20Sopenharmony_ci EEP_NFTHRESH_5, 2328c2ecf20Sopenharmony_ci EEP_NFTHRESH_2, 2338c2ecf20Sopenharmony_ci EEP_MAC_MSW, 2348c2ecf20Sopenharmony_ci EEP_MAC_MID, 2358c2ecf20Sopenharmony_ci EEP_MAC_LSW, 2368c2ecf20Sopenharmony_ci EEP_REG_0, 2378c2ecf20Sopenharmony_ci EEP_OP_CAP, 2388c2ecf20Sopenharmony_ci EEP_OP_MODE, 2398c2ecf20Sopenharmony_ci EEP_RF_SILENT, 2408c2ecf20Sopenharmony_ci EEP_OB_5, 2418c2ecf20Sopenharmony_ci EEP_DB_5, 2428c2ecf20Sopenharmony_ci EEP_OB_2, 2438c2ecf20Sopenharmony_ci EEP_DB_2, 2448c2ecf20Sopenharmony_ci EEP_TX_MASK, 2458c2ecf20Sopenharmony_ci EEP_RX_MASK, 2468c2ecf20Sopenharmony_ci EEP_FSTCLK_5G, 2478c2ecf20Sopenharmony_ci EEP_RXGAIN_TYPE, 2488c2ecf20Sopenharmony_ci EEP_OL_PWRCTRL, 2498c2ecf20Sopenharmony_ci EEP_TXGAIN_TYPE, 2508c2ecf20Sopenharmony_ci EEP_RC_CHAIN_MASK, 2518c2ecf20Sopenharmony_ci EEP_DAC_HPWR_5G, 2528c2ecf20Sopenharmony_ci EEP_FRAC_N_5G, 2538c2ecf20Sopenharmony_ci EEP_DEV_TYPE, 2548c2ecf20Sopenharmony_ci EEP_TEMPSENSE_SLOPE, 2558c2ecf20Sopenharmony_ci EEP_TEMPSENSE_SLOPE_PAL_ON, 2568c2ecf20Sopenharmony_ci EEP_PWR_TABLE_OFFSET, 2578c2ecf20Sopenharmony_ci EEP_PAPRD, 2588c2ecf20Sopenharmony_ci EEP_MODAL_VER, 2598c2ecf20Sopenharmony_ci EEP_ANT_DIV_CTL1, 2608c2ecf20Sopenharmony_ci EEP_CHAIN_MASK_REDUCE, 2618c2ecf20Sopenharmony_ci EEP_ANTENNA_GAIN_2G, 2628c2ecf20Sopenharmony_ci EEP_ANTENNA_GAIN_5G, 2638c2ecf20Sopenharmony_ci}; 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_cienum ar5416_rates { 2668c2ecf20Sopenharmony_ci rate6mb, rate9mb, rate12mb, rate18mb, 2678c2ecf20Sopenharmony_ci rate24mb, rate36mb, rate48mb, rate54mb, 2688c2ecf20Sopenharmony_ci rate1l, rate2l, rate2s, rate5_5l, 2698c2ecf20Sopenharmony_ci rate5_5s, rate11l, rate11s, rateXr, 2708c2ecf20Sopenharmony_ci rateHt20_0, rateHt20_1, rateHt20_2, rateHt20_3, 2718c2ecf20Sopenharmony_ci rateHt20_4, rateHt20_5, rateHt20_6, rateHt20_7, 2728c2ecf20Sopenharmony_ci rateHt40_0, rateHt40_1, rateHt40_2, rateHt40_3, 2738c2ecf20Sopenharmony_ci rateHt40_4, rateHt40_5, rateHt40_6, rateHt40_7, 2748c2ecf20Sopenharmony_ci rateDupCck, rateDupOfdm, rateExtCck, rateExtOfdm, 2758c2ecf20Sopenharmony_ci Ar5416RateSize 2768c2ecf20Sopenharmony_ci}; 2778c2ecf20Sopenharmony_ci 2788c2ecf20Sopenharmony_cienum ath9k_hal_freq_band { 2798c2ecf20Sopenharmony_ci ATH9K_HAL_FREQ_BAND_5GHZ = 0, 2808c2ecf20Sopenharmony_ci ATH9K_HAL_FREQ_BAND_2GHZ = 1 2818c2ecf20Sopenharmony_ci}; 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_cistruct base_eep_header { 2848c2ecf20Sopenharmony_ci __le16 length; 2858c2ecf20Sopenharmony_ci __le16 checksum; 2868c2ecf20Sopenharmony_ci __le16 version; 2878c2ecf20Sopenharmony_ci u8 opCapFlags; 2888c2ecf20Sopenharmony_ci u8 eepMisc; 2898c2ecf20Sopenharmony_ci __le16 regDmn[2]; 2908c2ecf20Sopenharmony_ci u8 macAddr[6]; 2918c2ecf20Sopenharmony_ci u8 rxMask; 2928c2ecf20Sopenharmony_ci u8 txMask; 2938c2ecf20Sopenharmony_ci __le16 rfSilent; 2948c2ecf20Sopenharmony_ci __le16 blueToothOptions; 2958c2ecf20Sopenharmony_ci __le16 deviceCap; 2968c2ecf20Sopenharmony_ci __le32 binBuildNumber; 2978c2ecf20Sopenharmony_ci u8 deviceType; 2988c2ecf20Sopenharmony_ci u8 pwdclkind; 2998c2ecf20Sopenharmony_ci u8 fastClk5g; 3008c2ecf20Sopenharmony_ci u8 divChain; 3018c2ecf20Sopenharmony_ci u8 rxGainType; 3028c2ecf20Sopenharmony_ci u8 dacHiPwrMode_5G; 3038c2ecf20Sopenharmony_ci u8 openLoopPwrCntl; 3048c2ecf20Sopenharmony_ci u8 dacLpMode; 3058c2ecf20Sopenharmony_ci u8 txGainType; 3068c2ecf20Sopenharmony_ci u8 rcChainMask; 3078c2ecf20Sopenharmony_ci u8 desiredScaleCCK; 3088c2ecf20Sopenharmony_ci u8 pwr_table_offset; 3098c2ecf20Sopenharmony_ci u8 frac_n_5g; 3108c2ecf20Sopenharmony_ci u8 futureBase_3[21]; 3118c2ecf20Sopenharmony_ci} __packed; 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_cistruct base_eep_header_4k { 3148c2ecf20Sopenharmony_ci __le16 length; 3158c2ecf20Sopenharmony_ci __le16 checksum; 3168c2ecf20Sopenharmony_ci __le16 version; 3178c2ecf20Sopenharmony_ci u8 opCapFlags; 3188c2ecf20Sopenharmony_ci u8 eepMisc; 3198c2ecf20Sopenharmony_ci __le16 regDmn[2]; 3208c2ecf20Sopenharmony_ci u8 macAddr[6]; 3218c2ecf20Sopenharmony_ci u8 rxMask; 3228c2ecf20Sopenharmony_ci u8 txMask; 3238c2ecf20Sopenharmony_ci __le16 rfSilent; 3248c2ecf20Sopenharmony_ci __le16 blueToothOptions; 3258c2ecf20Sopenharmony_ci __le16 deviceCap; 3268c2ecf20Sopenharmony_ci __le32 binBuildNumber; 3278c2ecf20Sopenharmony_ci u8 deviceType; 3288c2ecf20Sopenharmony_ci u8 txGainType; 3298c2ecf20Sopenharmony_ci} __packed; 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_ci 3328c2ecf20Sopenharmony_cistruct spur_chan { 3338c2ecf20Sopenharmony_ci __le16 spurChan; 3348c2ecf20Sopenharmony_ci u8 spurRangeLow; 3358c2ecf20Sopenharmony_ci u8 spurRangeHigh; 3368c2ecf20Sopenharmony_ci} __packed; 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_cistruct modal_eep_header { 3398c2ecf20Sopenharmony_ci __le32 antCtrlChain[AR5416_MAX_CHAINS]; 3408c2ecf20Sopenharmony_ci __le32 antCtrlCommon; 3418c2ecf20Sopenharmony_ci u8 antennaGainCh[AR5416_MAX_CHAINS]; 3428c2ecf20Sopenharmony_ci u8 switchSettling; 3438c2ecf20Sopenharmony_ci u8 txRxAttenCh[AR5416_MAX_CHAINS]; 3448c2ecf20Sopenharmony_ci u8 rxTxMarginCh[AR5416_MAX_CHAINS]; 3458c2ecf20Sopenharmony_ci u8 adcDesiredSize; 3468c2ecf20Sopenharmony_ci u8 pgaDesiredSize; 3478c2ecf20Sopenharmony_ci u8 xlnaGainCh[AR5416_MAX_CHAINS]; 3488c2ecf20Sopenharmony_ci u8 txEndToXpaOff; 3498c2ecf20Sopenharmony_ci u8 txEndToRxOn; 3508c2ecf20Sopenharmony_ci u8 txFrameToXpaOn; 3518c2ecf20Sopenharmony_ci u8 thresh62; 3528c2ecf20Sopenharmony_ci u8 noiseFloorThreshCh[AR5416_MAX_CHAINS]; 3538c2ecf20Sopenharmony_ci u8 xpdGain; 3548c2ecf20Sopenharmony_ci u8 xpd; 3558c2ecf20Sopenharmony_ci u8 iqCalICh[AR5416_MAX_CHAINS]; 3568c2ecf20Sopenharmony_ci u8 iqCalQCh[AR5416_MAX_CHAINS]; 3578c2ecf20Sopenharmony_ci u8 pdGainOverlap; 3588c2ecf20Sopenharmony_ci u8 ob; 3598c2ecf20Sopenharmony_ci u8 db; 3608c2ecf20Sopenharmony_ci u8 xpaBiasLvl; 3618c2ecf20Sopenharmony_ci u8 pwrDecreaseFor2Chain; 3628c2ecf20Sopenharmony_ci u8 pwrDecreaseFor3Chain; 3638c2ecf20Sopenharmony_ci u8 txFrameToDataStart; 3648c2ecf20Sopenharmony_ci u8 txFrameToPaOn; 3658c2ecf20Sopenharmony_ci u8 ht40PowerIncForPdadc; 3668c2ecf20Sopenharmony_ci u8 bswAtten[AR5416_MAX_CHAINS]; 3678c2ecf20Sopenharmony_ci u8 bswMargin[AR5416_MAX_CHAINS]; 3688c2ecf20Sopenharmony_ci u8 swSettleHt40; 3698c2ecf20Sopenharmony_ci u8 xatten2Db[AR5416_MAX_CHAINS]; 3708c2ecf20Sopenharmony_ci u8 xatten2Margin[AR5416_MAX_CHAINS]; 3718c2ecf20Sopenharmony_ci u8 ob_ch1; 3728c2ecf20Sopenharmony_ci u8 db_ch1; 3738c2ecf20Sopenharmony_ci u8 lna_ctl; 3748c2ecf20Sopenharmony_ci u8 miscBits; 3758c2ecf20Sopenharmony_ci __le16 xpaBiasLvlFreq[3]; 3768c2ecf20Sopenharmony_ci u8 futureModal[6]; 3778c2ecf20Sopenharmony_ci 3788c2ecf20Sopenharmony_ci struct spur_chan spurChans[AR_EEPROM_MODAL_SPURS]; 3798c2ecf20Sopenharmony_ci} __packed; 3808c2ecf20Sopenharmony_ci 3818c2ecf20Sopenharmony_cistruct calDataPerFreqOpLoop { 3828c2ecf20Sopenharmony_ci u8 pwrPdg[2][5]; 3838c2ecf20Sopenharmony_ci u8 vpdPdg[2][5]; 3848c2ecf20Sopenharmony_ci u8 pcdac[2][5]; 3858c2ecf20Sopenharmony_ci u8 empty[2][5]; 3868c2ecf20Sopenharmony_ci} __packed; 3878c2ecf20Sopenharmony_ci 3888c2ecf20Sopenharmony_cistruct modal_eep_4k_header { 3898c2ecf20Sopenharmony_ci __le32 antCtrlChain[AR5416_EEP4K_MAX_CHAINS]; 3908c2ecf20Sopenharmony_ci __le32 antCtrlCommon; 3918c2ecf20Sopenharmony_ci u8 antennaGainCh[AR5416_EEP4K_MAX_CHAINS]; 3928c2ecf20Sopenharmony_ci u8 switchSettling; 3938c2ecf20Sopenharmony_ci u8 txRxAttenCh[AR5416_EEP4K_MAX_CHAINS]; 3948c2ecf20Sopenharmony_ci u8 rxTxMarginCh[AR5416_EEP4K_MAX_CHAINS]; 3958c2ecf20Sopenharmony_ci u8 adcDesiredSize; 3968c2ecf20Sopenharmony_ci u8 pgaDesiredSize; 3978c2ecf20Sopenharmony_ci u8 xlnaGainCh[AR5416_EEP4K_MAX_CHAINS]; 3988c2ecf20Sopenharmony_ci u8 txEndToXpaOff; 3998c2ecf20Sopenharmony_ci u8 txEndToRxOn; 4008c2ecf20Sopenharmony_ci u8 txFrameToXpaOn; 4018c2ecf20Sopenharmony_ci u8 thresh62; 4028c2ecf20Sopenharmony_ci u8 noiseFloorThreshCh[AR5416_EEP4K_MAX_CHAINS]; 4038c2ecf20Sopenharmony_ci u8 xpdGain; 4048c2ecf20Sopenharmony_ci u8 xpd; 4058c2ecf20Sopenharmony_ci u8 iqCalICh[AR5416_EEP4K_MAX_CHAINS]; 4068c2ecf20Sopenharmony_ci u8 iqCalQCh[AR5416_EEP4K_MAX_CHAINS]; 4078c2ecf20Sopenharmony_ci u8 pdGainOverlap; 4088c2ecf20Sopenharmony_ci#ifdef __BIG_ENDIAN_BITFIELD 4098c2ecf20Sopenharmony_ci u8 ob_1:4, ob_0:4; 4108c2ecf20Sopenharmony_ci u8 db1_1:4, db1_0:4; 4118c2ecf20Sopenharmony_ci#else 4128c2ecf20Sopenharmony_ci u8 ob_0:4, ob_1:4; 4138c2ecf20Sopenharmony_ci u8 db1_0:4, db1_1:4; 4148c2ecf20Sopenharmony_ci#endif 4158c2ecf20Sopenharmony_ci u8 xpaBiasLvl; 4168c2ecf20Sopenharmony_ci u8 txFrameToDataStart; 4178c2ecf20Sopenharmony_ci u8 txFrameToPaOn; 4188c2ecf20Sopenharmony_ci u8 ht40PowerIncForPdadc; 4198c2ecf20Sopenharmony_ci u8 bswAtten[AR5416_EEP4K_MAX_CHAINS]; 4208c2ecf20Sopenharmony_ci u8 bswMargin[AR5416_EEP4K_MAX_CHAINS]; 4218c2ecf20Sopenharmony_ci u8 swSettleHt40; 4228c2ecf20Sopenharmony_ci u8 xatten2Db[AR5416_EEP4K_MAX_CHAINS]; 4238c2ecf20Sopenharmony_ci u8 xatten2Margin[AR5416_EEP4K_MAX_CHAINS]; 4248c2ecf20Sopenharmony_ci#ifdef __BIG_ENDIAN_BITFIELD 4258c2ecf20Sopenharmony_ci u8 db2_1:4, db2_0:4; 4268c2ecf20Sopenharmony_ci#else 4278c2ecf20Sopenharmony_ci u8 db2_0:4, db2_1:4; 4288c2ecf20Sopenharmony_ci#endif 4298c2ecf20Sopenharmony_ci u8 version; 4308c2ecf20Sopenharmony_ci#ifdef __BIG_ENDIAN_BITFIELD 4318c2ecf20Sopenharmony_ci u8 ob_3:4, ob_2:4; 4328c2ecf20Sopenharmony_ci u8 antdiv_ctl1:4, ob_4:4; 4338c2ecf20Sopenharmony_ci u8 db1_3:4, db1_2:4; 4348c2ecf20Sopenharmony_ci u8 antdiv_ctl2:4, db1_4:4; 4358c2ecf20Sopenharmony_ci u8 db2_2:4, db2_3:4; 4368c2ecf20Sopenharmony_ci u8 reserved:4, db2_4:4; 4378c2ecf20Sopenharmony_ci#else 4388c2ecf20Sopenharmony_ci u8 ob_2:4, ob_3:4; 4398c2ecf20Sopenharmony_ci u8 ob_4:4, antdiv_ctl1:4; 4408c2ecf20Sopenharmony_ci u8 db1_2:4, db1_3:4; 4418c2ecf20Sopenharmony_ci u8 db1_4:4, antdiv_ctl2:4; 4428c2ecf20Sopenharmony_ci u8 db2_2:4, db2_3:4; 4438c2ecf20Sopenharmony_ci u8 db2_4:4, reserved:4; 4448c2ecf20Sopenharmony_ci#endif 4458c2ecf20Sopenharmony_ci u8 tx_diversity; 4468c2ecf20Sopenharmony_ci u8 flc_pwr_thresh; 4478c2ecf20Sopenharmony_ci u8 bb_scale_smrt_antenna; 4488c2ecf20Sopenharmony_ci#define EEP_4K_BB_DESIRED_SCALE_MASK 0x1f 4498c2ecf20Sopenharmony_ci u8 futureModal[1]; 4508c2ecf20Sopenharmony_ci struct spur_chan spurChans[AR_EEPROM_MODAL_SPURS]; 4518c2ecf20Sopenharmony_ci} __packed; 4528c2ecf20Sopenharmony_ci 4538c2ecf20Sopenharmony_cistruct base_eep_ar9287_header { 4548c2ecf20Sopenharmony_ci __le16 length; 4558c2ecf20Sopenharmony_ci __le16 checksum; 4568c2ecf20Sopenharmony_ci __le16 version; 4578c2ecf20Sopenharmony_ci u8 opCapFlags; 4588c2ecf20Sopenharmony_ci u8 eepMisc; 4598c2ecf20Sopenharmony_ci __le16 regDmn[2]; 4608c2ecf20Sopenharmony_ci u8 macAddr[6]; 4618c2ecf20Sopenharmony_ci u8 rxMask; 4628c2ecf20Sopenharmony_ci u8 txMask; 4638c2ecf20Sopenharmony_ci __le16 rfSilent; 4648c2ecf20Sopenharmony_ci __le16 blueToothOptions; 4658c2ecf20Sopenharmony_ci __le16 deviceCap; 4668c2ecf20Sopenharmony_ci __le32 binBuildNumber; 4678c2ecf20Sopenharmony_ci u8 deviceType; 4688c2ecf20Sopenharmony_ci u8 openLoopPwrCntl; 4698c2ecf20Sopenharmony_ci int8_t pwrTableOffset; 4708c2ecf20Sopenharmony_ci int8_t tempSensSlope; 4718c2ecf20Sopenharmony_ci int8_t tempSensSlopePalOn; 4728c2ecf20Sopenharmony_ci u8 futureBase[29]; 4738c2ecf20Sopenharmony_ci} __packed; 4748c2ecf20Sopenharmony_ci 4758c2ecf20Sopenharmony_cistruct modal_eep_ar9287_header { 4768c2ecf20Sopenharmony_ci __le32 antCtrlChain[AR9287_MAX_CHAINS]; 4778c2ecf20Sopenharmony_ci __le32 antCtrlCommon; 4788c2ecf20Sopenharmony_ci int8_t antennaGainCh[AR9287_MAX_CHAINS]; 4798c2ecf20Sopenharmony_ci u8 switchSettling; 4808c2ecf20Sopenharmony_ci u8 txRxAttenCh[AR9287_MAX_CHAINS]; 4818c2ecf20Sopenharmony_ci u8 rxTxMarginCh[AR9287_MAX_CHAINS]; 4828c2ecf20Sopenharmony_ci int8_t adcDesiredSize; 4838c2ecf20Sopenharmony_ci u8 txEndToXpaOff; 4848c2ecf20Sopenharmony_ci u8 txEndToRxOn; 4858c2ecf20Sopenharmony_ci u8 txFrameToXpaOn; 4868c2ecf20Sopenharmony_ci u8 thresh62; 4878c2ecf20Sopenharmony_ci int8_t noiseFloorThreshCh[AR9287_MAX_CHAINS]; 4888c2ecf20Sopenharmony_ci u8 xpdGain; 4898c2ecf20Sopenharmony_ci u8 xpd; 4908c2ecf20Sopenharmony_ci int8_t iqCalICh[AR9287_MAX_CHAINS]; 4918c2ecf20Sopenharmony_ci int8_t iqCalQCh[AR9287_MAX_CHAINS]; 4928c2ecf20Sopenharmony_ci u8 pdGainOverlap; 4938c2ecf20Sopenharmony_ci u8 xpaBiasLvl; 4948c2ecf20Sopenharmony_ci u8 txFrameToDataStart; 4958c2ecf20Sopenharmony_ci u8 txFrameToPaOn; 4968c2ecf20Sopenharmony_ci u8 ht40PowerIncForPdadc; 4978c2ecf20Sopenharmony_ci u8 bswAtten[AR9287_MAX_CHAINS]; 4988c2ecf20Sopenharmony_ci u8 bswMargin[AR9287_MAX_CHAINS]; 4998c2ecf20Sopenharmony_ci u8 swSettleHt40; 5008c2ecf20Sopenharmony_ci u8 version; 5018c2ecf20Sopenharmony_ci u8 db1; 5028c2ecf20Sopenharmony_ci u8 db2; 5038c2ecf20Sopenharmony_ci u8 ob_cck; 5048c2ecf20Sopenharmony_ci u8 ob_psk; 5058c2ecf20Sopenharmony_ci u8 ob_qam; 5068c2ecf20Sopenharmony_ci u8 ob_pal_off; 5078c2ecf20Sopenharmony_ci u8 futureModal[30]; 5088c2ecf20Sopenharmony_ci struct spur_chan spurChans[AR_EEPROM_MODAL_SPURS]; 5098c2ecf20Sopenharmony_ci} __packed; 5108c2ecf20Sopenharmony_ci 5118c2ecf20Sopenharmony_cistruct cal_data_per_freq { 5128c2ecf20Sopenharmony_ci u8 pwrPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; 5138c2ecf20Sopenharmony_ci u8 vpdPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; 5148c2ecf20Sopenharmony_ci} __packed; 5158c2ecf20Sopenharmony_ci 5168c2ecf20Sopenharmony_cistruct cal_data_per_freq_4k { 5178c2ecf20Sopenharmony_ci u8 pwrPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; 5188c2ecf20Sopenharmony_ci u8 vpdPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; 5198c2ecf20Sopenharmony_ci} __packed; 5208c2ecf20Sopenharmony_ci 5218c2ecf20Sopenharmony_cistruct cal_target_power_leg { 5228c2ecf20Sopenharmony_ci u8 bChannel; 5238c2ecf20Sopenharmony_ci u8 tPow2x[4]; 5248c2ecf20Sopenharmony_ci} __packed; 5258c2ecf20Sopenharmony_ci 5268c2ecf20Sopenharmony_cistruct cal_target_power_ht { 5278c2ecf20Sopenharmony_ci u8 bChannel; 5288c2ecf20Sopenharmony_ci u8 tPow2x[8]; 5298c2ecf20Sopenharmony_ci} __packed; 5308c2ecf20Sopenharmony_ci 5318c2ecf20Sopenharmony_cistruct cal_ctl_edges { 5328c2ecf20Sopenharmony_ci u8 bChannel; 5338c2ecf20Sopenharmony_ci u8 ctl; 5348c2ecf20Sopenharmony_ci} __packed; 5358c2ecf20Sopenharmony_ci 5368c2ecf20Sopenharmony_cistruct cal_data_op_loop_ar9287 { 5378c2ecf20Sopenharmony_ci u8 pwrPdg[2][5]; 5388c2ecf20Sopenharmony_ci u8 vpdPdg[2][5]; 5398c2ecf20Sopenharmony_ci u8 pcdac[2][5]; 5408c2ecf20Sopenharmony_ci u8 empty[2][5]; 5418c2ecf20Sopenharmony_ci} __packed; 5428c2ecf20Sopenharmony_ci 5438c2ecf20Sopenharmony_cistruct cal_data_per_freq_ar9287 { 5448c2ecf20Sopenharmony_ci u8 pwrPdg[AR5416_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS]; 5458c2ecf20Sopenharmony_ci u8 vpdPdg[AR5416_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS]; 5468c2ecf20Sopenharmony_ci} __packed; 5478c2ecf20Sopenharmony_ci 5488c2ecf20Sopenharmony_ciunion cal_data_per_freq_ar9287_u { 5498c2ecf20Sopenharmony_ci struct cal_data_op_loop_ar9287 calDataOpen; 5508c2ecf20Sopenharmony_ci struct cal_data_per_freq_ar9287 calDataClose; 5518c2ecf20Sopenharmony_ci} __packed; 5528c2ecf20Sopenharmony_ci 5538c2ecf20Sopenharmony_cistruct cal_ctl_data_ar9287 { 5548c2ecf20Sopenharmony_ci struct cal_ctl_edges 5558c2ecf20Sopenharmony_ci ctlEdges[AR9287_MAX_CHAINS][AR9287_NUM_BAND_EDGES]; 5568c2ecf20Sopenharmony_ci} __packed; 5578c2ecf20Sopenharmony_ci 5588c2ecf20Sopenharmony_cistruct cal_ctl_data { 5598c2ecf20Sopenharmony_ci struct cal_ctl_edges 5608c2ecf20Sopenharmony_ci ctlEdges[AR5416_MAX_CHAINS][AR5416_NUM_BAND_EDGES]; 5618c2ecf20Sopenharmony_ci} __packed; 5628c2ecf20Sopenharmony_ci 5638c2ecf20Sopenharmony_cistruct cal_ctl_data_4k { 5648c2ecf20Sopenharmony_ci struct cal_ctl_edges 5658c2ecf20Sopenharmony_ci ctlEdges[AR5416_EEP4K_MAX_CHAINS][AR5416_EEP4K_NUM_BAND_EDGES]; 5668c2ecf20Sopenharmony_ci} __packed; 5678c2ecf20Sopenharmony_ci 5688c2ecf20Sopenharmony_cistruct ar5416_eeprom_def { 5698c2ecf20Sopenharmony_ci struct base_eep_header baseEepHeader; 5708c2ecf20Sopenharmony_ci u8 custData[64]; 5718c2ecf20Sopenharmony_ci struct modal_eep_header modalHeader[2]; 5728c2ecf20Sopenharmony_ci u8 calFreqPier5G[AR5416_NUM_5G_CAL_PIERS]; 5738c2ecf20Sopenharmony_ci u8 calFreqPier2G[AR5416_NUM_2G_CAL_PIERS]; 5748c2ecf20Sopenharmony_ci struct cal_data_per_freq 5758c2ecf20Sopenharmony_ci calPierData5G[AR5416_MAX_CHAINS][AR5416_NUM_5G_CAL_PIERS]; 5768c2ecf20Sopenharmony_ci struct cal_data_per_freq 5778c2ecf20Sopenharmony_ci calPierData2G[AR5416_MAX_CHAINS][AR5416_NUM_2G_CAL_PIERS]; 5788c2ecf20Sopenharmony_ci struct cal_target_power_leg 5798c2ecf20Sopenharmony_ci calTargetPower5G[AR5416_NUM_5G_20_TARGET_POWERS]; 5808c2ecf20Sopenharmony_ci struct cal_target_power_ht 5818c2ecf20Sopenharmony_ci calTargetPower5GHT20[AR5416_NUM_5G_20_TARGET_POWERS]; 5828c2ecf20Sopenharmony_ci struct cal_target_power_ht 5838c2ecf20Sopenharmony_ci calTargetPower5GHT40[AR5416_NUM_5G_40_TARGET_POWERS]; 5848c2ecf20Sopenharmony_ci struct cal_target_power_leg 5858c2ecf20Sopenharmony_ci calTargetPowerCck[AR5416_NUM_2G_CCK_TARGET_POWERS]; 5868c2ecf20Sopenharmony_ci struct cal_target_power_leg 5878c2ecf20Sopenharmony_ci calTargetPower2G[AR5416_NUM_2G_20_TARGET_POWERS]; 5888c2ecf20Sopenharmony_ci struct cal_target_power_ht 5898c2ecf20Sopenharmony_ci calTargetPower2GHT20[AR5416_NUM_2G_20_TARGET_POWERS]; 5908c2ecf20Sopenharmony_ci struct cal_target_power_ht 5918c2ecf20Sopenharmony_ci calTargetPower2GHT40[AR5416_NUM_2G_40_TARGET_POWERS]; 5928c2ecf20Sopenharmony_ci u8 ctlIndex[AR5416_NUM_CTLS]; 5938c2ecf20Sopenharmony_ci struct cal_ctl_data ctlData[AR5416_NUM_CTLS]; 5948c2ecf20Sopenharmony_ci u8 padding; 5958c2ecf20Sopenharmony_ci} __packed; 5968c2ecf20Sopenharmony_ci 5978c2ecf20Sopenharmony_cistruct ar5416_eeprom_4k { 5988c2ecf20Sopenharmony_ci struct base_eep_header_4k baseEepHeader; 5998c2ecf20Sopenharmony_ci u8 custData[20]; 6008c2ecf20Sopenharmony_ci struct modal_eep_4k_header modalHeader; 6018c2ecf20Sopenharmony_ci u8 calFreqPier2G[AR5416_EEP4K_NUM_2G_CAL_PIERS]; 6028c2ecf20Sopenharmony_ci struct cal_data_per_freq_4k 6038c2ecf20Sopenharmony_ci calPierData2G[AR5416_EEP4K_MAX_CHAINS][AR5416_EEP4K_NUM_2G_CAL_PIERS]; 6048c2ecf20Sopenharmony_ci struct cal_target_power_leg 6058c2ecf20Sopenharmony_ci calTargetPowerCck[AR5416_EEP4K_NUM_2G_CCK_TARGET_POWERS]; 6068c2ecf20Sopenharmony_ci struct cal_target_power_leg 6078c2ecf20Sopenharmony_ci calTargetPower2G[AR5416_EEP4K_NUM_2G_20_TARGET_POWERS]; 6088c2ecf20Sopenharmony_ci struct cal_target_power_ht 6098c2ecf20Sopenharmony_ci calTargetPower2GHT20[AR5416_EEP4K_NUM_2G_20_TARGET_POWERS]; 6108c2ecf20Sopenharmony_ci struct cal_target_power_ht 6118c2ecf20Sopenharmony_ci calTargetPower2GHT40[AR5416_EEP4K_NUM_2G_40_TARGET_POWERS]; 6128c2ecf20Sopenharmony_ci u8 ctlIndex[AR5416_EEP4K_NUM_CTLS]; 6138c2ecf20Sopenharmony_ci struct cal_ctl_data_4k ctlData[AR5416_EEP4K_NUM_CTLS]; 6148c2ecf20Sopenharmony_ci u8 padding; 6158c2ecf20Sopenharmony_ci} __packed; 6168c2ecf20Sopenharmony_ci 6178c2ecf20Sopenharmony_cistruct ar9287_eeprom { 6188c2ecf20Sopenharmony_ci struct base_eep_ar9287_header baseEepHeader; 6198c2ecf20Sopenharmony_ci u8 custData[AR9287_DATA_SZ]; 6208c2ecf20Sopenharmony_ci struct modal_eep_ar9287_header modalHeader; 6218c2ecf20Sopenharmony_ci u8 calFreqPier2G[AR9287_NUM_2G_CAL_PIERS]; 6228c2ecf20Sopenharmony_ci union cal_data_per_freq_ar9287_u 6238c2ecf20Sopenharmony_ci calPierData2G[AR9287_MAX_CHAINS][AR9287_NUM_2G_CAL_PIERS]; 6248c2ecf20Sopenharmony_ci struct cal_target_power_leg 6258c2ecf20Sopenharmony_ci calTargetPowerCck[AR9287_NUM_2G_CCK_TARGET_POWERS]; 6268c2ecf20Sopenharmony_ci struct cal_target_power_leg 6278c2ecf20Sopenharmony_ci calTargetPower2G[AR9287_NUM_2G_20_TARGET_POWERS]; 6288c2ecf20Sopenharmony_ci struct cal_target_power_ht 6298c2ecf20Sopenharmony_ci calTargetPower2GHT20[AR9287_NUM_2G_20_TARGET_POWERS]; 6308c2ecf20Sopenharmony_ci struct cal_target_power_ht 6318c2ecf20Sopenharmony_ci calTargetPower2GHT40[AR9287_NUM_2G_40_TARGET_POWERS]; 6328c2ecf20Sopenharmony_ci u8 ctlIndex[AR9287_NUM_CTLS]; 6338c2ecf20Sopenharmony_ci struct cal_ctl_data_ar9287 ctlData[AR9287_NUM_CTLS]; 6348c2ecf20Sopenharmony_ci u8 padding; 6358c2ecf20Sopenharmony_ci} __packed; 6368c2ecf20Sopenharmony_ci 6378c2ecf20Sopenharmony_cienum reg_ext_bitmap { 6388c2ecf20Sopenharmony_ci REG_EXT_FCC_MIDBAND = 0, 6398c2ecf20Sopenharmony_ci REG_EXT_JAPAN_MIDBAND = 1, 6408c2ecf20Sopenharmony_ci REG_EXT_FCC_DFS_HT40 = 2, 6418c2ecf20Sopenharmony_ci REG_EXT_JAPAN_NONDFS_HT40 = 3, 6428c2ecf20Sopenharmony_ci REG_EXT_JAPAN_DFS_HT40 = 4 6438c2ecf20Sopenharmony_ci}; 6448c2ecf20Sopenharmony_ci 6458c2ecf20Sopenharmony_cistruct ath9k_country_entry { 6468c2ecf20Sopenharmony_ci u16 countryCode; 6478c2ecf20Sopenharmony_ci u16 regDmnEnum; 6488c2ecf20Sopenharmony_ci u16 regDmn5G; 6498c2ecf20Sopenharmony_ci u16 regDmn2G; 6508c2ecf20Sopenharmony_ci u8 isMultidomain; 6518c2ecf20Sopenharmony_ci u8 iso[3]; 6528c2ecf20Sopenharmony_ci}; 6538c2ecf20Sopenharmony_ci 6548c2ecf20Sopenharmony_cistruct eeprom_ops { 6558c2ecf20Sopenharmony_ci int (*check_eeprom)(struct ath_hw *hw); 6568c2ecf20Sopenharmony_ci u32 (*get_eeprom)(struct ath_hw *hw, enum eeprom_param param); 6578c2ecf20Sopenharmony_ci bool (*fill_eeprom)(struct ath_hw *hw); 6588c2ecf20Sopenharmony_ci u32 (*dump_eeprom)(struct ath_hw *hw, bool dump_base_hdr, u8 *buf, 6598c2ecf20Sopenharmony_ci u32 len, u32 size); 6608c2ecf20Sopenharmony_ci int (*get_eeprom_ver)(struct ath_hw *hw); 6618c2ecf20Sopenharmony_ci int (*get_eeprom_rev)(struct ath_hw *hw); 6628c2ecf20Sopenharmony_ci void (*set_board_values)(struct ath_hw *hw, struct ath9k_channel *chan); 6638c2ecf20Sopenharmony_ci void (*set_addac)(struct ath_hw *hw, struct ath9k_channel *chan); 6648c2ecf20Sopenharmony_ci void (*set_txpower)(struct ath_hw *hw, struct ath9k_channel *chan, 6658c2ecf20Sopenharmony_ci u16 cfgCtl, u8 twiceAntennaReduction, 6668c2ecf20Sopenharmony_ci u8 powerLimit, bool test); 6678c2ecf20Sopenharmony_ci u16 (*get_spur_channel)(struct ath_hw *ah, u16 i, bool is2GHz); 6688c2ecf20Sopenharmony_ci u8 (*get_eepmisc)(struct ath_hw *ah); 6698c2ecf20Sopenharmony_ci}; 6708c2ecf20Sopenharmony_ci 6718c2ecf20Sopenharmony_civoid ath9k_hw_analog_shift_regwrite(struct ath_hw *ah, u32 reg, u32 val); 6728c2ecf20Sopenharmony_civoid ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask, 6738c2ecf20Sopenharmony_ci u32 shift, u32 val); 6748c2ecf20Sopenharmony_ciint16_t ath9k_hw_interpolate(u16 target, u16 srcLeft, u16 srcRight, 6758c2ecf20Sopenharmony_ci int16_t targetLeft, 6768c2ecf20Sopenharmony_ci int16_t targetRight); 6778c2ecf20Sopenharmony_cibool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize, 6788c2ecf20Sopenharmony_ci u16 *indexL, u16 *indexR); 6798c2ecf20Sopenharmony_cibool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data); 6808c2ecf20Sopenharmony_ciint ath9k_hw_nvram_swap_data(struct ath_hw *ah, bool *swap_needed, int size); 6818c2ecf20Sopenharmony_cibool ath9k_hw_nvram_validate_checksum(struct ath_hw *ah, int size); 6828c2ecf20Sopenharmony_cibool ath9k_hw_nvram_check_version(struct ath_hw *ah, int version, int minrev); 6838c2ecf20Sopenharmony_civoid ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data, 6848c2ecf20Sopenharmony_ci int eep_start_loc, int size); 6858c2ecf20Sopenharmony_civoid ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList, 6868c2ecf20Sopenharmony_ci u8 *pVpdList, u16 numIntercepts, 6878c2ecf20Sopenharmony_ci u8 *pRetVpdList); 6888c2ecf20Sopenharmony_civoid ath9k_hw_get_legacy_target_powers(struct ath_hw *ah, 6898c2ecf20Sopenharmony_ci struct ath9k_channel *chan, 6908c2ecf20Sopenharmony_ci struct cal_target_power_leg *powInfo, 6918c2ecf20Sopenharmony_ci u16 numChannels, 6928c2ecf20Sopenharmony_ci struct cal_target_power_leg *pNewPower, 6938c2ecf20Sopenharmony_ci u16 numRates, bool isExtTarget); 6948c2ecf20Sopenharmony_civoid ath9k_hw_get_target_powers(struct ath_hw *ah, 6958c2ecf20Sopenharmony_ci struct ath9k_channel *chan, 6968c2ecf20Sopenharmony_ci struct cal_target_power_ht *powInfo, 6978c2ecf20Sopenharmony_ci u16 numChannels, 6988c2ecf20Sopenharmony_ci struct cal_target_power_ht *pNewPower, 6998c2ecf20Sopenharmony_ci u16 numRates, bool isHt40Target); 7008c2ecf20Sopenharmony_ciu16 ath9k_hw_get_max_edge_power(u16 freq, struct cal_ctl_edges *pRdEdgesPower, 7018c2ecf20Sopenharmony_ci bool is2GHz, int num_band_edges); 7028c2ecf20Sopenharmony_ciu16 ath9k_hw_get_scaled_power(struct ath_hw *ah, u16 power_limit, 7038c2ecf20Sopenharmony_ci u8 antenna_reduction); 7048c2ecf20Sopenharmony_civoid ath9k_hw_update_regulatory_maxpower(struct ath_hw *ah); 7058c2ecf20Sopenharmony_ciint ath9k_hw_eeprom_init(struct ath_hw *ah); 7068c2ecf20Sopenharmony_ci 7078c2ecf20Sopenharmony_civoid ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah, 7088c2ecf20Sopenharmony_ci struct ath9k_channel *chan, 7098c2ecf20Sopenharmony_ci void *pRawDataSet, 7108c2ecf20Sopenharmony_ci u8 *bChans, u16 availPiers, 7118c2ecf20Sopenharmony_ci u16 tPdGainOverlap, 7128c2ecf20Sopenharmony_ci u16 *pPdGainBoundaries, u8 *pPDADCValues, 7138c2ecf20Sopenharmony_ci u16 numXpdGains); 7148c2ecf20Sopenharmony_ci 7158c2ecf20Sopenharmony_cistatic inline u16 ath9k_hw_fbin2freq(u8 fbin, bool is2GHz) 7168c2ecf20Sopenharmony_ci{ 7178c2ecf20Sopenharmony_ci if (fbin == AR5416_BCHAN_UNUSED) 7188c2ecf20Sopenharmony_ci return fbin; 7198c2ecf20Sopenharmony_ci 7208c2ecf20Sopenharmony_ci return (u16) ((is2GHz) ? (2300 + fbin) : (4800 + 5 * fbin)); 7218c2ecf20Sopenharmony_ci} 7228c2ecf20Sopenharmony_ci 7238c2ecf20Sopenharmony_ci#define ar5416_get_ntxchains(_txchainmask) \ 7248c2ecf20Sopenharmony_ci (((_txchainmask >> 2) & 1) + \ 7258c2ecf20Sopenharmony_ci ((_txchainmask >> 1) & 1) + (_txchainmask & 1)) 7268c2ecf20Sopenharmony_ci 7278c2ecf20Sopenharmony_ciextern const struct eeprom_ops eep_def_ops; 7288c2ecf20Sopenharmony_ciextern const struct eeprom_ops eep_4k_ops; 7298c2ecf20Sopenharmony_ciextern const struct eeprom_ops eep_ar9287_ops; 7308c2ecf20Sopenharmony_ciextern const struct eeprom_ops eep_ar9287_ops; 7318c2ecf20Sopenharmony_ciextern const struct eeprom_ops eep_ar9300_ops; 7328c2ecf20Sopenharmony_ci 7338c2ecf20Sopenharmony_ci#endif /* EEPROM_H */ 734