Home | History | Annotate | Line # | Download | only in usb
if_otusreg.h revision 1.2
      1  1.2  christos /*	$NetBSD: if_otusreg.h,v 1.2 2010/11/03 20:03:02 christos Exp $	*/
      2  1.1  christos /*	$OpenBSD: if_otusreg.h,v 1.6 2009/04/06 18:17:01 damien Exp $	*/
      3  1.1  christos 
      4  1.1  christos /*-
      5  1.1  christos  * Copyright (c) 2009 Damien Bergamini <damien.bergamini (at) free.fr>
      6  1.1  christos  * Copyright (c) 2007-2008 Atheros Communications, Inc.
      7  1.1  christos  *
      8  1.1  christos  * Permission to use, copy, modify, and distribute this software for any
      9  1.1  christos  * purpose with or without fee is hereby granted, provided that the above
     10  1.1  christos  * copyright notice and this permission notice appear in all copies.
     11  1.1  christos  *
     12  1.1  christos  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     13  1.1  christos  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     14  1.1  christos  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     15  1.1  christos  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     16  1.1  christos  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     17  1.1  christos  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     18  1.1  christos  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     19  1.1  christos  */
     20  1.1  christos 
     21  1.1  christos /* USB Endpoints addresses. */
     22  1.1  christos #define AR_EPT_BULK_TX_NO	(UE_DIR_OUT | 1)
     23  1.1  christos #define AR_EPT_BULK_RX_NO	(UE_DIR_IN  | 2)
     24  1.1  christos #define AR_EPT_INTR_RX_NO	(UE_DIR_IN  | 3)
     25  1.1  christos #define AR_EPT_INTR_TX_NO	(UE_DIR_OUT | 4)
     26  1.1  christos 
     27  1.1  christos /* USB Requests. */
     28  1.1  christos #define AR_FW_DOWNLOAD			0x30
     29  1.1  christos #define AR_FW_DOWNLOAD_COMPLETE		0x31
     30  1.1  christos 
     31  1.1  christos /* Maximum number of writes that can fit in a single FW command is 7. */
     32  1.2  christos #define AR_FW_MAX_WRITES		7	/* 56 bytes */
     33  1.1  christos 
     34  1.1  christos #define AR_FW_INIT_ADDR			0x102800
     35  1.1  christos #define AR_FW_MAIN_ADDR			0x200000
     36  1.1  christos #define AR_USB_MODE_CTRL		0x1e1108
     37  1.1  christos 
     38  1.1  christos /*
     39  1.1  christos  * AR9170 MAC registers.
     40  1.1  christos  */
     41  1.1  christos #define AR_MAC_REG_BASE			0x1c3000
     42  1.1  christos #define AR_MAC_REG_MAC_ADDR_L		(AR_MAC_REG_BASE + 0x610)
     43  1.1  christos #define AR_MAC_REG_MAC_ADDR_H		(AR_MAC_REG_BASE + 0x614)
     44  1.1  christos #define AR_MAC_REG_BSSID_L		(AR_MAC_REG_BASE + 0x618)
     45  1.1  christos #define AR_MAC_REG_BSSID_H		(AR_MAC_REG_BASE + 0x61c)
     46  1.1  christos #define AR_MAC_REG_GROUP_HASH_TBL_L	(AR_MAC_REG_BASE + 0x624)
     47  1.1  christos #define AR_MAC_REG_GROUP_HASH_TBL_H	(AR_MAC_REG_BASE + 0x628)
     48  1.1  christos #define AR_MAC_REG_BASIC_RATE		(AR_MAC_REG_BASE + 0x630)
     49  1.1  christos #define AR_MAC_REG_MANDATORY_RATE	(AR_MAC_REG_BASE + 0x634)
     50  1.1  christos #define AR_MAC_REG_RTS_CTS_RATE		(AR_MAC_REG_BASE + 0x638)
     51  1.1  christos #define AR_MAC_REG_BACKOFF_PROTECT	(AR_MAC_REG_BASE + 0x63c)
     52  1.1  christos #define AR_MAC_REG_RX_THRESHOLD		(AR_MAC_REG_BASE + 0x640)
     53  1.1  christos #define AR_MAC_REG_RX_PE_DELAY		(AR_MAC_REG_BASE + 0x64c)
     54  1.1  christos #define AR_MAC_REG_DYNAMIC_SIFS_ACK	(AR_MAC_REG_BASE + 0x658)
     55  1.1  christos #define AR_MAC_REG_SNIFFER		(AR_MAC_REG_BASE + 0x674)
     56  1.1  christos #define AR_MAC_REG_ACK_EXTENSION	(AR_MAC_REG_BASE + 0x690)
     57  1.1  christos #define AR_MAC_REG_EIFS_AND_SIFS	(AR_MAC_REG_BASE + 0x698)
     58  1.1  christos #define AR_MAC_REG_BUSY			(AR_MAC_REG_BASE + 0x6e8)
     59  1.1  christos #define AR_MAC_REG_BUSY_EXT		(AR_MAC_REG_BASE + 0x6ec)
     60  1.1  christos #define AR_MAC_REG_SLOT_TIME		(AR_MAC_REG_BASE + 0x6f0)
     61  1.1  christos #define AR_MAC_REG_AC0_CW		(AR_MAC_REG_BASE + 0xb00)
     62  1.1  christos #define AR_MAC_REG_AC1_CW		(AR_MAC_REG_BASE + 0xb04)
     63  1.1  christos #define AR_MAC_REG_AC2_CW		(AR_MAC_REG_BASE + 0xb08)
     64  1.1  christos #define AR_MAC_REG_AC3_CW		(AR_MAC_REG_BASE + 0xb0c)
     65  1.1  christos #define AR_MAC_REG_AC4_CW		(AR_MAC_REG_BASE + 0xb10)
     66  1.1  christos #define AR_MAC_REG_AC1_AC0_AIFS		(AR_MAC_REG_BASE + 0xb14)
     67  1.1  christos #define AR_MAC_REG_AC3_AC2_AIFS		(AR_MAC_REG_BASE + 0xb18)
     68  1.1  christos #define AR_MAC_REG_RETRY_MAX		(AR_MAC_REG_BASE + 0xb28)
     69  1.1  christos #define AR_MAC_REG_TXOP_NOT_ENOUGH_INDICATION	\
     70  1.1  christos 					(AR_MAC_REG_BASE + 0xb30)
     71  1.1  christos #define AR_MAC_REG_AC1_AC0_TXOP		(AR_MAC_REG_BASE + 0xb44)
     72  1.1  christos #define AR_MAC_REG_AC3_AC2_TXOP		(AR_MAC_REG_BASE + 0xb48)
     73  1.1  christos #define AR_MAC_REG_OFDM_PHY_ERRORS	(AR_MAC_REG_BASE + 0xcb4)
     74  1.1  christos #define AR_MAC_REG_CCK_PHY_ERRORS	(AR_MAC_REG_BASE + 0xcb8)
     75  1.1  christos #define AR_MAC_REG_BCN_HT1		(AR_MAC_REG_BASE + 0xda0)
     76  1.1  christos 
     77  1.1  christos /* Possible values for register AR_USB_MODE_CTRL. */
     78  1.1  christos #define AR_USB_DS_ENA		(1 << 0)
     79  1.1  christos #define AR_USB_US_ENA		(1 << 1)
     80  1.1  christos #define AR_USB_US_PACKET_MODE	(1 << 3)
     81  1.1  christos #define AR_USB_RX_STREAM_4K	(0 << 4)
     82  1.1  christos #define AR_USB_RX_STREAM_8K	(1 << 4)
     83  1.1  christos #define AR_USB_RX_STREAM_16K	(2 << 4)
     84  1.1  christos #define AR_USB_RX_STREAM_32K	(3 << 4)
     85  1.1  christos #define AR_USB_TX_STREAM_MODE	(1 << 6)
     86  1.1  christos 
     87  1.1  christos #define AR_LED0_ON	(1 << 0)
     88  1.1  christos #define AR_LED1_ON	(1 << 1)
     89  1.1  christos 
     90  1.1  christos /*
     91  1.1  christos  * PHY registers.
     92  1.1  christos  */
     93  1.1  christos #define AR_PHY_BASE			0x1c5800
     94  1.1  christos #define AR_PHY(reg)			(AR_PHY_BASE + (reg) * 4)
     95  1.1  christos #define AR_PHY_TURBO			(AR_PHY_BASE + 0x0004)
     96  1.1  christos #define AR_PHY_RF_CTL3			(AR_PHY_BASE + 0x0028)
     97  1.1  christos #define AR_PHY_RF_CTL4			(AR_PHY_BASE + 0x0034)
     98  1.1  christos #define AR_PHY_SETTLING			(AR_PHY_BASE + 0x0044)
     99  1.1  christos #define AR_PHY_RXGAIN			(AR_PHY_BASE + 0x0048)
    100  1.1  christos #define AR_PHY_DESIRED_SZ		(AR_PHY_BASE + 0x0050)
    101  1.1  christos #define AR_PHY_FIND_SIG			(AR_PHY_BASE + 0x0058)
    102  1.1  christos #define AR_PHY_AGC_CTL1			(AR_PHY_BASE + 0x005c)
    103  1.1  christos #define AR_PHY_SFCORR			(AR_PHY_BASE + 0x0068)
    104  1.1  christos #define AR_PHY_SFCORR_LOW		(AR_PHY_BASE + 0x006c)
    105  1.1  christos #define AR_PHY_TIMING_CTRL4		(AR_PHY_BASE + 0x0120)
    106  1.1  christos #define AR_PHY_TIMING5			(AR_PHY_BASE + 0x0124)
    107  1.1  christos #define AR_PHY_POWER_TX_RATE1		(AR_PHY_BASE + 0x0134)
    108  1.1  christos #define AR_PHY_POWER_TX_RATE2		(AR_PHY_BASE + 0x0138)
    109  1.1  christos #define AR_PHY_POWER_TX_RATE_MAX	(AR_PHY_BASE + 0x013c)
    110  1.1  christos #define AR_PHY_SWITCH_CHAIN_0		(AR_PHY_BASE + 0x0160)
    111  1.1  christos #define AR_PHY_SWITCH_COM		(AR_PHY_BASE + 0x0164)
    112  1.1  christos #define AR_PHY_HEAVY_CLIP_ENABLE	(AR_PHY_BASE + 0x01e0)
    113  1.1  christos #define AR_PHY_CCK_DETECT		(AR_PHY_BASE + 0x0a08)
    114  1.1  christos #define AR_PHY_GAIN_2GHZ		(AR_PHY_BASE + 0x0a0c)
    115  1.1  christos #define AR_PHY_POWER_TX_RATE3		(AR_PHY_BASE + 0x0a34)
    116  1.1  christos #define AR_PHY_POWER_TX_RATE4		(AR_PHY_BASE + 0x0a38)
    117  1.1  christos #define AR_PHY_TPCRG1			(AR_PHY_BASE + 0x0a58)
    118  1.1  christos #define AR_PHY_POWER_TX_RATE5		(AR_PHY_BASE + 0x0b8c)
    119  1.1  christos #define AR_PHY_POWER_TX_RATE6		(AR_PHY_BASE + 0x0b90)
    120  1.1  christos #define AR_PHY_POWER_TX_RATE7		(AR_PHY_BASE + 0x0bcc)
    121  1.1  christos #define AR_PHY_POWER_TX_RATE8		(AR_PHY_BASE + 0x0bd0)
    122  1.1  christos #define AR_PHY_POWER_TX_RATE9		(AR_PHY_BASE + 0x0bd4)
    123  1.1  christos #define AR_PHY_CCA			(AR_PHY_BASE + 0x3064)
    124  1.1  christos 
    125  1.1  christos #define AR_SEEPROM_HW_TYPE_OFFSET	0x1374
    126  1.1  christos #define AR_EEPROM_OFFSET		0x1600
    127  1.1  christos 
    128  1.1  christos #define AR_BANK4_CHUP			(1 << 0)
    129  1.1  christos #define AR_BANK4_BMODE_LF_SYNTH_FREQ	(1 << 1)
    130  1.1  christos #define AR_BANK4_AMODE_REFSEL(x)	((x) << 2)
    131  1.1  christos #define AR_BANK4_ADDR(x)		((x) << 5)
    132  1.1  christos 
    133  1.1  christos /* Tx descriptor. */
    134  1.1  christos struct ar_tx_head {
    135  1.1  christos 	uint16_t	len;
    136  1.1  christos 	uint16_t	macctl;
    137  1.1  christos #define AR_TX_MAC_RTS		(1 <<  0)
    138  1.1  christos #define AR_TX_MAC_CTS		(1 <<  1)
    139  1.1  christos #define AR_TX_MAC_BACKOFF	(1 <<  3)
    140  1.1  christos #define AR_TX_MAC_NOACK		(1 <<  2)
    141  1.1  christos #define AR_TX_MAC_HW_DUR	(1 <<  9)
    142  1.1  christos #define AR_TX_MAC_QID(qid)	((qid) << 10)
    143  1.1  christos #define AR_TX_MAC_RATE_PROBING	(1 << 15)
    144  1.1  christos 
    145  1.1  christos 	uint32_t	phyctl;
    146  1.1  christos /* Modulation type. */
    147  1.1  christos #define AR_TX_PHY_MT_CCK	0
    148  1.1  christos #define AR_TX_PHY_MT_OFDM	1
    149  1.1  christos #define AR_TX_PHY_MT_HT		2
    150  1.1  christos #define AR_TX_PHY_GF		(1 << 2)
    151  1.1  christos #define AR_TX_PHY_BW_SHIFT	3
    152  1.1  christos #define AR_TX_PHY_TPC_SHIFT	9
    153  1.1  christos #define AR_TX_PHY_ANTMSK(msk)	((msk) << 15)
    154  1.1  christos #define AR_TX_PHY_MCS(mcs)	((mcs) << 18)
    155  1.1  christos #define AR_TX_PHY_SHGI		(1 << 31)
    156  1.1  christos } __packed;
    157  1.1  christos 
    158  1.1  christos /* USB Rx stream mode header. */
    159  1.1  christos struct ar_rx_head {
    160  1.1  christos 	uint16_t	len;
    161  1.1  christos 	uint16_t	tag;
    162  1.1  christos #define AR_RX_HEAD_TAG	0x4e00
    163  1.1  christos } __packed;
    164  1.1  christos 
    165  1.1  christos /* Rx descriptor. */
    166  1.1  christos struct ar_rx_tail {
    167  1.1  christos 	uint8_t	rssi_ant[3];
    168  1.1  christos 	uint8_t	rssi_ant_ext[3];
    169  1.1  christos 	uint8_t	rssi;		/* Combined RSSI. */
    170  1.1  christos 	uint8_t	evm[2][6];	/* Error Vector Magnitude. */
    171  1.1  christos 	uint8_t	phy_err;
    172  1.1  christos 	uint8_t	sa_idx;
    173  1.1  christos 	uint8_t	da_idx;
    174  1.1  christos 	uint8_t	error;
    175  1.1  christos #define AR_RX_ERROR_TIMEOUT	(1 << 0)
    176  1.1  christos #define AR_RX_ERROR_OVERRUN	(1 << 1)
    177  1.1  christos #define AR_RX_ERROR_DECRYPT	(1 << 2)
    178  1.1  christos #define AR_RX_ERROR_FCS		(1 << 3)
    179  1.1  christos #define AR_RX_ERROR_BAD_RA	(1 << 4)
    180  1.1  christos #define AR_RX_ERROR_PLCP	(1 << 5)
    181  1.1  christos #define AR_RX_ERROR_MMIC	(1 << 6)
    182  1.1  christos 
    183  1.1  christos 	uint8_t	status;
    184  1.1  christos /* Modulation type (same as AR_TX_PHY_MT). */
    185  1.1  christos #define AR_RX_STATUS_MT_MASK	0x3
    186  1.1  christos #define AR_RX_STATUS_MT_CCK	0
    187  1.1  christos #define AR_RX_STATUS_MT_OFDM	1
    188  1.1  christos #define AR_RX_STATUS_MT_HT	2
    189  1.1  christos #define AR_RX_STATUS_SHPREAMBLE	(1 << 3)
    190  1.1  christos } __packed;
    191  1.1  christos 
    192  1.1  christos #define AR_PLCP_HDR_LEN	12
    193  1.1  christos /* Magic PLCP header for firmware notifications through Rx bulk pipe. */
    194  1.1  christos static uint8_t AR_PLCP_HDR_INTR[] = {
    195  1.1  christos 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
    196  1.1  christos 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff
    197  1.1  christos };
    198  1.1  christos 
    199  1.1  christos /* Firmware command/reply header. */
    200  1.1  christos struct ar_cmd_hdr {
    201  1.1  christos 	uint8_t		len;
    202  1.1  christos 	uint8_t		code;
    203  1.1  christos #define AR_CMD_RREG		0x00
    204  1.1  christos #define AR_CMD_WREG		0x01
    205  1.1  christos #define AR_CMD_RMEM		0x02
    206  1.1  christos #define AR_CMD_WMEM		0x03
    207  1.1  christos #define AR_CMD_BITAND		0x04
    208  1.1  christos #define AR_CMD_BITOR		0x05
    209  1.1  christos #define AR_CMD_EKEY		0x28
    210  1.1  christos #define AR_CMD_DKEY		0x29
    211  1.1  christos #define AR_CMD_FREQUENCY	0x30
    212  1.1  christos #define AR_CMD_RF_INIT		0x31
    213  1.1  christos #define AR_CMD_SYNTH		0x32
    214  1.1  christos #define AR_CMD_FREQ_STRAT	0x33
    215  1.1  christos #define AR_CMD_ECHO		0x80
    216  1.1  christos #define AR_CMD_TALLY		0x81
    217  1.1  christos #define AR_CMD_TALLY_APD	0x82
    218  1.1  christos #define AR_CMD_CONFIG		0x83
    219  1.1  christos #define AR_CMD_RESET		0x90
    220  1.1  christos #define AR_CMD_DKRESET		0x91
    221  1.1  christos #define AR_CMD_DKTX_STATUS	0x92
    222  1.1  christos #define AR_CMD_FDC		0xa0
    223  1.1  christos #define AR_CMD_WREEPROM		0xb0
    224  1.1  christos #define AR_CMD_WFLASH		AR_CMD_WREEPROM
    225  1.1  christos #define AR_CMD_FLASH_ERASE	0xb1
    226  1.1  christos #define AR_CMD_FLASH_PROG	0xb2
    227  1.1  christos #define AR_CMD_FLASH_CHKSUM	0xb3
    228  1.1  christos #define AR_CMD_FLASH_READ	0xb4
    229  1.1  christos #define AR_CMD_FW_DL_INIT	0xb5
    230  1.1  christos #define AR_CMD_MEM_WREEPROM	0xbb
    231  1.1  christos /* Those have the 2 MSB set to 1. */
    232  1.1  christos #define AR_EVT_BEACON		0x00
    233  1.1  christos #define AR_EVT_TX_COMP		0x01
    234  1.1  christos #define AR_EVT_TBTT		0x02
    235  1.1  christos #define AR_EVT_ATIM		0x03
    236  1.1  christos 
    237  1.1  christos 	uint16_t	token;	/* Driver private data. */
    238  1.1  christos } __packed;
    239  1.1  christos 
    240  1.1  christos /* Structure for command AR_CMD_RF_INIT/AR_CMD_FREQUENCY. */
    241  1.1  christos struct ar_cmd_frequency {
    242  1.1  christos 	uint32_t	freq;
    243  1.1  christos 	uint32_t	dynht2040;
    244  1.1  christos 	uint32_t	htena;
    245  1.1  christos 	uint32_t	dsc_exp;
    246  1.1  christos 	uint32_t	dsc_man;
    247  1.1  christos 	uint32_t	dsc_shgi_exp;
    248  1.1  christos 	uint32_t	dsc_shgi_man;
    249  1.1  christos 	uint32_t	check_loop_count;
    250  1.1  christos } __packed;
    251  1.1  christos 
    252  1.1  christos /* Firmware reply for command AR_CMD_FREQUENCY. */
    253  1.1  christos struct ar_rsp_frequency {
    254  1.1  christos 	uint32_t	status;
    255  1.1  christos #define AR_CAL_ERR_AGC		(1 << 0)	/* AGC cal unfinished. */
    256  1.1  christos #define AR_CAL_ERR_NF		(1 << 1)	/* Noise cal unfinished. */
    257  1.1  christos #define AR_CAL_ERR_NF_VAL	(1 << 2)	/* NF value unexpected. */
    258  1.1  christos 
    259  1.1  christos 	uint32_t	nf[3];		/* Noisefloor. */
    260  1.1  christos 	uint32_t	nf_ext[3];	/* Noisefloor ext. */
    261  1.1  christos } __packed;
    262  1.1  christos 
    263  1.1  christos /* Structure for command AR_CMD_EKEY. */
    264  1.1  christos struct ar_cmd_ekey {
    265  1.1  christos 	uint16_t	uid;	/* user ID */
    266  1.1  christos 	uint16_t	kix;
    267  1.1  christos 	uint16_t	cipher;
    268  1.1  christos #define AR_CIPHER_NONE		0
    269  1.1  christos #define AR_CIPHER_WEP64		1
    270  1.1  christos #define AR_CIPHER_TKIP		2
    271  1.1  christos #define AR_CIPHER_AES		4
    272  1.1  christos #define AR_CIPHER_WEP128	5
    273  1.1  christos #define AR_CIPHER_WEP256	6
    274  1.1  christos #define AR_CIPHER_CENC		7
    275  1.1  christos 
    276  1.1  christos 	uint8_t		macaddr[IEEE80211_ADDR_LEN];
    277  1.1  christos 	uint8_t		key[16];
    278  1.1  christos } __packed;
    279  1.1  christos 
    280  1.1  christos /* Structure for event AR_EVT_TX_COMP. */
    281  1.1  christos struct ar_evt_tx_comp {
    282  1.1  christos 	uint8_t		macaddr[IEEE80211_ADDR_LEN];
    283  1.1  christos 	uint32_t	phy;
    284  1.1  christos 	uint16_t	status;
    285  1.1  christos #define AR_TX_STATUS_COMP	0
    286  1.1  christos #define AR_TX_STATUS_RETRY_COMP	1
    287  1.1  christos #define AR_TX_STATUS_FAILED	2
    288  1.1  christos } __packed;
    289  1.1  christos 
    290  1.1  christos /*
    291  1.1  christos  * EEPROM.
    292  1.1  christos  */
    293  1.1  christos /* Possible flags for opCapFlags. */
    294  1.1  christos #define AR5416_OPFLAGS_11A	0x01
    295  1.1  christos #define AR5416_OPFLAGS_11G	0x02
    296  1.1  christos #define AR5416_OPFLAGS_5G_HT40	0x04
    297  1.1  christos #define AR5416_OPFLAGS_2G_HT40	0x08
    298  1.1  christos #define AR5416_OPFLAGS_5G_HT20	0x10
    299  1.1  christos #define AR5416_OPFLAGS_2G_HT20	0x20
    300  1.1  christos 
    301  1.1  christos #define AR5416_NUM_5G_CAL_PIERS		8
    302  1.1  christos #define AR5416_NUM_2G_CAL_PIERS		4
    303  1.1  christos #define AR5416_NUM_5G_20_TARGET_POWERS	8
    304  1.1  christos #define AR5416_NUM_5G_40_TARGET_POWERS	8
    305  1.1  christos #define AR5416_NUM_2G_CCK_TARGET_POWERS	3
    306  1.1  christos #define AR5416_NUM_2G_20_TARGET_POWERS	4
    307  1.1  christos #define AR5416_NUM_2G_40_TARGET_POWERS	4
    308  1.1  christos #define AR5416_NUM_CTLS			24
    309  1.1  christos #define AR5416_NUM_BAND_EDGES		8
    310  1.1  christos #define AR5416_NUM_PD_GAINS		4
    311  1.1  christos #define AR5416_PD_GAIN_ICEPTS		5
    312  1.1  christos #define AR5416_EEPROM_MODAL_SPURS	5
    313  1.1  christos #define AR5416_MAX_CHAINS		2
    314  1.1  christos 
    315  1.1  christos typedef struct BaseEepHeader {
    316  1.1  christos 	uint16_t	length;
    317  1.1  christos 	uint16_t	checksum;
    318  1.1  christos 	uint16_t	version;
    319  1.1  christos 	uint8_t		opCapFlags;
    320  1.1  christos 	uint8_t		eepMisc;
    321  1.1  christos 	uint16_t	regDmn[2];
    322  1.1  christos 	uint8_t		macAddr[6];
    323  1.1  christos 	uint8_t		rxMask;
    324  1.1  christos 	uint8_t		txMask;
    325  1.1  christos 	uint16_t	rfSilent;
    326  1.1  christos 	uint16_t	blueToothOptions;
    327  1.1  christos 	uint16_t	deviceCap;
    328  1.1  christos 	uint32_t	binBuildNumber;
    329  1.1  christos 	uint8_t		deviceType;
    330  1.1  christos 	uint8_t		futureBase[33];
    331  1.1  christos } __packed BASE_EEP_HEADER;
    332  1.1  christos 
    333  1.1  christos typedef struct spurChanStruct {
    334  1.1  christos 	uint16_t	spurChan;
    335  1.1  christos 	uint8_t		spurRangeLow;
    336  1.1  christos 	uint8_t		spurRangeHigh;
    337  1.1  christos } __packed SPUR_CHAN;
    338  1.1  christos 
    339  1.1  christos typedef struct ModalEepHeader {
    340  1.1  christos 	uint32_t	antCtrlChain[AR5416_MAX_CHAINS];
    341  1.1  christos 	uint32_t	antCtrlCommon;
    342  1.1  christos 	int8_t		antennaGainCh[AR5416_MAX_CHAINS];
    343  1.1  christos 	uint8_t		switchSettling;
    344  1.1  christos 	uint8_t		txRxAttenCh[AR5416_MAX_CHAINS];
    345  1.1  christos 	uint8_t		rxTxMarginCh[AR5416_MAX_CHAINS];
    346  1.1  christos 	uint8_t		adcDesiredSize;
    347  1.1  christos 	int8_t		pgaDesiredSize;
    348  1.1  christos 	uint8_t		xlnaGainCh[AR5416_MAX_CHAINS];
    349  1.1  christos 	uint8_t		txEndToXpaOff;
    350  1.1  christos 	uint8_t		txEndToRxOn;
    351  1.1  christos 	uint8_t		txFrameToXpaOn;
    352  1.1  christos 	uint8_t		thresh62;
    353  1.1  christos 	uint8_t		noiseFloorThreshCh[AR5416_MAX_CHAINS];
    354  1.1  christos 	uint8_t		xpdGain;
    355  1.1  christos 	uint8_t		xpd;
    356  1.1  christos 	int8_t		iqCalICh[AR5416_MAX_CHAINS];
    357  1.1  christos 	int8_t		iqCalQCh[AR5416_MAX_CHAINS];
    358  1.1  christos 	uint8_t		pdGainOverlap;
    359  1.1  christos 	uint8_t		ob;
    360  1.1  christos 	uint8_t		db;
    361  1.1  christos 	uint8_t		xpaBiasLvl;
    362  1.1  christos 	uint8_t		pwrDecreaseFor2Chain;
    363  1.1  christos 	uint8_t		pwrDecreaseFor3Chain;
    364  1.1  christos 	uint8_t		txFrameToDataStart;
    365  1.1  christos 	uint8_t		txFrameToPaOn;
    366  1.1  christos 	uint8_t		ht40PowerIncForPdadc;
    367  1.1  christos 	uint8_t		bswAtten[AR5416_MAX_CHAINS];
    368  1.1  christos 	uint8_t		bswMargin[AR5416_MAX_CHAINS];
    369  1.1  christos 	uint8_t		swSettleHt40;
    370  1.1  christos 	uint8_t		futureModal[22];
    371  1.1  christos 	SPUR_CHAN	spurChans[AR5416_EEPROM_MODAL_SPURS];
    372  1.1  christos } __packed MODAL_EEP_HEADER;
    373  1.1  christos 
    374  1.1  christos typedef struct calDataPerFreq {
    375  1.1  christos 	uint8_t		pwrPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
    376  1.1  christos 	uint8_t		vpdPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
    377  1.1  christos } __packed CAL_DATA_PER_FREQ;
    378  1.1  christos 
    379  1.1  christos typedef struct CalTargetPowerLegacy {
    380  1.1  christos 	uint8_t		bChannel;
    381  1.1  christos 	uint8_t		tPow2x[4];
    382  1.1  christos } __packed CAL_TARGET_POWER_LEG;
    383  1.1  christos 
    384  1.1  christos typedef struct CalTargetPowerHt {
    385  1.1  christos 	uint8_t		bChannel;
    386  1.1  christos 	uint8_t		tPow2x[8];
    387  1.1  christos } __packed CAL_TARGET_POWER_HT;
    388  1.1  christos 
    389  1.1  christos typedef struct CalCtlEdges {
    390  1.1  christos 	uint8_t		bChannel;
    391  1.1  christos 	uint8_t		tPowerFlag;
    392  1.1  christos } __packed CAL_CTL_EDGES;
    393  1.1  christos 
    394  1.1  christos typedef struct CalCtlData {
    395  1.1  christos 	CAL_CTL_EDGES	ctlEdges[AR5416_MAX_CHAINS][AR5416_NUM_BAND_EDGES];
    396  1.1  christos } __packed CAL_CTL_DATA;
    397  1.1  christos 
    398  1.1  christos typedef struct ar5416eeprom {
    399  1.1  christos 	BASE_EEP_HEADER		baseEepHeader;
    400  1.1  christos 	uint8_t			custData[64];
    401  1.1  christos 	MODAL_EEP_HEADER	modalHeader[2];
    402  1.1  christos 	uint8_t			calFreqPier5G[AR5416_NUM_5G_CAL_PIERS];
    403  1.1  christos 	uint8_t			calFreqPier2G[AR5416_NUM_2G_CAL_PIERS];
    404  1.1  christos 	CAL_DATA_PER_FREQ	calPierData5G[AR5416_MAX_CHAINS]
    405  1.1  christos 					     [AR5416_NUM_5G_CAL_PIERS];
    406  1.1  christos 	CAL_DATA_PER_FREQ	calPierData2G[AR5416_MAX_CHAINS]
    407  1.1  christos 					     [AR5416_NUM_2G_CAL_PIERS];
    408  1.1  christos 	CAL_TARGET_POWER_LEG	calTPow5G[AR5416_NUM_5G_20_TARGET_POWERS];
    409  1.1  christos 	CAL_TARGET_POWER_HT	calTPow5GHT20[AR5416_NUM_5G_20_TARGET_POWERS];
    410  1.1  christos 	CAL_TARGET_POWER_HT	calTPow5GHT40[AR5416_NUM_5G_40_TARGET_POWERS];
    411  1.1  christos 	CAL_TARGET_POWER_LEG	calTPowCck[AR5416_NUM_2G_CCK_TARGET_POWERS];
    412  1.1  christos 	CAL_TARGET_POWER_LEG	calTPow2G[AR5416_NUM_2G_20_TARGET_POWERS];
    413  1.1  christos 	CAL_TARGET_POWER_HT	calTPow2GHT20[AR5416_NUM_2G_20_TARGET_POWERS];
    414  1.1  christos 	CAL_TARGET_POWER_HT	calTPow2GHT40[AR5416_NUM_2G_40_TARGET_POWERS];
    415  1.1  christos 	uint8_t			ctlIndex[AR5416_NUM_CTLS];
    416  1.1  christos 	CAL_CTL_DATA		ctlData[AR5416_NUM_CTLS];
    417  1.2  christos 	uint8_t			padding[3];
    418  1.1  christos } __packed AR5416_EEPROM;
    419