1 1.1 jmcneill /* 2 1.1 jmcneill * Copyright (c) 2009 Rui Paulo <rpaulo (at) FreeBSD.org> 3 1.1 jmcneill * Copyright (c) 2008 Sam Leffler, Errno Consulting 4 1.1 jmcneill * Copyright (c) 2008 Atheros Communications, Inc. 5 1.1 jmcneill * 6 1.1 jmcneill * Permission to use, copy, modify, and/or distribute this software for any 7 1.1 jmcneill * purpose with or without fee is hereby granted, provided that the above 8 1.1 jmcneill * copyright notice and this permission notice appear in all copies. 9 1.1 jmcneill * 10 1.1 jmcneill * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 1.1 jmcneill * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 1.1 jmcneill * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 1.1 jmcneill * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 1.1 jmcneill * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 1.1 jmcneill * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 1.1 jmcneill * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 1.1 jmcneill * 18 1.1 jmcneill * $FreeBSD: src/sys/dev/ath/ath_hal/ah_eeprom_v4k.h,v 1.2.2.3.2.1 2010/06/14 02:09:06 kensmith Exp $ 19 1.1 jmcneill */ 20 1.1 jmcneill #ifndef _AH_EEPROM_V4K_H_ 21 1.1 jmcneill #define _AH_EEPROM_V4K_H_ 22 1.1 jmcneill 23 1.1 jmcneill #include "ah_eeprom.h" 24 1.1 jmcneill #include "ah_eeprom_v14.h" 25 1.1 jmcneill 26 1.1 jmcneill #define AR9285_RDEXT_DEFAULT 0x1F 27 1.1 jmcneill 28 1.1 jmcneill #undef owl_eep_start_loc 29 1.1 jmcneill #ifdef __LINUX_ARM_ARCH__ /* AP71 */ 30 1.1 jmcneill #define owl_eep_start_loc 0 31 1.1 jmcneill #else 32 1.1 jmcneill #define owl_eep_start_loc 64 33 1.1 jmcneill #endif 34 1.1 jmcneill 35 1.1 jmcneill // 16-bit offset location start of calibration struct 36 1.1 jmcneill #define AR5416_4K_EEP_START_LOC 64 37 1.1 jmcneill #define AR5416_4K_NUM_2G_CAL_PIERS 3 38 1.1 jmcneill #define AR5416_4K_NUM_2G_CCK_TARGET_POWERS 3 39 1.1 jmcneill #define AR5416_4K_NUM_2G_20_TARGET_POWERS 3 40 1.1 jmcneill #define AR5416_4K_NUM_2G_40_TARGET_POWERS 3 41 1.1 jmcneill #define AR5416_4K_NUM_CTLS 12 42 1.1 jmcneill #define AR5416_4K_NUM_BAND_EDGES 4 43 1.1 jmcneill #define AR5416_4K_NUM_PD_GAINS 2 44 1.1 jmcneill #define AR5416_4K_MAX_CHAINS 1 45 1.1 jmcneill 46 1.1 jmcneill /* 47 1.1 jmcneill * NB: The format in EEPROM has words 0 and 2 swapped (i.e. version 48 1.1 jmcneill * and length are swapped). We reverse their position after reading 49 1.1 jmcneill * the data into host memory so the version field is at the same 50 1.1 jmcneill * offset as in previous EEPROM layouts. This makes utilities that 51 1.1 jmcneill * inspect the EEPROM contents work without looking at the PCI device 52 1.1 jmcneill * id which may or may not be reliable. 53 1.1 jmcneill */ 54 1.1 jmcneill typedef struct BaseEepHeader4k { 55 1.1 jmcneill uint16_t version; /* NB: length in EEPROM */ 56 1.1 jmcneill uint16_t checksum; 57 1.1 jmcneill uint16_t length; /* NB: version in EEPROM */ 58 1.1 jmcneill uint8_t opCapFlags; 59 1.1 jmcneill uint8_t eepMisc; 60 1.1 jmcneill uint16_t regDmn[2]; 61 1.1 jmcneill uint8_t macAddr[6]; 62 1.1 jmcneill uint8_t rxMask; 63 1.1 jmcneill uint8_t txMask; 64 1.1 jmcneill uint16_t rfSilent; 65 1.1 jmcneill uint16_t blueToothOptions; 66 1.1 jmcneill uint16_t deviceCap; 67 1.1 jmcneill uint32_t binBuildNumber; 68 1.1 jmcneill uint8_t deviceType; 69 1.1 jmcneill uint8_t txGainType; /* high power tx gain table support */ 70 1.1 jmcneill } __packed BASE_EEP4K_HEADER; // 32 B 71 1.1 jmcneill 72 1.1 jmcneill typedef struct ModalEepHeader4k { 73 1.1 jmcneill uint32_t antCtrlChain[AR5416_4K_MAX_CHAINS]; // 12 74 1.1 jmcneill uint32_t antCtrlCommon; // 4 75 1.1 jmcneill int8_t antennaGainCh[AR5416_4K_MAX_CHAINS]; // 1 76 1.1 jmcneill uint8_t switchSettling; // 1 77 1.1 jmcneill uint8_t txRxAttenCh[AR5416_4K_MAX_CHAINS]; // 1 78 1.1 jmcneill uint8_t rxTxMarginCh[AR5416_4K_MAX_CHAINS]; // 1 79 1.1 jmcneill uint8_t adcDesiredSize; // 1 80 1.1 jmcneill int8_t pgaDesiredSize; // 1 81 1.1 jmcneill uint8_t xlnaGainCh[AR5416_4K_MAX_CHAINS]; // 1 82 1.1 jmcneill uint8_t txEndToXpaOff; // 1 83 1.1 jmcneill uint8_t txEndToRxOn; // 1 84 1.1 jmcneill uint8_t txFrameToXpaOn; // 1 85 1.1 jmcneill uint8_t thresh62; // 1 86 1.1 jmcneill uint8_t noiseFloorThreshCh[AR5416_4K_MAX_CHAINS]; // 1 87 1.1 jmcneill uint8_t xpdGain; // 1 88 1.1 jmcneill uint8_t xpd; // 1 89 1.1 jmcneill int8_t iqCalICh[AR5416_4K_MAX_CHAINS]; // 1 90 1.1 jmcneill int8_t iqCalQCh[AR5416_4K_MAX_CHAINS]; // 1 91 1.1 jmcneill uint8_t pdGainOverlap; // 1 92 1.1 jmcneill uint8_t ob; // 1 93 1.1 jmcneill uint8_t db; // 1 94 1.1 jmcneill uint8_t xpaBiasLvl; // 1 95 1.1 jmcneill #if 0 96 1.1 jmcneill uint8_t pwrDecreaseFor2Chain; // 1 97 1.1 jmcneill uint8_t pwrDecreaseFor3Chain; // 1 -> 48 B 98 1.1 jmcneill #endif 99 1.1 jmcneill uint8_t txFrameToDataStart; // 1 100 1.1 jmcneill uint8_t txFrameToPaOn; // 1 101 1.1 jmcneill uint8_t ht40PowerIncForPdadc; // 1 102 1.1 jmcneill uint8_t bswAtten[AR5416_4K_MAX_CHAINS]; // 1 103 1.1 jmcneill uint8_t bswMargin[AR5416_4K_MAX_CHAINS]; // 1 104 1.1 jmcneill uint8_t swSettleHt40; // 1 105 1.1 jmcneill uint8_t xatten2Db[AR5416_4K_MAX_CHAINS]; // 1 106 1.1 jmcneill uint8_t xatten2Margin[AR5416_4K_MAX_CHAINS]; // 1 107 1.1 jmcneill uint8_t ob_ch1; // 1 -> ob and db become chain specific from AR9280 108 1.1 jmcneill uint8_t db_ch1; // 1 109 1.1 jmcneill uint8_t flagBits; // 1 110 1.1 jmcneill #define AR5416_EEP_FLAG_USEANT1 0x01 /* +1 configured antenna */ 111 1.1 jmcneill #define AR5416_EEP_FLAG_FORCEXPAON 0x02 /* force XPA bit for 5G */ 112 1.1 jmcneill #define AR5416_EEP_FLAG_LOCALBIAS 0x04 /* enable local bias */ 113 1.1 jmcneill #define AR5416_EEP_FLAG_FEMBANDSELECT 0x08 /* FEM band select used */ 114 1.1 jmcneill #define AR5416_EEP_FLAG_XLNABUFIN 0x10 115 1.1 jmcneill #define AR5416_EEP_FLAG_XLNAISEL 0x60 116 1.1 jmcneill #define AR5416_EEP_FLAG_XLNAISEL_S 5 117 1.1 jmcneill #define AR5416_EEP_FLAG_XLNABUFMODE 0x80 118 1.1 jmcneill uint8_t miscBits; // [0..1]: bb_tx_dac_scale_cck 119 1.1 jmcneill uint16_t xpaBiasLvlFreq[3]; // 6 120 1.1 jmcneill uint8_t futureModal[2]; // 2 121 1.1 jmcneill 122 1.1 jmcneill SPUR_CHAN spurChans[AR5416_EEPROM_MODAL_SPURS]; // 20 B 123 1.1 jmcneill } __packed MODAL_EEP4K_HEADER; // == 68 B 124 1.1 jmcneill 125 1.1 jmcneill typedef struct CalCtlData4k { 126 1.1 jmcneill CAL_CTL_EDGES ctlEdges[AR5416_4K_MAX_CHAINS][AR5416_4K_NUM_BAND_EDGES]; 127 1.1 jmcneill } __packed CAL_CTL_DATA_4K; 128 1.1 jmcneill 129 1.1 jmcneill typedef struct calDataPerFreq4k { 130 1.1 jmcneill uint8_t pwrPdg[AR5416_4K_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; 131 1.1 jmcneill uint8_t vpdPdg[AR5416_4K_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; 132 1.1 jmcneill } __packed CAL_DATA_PER_FREQ_4K; 133 1.1 jmcneill 134 1.1 jmcneill struct ar5416eeprom_4k { 135 1.1 jmcneill BASE_EEP4K_HEADER baseEepHeader; // 32 B 136 1.1 jmcneill uint8_t custData[20]; // 20 B 137 1.1 jmcneill MODAL_EEP4K_HEADER modalHeader; // 68 B 138 1.1 jmcneill uint8_t calFreqPier2G[AR5416_4K_NUM_2G_CAL_PIERS]; 139 1.1 jmcneill CAL_DATA_PER_FREQ_4K calPierData2G[AR5416_4K_MAX_CHAINS][AR5416_4K_NUM_2G_CAL_PIERS]; 140 1.1 jmcneill CAL_TARGET_POWER_LEG calTargetPowerCck[AR5416_4K_NUM_2G_CCK_TARGET_POWERS]; 141 1.1 jmcneill CAL_TARGET_POWER_LEG calTargetPower2G[AR5416_4K_NUM_2G_20_TARGET_POWERS]; 142 1.1 jmcneill CAL_TARGET_POWER_HT calTargetPower2GHT20[AR5416_4K_NUM_2G_20_TARGET_POWERS]; 143 1.1 jmcneill CAL_TARGET_POWER_HT calTargetPower2GHT40[AR5416_4K_NUM_2G_40_TARGET_POWERS]; 144 1.1 jmcneill uint8_t ctlIndex[AR5416_4K_NUM_CTLS]; 145 1.1 jmcneill CAL_CTL_DATA_4K ctlData[AR5416_4K_NUM_CTLS]; 146 1.1 jmcneill uint8_t padding; 147 1.1 jmcneill } __packed; 148 1.1 jmcneill 149 1.1 jmcneill typedef struct { 150 1.1 jmcneill struct ar5416eeprom_4k ee_base; 151 1.1 jmcneill #define NUM_EDGES 8 152 1.1 jmcneill uint16_t ee_numCtls; 153 1.1 jmcneill RD_EDGES_POWER ee_rdEdgesPower[NUM_EDGES*AR5416_4K_NUM_CTLS]; 154 1.1 jmcneill /* XXX these are dynamically calculated for use by shared code */ 155 1.1 jmcneill int8_t ee_antennaGainMax; 156 1.1 jmcneill } HAL_EEPROM_v4k; 157 1.1 jmcneill #endif /* _AH_EEPROM_V4K_H_ */ 158