xref: /dflybsd-src/sys/dev/netif/ath/ath_hal/ar5416/ar5416phy.h (revision 572ff6f6e8b95055988f178b6ba12ce77bb5b3c2)
1*572ff6f6SMatthew Dillon /*
2*572ff6f6SMatthew Dillon  * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3*572ff6f6SMatthew Dillon  * Copyright (c) 2002-2008 Atheros Communications, Inc.
4*572ff6f6SMatthew Dillon  *
5*572ff6f6SMatthew Dillon  * Permission to use, copy, modify, and/or distribute this software for any
6*572ff6f6SMatthew Dillon  * purpose with or without fee is hereby granted, provided that the above
7*572ff6f6SMatthew Dillon  * copyright notice and this permission notice appear in all copies.
8*572ff6f6SMatthew Dillon  *
9*572ff6f6SMatthew Dillon  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10*572ff6f6SMatthew Dillon  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*572ff6f6SMatthew Dillon  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12*572ff6f6SMatthew Dillon  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*572ff6f6SMatthew Dillon  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14*572ff6f6SMatthew Dillon  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15*572ff6f6SMatthew Dillon  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16*572ff6f6SMatthew Dillon  *
17*572ff6f6SMatthew Dillon  * $FreeBSD$
18*572ff6f6SMatthew Dillon  */
19*572ff6f6SMatthew Dillon #ifndef _DEV_ATH_AR5416PHY_H_
20*572ff6f6SMatthew Dillon #define _DEV_ATH_AR5416PHY_H_
21*572ff6f6SMatthew Dillon 
22*572ff6f6SMatthew Dillon #include "ar5212/ar5212phy.h"
23*572ff6f6SMatthew Dillon 
24*572ff6f6SMatthew Dillon #define	AR_BT_COEX_MODE            0x8170
25*572ff6f6SMatthew Dillon #define	AR_BT_TIME_EXTEND          0x000000ff
26*572ff6f6SMatthew Dillon #define	AR_BT_TIME_EXTEND_S        0
27*572ff6f6SMatthew Dillon #define	AR_BT_TXSTATE_EXTEND       0x00000100
28*572ff6f6SMatthew Dillon #define	AR_BT_TXSTATE_EXTEND_S     8
29*572ff6f6SMatthew Dillon #define	AR_BT_TX_FRAME_EXTEND      0x00000200
30*572ff6f6SMatthew Dillon #define	AR_BT_TX_FRAME_EXTEND_S    9
31*572ff6f6SMatthew Dillon #define	AR_BT_MODE                 0x00000c00
32*572ff6f6SMatthew Dillon #define	AR_BT_MODE_S               10
33*572ff6f6SMatthew Dillon #define	AR_BT_QUIET                0x00001000
34*572ff6f6SMatthew Dillon #define	AR_BT_QUIET_S              12
35*572ff6f6SMatthew Dillon #define	AR_BT_QCU_THRESH           0x0001e000
36*572ff6f6SMatthew Dillon #define	AR_BT_QCU_THRESH_S         13
37*572ff6f6SMatthew Dillon #define	AR_BT_RX_CLEAR_POLARITY    0x00020000
38*572ff6f6SMatthew Dillon #define	AR_BT_RX_CLEAR_POLARITY_S  17
39*572ff6f6SMatthew Dillon #define	AR_BT_PRIORITY_TIME        0x00fc0000
40*572ff6f6SMatthew Dillon #define	AR_BT_PRIORITY_TIME_S      18
41*572ff6f6SMatthew Dillon #define	AR_BT_FIRST_SLOT_TIME      0xff000000
42*572ff6f6SMatthew Dillon #define	AR_BT_FIRST_SLOT_TIME_S    24
43*572ff6f6SMatthew Dillon 
44*572ff6f6SMatthew Dillon #define	AR_BT_COEX_WEIGHT          0x8174
45*572ff6f6SMatthew Dillon #define	AR_BT_BT_WGHT              0x0000ffff
46*572ff6f6SMatthew Dillon #define	AR_BT_BT_WGHT_S            0
47*572ff6f6SMatthew Dillon #define	AR_BT_WL_WGHT              0xffff0000
48*572ff6f6SMatthew Dillon #define	AR_BT_WL_WGHT_S            16
49*572ff6f6SMatthew Dillon 
50*572ff6f6SMatthew Dillon #define	AR_BT_COEX_MODE2           0x817c
51*572ff6f6SMatthew Dillon #define	AR_BT_BCN_MISS_THRESH      0x000000ff
52*572ff6f6SMatthew Dillon #define	AR_BT_BCN_MISS_THRESH_S    0
53*572ff6f6SMatthew Dillon #define	AR_BT_BCN_MISS_CNT         0x0000ff00
54*572ff6f6SMatthew Dillon #define	AR_BT_BCN_MISS_CNT_S       8
55*572ff6f6SMatthew Dillon #define	AR_BT_HOLD_RX_CLEAR        0x00010000
56*572ff6f6SMatthew Dillon #define	AR_BT_HOLD_RX_CLEAR_S      16
57*572ff6f6SMatthew Dillon #define	AR_BT_DISABLE_BT_ANT       0x00100000
58*572ff6f6SMatthew Dillon #define	AR_BT_DISABLE_BT_ANT_S     20
59*572ff6f6SMatthew Dillon 
60*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN		0x9910
61*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN_ENA	0x00000001
62*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN_ENA_S	0
63*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN_ACTIVE	0x00000002
64*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN_ACTIVE_S	1
65*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN_FFT_PERIOD	0x000000F0
66*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN_FFT_PERIOD_S	4
67*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN_PERIOD	0x0000FF00
68*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN_PERIOD_S	8
69*572ff6f6SMatthew Dillon 
70*572ff6f6SMatthew Dillon /* Scan count and Short repeat flags are different for Kiwi and Merlin */
71*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN_COUNT	0x00FF0000
72*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN_COUNT_S	16
73*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN_COUNT_KIWI	0x0FFF0000
74*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN_COUNT_KIWI_S	16
75*572ff6f6SMatthew Dillon 
76*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT	0x01000000
77*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_S	24
78*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI	0x10000000
79*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI_S	28
80*572ff6f6SMatthew Dillon 
81*572ff6f6SMatthew Dillon /*
82*572ff6f6SMatthew Dillon  * Kiwi only, bit 30 is used to set the error type, if set it is 0x5 (HAL_PHYERR_RADAR)
83*572ff6f6SMatthew Dillon  * Else it is 38 (new error type)
84*572ff6f6SMatthew Dillon  */
85*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT_KIWI	0x40000000  /* Spectral Error select bit mask */
86*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT_KIWI_S	30  /* Spectral Error select bit 30 */
87*572ff6f6SMatthew Dillon 
88*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN_PRIORITY_SELECT_KIWI	0x20000000  /* Spectral Error select bit mask */
89*572ff6f6SMatthew Dillon #define	AR_PHY_SPECTRAL_SCAN_PRIORITY_SELECT_SELECT_KIWI_S	29  /* Spectral Error select bit 30 */
90*572ff6f6SMatthew Dillon 
91*572ff6f6SMatthew Dillon /* For AR_PHY_RADAR0 */
92*572ff6f6SMatthew Dillon #define	AR_PHY_RADAR_0_FFT_ENA		0x80000000
93*572ff6f6SMatthew Dillon 
94*572ff6f6SMatthew Dillon #define	AR_PHY_RADAR_EXT		0x9940
95*572ff6f6SMatthew Dillon #define	AR_PHY_RADAR_EXT_ENA		0x00004000
96*572ff6f6SMatthew Dillon 
97*572ff6f6SMatthew Dillon #define	AR_PHY_RADAR_1			0x9958
98*572ff6f6SMatthew Dillon #define	AR_PHY_RADAR_1_BIN_THRESH_SELECT	0x07000000
99*572ff6f6SMatthew Dillon #define	AR_PHY_RADAR_1_BIN_THRESH_SELECT_S	24
100*572ff6f6SMatthew Dillon #define	AR_PHY_RADAR_1_RELPWR_ENA	0x00800000
101*572ff6f6SMatthew Dillon #define	AR_PHY_RADAR_1_USE_FIR128	0x00400000
102*572ff6f6SMatthew Dillon #define	AR_PHY_RADAR_1_RELPWR_THRESH	0x003F0000
103*572ff6f6SMatthew Dillon #define	AR_PHY_RADAR_1_RELPWR_THRESH_S	16
104*572ff6f6SMatthew Dillon #define	AR_PHY_RADAR_1_BLOCK_CHECK	0x00008000
105*572ff6f6SMatthew Dillon #define	AR_PHY_RADAR_1_MAX_RRSSI	0x00004000
106*572ff6f6SMatthew Dillon #define	AR_PHY_RADAR_1_RELSTEP_CHECK	0x00002000
107*572ff6f6SMatthew Dillon #define	AR_PHY_RADAR_1_RELSTEP_THRESH	0x00001F00
108*572ff6f6SMatthew Dillon #define	AR_PHY_RADAR_1_RELSTEP_THRESH_S	8
109*572ff6f6SMatthew Dillon #define	AR_PHY_RADAR_1_MAXLEN		0x000000FF
110*572ff6f6SMatthew Dillon #define	AR_PHY_RADAR_1_MAXLEN_S		0
111*572ff6f6SMatthew Dillon 
112*572ff6f6SMatthew Dillon #define AR_PHY_CHIP_ID_REV_0    0x80        /* 5416 Rev 0 (owl 1.0) BB */
113*572ff6f6SMatthew Dillon #define AR_PHY_CHIP_ID_REV_1    0x81        /* 5416 Rev 1 (owl 2.0) BB */
114*572ff6f6SMatthew Dillon 
115*572ff6f6SMatthew Dillon #define RFSILENT_BB             0x00002000      /* shush bb */
116*572ff6f6SMatthew Dillon #define AR_PHY_RESTART      	0x9970      /* restart */
117*572ff6f6SMatthew Dillon #define AR_PHY_RESTART_DIV_GC   0x001C0000  /* bb_ant_fast_div_gc_limit */
118*572ff6f6SMatthew Dillon #define AR_PHY_RESTART_DIV_GC_S 18
119*572ff6f6SMatthew Dillon 
120*572ff6f6SMatthew Dillon /* PLL settling times */
121*572ff6f6SMatthew Dillon #define RTC_PLL_SETTLE_DELAY		1000    /* 1 ms     */
122*572ff6f6SMatthew Dillon #define HT40_CHANNEL_CENTER_SHIFT   	10	/* MHz      */
123*572ff6f6SMatthew Dillon 
124*572ff6f6SMatthew Dillon #define AR_PHY_RFBUS_REQ        0x997C
125*572ff6f6SMatthew Dillon #define AR_PHY_RFBUS_REQ_EN     0x00000001
126*572ff6f6SMatthew Dillon 
127*572ff6f6SMatthew Dillon #define AR_2040_MODE                0x8318
128*572ff6f6SMatthew Dillon #define AR_2040_JOINED_RX_CLEAR     0x00000001   // use ctl + ext rx_clear for cca
129*572ff6f6SMatthew Dillon 
130*572ff6f6SMatthew Dillon #define AR_PHY_FC_TURBO_SHORT       0x00000002  /* Set short symbols to turbo mode setting */
131*572ff6f6SMatthew Dillon #define AR_PHY_FC_DYN2040_EN        0x00000004      /* Enable dyn 20/40 mode */
132*572ff6f6SMatthew Dillon #define AR_PHY_FC_DYN2040_PRI_ONLY  0x00000008      /* dyn 20/40 - primary only */
133*572ff6f6SMatthew Dillon #define AR_PHY_FC_DYN2040_PRI_CH    0x00000010      /* dyn 20/40 - primary ch offset (0=+10MHz, 1=-10MHz)*/
134*572ff6f6SMatthew Dillon #define AR_PHY_FC_DYN2040_EXT_CH    0x00000020      /* dyn 20/40 - ext ch spacing (0=20MHz/ 1=25MHz) */
135*572ff6f6SMatthew Dillon #define AR_PHY_FC_HT_EN             0x00000040      /* ht enable */
136*572ff6f6SMatthew Dillon #define AR_PHY_FC_SHORT_GI_40       0x00000080      /* allow short GI for HT 40 */
137*572ff6f6SMatthew Dillon #define AR_PHY_FC_WALSH             0x00000100      /* walsh spatial spreading for 2 chains,2 streams TX */
138*572ff6f6SMatthew Dillon #define AR_PHY_FC_SINGLE_HT_LTF1    0x00000200      /* single length (4us) 1st HT long training symbol */
139*572ff6f6SMatthew Dillon #define	AR_PHY_FC_ENABLE_DAC_FIFO   0x00000800
140*572ff6f6SMatthew Dillon 
141*572ff6f6SMatthew Dillon #define AR_PHY_TIMING2      0x9810      /* Timing Control 2 */
142*572ff6f6SMatthew Dillon #define AR_PHY_TIMING2_USE_FORCE    0x00001000
143*572ff6f6SMatthew Dillon #define AR_PHY_TIMING2_FORCE_VAL    0x00000fff
144*572ff6f6SMatthew Dillon 
145*572ff6f6SMatthew Dillon #define	AR_PHY_TIMING_CTRL4_CHAIN(_i) \
146*572ff6f6SMatthew Dillon 	(AR_PHY_TIMING_CTRL4 + ((_i) << 12))
147*572ff6f6SMatthew Dillon #define	AR_PHY_TIMING_CTRL4_DO_CAL  0x10000	    /* perform calibration */
148*572ff6f6SMatthew Dillon #define AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF 0x01F   /* Mask for kcos_theta-1 for q correction */
149*572ff6f6SMatthew Dillon #define AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF_S   0   /* shift for Q_COFF */
150*572ff6f6SMatthew Dillon #define AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF 0x7E0   /* Mask for sin_theta for i correction */
151*572ff6f6SMatthew Dillon #define AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF_S   5   /* Shift for sin_theta for i correction */
152*572ff6f6SMatthew Dillon #define AR_PHY_TIMING_CTRL4_IQCORR_ENABLE   0x800   /* enable IQ correction */
153*572ff6f6SMatthew Dillon #define AR_PHY_TIMING_CTRL4_IQCAL_LOG_COUNT_MAX 0xF000  /* Mask for max number of samples (logarithmic) */
154*572ff6f6SMatthew Dillon #define AR_PHY_TIMING_CTRL4_IQCAL_LOG_COUNT_MAX_S   12  /* Shift for max number of samples */
155*572ff6f6SMatthew Dillon 
156*572ff6f6SMatthew Dillon #define AR_PHY_TIMING_CTRL4_ENABLE_SPUR_RSSI	0x80000000
157*572ff6f6SMatthew Dillon #define	AR_PHY_TIMING_CTRL4_ENABLE_SPUR_FILTER	0x40000000	/* Enable spur filter */
158*572ff6f6SMatthew Dillon #define	AR_PHY_TIMING_CTRL4_ENABLE_CHAN_MASK	0x20000000
159*572ff6f6SMatthew Dillon #define	AR_PHY_TIMING_CTRL4_ENABLE_PILOT_MASK	0x10000000
160*572ff6f6SMatthew Dillon 
161*572ff6f6SMatthew Dillon #define AR_PHY_ADC_SERIAL_CTL       0x9830
162*572ff6f6SMatthew Dillon #define AR_PHY_SEL_INTERNAL_ADDAC   0x00000000
163*572ff6f6SMatthew Dillon #define AR_PHY_SEL_EXTERNAL_RADIO   0x00000001
164*572ff6f6SMatthew Dillon 
165*572ff6f6SMatthew Dillon #define AR_PHY_GAIN_2GHZ_BSW_MARGIN	0x00003C00
166*572ff6f6SMatthew Dillon #define AR_PHY_GAIN_2GHZ_BSW_MARGIN_S	10
167*572ff6f6SMatthew Dillon #define AR_PHY_GAIN_2GHZ_BSW_ATTEN	0x0000001F
168*572ff6f6SMatthew Dillon #define AR_PHY_GAIN_2GHZ_BSW_ATTEN_S	0
169*572ff6f6SMatthew Dillon 
170*572ff6f6SMatthew Dillon #define AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN	    0x003E0000
171*572ff6f6SMatthew Dillon #define AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN_S   17
172*572ff6f6SMatthew Dillon #define AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN     0x0001F000
173*572ff6f6SMatthew Dillon #define AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN_S   12
174*572ff6f6SMatthew Dillon #define AR_PHY_GAIN_2GHZ_XATTEN2_DB         0x00000FC0
175*572ff6f6SMatthew Dillon #define AR_PHY_GAIN_2GHZ_XATTEN2_DB_S       6
176*572ff6f6SMatthew Dillon #define AR_PHY_GAIN_2GHZ_XATTEN1_DB         0x0000003F
177*572ff6f6SMatthew Dillon #define AR_PHY_GAIN_2GHZ_XATTEN1_DB_S       0
178*572ff6f6SMatthew Dillon 
179*572ff6f6SMatthew Dillon #define AR9280_PHY_RXGAIN_TXRX_ATTEN	0x00003F80
180*572ff6f6SMatthew Dillon #define AR9280_PHY_RXGAIN_TXRX_ATTEN_S	7
181*572ff6f6SMatthew Dillon #define AR9280_PHY_RXGAIN_TXRX_MARGIN	0x001FC000
182*572ff6f6SMatthew Dillon #define AR9280_PHY_RXGAIN_TXRX_MARGIN_S	14
183*572ff6f6SMatthew Dillon 
184*572ff6f6SMatthew Dillon #define	AR_PHY_SEARCH_START_DELAY	0x9918		/* search start delay */
185*572ff6f6SMatthew Dillon 
186*572ff6f6SMatthew Dillon #define AR_PHY_EXT_CCA          0x99bc
187*572ff6f6SMatthew Dillon #define AR_PHY_EXT_CCA_CYCPWR_THR1      0x0000FE00
188*572ff6f6SMatthew Dillon #define AR_PHY_EXT_CCA_CYCPWR_THR1_S    9
189*572ff6f6SMatthew Dillon #define AR_PHY_EXT_MINCCA_PWR   0xFF800000
190*572ff6f6SMatthew Dillon #define AR_PHY_EXT_MINCCA_PWR_S 23
191*572ff6f6SMatthew Dillon #define AR_PHY_EXT_CCA_THRESH62	0x007F0000
192*572ff6f6SMatthew Dillon #define AR_PHY_EXT_CCA_THRESH62_S	16
193*572ff6f6SMatthew Dillon 
194*572ff6f6SMatthew Dillon #define AR9280_PHY_EXT_MINCCA_PWR       0x01FF0000
195*572ff6f6SMatthew Dillon #define AR9280_PHY_EXT_MINCCA_PWR_S     16
196*572ff6f6SMatthew Dillon 
197*572ff6f6SMatthew Dillon #define AR_PHY_HALFGI           0x99D0      /* Timing control 3 */
198*572ff6f6SMatthew Dillon #define AR_PHY_HALFGI_DSC_MAN   0x0007FFF0
199*572ff6f6SMatthew Dillon #define AR_PHY_HALFGI_DSC_MAN_S 4
200*572ff6f6SMatthew Dillon #define AR_PHY_HALFGI_DSC_EXP   0x0000000F
201*572ff6f6SMatthew Dillon #define AR_PHY_HALFGI_DSC_EXP_S 0
202*572ff6f6SMatthew Dillon 
203*572ff6f6SMatthew Dillon #define AR_PHY_HEAVY_CLIP_ENABLE    0x99E0
204*572ff6f6SMatthew Dillon 
205*572ff6f6SMatthew Dillon #define AR_PHY_HEAVY_CLIP_FACTOR_RIFS	0x99ec
206*572ff6f6SMatthew Dillon #define AR_PHY_RIFS_INIT_DELAY		0x03ff0000
207*572ff6f6SMatthew Dillon 
208*572ff6f6SMatthew Dillon #define AR_PHY_M_SLEEP      0x99f0      /* sleep control registers */
209*572ff6f6SMatthew Dillon #define AR_PHY_REFCLKDLY    0x99f4
210*572ff6f6SMatthew Dillon #define AR_PHY_REFCLKPD     0x99f8
211*572ff6f6SMatthew Dillon 
212*572ff6f6SMatthew Dillon #define	AR_PHY_CALMODE		0x99f0
213*572ff6f6SMatthew Dillon /* Calibration Types */
214*572ff6f6SMatthew Dillon #define	AR_PHY_CALMODE_IQ		0x00000000
215*572ff6f6SMatthew Dillon #define	AR_PHY_CALMODE_ADC_GAIN		0x00000001
216*572ff6f6SMatthew Dillon #define	AR_PHY_CALMODE_ADC_DC_PER	0x00000002
217*572ff6f6SMatthew Dillon #define	AR_PHY_CALMODE_ADC_DC_INIT	0x00000003
218*572ff6f6SMatthew Dillon /* Calibration results */
219*572ff6f6SMatthew Dillon #define	AR_PHY_CAL_MEAS_0(_i)	(0x9c10 + ((_i) << 12))
220*572ff6f6SMatthew Dillon #define	AR_PHY_CAL_MEAS_1(_i)	(0x9c14 + ((_i) << 12))
221*572ff6f6SMatthew Dillon #define	AR_PHY_CAL_MEAS_2(_i)	(0x9c18 + ((_i) << 12))
222*572ff6f6SMatthew Dillon /* This is AR9130 and later */
223*572ff6f6SMatthew Dillon #define	AR_PHY_CAL_MEAS_3(_i)	(0x9c1c + ((_i) << 12))
224*572ff6f6SMatthew Dillon 
225*572ff6f6SMatthew Dillon /*
226*572ff6f6SMatthew Dillon  * AR5416 still uses AR_PHY(263) for current RSSI;
227*572ff6f6SMatthew Dillon  * AR9130 and later uses AR_PHY(271).
228*572ff6f6SMatthew Dillon  */
229*572ff6f6SMatthew Dillon #define	AR9130_PHY_CURRENT_RSSI	0x9c3c		/* rssi of current frame rx'd */
230*572ff6f6SMatthew Dillon 
231*572ff6f6SMatthew Dillon #define AR_PHY_CCA          0x9864
232*572ff6f6SMatthew Dillon #define AR_PHY_MINCCA_PWR   0x0FF80000
233*572ff6f6SMatthew Dillon #define AR_PHY_MINCCA_PWR_S 19
234*572ff6f6SMatthew Dillon #define AR9280_PHY_MINCCA_PWR       0x1FF00000
235*572ff6f6SMatthew Dillon #define AR9280_PHY_MINCCA_PWR_S     20
236*572ff6f6SMatthew Dillon #define AR9280_PHY_CCA_THRESH62     0x000FF000
237*572ff6f6SMatthew Dillon #define AR9280_PHY_CCA_THRESH62_S   12
238*572ff6f6SMatthew Dillon 
239*572ff6f6SMatthew Dillon #define AR_PHY_CH1_CCA          0xa864
240*572ff6f6SMatthew Dillon #define AR_PHY_CH1_MINCCA_PWR   0x0FF80000
241*572ff6f6SMatthew Dillon #define AR_PHY_CH1_MINCCA_PWR_S 19
242*572ff6f6SMatthew Dillon #define AR_PHY_CCA_THRESH62     0x0007F000
243*572ff6f6SMatthew Dillon #define AR_PHY_CCA_THRESH62_S   12
244*572ff6f6SMatthew Dillon #define AR9280_PHY_CH1_MINCCA_PWR   0x1FF00000
245*572ff6f6SMatthew Dillon #define AR9280_PHY_CH1_MINCCA_PWR_S 20
246*572ff6f6SMatthew Dillon 
247*572ff6f6SMatthew Dillon #define AR_PHY_CH2_CCA          0xb864
248*572ff6f6SMatthew Dillon #define AR_PHY_CH2_MINCCA_PWR   0x0FF80000
249*572ff6f6SMatthew Dillon #define AR_PHY_CH2_MINCCA_PWR_S 19
250*572ff6f6SMatthew Dillon 
251*572ff6f6SMatthew Dillon #define AR_PHY_CH1_EXT_CCA          0xa9bc
252*572ff6f6SMatthew Dillon #define AR_PHY_CH1_EXT_MINCCA_PWR   0xFF800000
253*572ff6f6SMatthew Dillon #define AR_PHY_CH1_EXT_MINCCA_PWR_S 23
254*572ff6f6SMatthew Dillon #define AR9280_PHY_CH1_EXT_MINCCA_PWR   0x01FF0000
255*572ff6f6SMatthew Dillon #define AR9280_PHY_CH1_EXT_MINCCA_PWR_S 16
256*572ff6f6SMatthew Dillon 
257*572ff6f6SMatthew Dillon #define AR_PHY_CH2_EXT_CCA          0xb9bc
258*572ff6f6SMatthew Dillon #define AR_PHY_CH2_EXT_MINCCA_PWR   0xFF800000
259*572ff6f6SMatthew Dillon #define AR_PHY_CH2_EXT_MINCCA_PWR_S 23
260*572ff6f6SMatthew Dillon 
261*572ff6f6SMatthew Dillon #define AR_PHY_RX_CHAINMASK     0x99a4
262*572ff6f6SMatthew Dillon 
263*572ff6f6SMatthew Dillon #define	AR_PHY_NEW_ADC_DC_GAIN_CORR(_i)	(0x99b4 + ((_i) << 12))
264*572ff6f6SMatthew Dillon #define	AR_PHY_NEW_ADC_GAIN_CORR_ENABLE	0x40000000
265*572ff6f6SMatthew Dillon #define	AR_PHY_NEW_ADC_DC_OFFSET_CORR_ENABLE	0x80000000
266*572ff6f6SMatthew Dillon #define	AR_PHY_MULTICHAIN_GAIN_CTL	0x99ac
267*572ff6f6SMatthew Dillon 
268*572ff6f6SMatthew Dillon #define	AR_PHY_EXT_CCA0			0x99b8
269*572ff6f6SMatthew Dillon #define	AR_PHY_EXT_CCA0_THRESH62	0x000000FF
270*572ff6f6SMatthew Dillon #define	AR_PHY_EXT_CCA0_THRESH62_S	0
271*572ff6f6SMatthew Dillon 
272*572ff6f6SMatthew Dillon #define AR_PHY_CH1_EXT_CCA          0xa9bc
273*572ff6f6SMatthew Dillon #define AR_PHY_CH1_EXT_MINCCA_PWR   0xFF800000
274*572ff6f6SMatthew Dillon #define AR_PHY_CH1_EXT_MINCCA_PWR_S 23
275*572ff6f6SMatthew Dillon 
276*572ff6f6SMatthew Dillon #define AR_PHY_CH2_EXT_CCA          0xb9bc
277*572ff6f6SMatthew Dillon #define AR_PHY_CH2_EXT_MINCCA_PWR   0xFF800000
278*572ff6f6SMatthew Dillon #define AR_PHY_CH2_EXT_MINCCA_PWR_S 23
279*572ff6f6SMatthew Dillon #define AR_PHY_ANALOG_SWAP      0xa268
280*572ff6f6SMatthew Dillon #define AR_PHY_SWAP_ALT_CHAIN   0x00000040
281*572ff6f6SMatthew Dillon #define AR_PHY_CAL_CHAINMASK	0xa39c
282*572ff6f6SMatthew Dillon 
283*572ff6f6SMatthew Dillon #define AR_PHY_SWITCH_CHAIN_0     0x9960
284*572ff6f6SMatthew Dillon #define AR_PHY_SWITCH_COM         0x9964
285*572ff6f6SMatthew Dillon 
286*572ff6f6SMatthew Dillon #define AR_PHY_RF_CTL2                  0x9824
287*572ff6f6SMatthew Dillon #define AR_PHY_TX_FRAME_TO_DATA_START	0x000000FF
288*572ff6f6SMatthew Dillon #define AR_PHY_TX_FRAME_TO_DATA_START_S	0
289*572ff6f6SMatthew Dillon #define AR_PHY_TX_FRAME_TO_PA_ON	0x0000FF00
290*572ff6f6SMatthew Dillon #define AR_PHY_TX_FRAME_TO_PA_ON_S	8
291*572ff6f6SMatthew Dillon 
292*572ff6f6SMatthew Dillon #define AR_PHY_RF_CTL3                  0x9828
293*572ff6f6SMatthew Dillon #define AR_PHY_TX_END_TO_A2_RX_ON       0x00FF0000
294*572ff6f6SMatthew Dillon #define AR_PHY_TX_END_TO_A2_RX_ON_S     16
295*572ff6f6SMatthew Dillon 
296*572ff6f6SMatthew Dillon #define AR_PHY_RF_CTL4                    0x9834
297*572ff6f6SMatthew Dillon #define AR_PHY_RF_CTL4_TX_END_XPAB_OFF    0xFF000000
298*572ff6f6SMatthew Dillon #define AR_PHY_RF_CTL4_TX_END_XPAB_OFF_S  24
299*572ff6f6SMatthew Dillon #define AR_PHY_RF_CTL4_TX_END_XPAA_OFF    0x00FF0000
300*572ff6f6SMatthew Dillon #define AR_PHY_RF_CTL4_TX_END_XPAA_OFF_S  16
301*572ff6f6SMatthew Dillon #define AR_PHY_RF_CTL4_FRAME_XPAB_ON      0x0000FF00
302*572ff6f6SMatthew Dillon #define AR_PHY_RF_CTL4_FRAME_XPAB_ON_S    8
303*572ff6f6SMatthew Dillon #define AR_PHY_RF_CTL4_FRAME_XPAA_ON      0x000000FF
304*572ff6f6SMatthew Dillon #define AR_PHY_RF_CTL4_FRAME_XPAA_ON_S    0
305*572ff6f6SMatthew Dillon 
306*572ff6f6SMatthew Dillon #define	AR_PHY_SYNTH_CONTROL	0x9874
307*572ff6f6SMatthew Dillon 
308*572ff6f6SMatthew Dillon #define	AR_PHY_FORCE_CLKEN_CCK	0xA22C
309*572ff6f6SMatthew Dillon #define	AR_PHY_FORCE_CLKEN_CCK_MRC_MUX	0x00000040
310*572ff6f6SMatthew Dillon 
311*572ff6f6SMatthew Dillon #define AR_PHY_POWER_TX_SUB     0xA3C8
312*572ff6f6SMatthew Dillon #define AR_PHY_POWER_TX_RATE5   0xA38C
313*572ff6f6SMatthew Dillon #define AR_PHY_POWER_TX_RATE6   0xA390
314*572ff6f6SMatthew Dillon #define AR_PHY_POWER_TX_RATE7   0xA3CC
315*572ff6f6SMatthew Dillon #define AR_PHY_POWER_TX_RATE8   0xA3D0
316*572ff6f6SMatthew Dillon #define AR_PHY_POWER_TX_RATE9   0xA3D4
317*572ff6f6SMatthew Dillon 
318*572ff6f6SMatthew Dillon #define	AR_PHY_TPCRG1_PD_GAIN_1 	0x00030000
319*572ff6f6SMatthew Dillon #define	AR_PHY_TPCRG1_PD_GAIN_1_S	16
320*572ff6f6SMatthew Dillon #define	AR_PHY_TPCRG1_PD_GAIN_2		0x000C0000
321*572ff6f6SMatthew Dillon #define	AR_PHY_TPCRG1_PD_GAIN_2_S	18
322*572ff6f6SMatthew Dillon #define	AR_PHY_TPCRG1_PD_GAIN_3		0x00300000
323*572ff6f6SMatthew Dillon #define	AR_PHY_TPCRG1_PD_GAIN_3_S	20
324*572ff6f6SMatthew Dillon 
325*572ff6f6SMatthew Dillon #define	AR_PHY_TPCRG1_PD_CAL_ENABLE	0x00400000
326*572ff6f6SMatthew Dillon #define	AR_PHY_TPCRG1_PD_CAL_ENABLE_S	22
327*572ff6f6SMatthew Dillon 
328*572ff6f6SMatthew Dillon #define AR_PHY_VIT_MASK2_M_46_61 0xa3a0
329*572ff6f6SMatthew Dillon #define AR_PHY_MASK2_M_31_45     0xa3a4
330*572ff6f6SMatthew Dillon #define AR_PHY_MASK2_M_16_30     0xa3a8
331*572ff6f6SMatthew Dillon #define AR_PHY_MASK2_M_00_15     0xa3ac
332*572ff6f6SMatthew Dillon #define AR_PHY_MASK2_P_15_01     0xa3b8
333*572ff6f6SMatthew Dillon #define AR_PHY_MASK2_P_30_16     0xa3bc
334*572ff6f6SMatthew Dillon #define AR_PHY_MASK2_P_45_31     0xa3c0
335*572ff6f6SMatthew Dillon #define AR_PHY_MASK2_P_61_45     0xa3c4
336*572ff6f6SMatthew Dillon 
337*572ff6f6SMatthew Dillon #define	AR_PHY_SPUR_REG         0x994c
338*572ff6f6SMatthew Dillon #define	AR_PHY_SFCORR_EXT	0x99c0
339*572ff6f6SMatthew Dillon #define	AR_PHY_SFCORR_EXT_M1_THRESH	0x0000007F
340*572ff6f6SMatthew Dillon #define	AR_PHY_SFCORR_EXT_M1_THRESH_S	0
341*572ff6f6SMatthew Dillon #define	AR_PHY_SFCORR_EXT_M2_THRESH	0x00003F80
342*572ff6f6SMatthew Dillon #define	AR_PHY_SFCORR_EXT_M2_THRESH_S	7
343*572ff6f6SMatthew Dillon #define	AR_PHY_SFCORR_EXT_M1_THRESH_LOW	0x001FC000
344*572ff6f6SMatthew Dillon #define	AR_PHY_SFCORR_EXT_M1_THRESH_LOW_S	14
345*572ff6f6SMatthew Dillon #define	AR_PHY_SFCORR_EXT_M2_THRESH_LOW	0x0FE00000
346*572ff6f6SMatthew Dillon #define	AR_PHY_SFCORR_EXT_M2_THRESH_LOW_S	21
347*572ff6f6SMatthew Dillon #define	AR_PHY_SFCORR_SPUR_SUBCHNL_SD_S	28
348*572ff6f6SMatthew Dillon 
349*572ff6f6SMatthew Dillon /* enable vit puncture per rate, 8 bits, lsb is low rate */
350*572ff6f6SMatthew Dillon #define AR_PHY_SPUR_REG_MASK_RATE_CNTL       (0xFF << 18)
351*572ff6f6SMatthew Dillon #define AR_PHY_SPUR_REG_MASK_RATE_CNTL_S     18
352*572ff6f6SMatthew Dillon 
353*572ff6f6SMatthew Dillon #define AR_PHY_SPUR_REG_ENABLE_MASK_PPM      0x20000     /* bins move with freq offset */
354*572ff6f6SMatthew Dillon #define AR_PHY_SPUR_REG_MASK_RATE_SELECT     (0xFF << 9) /* use mask1 or mask2, one per rate */
355*572ff6f6SMatthew Dillon #define AR_PHY_SPUR_REG_MASK_RATE_SELECT_S   9
356*572ff6f6SMatthew Dillon #define AR_PHY_SPUR_REG_ENABLE_VIT_SPUR_RSSI 0x100
357*572ff6f6SMatthew Dillon #define AR_PHY_SPUR_REG_SPUR_RSSI_THRESH     0x7F
358*572ff6f6SMatthew Dillon #define AR_PHY_SPUR_REG_SPUR_RSSI_THRESH_S   0
359*572ff6f6SMatthew Dillon 
360*572ff6f6SMatthew Dillon #define AR_PHY_PILOT_MASK_01_30   0xa3b0
361*572ff6f6SMatthew Dillon #define AR_PHY_PILOT_MASK_31_60   0xa3b4
362*572ff6f6SMatthew Dillon 
363*572ff6f6SMatthew Dillon #define AR_PHY_CHANNEL_MASK_01_30 0x99d4
364*572ff6f6SMatthew Dillon #define AR_PHY_CHANNEL_MASK_31_60 0x99d8
365*572ff6f6SMatthew Dillon 
366*572ff6f6SMatthew Dillon #define	AR_PHY_CL_CAL_CTL	0xA358		/* carrier leak cal control */
367*572ff6f6SMatthew Dillon #define	AR_PHY_CL_CAL_ENABLE	0x00000002
368*572ff6f6SMatthew Dillon #define	AR_PHY_PARALLEL_CAL_ENABLE	0x00000001
369*572ff6f6SMatthew Dillon 
370*572ff6f6SMatthew Dillon /* empirically determined "good" CCA value ranges from atheros */
371*572ff6f6SMatthew Dillon #define	AR_PHY_CCA_NOM_VAL_5416_2GHZ		-90
372*572ff6f6SMatthew Dillon #define	AR_PHY_CCA_NOM_VAL_5416_5GHZ		-100
373*572ff6f6SMatthew Dillon #define	AR_PHY_CCA_MIN_GOOD_VAL_5416_2GHZ	-100
374*572ff6f6SMatthew Dillon #define	AR_PHY_CCA_MIN_GOOD_VAL_5416_5GHZ	-110
375*572ff6f6SMatthew Dillon #define	AR_PHY_CCA_MAX_GOOD_VAL_5416_2GHZ	-80
376*572ff6f6SMatthew Dillon #define	AR_PHY_CCA_MAX_GOOD_VAL_5416_5GHZ	-90
377*572ff6f6SMatthew Dillon 
378*572ff6f6SMatthew Dillon /* ar9280 specific? */
379*572ff6f6SMatthew Dillon #define	AR_PHY_XPA_CFG		0xA3D8
380*572ff6f6SMatthew Dillon #define	AR_PHY_FORCE_XPA_CFG	0x000000001
381*572ff6f6SMatthew Dillon #define	AR_PHY_FORCE_XPA_CFG_S	0
382*572ff6f6SMatthew Dillon 
383*572ff6f6SMatthew Dillon #define	AR_PHY_CCK_TX_CTRL_TX_DAC_SCALE_CCK	0x0000000C
384*572ff6f6SMatthew Dillon #define	AR_PHY_CCK_TX_CTRL_TX_DAC_SCALE_CCK_S	2
385*572ff6f6SMatthew Dillon 
386*572ff6f6SMatthew Dillon #define	AR_PHY_TX_PWRCTRL9			0xa27C
387*572ff6f6SMatthew Dillon #define	AR_PHY_TX_DESIRED_SCALE_CCK		0x00007C00
388*572ff6f6SMatthew Dillon #define	AR_PHY_TX_DESIRED_SCALE_CCK_S		10
389*572ff6f6SMatthew Dillon #define	AR_PHY_TX_PWRCTRL9_RES_DC_REMOVAL	0x80000000
390*572ff6f6SMatthew Dillon #define	AR_PHY_TX_PWRCTRL9_RES_DC_REMOVAL_S	31
391*572ff6f6SMatthew Dillon 
392*572ff6f6SMatthew Dillon #define	AR_PHY_MODE_ASYNCFIFO			0x80	/* Enable async fifo */
393*572ff6f6SMatthew Dillon 
394*572ff6f6SMatthew Dillon #endif /* _DEV_ATH_AR5416PHY_H_ */
395