xref: /openbmc/linux/drivers/net/wireless/ath/ath9k/ar9003_phy.h (revision 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e)
1da6f1d7fSFelix Fietkau /*
25b68138eSSujith Manoharan  * Copyright (c) 2010-2011 Atheros Communications, Inc.
3da6f1d7fSFelix Fietkau  *
4da6f1d7fSFelix Fietkau  * Permission to use, copy, modify, and/or distribute this software for any
5da6f1d7fSFelix Fietkau  * purpose with or without fee is hereby granted, provided that the above
6da6f1d7fSFelix Fietkau  * copyright notice and this permission notice appear in all copies.
7da6f1d7fSFelix Fietkau  *
8da6f1d7fSFelix Fietkau  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9da6f1d7fSFelix Fietkau  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10da6f1d7fSFelix Fietkau  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11da6f1d7fSFelix Fietkau  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12da6f1d7fSFelix Fietkau  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13da6f1d7fSFelix Fietkau  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14da6f1d7fSFelix Fietkau  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15da6f1d7fSFelix Fietkau  */
16da6f1d7fSFelix Fietkau 
17da6f1d7fSFelix Fietkau #ifndef AR9003_PHY_H
18da6f1d7fSFelix Fietkau #define AR9003_PHY_H
19da6f1d7fSFelix Fietkau 
20da6f1d7fSFelix Fietkau /*
21da6f1d7fSFelix Fietkau  * Channel Register Map
22da6f1d7fSFelix Fietkau  */
23da6f1d7fSFelix Fietkau #define AR_CHAN_BASE	0x9800
24da6f1d7fSFelix Fietkau 
25da6f1d7fSFelix Fietkau #define AR_PHY_TIMING1      (AR_CHAN_BASE + 0x0)
26da6f1d7fSFelix Fietkau #define AR_PHY_TIMING2      (AR_CHAN_BASE + 0x4)
27da6f1d7fSFelix Fietkau #define AR_PHY_TIMING3      (AR_CHAN_BASE + 0x8)
28da6f1d7fSFelix Fietkau #define AR_PHY_TIMING4      (AR_CHAN_BASE + 0xc)
29da6f1d7fSFelix Fietkau #define AR_PHY_TIMING5      (AR_CHAN_BASE + 0x10)
30da6f1d7fSFelix Fietkau #define AR_PHY_TIMING6      (AR_CHAN_BASE + 0x14)
31da6f1d7fSFelix Fietkau #define AR_PHY_TIMING11     (AR_CHAN_BASE + 0x18)
32da6f1d7fSFelix Fietkau #define AR_PHY_SPUR_REG     (AR_CHAN_BASE + 0x1c)
33da6f1d7fSFelix Fietkau #define AR_PHY_RX_IQCAL_CORR_B0    (AR_CHAN_BASE + 0xdc)
34da6f1d7fSFelix Fietkau #define AR_PHY_TX_IQCAL_CONTROL_3  (AR_CHAN_BASE + 0xb0)
35b55f6bb7SBala Shanmugam #define AR_PHY_TIMING_CONTROL4_DO_GAIN_DC_IQ_CAL_SHIFT 16
36da6f1d7fSFelix Fietkau 
371547da37SLuis R. Rodriguez #define AR_PHY_TIMING11_SPUR_FREQ_SD    0x3FF00000
381547da37SLuis R. Rodriguez #define AR_PHY_TIMING11_SPUR_FREQ_SD_S  20
391547da37SLuis R. Rodriguez 
401547da37SLuis R. Rodriguez #define AR_PHY_TIMING11_SPUR_DELTA_PHASE 0x000FFFFF
411547da37SLuis R. Rodriguez #define AR_PHY_TIMING11_SPUR_DELTA_PHASE_S 0
421547da37SLuis R. Rodriguez 
431547da37SLuis R. Rodriguez #define AR_PHY_TIMING11_USE_SPUR_FILTER_IN_AGC 0x40000000
441547da37SLuis R. Rodriguez #define AR_PHY_TIMING11_USE_SPUR_FILTER_IN_AGC_S 30
451547da37SLuis R. Rodriguez 
461547da37SLuis R. Rodriguez #define AR_PHY_TIMING11_USE_SPUR_FILTER_IN_SELFCOR 0x80000000
471547da37SLuis R. Rodriguez #define AR_PHY_TIMING11_USE_SPUR_FILTER_IN_SELFCOR_S 31
481547da37SLuis R. Rodriguez 
491547da37SLuis R. Rodriguez #define AR_PHY_SPUR_REG_ENABLE_NF_RSSI_SPUR_MIT         0x4000000
501547da37SLuis R. Rodriguez #define AR_PHY_SPUR_REG_ENABLE_NF_RSSI_SPUR_MIT_S       26
511547da37SLuis R. Rodriguez 
521547da37SLuis R. Rodriguez #define AR_PHY_SPUR_REG_ENABLE_MASK_PPM                         0x20000     /* bins move with freq offset */
531547da37SLuis R. Rodriguez #define AR_PHY_SPUR_REG_ENABLE_MASK_PPM_S                       17
541547da37SLuis R. Rodriguez #define AR_PHY_SPUR_REG_SPUR_RSSI_THRESH            0x000000FF
551547da37SLuis R. Rodriguez #define AR_PHY_SPUR_REG_SPUR_RSSI_THRESH_S          0
561547da37SLuis R. Rodriguez #define AR_PHY_SPUR_REG_EN_VIT_SPUR_RSSI                        0x00000100
571547da37SLuis R. Rodriguez #define AR_PHY_SPUR_REG_EN_VIT_SPUR_RSSI_S                      8
581547da37SLuis R. Rodriguez #define AR_PHY_SPUR_REG_MASK_RATE_CNTL                          0x03FC0000
591547da37SLuis R. Rodriguez #define AR_PHY_SPUR_REG_MASK_RATE_CNTL_S			18
601547da37SLuis R. Rodriguez 
61da6f1d7fSFelix Fietkau #define AR_PHY_RX_IQCAL_CORR_B0_LOOPBACK_IQCORR_EN   0x20000000
62da6f1d7fSFelix Fietkau #define AR_PHY_RX_IQCAL_CORR_B0_LOOPBACK_IQCORR_EN_S         29
63da6f1d7fSFelix Fietkau 
64da6f1d7fSFelix Fietkau #define AR_PHY_TX_IQCAL_CONTROL_3_IQCORR_EN   0x80000000
65da6f1d7fSFelix Fietkau #define AR_PHY_TX_IQCAL_CONTROL_3_IQCORR_EN_S         31
66da6f1d7fSFelix Fietkau 
67da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG_LOW  (AR_CHAN_BASE + 0x20)
68da6f1d7fSFelix Fietkau 
69da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR           (AR_CHAN_BASE + 0x24)
70da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_LOW       (AR_CHAN_BASE + 0x28)
71da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_EXT       (AR_CHAN_BASE + 0x2c)
72da6f1d7fSFelix Fietkau 
73da6f1d7fSFelix Fietkau #define AR_PHY_EXT_CCA              (AR_CHAN_BASE + 0x30)
74da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_0              (AR_CHAN_BASE + 0x34)
75da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_1              (AR_CHAN_BASE + 0x38)
76da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_EXT            (AR_CHAN_BASE + 0x3c)
77da6f1d7fSFelix Fietkau #define AR_PHY_MULTICHAIN_CTRL      (AR_CHAN_BASE + 0x80)
78da6f1d7fSFelix Fietkau #define AR_PHY_PERCHAIN_CSD         (AR_CHAN_BASE + 0x84)
79da6f1d7fSFelix Fietkau 
80da6f1d7fSFelix Fietkau #define AR_PHY_TX_PHASE_RAMP_0      (AR_CHAN_BASE + 0xd0)
81da6f1d7fSFelix Fietkau #define AR_PHY_ADC_GAIN_DC_CORR_0   (AR_CHAN_BASE + 0xd4)
82da6f1d7fSFelix Fietkau #define AR_PHY_IQ_ADC_MEAS_0_B0     (AR_CHAN_BASE + 0xc0)
83da6f1d7fSFelix Fietkau #define AR_PHY_IQ_ADC_MEAS_1_B0     (AR_CHAN_BASE + 0xc4)
84da6f1d7fSFelix Fietkau #define AR_PHY_IQ_ADC_MEAS_2_B0     (AR_CHAN_BASE + 0xc8)
85da6f1d7fSFelix Fietkau #define AR_PHY_IQ_ADC_MEAS_3_B0     (AR_CHAN_BASE + 0xcc)
86da6f1d7fSFelix Fietkau 
87da6f1d7fSFelix Fietkau /* The following registers changed position from AR9300 1.0 to AR9300 2.0 */
88da6f1d7fSFelix Fietkau #define AR_PHY_TX_PHASE_RAMP_0_9300_10      (AR_CHAN_BASE + 0xd0 - 0x10)
89da6f1d7fSFelix Fietkau #define AR_PHY_ADC_GAIN_DC_CORR_0_9300_10   (AR_CHAN_BASE + 0xd4 - 0x10)
90da6f1d7fSFelix Fietkau #define AR_PHY_IQ_ADC_MEAS_0_B0_9300_10     (AR_CHAN_BASE + 0xc0 + 0x8)
91da6f1d7fSFelix Fietkau #define AR_PHY_IQ_ADC_MEAS_1_B0_9300_10     (AR_CHAN_BASE + 0xc4 + 0x8)
92da6f1d7fSFelix Fietkau #define AR_PHY_IQ_ADC_MEAS_2_B0_9300_10     (AR_CHAN_BASE + 0xc8 + 0x8)
93da6f1d7fSFelix Fietkau #define AR_PHY_IQ_ADC_MEAS_3_B0_9300_10     (AR_CHAN_BASE + 0xcc + 0x8)
94da6f1d7fSFelix Fietkau 
95da6f1d7fSFelix Fietkau #define AR_PHY_TX_CRC               (AR_CHAN_BASE + 0xa0)
96da6f1d7fSFelix Fietkau #define AR_PHY_TST_DAC_CONST        (AR_CHAN_BASE + 0xa4)
97da6f1d7fSFelix Fietkau #define AR_PHY_SPUR_REPORT_0        (AR_CHAN_BASE + 0xa8)
98da6f1d7fSFelix Fietkau #define AR_PHY_CHAN_INFO_TAB_0      (AR_CHAN_BASE + 0x300)
99da6f1d7fSFelix Fietkau 
100da6f1d7fSFelix Fietkau /*
101da6f1d7fSFelix Fietkau  * Channel Field Definitions
102da6f1d7fSFelix Fietkau  */
103da6f1d7fSFelix Fietkau #define AR_PHY_TIMING2_USE_FORCE_PPM    0x00001000
104da6f1d7fSFelix Fietkau #define AR_PHY_TIMING2_FORCE_PPM_VAL    0x00000fff
105da6f1d7fSFelix Fietkau #define AR_PHY_TIMING3_DSC_MAN      0xFFFE0000
106da6f1d7fSFelix Fietkau #define AR_PHY_TIMING3_DSC_MAN_S    17
107da6f1d7fSFelix Fietkau #define AR_PHY_TIMING3_DSC_EXP      0x0001E000
108da6f1d7fSFelix Fietkau #define AR_PHY_TIMING3_DSC_EXP_S    13
109da6f1d7fSFelix Fietkau #define AR_PHY_TIMING4_IQCAL_LOG_COUNT_MAX 0xF000
110da6f1d7fSFelix Fietkau #define AR_PHY_TIMING4_IQCAL_LOG_COUNT_MAX_S   12
111da6f1d7fSFelix Fietkau #define AR_PHY_TIMING4_DO_CAL    0x10000
1121547da37SLuis R. Rodriguez 
1131547da37SLuis R. Rodriguez #define AR_PHY_TIMING4_ENABLE_PILOT_MASK        0x10000000
1141547da37SLuis R. Rodriguez #define AR_PHY_TIMING4_ENABLE_PILOT_MASK_S      28
1151547da37SLuis R. Rodriguez #define AR_PHY_TIMING4_ENABLE_CHAN_MASK         0x20000000
1161547da37SLuis R. Rodriguez #define AR_PHY_TIMING4_ENABLE_CHAN_MASK_S       29
1171547da37SLuis R. Rodriguez 
1181547da37SLuis R. Rodriguez #define AR_PHY_TIMING4_ENABLE_SPUR_FILTER 0x40000000
1191547da37SLuis R. Rodriguez #define AR_PHY_TIMING4_ENABLE_SPUR_FILTER_S 30
1201547da37SLuis R. Rodriguez #define AR_PHY_TIMING4_ENABLE_SPUR_RSSI 0x80000000
1211547da37SLuis R. Rodriguez #define AR_PHY_TIMING4_ENABLE_SPUR_RSSI_S 31
1221547da37SLuis R. Rodriguez 
123da6f1d7fSFelix Fietkau #define AR_PHY_NEW_ADC_GAIN_CORR_ENABLE 0x40000000
124da6f1d7fSFelix Fietkau #define AR_PHY_NEW_ADC_DC_OFFSET_CORR_ENABLE 0x80000000
125da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW  0x00000001
126da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW    0x00003F00
127da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW_S  8
128da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_LOW_M1_THRESH_LOW      0x001FC000
129da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_LOW_M1_THRESH_LOW_S    14
130da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_LOW_M2_THRESH_LOW      0x0FE00000
131da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_LOW_M2_THRESH_LOW_S    21
132da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_M2COUNT_THR    0x0000001F
133da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_M2COUNT_THR_S  0
134da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_M1_THRESH      0x00FE0000
135da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_M1_THRESH_S    17
136da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_M2_THRESH      0x7F000000
137da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_M2_THRESH_S    24
138da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_EXT_M1_THRESH       0x0000007F
139da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_EXT_M1_THRESH_S     0
140da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_EXT_M2_THRESH       0x00003F80
141da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_EXT_M2_THRESH_S     7
142da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_EXT_M1_THRESH_LOW   0x001FC000
143da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_EXT_M1_THRESH_LOW_S 14
144da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_EXT_M2_THRESH_LOW   0x0FE00000
145da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_EXT_M2_THRESH_LOW_S 21
1461547da37SLuis R. Rodriguez #define AR_PHY_SFCORR_EXT_SPUR_SUBCHANNEL_SD 0x10000000
1471547da37SLuis R. Rodriguez #define AR_PHY_SFCORR_EXT_SPUR_SUBCHANNEL_SD_S 28
148da6f1d7fSFelix Fietkau #define AR_PHY_SFCORR_SPUR_SUBCHNL_SD_S   28
149da6f1d7fSFelix Fietkau #define AR_PHY_EXT_CCA_THRESH62 0x007F0000
150da6f1d7fSFelix Fietkau #define AR_PHY_EXT_CCA_THRESH62_S       16
151e083a42eSSujith Manoharan #define AR_PHY_EXTCHN_PWRTHR1_ANT_DIV_ALT_ANT_MINGAINIDX    0x0000FF00
152e083a42eSSujith Manoharan #define AR_PHY_EXTCHN_PWRTHR1_ANT_DIV_ALT_ANT_MINGAINIDX_S  8
153da6f1d7fSFelix Fietkau #define AR_PHY_EXT_MINCCA_PWR   0x01FF0000
154da6f1d7fSFelix Fietkau #define AR_PHY_EXT_MINCCA_PWR_S 16
1557ca710d5SLuis R. Rodriguez #define AR_PHY_EXT_CYCPWR_THR1 0x0000FE00L
1567ca710d5SLuis R. Rodriguez #define AR_PHY_EXT_CYCPWR_THR1_S 9
157da6f1d7fSFelix Fietkau #define AR_PHY_TIMING5_CYCPWR_THR1  0x000000FE
158da6f1d7fSFelix Fietkau #define AR_PHY_TIMING5_CYCPWR_THR1_S    1
159da6f1d7fSFelix Fietkau #define AR_PHY_TIMING5_CYCPWR_THR1_ENABLE  0x00000001
160da6f1d7fSFelix Fietkau #define AR_PHY_TIMING5_CYCPWR_THR1_ENABLE_S    0
161da6f1d7fSFelix Fietkau #define AR_PHY_TIMING5_CYCPWR_THR1A  0x007F0000
162da6f1d7fSFelix Fietkau #define AR_PHY_TIMING5_CYCPWR_THR1A_S    16
163da6f1d7fSFelix Fietkau #define AR_PHY_TIMING5_RSSI_THR1A     (0x7F << 16)
164da6f1d7fSFelix Fietkau #define AR_PHY_TIMING5_RSSI_THR1A_S   16
165da6f1d7fSFelix Fietkau #define AR_PHY_TIMING5_RSSI_THR1A_ENA (0x1 << 15)
166da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_0_ENA  0x00000001
167da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_0_FFT_ENA  0x80000000
168da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_0_INBAND   0x0000003e
169da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_0_INBAND_S 1
170da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_0_PRSSI    0x00000FC0
171da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_0_PRSSI_S  6
172da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_0_HEIGHT   0x0003F000
173da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_0_HEIGHT_S 12
174da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_0_RRSSI    0x00FC0000
175da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_0_RRSSI_S  18
176da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_0_FIRPWR   0x7F000000
177da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_0_FIRPWR_S 24
178da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_1_RELPWR_ENA       0x00800000
179da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_1_USE_FIR128       0x00400000
180da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_1_RELPWR_THRESH    0x003F0000
181da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_1_RELPWR_THRESH_S  16
182da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_1_BLOCK_CHECK      0x00008000
183da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_1_MAX_RRSSI        0x00004000
184da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_1_RELSTEP_CHECK    0x00002000
185da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_1_RELSTEP_THRESH   0x00001F00
186da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_1_RELSTEP_THRESH_S 8
187da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_1_MAXLEN           0x000000FF
188da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_1_MAXLEN_S         0
189da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_EXT_ENA            0x00004000
190da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_DC_PWR_THRESH      0x007f8000
191da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_DC_PWR_THRESH_S    15
192da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_LB_DC_CAP          0x7f800000
193da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_LB_DC_CAP_S        23
194da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG_LOW_FIRSTEP_LOW (0x3f << 6)
195da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG_LOW_FIRSTEP_LOW_S   6
196da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG_LOW_FIRPWR      (0x7f << 12)
197da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG_LOW_FIRPWR_S    12
198da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG_LOW_FIRPWR_SIGN_BIT 19
199da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG_LOW_RELSTEP     0x1f
200da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG_LOW_RELSTEP_S   0
201da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG_LOW_RELSTEP_SIGN_BIT 5
202da6f1d7fSFelix Fietkau #define AR_PHY_CHAN_INFO_TAB_S2_READ    0x00000008
203da6f1d7fSFelix Fietkau #define AR_PHY_CHAN_INFO_TAB_S2_READ_S           3
204da6f1d7fSFelix Fietkau #define AR_PHY_RX_IQCAL_CORR_IQCORR_Q_Q_COFF 0x0000007F
205da6f1d7fSFelix Fietkau #define AR_PHY_RX_IQCAL_CORR_IQCORR_Q_Q_COFF_S   0
206da6f1d7fSFelix Fietkau #define AR_PHY_RX_IQCAL_CORR_IQCORR_Q_I_COFF 0x00003F80
207da6f1d7fSFelix Fietkau #define AR_PHY_RX_IQCAL_CORR_IQCORR_Q_I_COFF_S   7
208da6f1d7fSFelix Fietkau #define AR_PHY_RX_IQCAL_CORR_IQCORR_ENABLE   0x00004000
209da6f1d7fSFelix Fietkau #define AR_PHY_RX_IQCAL_CORR_LOOPBACK_IQCORR_Q_Q_COFF   0x003f8000
210da6f1d7fSFelix Fietkau #define AR_PHY_RX_IQCAL_CORR_LOOPBACK_IQCORR_Q_Q_COFF_S 15
211da6f1d7fSFelix Fietkau #define AR_PHY_RX_IQCAL_CORR_LOOPBACK_IQCORR_Q_I_COFF   0x1fc00000
212da6f1d7fSFelix Fietkau #define AR_PHY_RX_IQCAL_CORR_LOOPBACK_IQCORR_Q_I_COFF_S 22
213da6f1d7fSFelix Fietkau 
214da6f1d7fSFelix Fietkau /*
215da6f1d7fSFelix Fietkau  * MRC Register Map
216da6f1d7fSFelix Fietkau  */
217da6f1d7fSFelix Fietkau #define AR_MRC_BASE	0x9c00
218da6f1d7fSFelix Fietkau 
219da6f1d7fSFelix Fietkau #define AR_PHY_TIMING_3A       (AR_MRC_BASE + 0x0)
220da6f1d7fSFelix Fietkau #define AR_PHY_LDPC_CNTL1      (AR_MRC_BASE + 0x4)
221da6f1d7fSFelix Fietkau #define AR_PHY_LDPC_CNTL2      (AR_MRC_BASE + 0x8)
222da6f1d7fSFelix Fietkau #define AR_PHY_PILOT_SPUR_MASK (AR_MRC_BASE + 0xc)
223da6f1d7fSFelix Fietkau #define AR_PHY_CHAN_SPUR_MASK  (AR_MRC_BASE + 0x10)
224da6f1d7fSFelix Fietkau #define AR_PHY_SGI_DELTA       (AR_MRC_BASE + 0x14)
225da6f1d7fSFelix Fietkau #define AR_PHY_ML_CNTL_1       (AR_MRC_BASE + 0x18)
226da6f1d7fSFelix Fietkau #define AR_PHY_ML_CNTL_2       (AR_MRC_BASE + 0x1c)
227da6f1d7fSFelix Fietkau #define AR_PHY_TST_ADC         (AR_MRC_BASE + 0x20)
228da6f1d7fSFelix Fietkau 
2291547da37SLuis R. Rodriguez #define AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_A      0x00000FE0
2301547da37SLuis R. Rodriguez #define AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_A_S    5
2311547da37SLuis R. Rodriguez #define AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_A          0x1F
2321547da37SLuis R. Rodriguez #define AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_A_S        0
233d43d04a9SSujith Manoharan #define AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_B      0x00FE0000
234d43d04a9SSujith Manoharan #define AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_B_S    17
235d43d04a9SSujith Manoharan #define AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_B          0x0001F000
236d43d04a9SSujith Manoharan #define AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_B_S        12
2371547da37SLuis R. Rodriguez 
2381547da37SLuis R. Rodriguez #define AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_A        0x00000FE0
2391547da37SLuis R. Rodriguez #define AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_A_S      5
2401547da37SLuis R. Rodriguez #define AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_A            0x1F
2411547da37SLuis R. Rodriguez #define AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_A_S		0
242d43d04a9SSujith Manoharan #define AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_B	0x00FE0000
243d43d04a9SSujith Manoharan #define AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_B_S	17
244d43d04a9SSujith Manoharan #define AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_B		0x0001F000
245d43d04a9SSujith Manoharan #define AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_B_S		12
246d43d04a9SSujith Manoharan 
2471547da37SLuis R. Rodriguez 
248da6f1d7fSFelix Fietkau /*
249da6f1d7fSFelix Fietkau  * MRC Feild Definitions
250da6f1d7fSFelix Fietkau  */
251da6f1d7fSFelix Fietkau #define AR_PHY_SGI_DSC_MAN   0x0007FFF0
252da6f1d7fSFelix Fietkau #define AR_PHY_SGI_DSC_MAN_S 4
253da6f1d7fSFelix Fietkau #define AR_PHY_SGI_DSC_EXP   0x0000000F
254da6f1d7fSFelix Fietkau #define AR_PHY_SGI_DSC_EXP_S 0
255da6f1d7fSFelix Fietkau /*
256da6f1d7fSFelix Fietkau  * BBB Register Map
257da6f1d7fSFelix Fietkau  */
258da6f1d7fSFelix Fietkau #define AR_BBB_BASE	0x9d00
259da6f1d7fSFelix Fietkau 
260da6f1d7fSFelix Fietkau /*
261da6f1d7fSFelix Fietkau  * AGC Register Map
262da6f1d7fSFelix Fietkau  */
263da6f1d7fSFelix Fietkau #define AR_AGC_BASE	0x9e00
264da6f1d7fSFelix Fietkau 
265da6f1d7fSFelix Fietkau #define AR_PHY_SETTLING         (AR_AGC_BASE + 0x0)
266da6f1d7fSFelix Fietkau #define AR_PHY_FORCEMAX_GAINS_0 (AR_AGC_BASE + 0x4)
267da6f1d7fSFelix Fietkau #define AR_PHY_GAINS_MINOFF0    (AR_AGC_BASE + 0x8)
268da6f1d7fSFelix Fietkau #define AR_PHY_DESIRED_SZ       (AR_AGC_BASE + 0xc)
269da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG         (AR_AGC_BASE + 0x10)
270da6f1d7fSFelix Fietkau #define AR_PHY_AGC              (AR_AGC_BASE + 0x14)
271da6f1d7fSFelix Fietkau #define AR_PHY_EXT_ATTEN_CTL_0  (AR_AGC_BASE + 0x18)
272da6f1d7fSFelix Fietkau #define AR_PHY_CCA_0            (AR_AGC_BASE + 0x1c)
2733533bf6bSSujith Manoharan #define AR_PHY_CCA_CTRL_0       (AR_AGC_BASE + 0x20)
274da6f1d7fSFelix Fietkau #define AR_PHY_RESTART          (AR_AGC_BASE + 0x24)
27547e84dfbSVasanthakumar Thiagarajan 
276c6ba9febSMohammed Shafi Shajakhan /*
277c6ba9febSMohammed Shafi Shajakhan  * Antenna Diversity  settings
278c6ba9febSMohammed Shafi Shajakhan  */
279da6f1d7fSFelix Fietkau #define AR_PHY_MC_GAIN_CTRL     (AR_AGC_BASE + 0x28)
28047e84dfbSVasanthakumar Thiagarajan #define AR_ANT_DIV_CTRL_ALL	0x7e000000
28147e84dfbSVasanthakumar Thiagarajan #define AR_ANT_DIV_CTRL_ALL_S	25
28247e84dfbSVasanthakumar Thiagarajan #define AR_ANT_DIV_ENABLE	0x1000000
28347e84dfbSVasanthakumar Thiagarajan #define AR_ANT_DIV_ENABLE_S	24
28447e84dfbSVasanthakumar Thiagarajan 
285c6ba9febSMohammed Shafi Shajakhan 
2869aa49ea3SSujith Manoharan #define AR_PHY_ANT_FAST_DIV_BIAS                0x00007e00
2879aa49ea3SSujith Manoharan #define AR_PHY_ANT_FAST_DIV_BIAS_S              9
288362cd03fSSujith Manoharan #define AR_PHY_ANT_SW_RX_PROT                   0x00800000
289362cd03fSSujith Manoharan #define AR_PHY_ANT_SW_RX_PROT_S                 23
2909aa49ea3SSujith Manoharan #define AR_PHY_ANT_DIV_LNADIV                   0x01000000
2919aa49ea3SSujith Manoharan #define AR_PHY_ANT_DIV_LNADIV_S                 24
2929aa49ea3SSujith Manoharan #define AR_PHY_ANT_DIV_ALT_LNACONF              0x06000000
2939aa49ea3SSujith Manoharan #define AR_PHY_ANT_DIV_ALT_LNACONF_S            25
2949aa49ea3SSujith Manoharan #define AR_PHY_ANT_DIV_MAIN_LNACONF             0x18000000
2959aa49ea3SSujith Manoharan #define AR_PHY_ANT_DIV_MAIN_LNACONF_S           27
2969aa49ea3SSujith Manoharan #define AR_PHY_ANT_DIV_ALT_GAINTB               0x20000000
2979aa49ea3SSujith Manoharan #define AR_PHY_ANT_DIV_ALT_GAINTB_S             29
2989aa49ea3SSujith Manoharan #define AR_PHY_ANT_DIV_MAIN_GAINTB              0x40000000
2999aa49ea3SSujith Manoharan #define AR_PHY_ANT_DIV_MAIN_GAINTB_S            30
300c6ba9febSMohammed Shafi Shajakhan 
301da6f1d7fSFelix Fietkau #define AR_PHY_EXTCHN_PWRTHR1   (AR_AGC_BASE + 0x2c)
302da6f1d7fSFelix Fietkau #define AR_PHY_EXT_CHN_WIN      (AR_AGC_BASE + 0x30)
303da6f1d7fSFelix Fietkau #define AR_PHY_20_40_DET_THR    (AR_AGC_BASE + 0x34)
304da6f1d7fSFelix Fietkau #define AR_PHY_RIFS_SRCH        (AR_AGC_BASE + 0x38)
305da6f1d7fSFelix Fietkau #define AR_PHY_PEAK_DET_CTRL_1  (AR_AGC_BASE + 0x3c)
306da6f1d7fSFelix Fietkau #define AR_PHY_PEAK_DET_CTRL_2  (AR_AGC_BASE + 0x40)
307da6f1d7fSFelix Fietkau #define AR_PHY_RX_GAIN_BOUNDS_1 (AR_AGC_BASE + 0x44)
308da6f1d7fSFelix Fietkau #define AR_PHY_RX_GAIN_BOUNDS_2 (AR_AGC_BASE + 0x48)
309da6f1d7fSFelix Fietkau #define AR_PHY_RSSI_0           (AR_AGC_BASE + 0x180)
310da6f1d7fSFelix Fietkau #define AR_PHY_SPUR_CCK_REP0    (AR_AGC_BASE + 0x184)
31147e84dfbSVasanthakumar Thiagarajan 
312da6f1d7fSFelix Fietkau #define AR_PHY_CCK_DETECT       (AR_AGC_BASE + 0x1c0)
31347e84dfbSVasanthakumar Thiagarajan #define AR_FAST_DIV_ENABLE	0x2000
31447e84dfbSVasanthakumar Thiagarajan #define AR_FAST_DIV_ENABLE_S	13
31547e84dfbSVasanthakumar Thiagarajan 
316da6f1d7fSFelix Fietkau #define AR_PHY_DAG_CTRLCCK      (AR_AGC_BASE + 0x1c4)
317da6f1d7fSFelix Fietkau #define AR_PHY_IQCORR_CTRL_CCK  (AR_AGC_BASE + 0x1c8)
318da6f1d7fSFelix Fietkau 
319da6f1d7fSFelix Fietkau #define AR_PHY_CCK_SPUR_MIT     (AR_AGC_BASE + 0x1cc)
320da6f1d7fSFelix Fietkau #define AR_PHY_CCK_SPUR_MIT_SPUR_RSSI_THR                           0x000001fe
321da6f1d7fSFelix Fietkau #define AR_PHY_CCK_SPUR_MIT_SPUR_RSSI_THR_S                                  1
322da6f1d7fSFelix Fietkau #define AR_PHY_CCK_SPUR_MIT_SPUR_FILTER_TYPE                        0x60000000
323da6f1d7fSFelix Fietkau #define AR_PHY_CCK_SPUR_MIT_SPUR_FILTER_TYPE_S                              29
324da6f1d7fSFelix Fietkau #define AR_PHY_CCK_SPUR_MIT_USE_CCK_SPUR_MIT                        0x00000001
325da6f1d7fSFelix Fietkau #define AR_PHY_CCK_SPUR_MIT_USE_CCK_SPUR_MIT_S                               0
326da6f1d7fSFelix Fietkau #define AR_PHY_CCK_SPUR_MIT_CCK_SPUR_FREQ                           0x1ffffe00
327da6f1d7fSFelix Fietkau #define AR_PHY_CCK_SPUR_MIT_CCK_SPUR_FREQ_S                                  9
328da6f1d7fSFelix Fietkau 
3297ca710d5SLuis R. Rodriguez #define AR_PHY_MRC_CCK_CTRL         (AR_AGC_BASE + 0x1d0)
3307ca710d5SLuis R. Rodriguez #define AR_PHY_MRC_CCK_ENABLE       0x00000001
3317ca710d5SLuis R. Rodriguez #define AR_PHY_MRC_CCK_ENABLE_S              0
3327ca710d5SLuis R. Rodriguez #define AR_PHY_MRC_CCK_MUX_REG      0x00000002
3337ca710d5SLuis R. Rodriguez #define AR_PHY_MRC_CCK_MUX_REG_S             1
3347ca710d5SLuis R. Rodriguez 
335da6f1d7fSFelix Fietkau #define AR_PHY_RX_OCGAIN        (AR_AGC_BASE + 0x200)
336da6f1d7fSFelix Fietkau 
337ae245cdeSSujith Manoharan #define AR_PHY_CCA_NOM_VAL_9300_2GHZ          -110
338ae245cdeSSujith Manoharan #define AR_PHY_CCA_NOM_VAL_9300_5GHZ          -115
339ae245cdeSSujith Manoharan #define AR_PHY_CCA_MIN_GOOD_VAL_9300_2GHZ     -125
340ae245cdeSSujith Manoharan #define AR_PHY_CCA_MIN_GOOD_VAL_9300_5GHZ     -125
3414d6f7201SSujith Manoharan #define AR_PHY_CCA_MAX_GOOD_VAL_9300_2GHZ     -60
3424d6f7201SSujith Manoharan #define AR_PHY_CCA_MAX_GOOD_VAL_9300_5GHZ     -60
3430c7c2bb4SSujith Manoharan #define AR_PHY_CCA_MAX_GOOD_VAL_9300_FCC_2GHZ -95
3440c7c2bb4SSujith Manoharan #define AR_PHY_CCA_MAX_GOOD_VAL_9300_FCC_5GHZ -100
3450c7c2bb4SSujith Manoharan 
346ae245cdeSSujith Manoharan #define AR_PHY_CCA_NOM_VAL_9462_2GHZ          -127
347ae245cdeSSujith Manoharan #define AR_PHY_CCA_MIN_GOOD_VAL_9462_2GHZ     -127
348d3b371cbSSujith Manoharan #define AR_PHY_CCA_MAX_GOOD_VAL_9462_2GHZ     -60
349ae245cdeSSujith Manoharan #define AR_PHY_CCA_NOM_VAL_9462_5GHZ          -127
350ae245cdeSSujith Manoharan #define AR_PHY_CCA_MIN_GOOD_VAL_9462_5GHZ     -127
351d3b371cbSSujith Manoharan #define AR_PHY_CCA_MAX_GOOD_VAL_9462_5GHZ     -60
352ae245cdeSSujith Manoharan 
3530c453732SGabor Juhos #define AR_PHY_CCA_NOM_VAL_9330_2GHZ          -118
3540c453732SGabor Juhos 
35530d5b709SSujith Manoharan #define AR9300_EXT_LNA_CTL_GPIO_AR9485 9
35630d5b709SSujith Manoharan 
357da6f1d7fSFelix Fietkau /*
358da6f1d7fSFelix Fietkau  * AGC Field Definitions
359da6f1d7fSFelix Fietkau  */
360da6f1d7fSFelix Fietkau #define AR_PHY_EXT_ATTEN_CTL_RXTX_MARGIN    0x00FC0000
361da6f1d7fSFelix Fietkau #define AR_PHY_EXT_ATTEN_CTL_RXTX_MARGIN_S  18
362da6f1d7fSFelix Fietkau #define AR_PHY_EXT_ATTEN_CTL_BSW_MARGIN     0x00003C00
363da6f1d7fSFelix Fietkau #define AR_PHY_EXT_ATTEN_CTL_BSW_MARGIN_S   10
364da6f1d7fSFelix Fietkau #define AR_PHY_EXT_ATTEN_CTL_BSW_ATTEN      0x0000001F
365da6f1d7fSFelix Fietkau #define AR_PHY_EXT_ATTEN_CTL_BSW_ATTEN_S    0
366da6f1d7fSFelix Fietkau #define AR_PHY_EXT_ATTEN_CTL_XATTEN2_MARGIN     0x003E0000
367da6f1d7fSFelix Fietkau #define AR_PHY_EXT_ATTEN_CTL_XATTEN2_MARGIN_S   17
368da6f1d7fSFelix Fietkau #define AR_PHY_EXT_ATTEN_CTL_XATTEN1_MARGIN     0x0001F000
369da6f1d7fSFelix Fietkau #define AR_PHY_EXT_ATTEN_CTL_XATTEN1_MARGIN_S   12
370da6f1d7fSFelix Fietkau #define AR_PHY_EXT_ATTEN_CTL_XATTEN2_DB         0x00000FC0
371da6f1d7fSFelix Fietkau #define AR_PHY_EXT_ATTEN_CTL_XATTEN2_DB_S       6
372da6f1d7fSFelix Fietkau #define AR_PHY_EXT_ATTEN_CTL_XATTEN1_DB         0x0000003F
373da6f1d7fSFelix Fietkau #define AR_PHY_EXT_ATTEN_CTL_XATTEN1_DB_S       0
374da6f1d7fSFelix Fietkau #define AR_PHY_RXGAIN_TXRX_ATTEN    0x0003F000
375da6f1d7fSFelix Fietkau #define AR_PHY_RXGAIN_TXRX_ATTEN_S  12
376da6f1d7fSFelix Fietkau #define AR_PHY_RXGAIN_TXRX_RF_MAX   0x007C0000
377da6f1d7fSFelix Fietkau #define AR_PHY_RXGAIN_TXRX_RF_MAX_S 18
378da6f1d7fSFelix Fietkau #define AR9280_PHY_RXGAIN_TXRX_ATTEN    0x00003F80
379da6f1d7fSFelix Fietkau #define AR9280_PHY_RXGAIN_TXRX_ATTEN_S  7
380da6f1d7fSFelix Fietkau #define AR9280_PHY_RXGAIN_TXRX_MARGIN   0x001FC000
381da6f1d7fSFelix Fietkau #define AR9280_PHY_RXGAIN_TXRX_MARGIN_S 14
382da6f1d7fSFelix Fietkau #define AR_PHY_SETTLING_SWITCH  0x00003F80
383da6f1d7fSFelix Fietkau #define AR_PHY_SETTLING_SWITCH_S    7
384da6f1d7fSFelix Fietkau #define AR_PHY_DESIRED_SZ_ADC       0x000000FF
385da6f1d7fSFelix Fietkau #define AR_PHY_DESIRED_SZ_ADC_S     0
386da6f1d7fSFelix Fietkau #define AR_PHY_DESIRED_SZ_PGA       0x0000FF00
387da6f1d7fSFelix Fietkau #define AR_PHY_DESIRED_SZ_PGA_S     8
388da6f1d7fSFelix Fietkau #define AR_PHY_DESIRED_SZ_TOT_DES   0x0FF00000
389da6f1d7fSFelix Fietkau #define AR_PHY_DESIRED_SZ_TOT_DES_S 20
390da6f1d7fSFelix Fietkau #define AR_PHY_MINCCA_PWR       0x1FF00000
391da6f1d7fSFelix Fietkau #define AR_PHY_MINCCA_PWR_S     20
392da6f1d7fSFelix Fietkau #define AR_PHY_CCA_THRESH62     0x0007F000
393da6f1d7fSFelix Fietkau #define AR_PHY_CCA_THRESH62_S   12
394da6f1d7fSFelix Fietkau #define AR9280_PHY_MINCCA_PWR       0x1FF00000
395da6f1d7fSFelix Fietkau #define AR9280_PHY_MINCCA_PWR_S     20
396da6f1d7fSFelix Fietkau #define AR9280_PHY_CCA_THRESH62     0x000FF000
397da6f1d7fSFelix Fietkau #define AR9280_PHY_CCA_THRESH62_S   12
398da6f1d7fSFelix Fietkau #define AR_PHY_EXT_CCA0_THRESH62    0x000000FF
399da6f1d7fSFelix Fietkau #define AR_PHY_EXT_CCA0_THRESH62_S  0
4003533bf6bSSujith Manoharan #define AR_PHY_EXT_CCA0_THRESH62_1    0x000001FF
4013533bf6bSSujith Manoharan #define AR_PHY_EXT_CCA0_THRESH62_1_S  0
402da6f1d7fSFelix Fietkau #define AR_PHY_CCK_DETECT_WEAK_SIG_THR_CCK          0x0000003F
403da6f1d7fSFelix Fietkau #define AR_PHY_CCK_DETECT_WEAK_SIG_THR_CCK_S        0
404da6f1d7fSFelix Fietkau #define AR_PHY_CCK_DETECT_ANT_SWITCH_TIME           0x00001FC0
405da6f1d7fSFelix Fietkau #define AR_PHY_CCK_DETECT_ANT_SWITCH_TIME_S         6
406da6f1d7fSFelix Fietkau #define AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV    0x2000
407da6f1d7fSFelix Fietkau 
408da6f1d7fSFelix Fietkau #define AR_PHY_DAG_CTRLCCK_EN_RSSI_THR  0x00000200
409da6f1d7fSFelix Fietkau #define AR_PHY_DAG_CTRLCCK_EN_RSSI_THR_S  9
410da6f1d7fSFelix Fietkau #define AR_PHY_DAG_CTRLCCK_RSSI_THR 0x0001FC00
411da6f1d7fSFelix Fietkau #define AR_PHY_DAG_CTRLCCK_RSSI_THR_S   10
412da6f1d7fSFelix Fietkau 
413da6f1d7fSFelix Fietkau #define AR_PHY_RIFS_INIT_DELAY         0x3ff0000
414df222edcSRajkumar Manoharan #define AR_PHY_AGC_QUICK_DROP       0x03c00000
415df222edcSRajkumar Manoharan #define AR_PHY_AGC_QUICK_DROP_S     22
416da6f1d7fSFelix Fietkau #define AR_PHY_AGC_COARSE_LOW       0x00007F80
417da6f1d7fSFelix Fietkau #define AR_PHY_AGC_COARSE_LOW_S     7
418da6f1d7fSFelix Fietkau #define AR_PHY_AGC_COARSE_HIGH      0x003F8000
419da6f1d7fSFelix Fietkau #define AR_PHY_AGC_COARSE_HIGH_S    15
420da6f1d7fSFelix Fietkau #define AR_PHY_AGC_COARSE_PWR_CONST 0x0000007F
421da6f1d7fSFelix Fietkau #define AR_PHY_AGC_COARSE_PWR_CONST_S   0
422da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG_FIRSTEP  0x0003F000
423da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG_FIRSTEP_S        12
424da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG_FIRPWR   0x03FC0000
425da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG_FIRPWR_S         18
426da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG_FIRPWR_SIGN_BIT  25
427da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG_RELPWR   (0x1f << 6)
428da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG_RELPWR_S          6
429da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG_RELPWR_SIGN_BIT  11
430da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG_RELSTEP        0x1f
431da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG_RELSTEP_S         0
432da6f1d7fSFelix Fietkau #define AR_PHY_FIND_SIG_RELSTEP_SIGN_BIT  5
433362cd03fSSujith Manoharan #define AR_PHY_RESTART_ENABLE_DIV_M2FLAG 0x00200000
434362cd03fSSujith Manoharan #define AR_PHY_RESTART_ENABLE_DIV_M2FLAG_S 21
435da6f1d7fSFelix Fietkau #define AR_PHY_RESTART_DIV_GC   0x001C0000
436da6f1d7fSFelix Fietkau #define AR_PHY_RESTART_DIV_GC_S 18
437da6f1d7fSFelix Fietkau #define AR_PHY_RESTART_ENA      0x01
438da6f1d7fSFelix Fietkau #define AR_PHY_DC_RESTART_DIS   0x40000000
439da6f1d7fSFelix Fietkau 
440da6f1d7fSFelix Fietkau #define AR_PHY_TPC_OLPC_GAIN_DELTA_PAL_ON       0xFF000000
441da6f1d7fSFelix Fietkau #define AR_PHY_TPC_OLPC_GAIN_DELTA_PAL_ON_S     24
442da6f1d7fSFelix Fietkau #define AR_PHY_TPC_OLPC_GAIN_DELTA              0x00FF0000
443da6f1d7fSFelix Fietkau #define AR_PHY_TPC_OLPC_GAIN_DELTA_S            16
444da6f1d7fSFelix Fietkau 
445da6f1d7fSFelix Fietkau #define AR_PHY_TPC_6_ERROR_EST_MODE             0x03000000
446da6f1d7fSFelix Fietkau #define AR_PHY_TPC_6_ERROR_EST_MODE_S           24
447da6f1d7fSFelix Fietkau 
448da6f1d7fSFelix Fietkau /*
449da6f1d7fSFelix Fietkau  * SM Register Map
450da6f1d7fSFelix Fietkau  */
451da6f1d7fSFelix Fietkau #define AR_SM_BASE	0xa200
452da6f1d7fSFelix Fietkau 
453da6f1d7fSFelix Fietkau #define AR_PHY_D2_CHIP_ID        (AR_SM_BASE + 0x0)
454da6f1d7fSFelix Fietkau #define AR_PHY_GEN_CTRL          (AR_SM_BASE + 0x4)
455da6f1d7fSFelix Fietkau #define AR_PHY_MODE              (AR_SM_BASE + 0x8)
456da6f1d7fSFelix Fietkau #define AR_PHY_ACTIVE            (AR_SM_BASE + 0xc)
457*b3a663f0SWenli Looi #define AR_PHY_SPUR_MASK_A(_ah)  (AR_SM_BASE + (AR_SREV_9561(_ah) ? 0x18 : 0x20))
458*b3a663f0SWenli Looi #define AR_PHY_SPUR_MASK_B(_ah)  (AR_SM_BASE + (AR_SREV_9561(_ah) ? 0x1c : 0x24))
459da6f1d7fSFelix Fietkau #define AR_PHY_SPECTRAL_SCAN     (AR_SM_BASE + 0x28)
460da6f1d7fSFelix Fietkau #define AR_PHY_RADAR_BW_FILTER   (AR_SM_BASE + 0x2c)
461da6f1d7fSFelix Fietkau #define AR_PHY_SEARCH_START_DELAY (AR_SM_BASE + 0x30)
462da6f1d7fSFelix Fietkau #define AR_PHY_MAX_RX_LEN        (AR_SM_BASE + 0x34)
463da6f1d7fSFelix Fietkau #define AR_PHY_FRAME_CTL         (AR_SM_BASE + 0x38)
464da6f1d7fSFelix Fietkau #define AR_PHY_RFBUS_REQ         (AR_SM_BASE + 0x3c)
465da6f1d7fSFelix Fietkau #define AR_PHY_RFBUS_GRANT       (AR_SM_BASE + 0x40)
466da6f1d7fSFelix Fietkau #define AR_PHY_RIFS              (AR_SM_BASE + 0x44)
467da6f1d7fSFelix Fietkau #define AR_PHY_RX_CLR_DELAY      (AR_SM_BASE + 0x50)
468da6f1d7fSFelix Fietkau #define AR_PHY_RX_DELAY          (AR_SM_BASE + 0x54)
469da6f1d7fSFelix Fietkau 
470da6f1d7fSFelix Fietkau #define AR_PHY_XPA_TIMING_CTL    (AR_SM_BASE + 0x64)
471da6f1d7fSFelix Fietkau #define AR_PHY_MISC_PA_CTL       (AR_SM_BASE + 0x80)
472da6f1d7fSFelix Fietkau #define AR_PHY_SWITCH_CHAIN_0    (AR_SM_BASE + 0x84)
473da6f1d7fSFelix Fietkau #define AR_PHY_SWITCH_COM        (AR_SM_BASE + 0x88)
474da6f1d7fSFelix Fietkau #define AR_PHY_SWITCH_COM_2      (AR_SM_BASE + 0x8c)
475da6f1d7fSFelix Fietkau #define AR_PHY_RX_CHAINMASK      (AR_SM_BASE + 0xa0)
476da6f1d7fSFelix Fietkau #define AR_PHY_CAL_CHAINMASK     (AR_SM_BASE + 0xc0)
477da6f1d7fSFelix Fietkau #define AR_PHY_CALMODE           (AR_SM_BASE + 0xc8)
478da6f1d7fSFelix Fietkau #define AR_PHY_FCAL_1            (AR_SM_BASE + 0xcc)
479da6f1d7fSFelix Fietkau #define AR_PHY_FCAL_2_0          (AR_SM_BASE + 0xd0)
480da6f1d7fSFelix Fietkau #define AR_PHY_DFT_TONE_CTL_0    (AR_SM_BASE + 0xd4)
481da6f1d7fSFelix Fietkau #define AR_PHY_CL_CAL_CTL        (AR_SM_BASE + 0xd8)
482da6f1d7fSFelix Fietkau #define AR_PHY_CL_TAB_0          (AR_SM_BASE + 0x100)
483da6f1d7fSFelix Fietkau #define AR_PHY_SYNTH_CONTROL     (AR_SM_BASE + 0x140)
484da6f1d7fSFelix Fietkau #define AR_PHY_ADDAC_CLK_SEL     (AR_SM_BASE + 0x144)
485da6f1d7fSFelix Fietkau #define AR_PHY_PLL_CTL           (AR_SM_BASE + 0x148)
486da6f1d7fSFelix Fietkau #define AR_PHY_ANALOG_SWAP       (AR_SM_BASE + 0x14c)
487da6f1d7fSFelix Fietkau #define AR_PHY_ADDAC_PARA_CTL    (AR_SM_BASE + 0x150)
488da6f1d7fSFelix Fietkau #define AR_PHY_XPA_CFG           (AR_SM_BASE + 0x158)
489da6f1d7fSFelix Fietkau 
49025c0f301SMiaoqing Pan #define AR_PHY_FLC_PWR_THRESH		7
49125c0f301SMiaoqing Pan #define AR_PHY_FLC_PWR_THRESH_S		0
49225c0f301SMiaoqing Pan 
4933e61d3f9SFelix Fietkau #define AR_PHY_FRAME_CTL_CF_OVERLAP_WINDOW  3
4943e61d3f9SFelix Fietkau #define AR_PHY_FRAME_CTL_CF_OVERLAP_WINDOW_S    0
4953e61d3f9SFelix Fietkau 
4961547da37SLuis R. Rodriguez #define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A           0x0001FC00
4971547da37SLuis R. Rodriguez #define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A_S         10
4981547da37SLuis R. Rodriguez #define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_A                       0x3FF
4991547da37SLuis R. Rodriguez #define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_A_S                     0
5001547da37SLuis R. Rodriguez 
501*b3a663f0SWenli Looi #define AR_PHY_TEST(_ah)         (AR_SM_BASE + (AR_SREV_9561(_ah) ? 0x15c : 0x160))
502da6f1d7fSFelix Fietkau 
503da6f1d7fSFelix Fietkau #define AR_PHY_TEST_BBB_OBS_SEL       0x780000
504da6f1d7fSFelix Fietkau #define AR_PHY_TEST_BBB_OBS_SEL_S     19
505da6f1d7fSFelix Fietkau 
506da6f1d7fSFelix Fietkau #define AR_PHY_TEST_RX_OBS_SEL_BIT5_S 23
507da6f1d7fSFelix Fietkau #define AR_PHY_TEST_RX_OBS_SEL_BIT5   (1 << AR_PHY_TEST_RX_OBS_SEL_BIT5_S)
508da6f1d7fSFelix Fietkau 
509da6f1d7fSFelix Fietkau #define AR_PHY_TEST_CHAIN_SEL      0xC0000000
510da6f1d7fSFelix Fietkau #define AR_PHY_TEST_CHAIN_SEL_S    30
511da6f1d7fSFelix Fietkau 
512*b3a663f0SWenli Looi #define AR_PHY_TEST_CTL_STATUS(_ah) (AR_SM_BASE + (AR_SREV_9561(_ah) ? 0x160 : 0x164))
513da6f1d7fSFelix Fietkau #define AR_PHY_TEST_CTL_TSTDAC_EN         0x1
514da6f1d7fSFelix Fietkau #define AR_PHY_TEST_CTL_TSTDAC_EN_S       0
515da6f1d7fSFelix Fietkau #define AR_PHY_TEST_CTL_TX_OBS_SEL        0x1C
516da6f1d7fSFelix Fietkau #define AR_PHY_TEST_CTL_TX_OBS_SEL_S      2
517da6f1d7fSFelix Fietkau #define AR_PHY_TEST_CTL_TX_OBS_MUX_SEL    0x60
518da6f1d7fSFelix Fietkau #define AR_PHY_TEST_CTL_TX_OBS_MUX_SEL_S  5
519da6f1d7fSFelix Fietkau #define AR_PHY_TEST_CTL_TSTADC_EN         0x100
520da6f1d7fSFelix Fietkau #define AR_PHY_TEST_CTL_TSTADC_EN_S       8
521da6f1d7fSFelix Fietkau #define AR_PHY_TEST_CTL_RX_OBS_SEL        0x3C00
522da6f1d7fSFelix Fietkau #define AR_PHY_TEST_CTL_RX_OBS_SEL_S      10
5232ee4bd1eSMohammed Shafi Shajakhan #define AR_PHY_TEST_CTL_DEBUGPORT_SEL	  0xe0000000
5242ee4bd1eSMohammed Shafi Shajakhan #define AR_PHY_TEST_CTL_DEBUGPORT_SEL_S	  29
525da6f1d7fSFelix Fietkau 
526da6f1d7fSFelix Fietkau 
527*b3a663f0SWenli Looi #define AR_PHY_TSTDAC(_ah)       (AR_SM_BASE + (AR_SREV_9561(_ah) ? 0x164 : 0x168))
528da6f1d7fSFelix Fietkau 
529*b3a663f0SWenli Looi #define AR_PHY_CHAN_STATUS(_ah)  (AR_SM_BASE + (AR_SREV_9561(_ah) ? 0x168 : 0x16c))
530ab334498SFelix Fietkau 
531*b3a663f0SWenli Looi #define AR_PHY_CHAN_INFO_MEMORY(_ah) (AR_SM_BASE + (AR_SREV_9561(_ah) ? 0x16c : 0x170))
532ab334498SFelix Fietkau #define AR_PHY_CHAN_INFO_MEMORY_CHANINFOMEM_S2_READ	0x00000008
533ab334498SFelix Fietkau #define AR_PHY_CHAN_INFO_MEMORY_CHANINFOMEM_S2_READ_S	3
534ab334498SFelix Fietkau 
535*b3a663f0SWenli Looi #define AR_PHY_CHNINFO_NOISEPWR(_ah)  (AR_SM_BASE + (AR_SREV_9561(_ah) ? 0x170 : 0x174))
536*b3a663f0SWenli Looi #define AR_PHY_CHNINFO_GAINDIFF(_ah)  (AR_SM_BASE + (AR_SREV_9561(_ah) ? 0x174 : 0x178))
537*b3a663f0SWenli Looi #define AR_PHY_CHNINFO_FINETIM(_ah)   (AR_SM_BASE + (AR_SREV_9561(_ah) ? 0x178 : 0x17c))
538*b3a663f0SWenli Looi #define AR_PHY_CHAN_INFO_GAIN_0(_ah)  (AR_SM_BASE + (AR_SREV_9561(_ah) ? 0x17c : 0x180))
539*b3a663f0SWenli Looi #define AR_PHY_SCRAMBLER_SEED(_ah)    (AR_SM_BASE + (AR_SREV_9561(_ah) ? 0x184 : 0x190))
540*b3a663f0SWenli Looi #define AR_PHY_CCK_TX_CTRL(_ah)       (AR_SM_BASE + (AR_SREV_9561(_ah) ? 0x188 : 0x194))
541da6f1d7fSFelix Fietkau 
542*b3a663f0SWenli Looi #define AR_PHY_HEAVYCLIP_CTL(_ah) (AR_SM_BASE + (AR_SREV_9561(_ah) ? 0x198 : 0x1a4))
543da6f1d7fSFelix Fietkau #define AR_PHY_HEAVYCLIP_20      (AR_SM_BASE + 0x1a8)
544da6f1d7fSFelix Fietkau #define AR_PHY_HEAVYCLIP_40      (AR_SM_BASE + 0x1ac)
545fa5b8c8aSMiaoqing Pan #define AR_PHY_HEAVYCLIP_1	 (AR_SM_BASE + 0x19c)
546fa5b8c8aSMiaoqing Pan #define AR_PHY_HEAVYCLIP_2	 (AR_SM_BASE + 0x1a0)
547fa5b8c8aSMiaoqing Pan #define AR_PHY_HEAVYCLIP_3	 (AR_SM_BASE + 0x1a4)
548fa5b8c8aSMiaoqing Pan #define AR_PHY_HEAVYCLIP_4	 (AR_SM_BASE + 0x1a8)
549fa5b8c8aSMiaoqing Pan #define AR_PHY_HEAVYCLIP_5	 (AR_SM_BASE + 0x1ac)
550da6f1d7fSFelix Fietkau #define AR_PHY_ILLEGAL_TXRATE    (AR_SM_BASE + 0x1b0)
551da6f1d7fSFelix Fietkau 
5524a4fdf2eSFelix Fietkau #define AR_PHY_POWER_TX_RATE(_d) (AR_SM_BASE + 0x1c0 + ((_d) << 2))
5534a4fdf2eSFelix Fietkau 
554da6f1d7fSFelix Fietkau #define AR_PHY_PWRTX_MAX         (AR_SM_BASE + 0x1f0)
555da6f1d7fSFelix Fietkau #define AR_PHY_POWER_TX_SUB      (AR_SM_BASE + 0x1f4)
556da6f1d7fSFelix Fietkau 
557ab334498SFelix Fietkau #define AR_PHY_TPC_1				(AR_SM_BASE + 0x1f8)
558ab334498SFelix Fietkau #define AR_PHY_TPC_1_FORCED_DAC_GAIN		0x0000003e
559ab334498SFelix Fietkau #define AR_PHY_TPC_1_FORCED_DAC_GAIN_S		1
560ab334498SFelix Fietkau #define AR_PHY_TPC_1_FORCE_DAC_GAIN		0x00000001
561ab334498SFelix Fietkau #define AR_PHY_TPC_1_FORCE_DAC_GAIN_S		0
562ab334498SFelix Fietkau 
563da6f1d7fSFelix Fietkau #define AR_PHY_TPC_4_B0				(AR_SM_BASE + 0x204)
564da6f1d7fSFelix Fietkau #define AR_PHY_TPC_5_B0				(AR_SM_BASE + 0x208)
565da6f1d7fSFelix Fietkau #define AR_PHY_TPC_6_B0				(AR_SM_BASE + 0x20c)
566ab334498SFelix Fietkau 
567da6f1d7fSFelix Fietkau #define AR_PHY_TPC_11_B0			(AR_SM_BASE + 0x220)
568ab334498SFelix Fietkau #define AR_PHY_TPC_11_B1			(AR_SM1_BASE + 0x220)
569ab334498SFelix Fietkau #define AR_PHY_TPC_11_B2			(AR_SM2_BASE + 0x220)
570ab334498SFelix Fietkau #define AR_PHY_TPC_11_OLPC_GAIN_DELTA		0x00ff0000
571ab334498SFelix Fietkau #define AR_PHY_TPC_11_OLPC_GAIN_DELTA_S		16
572ab334498SFelix Fietkau 
573ab334498SFelix Fietkau #define AR_PHY_TPC_12				(AR_SM_BASE + 0x224)
574ab334498SFelix Fietkau #define AR_PHY_TPC_12_DESIRED_SCALE_HT40_5	0x3e000000
575ab334498SFelix Fietkau #define AR_PHY_TPC_12_DESIRED_SCALE_HT40_5_S	25
576ab334498SFelix Fietkau 
577da6f1d7fSFelix Fietkau #define AR_PHY_TPC_18				(AR_SM_BASE + 0x23c)
578ab334498SFelix Fietkau #define AR_PHY_TPC_18_THERM_CAL_VALUE           0x000000ff
579ab334498SFelix Fietkau #define AR_PHY_TPC_18_THERM_CAL_VALUE_S         0
580ab334498SFelix Fietkau #define AR_PHY_TPC_18_VOLT_CAL_VALUE		0x0000ff00
581ab334498SFelix Fietkau #define AR_PHY_TPC_18_VOLT_CAL_VALUE_S		8
582ab334498SFelix Fietkau 
583da6f1d7fSFelix Fietkau #define AR_PHY_TPC_19				(AR_SM_BASE + 0x240)
584ab334498SFelix Fietkau #define AR_PHY_TPC_19_ALPHA_VOLT		0x001f0000
585ab334498SFelix Fietkau #define AR_PHY_TPC_19_ALPHA_VOLT_S		16
586ab334498SFelix Fietkau #define AR_PHY_TPC_19_ALPHA_THERM		0xff
587ab334498SFelix Fietkau #define AR_PHY_TPC_19_ALPHA_THERM_S		0
588da6f1d7fSFelix Fietkau 
589da6f1d7fSFelix Fietkau #define AR_PHY_TX_FORCED_GAIN				(AR_SM_BASE + 0x258)
590ab334498SFelix Fietkau #define AR_PHY_TX_FORCED_GAIN_FORCE_TX_GAIN		0x00000001
591ab334498SFelix Fietkau #define AR_PHY_TX_FORCED_GAIN_FORCE_TX_GAIN_S		0
592ab334498SFelix Fietkau #define AR_PHY_TX_FORCED_GAIN_FORCED_TXBB1DBGAIN	0x0000000e
593ab334498SFelix Fietkau #define AR_PHY_TX_FORCED_GAIN_FORCED_TXBB1DBGAIN_S	1
594ab334498SFelix Fietkau #define AR_PHY_TX_FORCED_GAIN_FORCED_TXBB6DBGAIN	0x00000030
595ab334498SFelix Fietkau #define AR_PHY_TX_FORCED_GAIN_FORCED_TXBB6DBGAIN_S	4
596ab334498SFelix Fietkau #define AR_PHY_TX_FORCED_GAIN_FORCED_TXMXRGAIN		0x000003c0
597ab334498SFelix Fietkau #define AR_PHY_TX_FORCED_GAIN_FORCED_TXMXRGAIN_S	6
598ab334498SFelix Fietkau #define AR_PHY_TX_FORCED_GAIN_FORCED_PADRVGNA		0x00003c00
599ab334498SFelix Fietkau #define AR_PHY_TX_FORCED_GAIN_FORCED_PADRVGNA_S		10
600ab334498SFelix Fietkau #define AR_PHY_TX_FORCED_GAIN_FORCED_PADRVGNB		0x0003c000
601ab334498SFelix Fietkau #define AR_PHY_TX_FORCED_GAIN_FORCED_PADRVGNB_S		14
602ab334498SFelix Fietkau #define AR_PHY_TX_FORCED_GAIN_FORCED_PADRVGNC		0x003c0000
603ab334498SFelix Fietkau #define AR_PHY_TX_FORCED_GAIN_FORCED_PADRVGNC_S		18
604ab334498SFelix Fietkau #define AR_PHY_TX_FORCED_GAIN_FORCED_PADRVGND		0x00c00000
605ab334498SFelix Fietkau #define AR_PHY_TX_FORCED_GAIN_FORCED_PADRVGND_S		22
606ab334498SFelix Fietkau #define AR_PHY_TX_FORCED_GAIN_FORCED_ENABLE_PAL		0x01000000
607ab334498SFelix Fietkau #define AR_PHY_TX_FORCED_GAIN_FORCED_ENABLE_PAL_S	24
608ab334498SFelix Fietkau 
609da6f1d7fSFelix Fietkau 
610da6f1d7fSFelix Fietkau #define AR_PHY_PDADC_TAB_0       (AR_SM_BASE + 0x280)
611da6f1d7fSFelix Fietkau 
612ab334498SFelix Fietkau #define AR_PHY_TXGAIN_TABLE      (AR_SM_BASE + 0x300)
613ab334498SFelix Fietkau 
614*b3a663f0SWenli Looi #define AR_PHY_TX_IQCAL_CONTROL_0(_ah)   (AR_SM_BASE + (AR_SREV_9485(_ah) ? \
61552d6d4efSRajkumar Manoharan 						 0x3c4 : 0x444))
616*b3a663f0SWenli Looi #define AR_PHY_TX_IQCAL_CONTROL_1(_ah)   (AR_SM_BASE + (AR_SREV_9485(_ah) ? \
61752d6d4efSRajkumar Manoharan 						 0x3c8 : 0x448))
618*b3a663f0SWenli Looi #define AR_PHY_TX_IQCAL_START(_ah)       (AR_SM_BASE + (AR_SREV_9485(_ah) ? \
61952d6d4efSRajkumar Manoharan 						 0x3c4 : 0x440))
620*b3a663f0SWenli Looi #define AR_PHY_TX_IQCAL_STATUS_B0(_ah)   (AR_SM_BASE + (AR_SREV_9485(_ah) ? \
62152d6d4efSRajkumar Manoharan 						 0x3f0 : 0x48c))
622*b3a663f0SWenli Looi #define AR_PHY_TX_IQCAL_CORR_COEFF_B0(_ah, _i)    (AR_SM_BASE + \
623*b3a663f0SWenli Looi 					     (AR_SREV_9485(_ah) ? \
62431faff81SVasanthakumar Thiagarajan 					      0x3d0 : 0x450) + ((_i) << 2))
625ce407afcSSenthil Balasubramanian #define AR_PHY_RTT_CTRL			(AR_SM_BASE + 0x380)
626da6f1d7fSFelix Fietkau 
627aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_STATUS      (AR_SM_BASE + 0x5c0)
628aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_CTL_1       (AR_SM_BASE + 0x5c4)
629aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_CTL_2       (AR_SM_BASE + 0x5c8)
630aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_CTL         (AR_SM_BASE + 0x5cc)
631da6f1d7fSFelix Fietkau #define AR_PHY_ONLY_WARMRESET       (AR_SM_BASE + 0x5d0)
632da6f1d7fSFelix Fietkau #define AR_PHY_ONLY_CTL             (AR_SM_BASE + 0x5d4)
633da6f1d7fSFelix Fietkau #define AR_PHY_ECO_CTRL             (AR_SM_BASE + 0x5dc)
634ab334498SFelix Fietkau 
635da6f1d7fSFelix Fietkau #define AR_PHY_BB_THERM_ADC_1				(AR_SM_BASE + 0x248)
636ab334498SFelix Fietkau #define AR_PHY_BB_THERM_ADC_1_INIT_THERM		0x000000ff
637ab334498SFelix Fietkau #define AR_PHY_BB_THERM_ADC_1_INIT_THERM_S		0
638ab334498SFelix Fietkau 
63980fe43f2SRajkumar Manoharan #define AR_PHY_BB_THERM_ADC_3				(AR_SM_BASE + 0x250)
64080fe43f2SRajkumar Manoharan #define AR_PHY_BB_THERM_ADC_3_THERM_ADC_SCALE_GAIN	0x0001ff00
64180fe43f2SRajkumar Manoharan #define AR_PHY_BB_THERM_ADC_3_THERM_ADC_SCALE_GAIN_S	8
64280fe43f2SRajkumar Manoharan #define AR_PHY_BB_THERM_ADC_3_THERM_ADC_OFFSET		0x000000ff
64380fe43f2SRajkumar Manoharan #define AR_PHY_BB_THERM_ADC_3_THERM_ADC_OFFSET_S	0
64480fe43f2SRajkumar Manoharan 
645ab334498SFelix Fietkau #define AR_PHY_BB_THERM_ADC_4				(AR_SM_BASE + 0x254)
646ab334498SFelix Fietkau #define AR_PHY_BB_THERM_ADC_4_LATEST_THERM_VALUE	0x000000ff
647ab334498SFelix Fietkau #define AR_PHY_BB_THERM_ADC_4_LATEST_THERM_VALUE_S	0
648ab334498SFelix Fietkau #define AR_PHY_BB_THERM_ADC_4_LATEST_VOLT_VALUE		0x0000ff00
649ab334498SFelix Fietkau #define AR_PHY_BB_THERM_ADC_4_LATEST_VOLT_VALUE_S	8
650ab334498SFelix Fietkau 
651381c726cSFelix Fietkau #define AR_PHY_65NM_CH0_TXRF3       0x16048
652381c726cSFelix Fietkau #define AR_PHY_65NM_CH0_TXRF3_CAPDIV2G		0x0000001e
653381c726cSFelix Fietkau #define AR_PHY_65NM_CH0_TXRF3_CAPDIV2G_S	1
654381c726cSFelix Fietkau 
655da6f1d7fSFelix Fietkau #define AR_PHY_65NM_CH0_SYNTH4      0x1608c
656a4a2954fSSujith Manoharan #define AR_PHY_SYNTH4_LONG_SHIFT_SELECT   ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x00000001 : 0x00000002)
657a4a2954fSSujith Manoharan #define AR_PHY_SYNTH4_LONG_SHIFT_SELECT_S ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0 : 1)
658da6f1d7fSFelix Fietkau #define AR_PHY_65NM_CH0_SYNTH7      0x16098
6596fcbe538SSujith Manoharan #define AR_PHY_65NM_CH0_SYNTH12     0x160ac
660da6f1d7fSFelix Fietkau #define AR_PHY_65NM_CH0_BIAS1       0x160c0
661da6f1d7fSFelix Fietkau #define AR_PHY_65NM_CH0_BIAS2       0x160c4
662da6f1d7fSFelix Fietkau #define AR_PHY_65NM_CH0_BIAS4       0x160cc
6636fcbe538SSujith Manoharan #define AR_PHY_65NM_CH0_RXTX2       0x16104
6646fcbe538SSujith Manoharan #define AR_PHY_65NM_CH1_RXTX2       0x16504
6656fcbe538SSujith Manoharan #define AR_PHY_65NM_CH2_RXTX2       0x16904
666da6f1d7fSFelix Fietkau #define AR_PHY_65NM_CH0_RXTX4       0x1610c
6673e2ea543SFelix Fietkau #define AR_PHY_65NM_CH1_RXTX4       0x1650c
6683e2ea543SFelix Fietkau #define AR_PHY_65NM_CH2_RXTX4       0x1690c
669ce407afcSSenthil Balasubramanian 
67042dd98b0SSujith Manoharan #define AR_PHY_65NM_CH0_BB1         0x16140
67142dd98b0SSujith Manoharan #define AR_PHY_65NM_CH0_BB2         0x16144
67242dd98b0SSujith Manoharan #define AR_PHY_65NM_CH0_BB3         0x16148
67342dd98b0SSujith Manoharan #define AR_PHY_65NM_CH1_BB1         0x16540
67442dd98b0SSujith Manoharan #define AR_PHY_65NM_CH1_BB2         0x16544
67542dd98b0SSujith Manoharan #define AR_PHY_65NM_CH1_BB3         0x16548
67642dd98b0SSujith Manoharan #define AR_PHY_65NM_CH2_BB1         0x16940
67742dd98b0SSujith Manoharan #define AR_PHY_65NM_CH2_BB2         0x16944
67842dd98b0SSujith Manoharan #define AR_PHY_65NM_CH2_BB3         0x16948
67942dd98b0SSujith Manoharan 
6806fcbe538SSujith Manoharan #define AR_PHY_65NM_CH0_SYNTH12_VREFMUL3           0x00780000
6816fcbe538SSujith Manoharan #define AR_PHY_65NM_CH0_SYNTH12_VREFMUL3_S         19
6826fcbe538SSujith Manoharan #define AR_PHY_65NM_CH0_RXTX2_SYNTHON_MASK         0x00000004
6836fcbe538SSujith Manoharan #define AR_PHY_65NM_CH0_RXTX2_SYNTHON_MASK_S       2
6846fcbe538SSujith Manoharan #define AR_PHY_65NM_CH0_RXTX2_SYNTHOVR_MASK        0x00000008
6856fcbe538SSujith Manoharan #define AR_PHY_65NM_CH0_RXTX2_SYNTHOVR_MASK_S      3
6866fcbe538SSujith Manoharan 
687*b3a663f0SWenli Looi #define AR_CH0_TOP(_ah)	(AR_SREV_9300(_ah) ? 0x16288 : \
688*b3a663f0SWenli Looi 			 (((AR_SREV_9462(_ah) || AR_SREV_9565(_ah)) ? 0x1628c : 0x16280)))
6894b091727SGabor Juhos #define AR_CH0_TOP_XPABIASLVL (AR_SREV_9550(ah) ? 0x3c0 : 0x300)
6904b091727SGabor Juhos #define AR_CH0_TOP_XPABIASLVL_S (AR_SREV_9550(ah) ? 6 : 8)
691b54af8afSSenthil Balasubramanian 
692b54af8afSSenthil Balasubramanian #define AR_SWITCH_TABLE_COM_ALL (0xffff)
693b54af8afSSenthil Balasubramanian #define AR_SWITCH_TABLE_COM_ALL_S (0)
694423e38e8SRajkumar Manoharan #define AR_SWITCH_TABLE_COM_AR9462_ALL (0xffffff)
695423e38e8SRajkumar Manoharan #define AR_SWITCH_TABLE_COM_AR9462_ALL_S (0)
6962d00de48SGabor Juhos #define AR_SWITCH_TABLE_COM_AR9550_ALL (0xffffff)
6972d00de48SGabor Juhos #define AR_SWITCH_TABLE_COM_AR9550_ALL_S (0)
698b54af8afSSenthil Balasubramanian #define AR_SWITCH_TABLE_COM_SPDT (0x00f00000)
699b54af8afSSenthil Balasubramanian #define AR_SWITCH_TABLE_COM_SPDT_ALL (0x0000fff0)
700b54af8afSSenthil Balasubramanian #define AR_SWITCH_TABLE_COM_SPDT_ALL_S (4)
701b54af8afSSenthil Balasubramanian 
702b54af8afSSenthil Balasubramanian #define AR_SWITCH_TABLE_COM2_ALL (0xffffff)
703b54af8afSSenthil Balasubramanian #define AR_SWITCH_TABLE_COM2_ALL_S (0)
704b54af8afSSenthil Balasubramanian 
705b54af8afSSenthil Balasubramanian #define AR_SWITCH_TABLE_ALL (0xfff)
706b54af8afSSenthil Balasubramanian #define AR_SWITCH_TABLE_ALL_S (0)
707ce407afcSSenthil Balasubramanian 
708*b3a663f0SWenli Looi #define AR_CH0_THERM(_ah)  (AR_SREV_9300(_ah) ? 0x16290 :\
709*b3a663f0SWenli Looi 			    ((AR_SREV_9462(_ah) || AR_SREV_9565(_ah)) ? 0x16294 : 0x1628c))
7103ff25093SFelix Fietkau #define AR_CH0_THERM_XPABIASLVL_MSB 0x3
7113ff25093SFelix Fietkau #define AR_CH0_THERM_XPABIASLVL_MSB_S 0
7123ff25093SFelix Fietkau #define AR_CH0_THERM_XPASHORT2GND 0x4
7133ff25093SFelix Fietkau #define AR_CH0_THERM_XPASHORT2GND_S 2
714da6f1d7fSFelix Fietkau 
7153ff25093SFelix Fietkau #define AR_CH0_THERM_LOCAL   0x80000000
7163ff25093SFelix Fietkau #define AR_CH0_THERM_START   0x20000000
7173ff25093SFelix Fietkau #define AR_CH0_THERM_SAR_ADC_OUT   0x0000ff00
7183ff25093SFelix Fietkau #define AR_CH0_THERM_SAR_ADC_OUT_S 8
719da6f1d7fSFelix Fietkau 
720*b3a663f0SWenli Looi #define AR_CH0_TOP2(_ah)		(AR_SREV_9300(_ah) ? 0x1628c : \
721*b3a663f0SWenli Looi 					(AR_SREV_9462(_ah) ? 0x16290 : 0x16284))
722df476df1SMiaoqing Pan #define AR_CH0_TOP2_XPABIASLVL		(AR_SREV_9561(ah) ? 0x1e00 : 0xf000)
723e999a5daSThibaut VARÈNE #define AR_CH0_TOP2_XPABIASLVL_S	(AR_SREV_9561(ah) ? 9 : 12)
7249936e65fSVasanthakumar Thiagarajan 
725*b3a663f0SWenli Looi #define AR_CH0_XTAL(_ah)	(AR_SREV_9300(_ah) ? 0x16294 : \
726*b3a663f0SWenli Looi 				 ((AR_SREV_9462(_ah) || AR_SREV_9565(_ah)) ? 0x16298 : \
727*b3a663f0SWenli Looi 				  (AR_SREV_9561(_ah) ? 0x162c0 : 0x16290)))
728dd040f76SVasanthakumar Thiagarajan #define AR_CH0_XTAL_CAPINDAC	0x7f000000
729dd040f76SVasanthakumar Thiagarajan #define AR_CH0_XTAL_CAPINDAC_S	24
730dd040f76SVasanthakumar Thiagarajan #define AR_CH0_XTAL_CAPOUTDAC	0x00fe0000
731dd040f76SVasanthakumar Thiagarajan #define AR_CH0_XTAL_CAPOUTDAC_S	17
732dd040f76SVasanthakumar Thiagarajan 
733*b3a663f0SWenli Looi #define AR_PHY_PMU1(_ah)	((AR_SREV_9462(_ah) || AR_SREV_9565(_ah)) ? 0x16340 : \
734*b3a663f0SWenli Looi 				 (AR_SREV_9561(_ah) ? 0x16cc0 : 0x16c40))
735ab09b5b4SVasanthakumar Thiagarajan #define AR_PHY_PMU1_PWD		0x1
736ab09b5b4SVasanthakumar Thiagarajan #define AR_PHY_PMU1_PWD_S	0
737ab09b5b4SVasanthakumar Thiagarajan 
738*b3a663f0SWenli Looi #define AR_PHY_PMU2(_ah)	((AR_SREV_9462(_ah) || AR_SREV_9565(_ah)) ? 0x16344 : \
739*b3a663f0SWenli Looi 				 (AR_SREV_9561(_ah) ? 0x16cc4 : 0x16c44))
740ab09b5b4SVasanthakumar Thiagarajan #define AR_PHY_PMU2_PGM		0x00200000
741ab09b5b4SVasanthakumar Thiagarajan #define AR_PHY_PMU2_PGM_S	21
742ab09b5b4SVasanthakumar Thiagarajan 
743da6f1d7fSFelix Fietkau #define AR_PHY_RX1DB_BIQUAD_LONG_SHIFT		0x00380000
744da6f1d7fSFelix Fietkau #define AR_PHY_RX1DB_BIQUAD_LONG_SHIFT_S	19
745da6f1d7fSFelix Fietkau #define AR_PHY_RX6DB_BIQUAD_LONG_SHIFT		0x00c00000
746da6f1d7fSFelix Fietkau #define AR_PHY_RX6DB_BIQUAD_LONG_SHIFT_S	22
747da6f1d7fSFelix Fietkau #define AR_PHY_LNAGAIN_LONG_SHIFT		0xe0000000
748da6f1d7fSFelix Fietkau #define AR_PHY_LNAGAIN_LONG_SHIFT_S		29
749da6f1d7fSFelix Fietkau #define AR_PHY_MXRGAIN_LONG_SHIFT		0x03000000
750da6f1d7fSFelix Fietkau #define AR_PHY_MXRGAIN_LONG_SHIFT_S		24
751da6f1d7fSFelix Fietkau #define AR_PHY_VGAGAIN_LONG_SHIFT		0x1c000000
752da6f1d7fSFelix Fietkau #define AR_PHY_VGAGAIN_LONG_SHIFT_S		26
753da6f1d7fSFelix Fietkau #define AR_PHY_SCFIR_GAIN_LONG_SHIFT		0x00000001
754da6f1d7fSFelix Fietkau #define AR_PHY_SCFIR_GAIN_LONG_SHIFT_S		0
755da6f1d7fSFelix Fietkau #define AR_PHY_MANRXGAIN_LONG_SHIFT		0x00000002
756da6f1d7fSFelix Fietkau #define AR_PHY_MANRXGAIN_LONG_SHIFT_S		1
757da6f1d7fSFelix Fietkau 
758da6f1d7fSFelix Fietkau /*
759da6f1d7fSFelix Fietkau  * SM Field Definitions
760da6f1d7fSFelix Fietkau  */
761da6f1d7fSFelix Fietkau #define AR_PHY_CL_CAL_ENABLE          0x00000002
762da6f1d7fSFelix Fietkau #define AR_PHY_PARALLEL_CAL_ENABLE    0x00000001
763da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG1_PD_CAL_ENABLE   0x00400000
764da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG1_PD_CAL_ENABLE_S 22
765da6f1d7fSFelix Fietkau 
766da6f1d7fSFelix Fietkau #define AR_PHY_ADDAC_PARACTL_OFF_PWDADC 0x00008000
767da6f1d7fSFelix Fietkau 
768da6f1d7fSFelix Fietkau #define AR_PHY_FCAL20_CAP_STATUS_0    0x01f00000
769da6f1d7fSFelix Fietkau #define AR_PHY_FCAL20_CAP_STATUS_0_S  20
770da6f1d7fSFelix Fietkau 
771da6f1d7fSFelix Fietkau #define AR_PHY_RFBUS_REQ_EN     0x00000001  /* request for RF bus */
772da6f1d7fSFelix Fietkau #define AR_PHY_RFBUS_GRANT_EN   0x00000001  /* RF bus granted */
773da6f1d7fSFelix Fietkau #define AR_PHY_GC_TURBO_MODE       0x00000001  /* set turbo mode bits */
774da6f1d7fSFelix Fietkau #define AR_PHY_GC_TURBO_SHORT      0x00000002  /* set short symbols to turbo mode setting */
775da6f1d7fSFelix Fietkau #define AR_PHY_GC_DYN2040_EN       0x00000004  /* enable dyn 20/40 mode */
776da6f1d7fSFelix Fietkau #define AR_PHY_GC_DYN2040_PRI_ONLY 0x00000008  /* dyn 20/40 - primary only */
777da6f1d7fSFelix Fietkau #define AR_PHY_GC_DYN2040_PRI_CH   0x00000010  /* dyn 20/40 - primary ch offset (0=+10MHz, 1=-10MHz)*/
7781547da37SLuis R. Rodriguez #define AR_PHY_GC_DYN2040_PRI_CH_S 4
779da6f1d7fSFelix Fietkau #define AR_PHY_GC_DYN2040_EXT_CH   0x00000020  /* dyn 20/40 - ext ch spacing (0=20MHz/ 1=25MHz) */
780da6f1d7fSFelix Fietkau #define AR_PHY_GC_HT_EN            0x00000040  /* ht enable */
781da6f1d7fSFelix Fietkau #define AR_PHY_GC_SHORT_GI_40      0x00000080  /* allow short GI for HT 40 */
782da6f1d7fSFelix Fietkau #define AR_PHY_GC_WALSH            0x00000100  /* walsh spatial spreading for 2 chains,2 streams TX */
783da6f1d7fSFelix Fietkau #define AR_PHY_GC_SINGLE_HT_LTF1   0x00000200  /* single length (4us) 1st HT long training symbol */
784da6f1d7fSFelix Fietkau #define AR_PHY_GC_GF_DETECT_EN     0x00000400  /* enable Green Field detection. Only affects rx, not tx */
785da6f1d7fSFelix Fietkau #define AR_PHY_GC_ENABLE_DAC_FIFO  0x00000800  /* fifo between bb and dac */
786da6f1d7fSFelix Fietkau #define AR_PHY_RX_DELAY_DELAY      0x00003FFF  /* delay from wakeup to rx ena */
787da6f1d7fSFelix Fietkau 
788da6f1d7fSFelix Fietkau #define AR_PHY_CALMODE_IQ           0x00000000
789da6f1d7fSFelix Fietkau #define AR_PHY_CALMODE_ADC_GAIN     0x00000001
790da6f1d7fSFelix Fietkau #define AR_PHY_CALMODE_ADC_DC_PER   0x00000002
791da6f1d7fSFelix Fietkau #define AR_PHY_CALMODE_ADC_DC_INIT  0x00000003
792da6f1d7fSFelix Fietkau #define AR_PHY_SWAP_ALT_CHAIN       0x00000040
793da6f1d7fSFelix Fietkau #define AR_PHY_MODE_OFDM            0x00000000
794da6f1d7fSFelix Fietkau #define AR_PHY_MODE_CCK             0x00000001
795da6f1d7fSFelix Fietkau #define AR_PHY_MODE_DYNAMIC         0x00000004
7961547da37SLuis R. Rodriguez #define AR_PHY_MODE_DYNAMIC_S       2
797da6f1d7fSFelix Fietkau #define AR_PHY_MODE_HALF            0x00000020
798da6f1d7fSFelix Fietkau #define AR_PHY_MODE_QUARTER         0x00000040
799da6f1d7fSFelix Fietkau #define AR_PHY_MAC_CLK_MODE         0x00000080
800da6f1d7fSFelix Fietkau #define AR_PHY_MODE_DYN_CCK_DISABLE 0x00000100
801da6f1d7fSFelix Fietkau #define AR_PHY_MODE_SVD_HALF        0x00000200
802da6f1d7fSFelix Fietkau #define AR_PHY_ACTIVE_EN    0x00000001
803da6f1d7fSFelix Fietkau #define AR_PHY_ACTIVE_DIS   0x00000000
804da6f1d7fSFelix Fietkau #define AR_PHY_FORCE_XPA_CFG    0x000000001
805da6f1d7fSFelix Fietkau #define AR_PHY_FORCE_XPA_CFG_S  0
806da6f1d7fSFelix Fietkau #define AR_PHY_XPA_TIMING_CTL_TX_END_XPAB_OFF    0xFF000000
807da6f1d7fSFelix Fietkau #define AR_PHY_XPA_TIMING_CTL_TX_END_XPAB_OFF_S  24
808da6f1d7fSFelix Fietkau #define AR_PHY_XPA_TIMING_CTL_TX_END_XPAA_OFF    0x00FF0000
809da6f1d7fSFelix Fietkau #define AR_PHY_XPA_TIMING_CTL_TX_END_XPAA_OFF_S  16
810da6f1d7fSFelix Fietkau #define AR_PHY_XPA_TIMING_CTL_FRAME_XPAB_ON      0x0000FF00
811da6f1d7fSFelix Fietkau #define AR_PHY_XPA_TIMING_CTL_FRAME_XPAB_ON_S    8
812da6f1d7fSFelix Fietkau #define AR_PHY_XPA_TIMING_CTL_FRAME_XPAA_ON      0x000000FF
813da6f1d7fSFelix Fietkau #define AR_PHY_XPA_TIMING_CTL_FRAME_XPAA_ON_S    0
814da6f1d7fSFelix Fietkau #define AR_PHY_TX_END_TO_A2_RX_ON       0x00FF0000
815da6f1d7fSFelix Fietkau #define AR_PHY_TX_END_TO_A2_RX_ON_S     16
816da6f1d7fSFelix Fietkau #define AR_PHY_TX_END_DATA_START  0x000000FF
817da6f1d7fSFelix Fietkau #define AR_PHY_TX_END_DATA_START_S  0
818da6f1d7fSFelix Fietkau #define AR_PHY_TX_END_PA_ON       0x0000FF00
819da6f1d7fSFelix Fietkau #define AR_PHY_TX_END_PA_ON_S       8
820da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG5_PD_GAIN_OVERLAP   0x0000000F
821da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG5_PD_GAIN_OVERLAP_S     0
822da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_1    0x000003F0
823da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_1_S  4
824da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_2    0x0000FC00
825da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_2_S  10
826da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_3    0x003F0000
827da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_3_S  16
828da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4    0x0FC00000
829da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4_S  22
830da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG1_NUM_PD_GAIN   0x0000c000
831da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG1_NUM_PD_GAIN_S 14
832da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG1_PD_GAIN_1    0x00030000
833da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG1_PD_GAIN_1_S  16
834da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG1_PD_GAIN_2    0x000C0000
835da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG1_PD_GAIN_2_S  18
836da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG1_PD_GAIN_3    0x00300000
837da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG1_PD_GAIN_3_S  20
838da6f1d7fSFelix Fietkau #define AR_PHY_TPCGR1_FORCED_DAC_GAIN   0x0000003e
839da6f1d7fSFelix Fietkau #define AR_PHY_TPCGR1_FORCED_DAC_GAIN_S 1
840da6f1d7fSFelix Fietkau #define AR_PHY_TPCGR1_FORCE_DAC_GAIN    0x00000001
841da6f1d7fSFelix Fietkau #define AR_PHY_TXGAIN_FORCE               0x00000001
842858b7e36SVasanthakumar Thiagarajan #define AR_PHY_TXGAIN_FORCE_S		  0
843da6f1d7fSFelix Fietkau #define AR_PHY_TXGAIN_FORCED_PADVGNRA     0x00003c00
844da6f1d7fSFelix Fietkau #define AR_PHY_TXGAIN_FORCED_PADVGNRA_S   10
845da6f1d7fSFelix Fietkau #define AR_PHY_TXGAIN_FORCED_PADVGNRB     0x0003c000
846da6f1d7fSFelix Fietkau #define AR_PHY_TXGAIN_FORCED_PADVGNRB_S   14
847da6f1d7fSFelix Fietkau #define AR_PHY_TXGAIN_FORCED_PADVGNRD     0x00c00000
848da6f1d7fSFelix Fietkau #define AR_PHY_TXGAIN_FORCED_PADVGNRD_S   22
849da6f1d7fSFelix Fietkau #define AR_PHY_TXGAIN_FORCED_TXMXRGAIN    0x000003c0
850da6f1d7fSFelix Fietkau #define AR_PHY_TXGAIN_FORCED_TXMXRGAIN_S  6
851da6f1d7fSFelix Fietkau #define AR_PHY_TXGAIN_FORCED_TXBB1DBGAIN  0x0000000e
852da6f1d7fSFelix Fietkau #define AR_PHY_TXGAIN_FORCED_TXBB1DBGAIN_S 1
853da6f1d7fSFelix Fietkau 
854da6f1d7fSFelix Fietkau #define AR_PHY_POWER_TX_RATE1   0x9934
855da6f1d7fSFelix Fietkau #define AR_PHY_POWER_TX_RATE2   0x9938
856da6f1d7fSFelix Fietkau #define AR_PHY_POWER_TX_RATE_MAX    0x993c
857da6f1d7fSFelix Fietkau #define AR_PHY_POWER_TX_RATE_MAX_TPC_ENABLE 0x00000040
858da6f1d7fSFelix Fietkau #define PHY_AGC_CLR             0x10000000
859da6f1d7fSFelix Fietkau #define RFSILENT_BB             0x00002000
860da6f1d7fSFelix Fietkau #define AR_PHY_CHAN_INFO_GAIN_DIFF_PPM_MASK          0xFFF
861da6f1d7fSFelix Fietkau #define AR_PHY_CHAN_INFO_GAIN_DIFF_PPM_SIGNED_BIT    0x800
862da6f1d7fSFelix Fietkau #define AR_PHY_CHAN_INFO_GAIN_DIFF_UPPER_LIMIT         320
863da6f1d7fSFelix Fietkau #define AR_PHY_CHAN_INFO_MEMORY_CAPTURE_MASK         0x0001
864da6f1d7fSFelix Fietkau #define AR_PHY_RX_DELAY_DELAY   0x00003FFF
865da6f1d7fSFelix Fietkau #define AR_PHY_CCK_TX_CTRL_JAPAN    0x00000010
866620a5568SZefir Kurtisi 
867da6f1d7fSFelix Fietkau #define AR_PHY_SPECTRAL_SCAN_ENABLE           0x00000001
868da6f1d7fSFelix Fietkau #define AR_PHY_SPECTRAL_SCAN_ENABLE_S         0
869da6f1d7fSFelix Fietkau #define AR_PHY_SPECTRAL_SCAN_ACTIVE           0x00000002
870da6f1d7fSFelix Fietkau #define AR_PHY_SPECTRAL_SCAN_ACTIVE_S         1
871da6f1d7fSFelix Fietkau #define AR_PHY_SPECTRAL_SCAN_FFT_PERIOD       0x000000F0
872da6f1d7fSFelix Fietkau #define AR_PHY_SPECTRAL_SCAN_FFT_PERIOD_S     4
873da6f1d7fSFelix Fietkau #define AR_PHY_SPECTRAL_SCAN_PERIOD           0x0000FF00
874da6f1d7fSFelix Fietkau #define AR_PHY_SPECTRAL_SCAN_PERIOD_S         8
875620a5568SZefir Kurtisi #define AR_PHY_SPECTRAL_SCAN_COUNT            0x0FFF0000
876da6f1d7fSFelix Fietkau #define AR_PHY_SPECTRAL_SCAN_COUNT_S          16
877620a5568SZefir Kurtisi #define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT     0x10000000
878620a5568SZefir Kurtisi #define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_S   28
879620a5568SZefir Kurtisi #define AR_PHY_SPECTRAL_SCAN_PRIORITY         0x20000000
880620a5568SZefir Kurtisi #define AR_PHY_SPECTRAL_SCAN_PRIORITY_S       29
881620a5568SZefir Kurtisi #define AR_PHY_SPECTRAL_SCAN_USE_ERR5         0x40000000
882620a5568SZefir Kurtisi #define AR_PHY_SPECTRAL_SCAN_USE_ERR5_S       30
883620a5568SZefir Kurtisi #define AR_PHY_SPECTRAL_SCAN_COMPRESSED_RPT   0x80000000
884620a5568SZefir Kurtisi #define AR_PHY_SPECTRAL_SCAN_COMPRESSED_RPT_S 31
885620a5568SZefir Kurtisi 
886da6f1d7fSFelix Fietkau #define AR_PHY_CHANNEL_STATUS_RX_CLEAR      0x00000004
887324c74adSRajkumar Manoharan #define AR_PHY_RTT_CTRL_ENA_RADIO_RETENTION     0x00000001
888324c74adSRajkumar Manoharan #define AR_PHY_RTT_CTRL_ENA_RADIO_RETENTION_S   0
889324c74adSRajkumar Manoharan #define AR_PHY_RTT_CTRL_RESTORE_MASK            0x0000007E
890324c74adSRajkumar Manoharan #define AR_PHY_RTT_CTRL_RESTORE_MASK_S          1
891324c74adSRajkumar Manoharan #define AR_PHY_RTT_CTRL_FORCE_RADIO_RESTORE     0x00000080
892324c74adSRajkumar Manoharan #define AR_PHY_RTT_CTRL_FORCE_RADIO_RESTORE_S   7
893324c74adSRajkumar Manoharan #define AR_PHY_RTT_SW_RTT_TABLE_ACCESS          0x00000001
894324c74adSRajkumar Manoharan #define AR_PHY_RTT_SW_RTT_TABLE_ACCESS_S        0
895324c74adSRajkumar Manoharan #define AR_PHY_RTT_SW_RTT_TABLE_WRITE           0x00000002
896324c74adSRajkumar Manoharan #define AR_PHY_RTT_SW_RTT_TABLE_WRITE_S         1
897324c74adSRajkumar Manoharan #define AR_PHY_RTT_SW_RTT_TABLE_ADDR            0x0000001C
898324c74adSRajkumar Manoharan #define AR_PHY_RTT_SW_RTT_TABLE_ADDR_S          2
899324c74adSRajkumar Manoharan #define AR_PHY_RTT_SW_RTT_TABLE_DATA            0xFFFFFFF0
900324c74adSRajkumar Manoharan #define AR_PHY_RTT_SW_RTT_TABLE_DATA_S          4
9015f0c04eaSRajkumar Manoharan #define AR_PHY_TX_IQCAL_CONTROL_0_ENABLE_TXIQ_CAL                   0x80000000
9028ad74c4dSRajkumar Manoharan #define AR_PHY_TX_IQCAL_CONTROL_0_ENABLE_TXIQ_CAL_S                         31
9033782c69dSRajkumar Manoharan #define AR_PHY_TX_IQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT             0x01fc0000
9043782c69dSRajkumar Manoharan #define AR_PHY_TX_IQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT_S                   18
905da6f1d7fSFelix Fietkau #define AR_PHY_TX_IQCAL_START_DO_CAL	    0x00000001
906da6f1d7fSFelix Fietkau #define AR_PHY_TX_IQCAL_START_DO_CAL_S	    0
907da6f1d7fSFelix Fietkau 
908da6f1d7fSFelix Fietkau #define AR_PHY_TX_IQCAL_STATUS_FAILED    0x00000001
909858b7e36SVasanthakumar Thiagarajan #define AR_PHY_CALIBRATED_GAINS_0	 0x3e
910858b7e36SVasanthakumar Thiagarajan #define AR_PHY_CALIBRATED_GAINS_0_S	 1
911858b7e36SVasanthakumar Thiagarajan 
912858b7e36SVasanthakumar Thiagarajan #define AR_PHY_TX_IQCAL_CORR_COEFF_00_COEFF_TABLE      0x00003fff
913858b7e36SVasanthakumar Thiagarajan #define AR_PHY_TX_IQCAL_CORR_COEFF_00_COEFF_TABLE_S    0
914858b7e36SVasanthakumar Thiagarajan #define AR_PHY_TX_IQCAL_CORR_COEFF_01_COEFF_TABLE      0x0fffc000
915858b7e36SVasanthakumar Thiagarajan #define AR_PHY_TX_IQCAL_CORR_COEFF_01_COEFF_TABLE_S    14
916da6f1d7fSFelix Fietkau 
917da6f1d7fSFelix Fietkau #define AR_PHY_65NM_CH0_RXTX4_THERM_ON          0x10000000
918da6f1d7fSFelix Fietkau #define AR_PHY_65NM_CH0_RXTX4_THERM_ON_S        28
91902eba421SRajkumar Manoharan #define AR_PHY_65NM_CH0_RXTX4_THERM_ON_OVR      0x20000000
92002eba421SRajkumar Manoharan #define AR_PHY_65NM_CH0_RXTX4_THERM_ON_OVR_S    29
921da6f1d7fSFelix Fietkau 
9223e2ea543SFelix Fietkau #define AR_PHY_65NM_RXTX4_XLNA_BIAS		0xC0000000
9233e2ea543SFelix Fietkau #define AR_PHY_65NM_RXTX4_XLNA_BIAS_S		30
9243e2ea543SFelix Fietkau 
925da6f1d7fSFelix Fietkau /*
926da6f1d7fSFelix Fietkau  * Channel 1 Register Map
927da6f1d7fSFelix Fietkau  */
928da6f1d7fSFelix Fietkau #define AR_CHAN1_BASE	0xa800
929da6f1d7fSFelix Fietkau 
930da6f1d7fSFelix Fietkau #define AR_PHY_EXT_CCA_1            (AR_CHAN1_BASE + 0x30)
931da6f1d7fSFelix Fietkau #define AR_PHY_TX_PHASE_RAMP_1      (AR_CHAN1_BASE + 0xd0)
932da6f1d7fSFelix Fietkau #define AR_PHY_ADC_GAIN_DC_CORR_1   (AR_CHAN1_BASE + 0xd4)
933da6f1d7fSFelix Fietkau 
934da6f1d7fSFelix Fietkau #define AR_PHY_SPUR_REPORT_1        (AR_CHAN1_BASE + 0xa8)
935da6f1d7fSFelix Fietkau #define AR_PHY_CHAN_INFO_TAB_1      (AR_CHAN1_BASE + 0x300)
936da6f1d7fSFelix Fietkau #define AR_PHY_RX_IQCAL_CORR_B1     (AR_CHAN1_BASE + 0xdc)
937da6f1d7fSFelix Fietkau 
938da6f1d7fSFelix Fietkau /*
939da6f1d7fSFelix Fietkau  * Channel 1 Field Definitions
940da6f1d7fSFelix Fietkau  */
941da6f1d7fSFelix Fietkau #define AR_PHY_CH1_EXT_MINCCA_PWR   0x01FF0000
942da6f1d7fSFelix Fietkau #define AR_PHY_CH1_EXT_MINCCA_PWR_S 16
943da6f1d7fSFelix Fietkau 
944da6f1d7fSFelix Fietkau /*
945da6f1d7fSFelix Fietkau  * AGC 1 Register Map
946da6f1d7fSFelix Fietkau  */
947da6f1d7fSFelix Fietkau #define AR_AGC1_BASE	0xae00
948da6f1d7fSFelix Fietkau 
949da6f1d7fSFelix Fietkau #define AR_PHY_FORCEMAX_GAINS_1      (AR_AGC1_BASE + 0x4)
950da6f1d7fSFelix Fietkau #define AR_PHY_EXT_ATTEN_CTL_1       (AR_AGC1_BASE + 0x18)
951da6f1d7fSFelix Fietkau #define AR_PHY_CCA_1                 (AR_AGC1_BASE + 0x1c)
952da6f1d7fSFelix Fietkau #define AR_PHY_CCA_CTRL_1            (AR_AGC1_BASE + 0x20)
953da6f1d7fSFelix Fietkau #define AR_PHY_RSSI_1                (AR_AGC1_BASE + 0x180)
954da6f1d7fSFelix Fietkau #define AR_PHY_SPUR_CCK_REP_1        (AR_AGC1_BASE + 0x184)
955da6f1d7fSFelix Fietkau #define AR_PHY_RX_OCGAIN_2           (AR_AGC1_BASE + 0x200)
956da6f1d7fSFelix Fietkau 
957da6f1d7fSFelix Fietkau /*
958da6f1d7fSFelix Fietkau  * AGC 1 Field Definitions
959da6f1d7fSFelix Fietkau  */
960da6f1d7fSFelix Fietkau #define AR_PHY_CH1_MINCCA_PWR   0x1FF00000
961da6f1d7fSFelix Fietkau #define AR_PHY_CH1_MINCCA_PWR_S 20
962da6f1d7fSFelix Fietkau 
963da6f1d7fSFelix Fietkau /*
964da6f1d7fSFelix Fietkau  * SM 1 Register Map
965da6f1d7fSFelix Fietkau  */
966da6f1d7fSFelix Fietkau #define AR_SM1_BASE	0xb200
967da6f1d7fSFelix Fietkau 
968da6f1d7fSFelix Fietkau #define AR_PHY_SWITCH_CHAIN_1   (AR_SM1_BASE + 0x84)
969da6f1d7fSFelix Fietkau #define AR_PHY_FCAL_2_1         (AR_SM1_BASE + 0xd0)
970da6f1d7fSFelix Fietkau #define AR_PHY_DFT_TONE_CTL_1   (AR_SM1_BASE + 0xd4)
971da6f1d7fSFelix Fietkau #define AR_PHY_CL_TAB_1         (AR_SM1_BASE + 0x100)
972da6f1d7fSFelix Fietkau #define AR_PHY_CHAN_INFO_GAIN_1 (AR_SM1_BASE + 0x180)
973da6f1d7fSFelix Fietkau #define AR_PHY_TPC_4_B1         (AR_SM1_BASE + 0x204)
974da6f1d7fSFelix Fietkau #define AR_PHY_TPC_5_B1         (AR_SM1_BASE + 0x208)
975da6f1d7fSFelix Fietkau #define AR_PHY_TPC_6_B1         (AR_SM1_BASE + 0x20c)
976da6f1d7fSFelix Fietkau #define AR_PHY_TPC_11_B1        (AR_SM1_BASE + 0x220)
977*b3a663f0SWenli Looi #define AR_PHY_PDADC_TAB_1(_ah)	(AR_SM1_BASE + (AR_SREV_9462_20_OR_LATER(_ah) ? \
978fd26981cSRajkumar Manoharan 					0x280 : 0x240))
979ce407afcSSenthil Balasubramanian #define AR_PHY_TPC_19_B1	(AR_SM1_BASE + 0x240)
980ce407afcSSenthil Balasubramanian #define AR_PHY_TPC_19_B1_ALPHA_THERM		0xff
981ce407afcSSenthil Balasubramanian #define AR_PHY_TPC_19_B1_ALPHA_THERM_S		0
982da6f1d7fSFelix Fietkau #define AR_PHY_TX_IQCAL_STATUS_B1   (AR_SM1_BASE + 0x48c)
983118c9db5SAlex Hacker #define AR_PHY_TX_IQCAL_CORR_COEFF_B1(_i)    (AR_SM1_BASE + 0x450 + ((_i) << 2))
984da6f1d7fSFelix Fietkau 
98552d6d4efSRajkumar Manoharan #define AR_PHY_RTT_TABLE_SW_INTF_B(i)	(0x384 + ((i) ? \
98652d6d4efSRajkumar Manoharan 					AR_SM1_BASE : AR_SM_BASE))
98752d6d4efSRajkumar Manoharan #define AR_PHY_RTT_TABLE_SW_INTF_1_B(i)	(0x388 + ((i) ? \
98852d6d4efSRajkumar Manoharan 					AR_SM1_BASE : AR_SM_BASE))
989da6f1d7fSFelix Fietkau /*
990da6f1d7fSFelix Fietkau  * Channel 2 Register Map
991da6f1d7fSFelix Fietkau  */
992da6f1d7fSFelix Fietkau #define AR_CHAN2_BASE	0xb800
993da6f1d7fSFelix Fietkau 
994da6f1d7fSFelix Fietkau #define AR_PHY_EXT_CCA_2            (AR_CHAN2_BASE + 0x30)
995da6f1d7fSFelix Fietkau #define AR_PHY_TX_PHASE_RAMP_2      (AR_CHAN2_BASE + 0xd0)
996da6f1d7fSFelix Fietkau #define AR_PHY_ADC_GAIN_DC_CORR_2   (AR_CHAN2_BASE + 0xd4)
997da6f1d7fSFelix Fietkau 
998da6f1d7fSFelix Fietkau #define AR_PHY_SPUR_REPORT_2        (AR_CHAN2_BASE + 0xa8)
999da6f1d7fSFelix Fietkau #define AR_PHY_CHAN_INFO_TAB_2      (AR_CHAN2_BASE + 0x300)
1000da6f1d7fSFelix Fietkau #define AR_PHY_RX_IQCAL_CORR_B2     (AR_CHAN2_BASE + 0xdc)
1001da6f1d7fSFelix Fietkau 
1002da6f1d7fSFelix Fietkau /*
1003da6f1d7fSFelix Fietkau  * Channel 2 Field Definitions
1004da6f1d7fSFelix Fietkau  */
1005da6f1d7fSFelix Fietkau #define AR_PHY_CH2_EXT_MINCCA_PWR   0x01FF0000
1006da6f1d7fSFelix Fietkau #define AR_PHY_CH2_EXT_MINCCA_PWR_S 16
1007da6f1d7fSFelix Fietkau /*
1008da6f1d7fSFelix Fietkau  * AGC 2 Register Map
1009da6f1d7fSFelix Fietkau  */
1010da6f1d7fSFelix Fietkau #define AR_AGC2_BASE	0xbe00
1011da6f1d7fSFelix Fietkau 
1012da6f1d7fSFelix Fietkau #define AR_PHY_FORCEMAX_GAINS_2      (AR_AGC2_BASE + 0x4)
1013da6f1d7fSFelix Fietkau #define AR_PHY_EXT_ATTEN_CTL_2       (AR_AGC2_BASE + 0x18)
1014da6f1d7fSFelix Fietkau #define AR_PHY_CCA_2                 (AR_AGC2_BASE + 0x1c)
1015da6f1d7fSFelix Fietkau #define AR_PHY_CCA_CTRL_2            (AR_AGC2_BASE + 0x20)
1016da6f1d7fSFelix Fietkau #define AR_PHY_RSSI_2                (AR_AGC2_BASE + 0x180)
1017da6f1d7fSFelix Fietkau 
1018da6f1d7fSFelix Fietkau /*
1019da6f1d7fSFelix Fietkau  * AGC 2 Field Definitions
1020da6f1d7fSFelix Fietkau  */
1021da6f1d7fSFelix Fietkau #define AR_PHY_CH2_MINCCA_PWR   0x1FF00000
1022da6f1d7fSFelix Fietkau #define AR_PHY_CH2_MINCCA_PWR_S 20
1023da6f1d7fSFelix Fietkau 
1024da6f1d7fSFelix Fietkau /*
1025da6f1d7fSFelix Fietkau  * SM 2 Register Map
1026da6f1d7fSFelix Fietkau  */
1027da6f1d7fSFelix Fietkau #define AR_SM2_BASE	0xc200
1028da6f1d7fSFelix Fietkau 
1029da6f1d7fSFelix Fietkau #define AR_PHY_SWITCH_CHAIN_2    (AR_SM2_BASE + 0x84)
1030da6f1d7fSFelix Fietkau #define AR_PHY_FCAL_2_2          (AR_SM2_BASE + 0xd0)
1031da6f1d7fSFelix Fietkau #define AR_PHY_DFT_TONE_CTL_2    (AR_SM2_BASE + 0xd4)
1032da6f1d7fSFelix Fietkau #define AR_PHY_CL_TAB_2          (AR_SM2_BASE + 0x100)
1033da6f1d7fSFelix Fietkau #define AR_PHY_CHAN_INFO_GAIN_2  (AR_SM2_BASE + 0x180)
1034da6f1d7fSFelix Fietkau #define AR_PHY_TPC_4_B2          (AR_SM2_BASE + 0x204)
1035da6f1d7fSFelix Fietkau #define AR_PHY_TPC_5_B2          (AR_SM2_BASE + 0x208)
1036da6f1d7fSFelix Fietkau #define AR_PHY_TPC_6_B2          (AR_SM2_BASE + 0x20c)
1037da6f1d7fSFelix Fietkau #define AR_PHY_TPC_11_B2         (AR_SM2_BASE + 0x220)
10382d7caefbSSujith Manoharan #define AR_PHY_TPC_19_B2         (AR_SM2_BASE + 0x240)
1039da6f1d7fSFelix Fietkau #define AR_PHY_TX_IQCAL_STATUS_B2   (AR_SM2_BASE + 0x48c)
104031faff81SVasanthakumar Thiagarajan #define AR_PHY_TX_IQCAL_CORR_COEFF_B2(_i)    (AR_SM2_BASE + 0x450 + ((_i) << 2))
1041da6f1d7fSFelix Fietkau 
1042da6f1d7fSFelix Fietkau #define AR_PHY_TX_IQCAL_STATUS_B2_FAILED    0x00000001
1043da6f1d7fSFelix Fietkau 
1044da6f1d7fSFelix Fietkau /*
1045da6f1d7fSFelix Fietkau  * AGC 3 Register Map
1046da6f1d7fSFelix Fietkau  */
1047da6f1d7fSFelix Fietkau #define AR_AGC3_BASE	0xce00
1048da6f1d7fSFelix Fietkau 
1049da6f1d7fSFelix Fietkau #define AR_PHY_RSSI_3            (AR_AGC3_BASE + 0x180)
1050da6f1d7fSFelix Fietkau 
1051ce407afcSSenthil Balasubramanian /* GLB Registers */
1052ce407afcSSenthil Balasubramanian #define AR_GLB_BASE	0x20000
10532ee4bd1eSMohammed Shafi Shajakhan #define AR_GLB_GPIO_CONTROL	(AR_GLB_BASE)
1054ce407afcSSenthil Balasubramanian #define AR_PHY_GLB_CONTROL	(AR_GLB_BASE + 0x44)
1055ce407afcSSenthil Balasubramanian #define AR_GLB_SCRATCH(_ah)	(AR_GLB_BASE + \
10562b5e54e2SSujith Manoharan 					(AR_SREV_9462_20_OR_LATER(_ah) ? 0x4c : 0x50))
1057ce407afcSSenthil Balasubramanian #define AR_GLB_STATUS		(AR_GLB_BASE + 0x48)
1058ce407afcSSenthil Balasubramanian 
1059da6f1d7fSFelix Fietkau /*
1060da6f1d7fSFelix Fietkau  * Misc helper defines
1061da6f1d7fSFelix Fietkau  */
1062da6f1d7fSFelix Fietkau #define AR_PHY_CHAIN_OFFSET     (AR_CHAN1_BASE - AR_CHAN_BASE)
1063da6f1d7fSFelix Fietkau 
1064da6f1d7fSFelix Fietkau #define AR_PHY_NEW_ADC_DC_GAIN_CORR(_i) (AR_PHY_ADC_GAIN_DC_CORR_0 + (AR_PHY_CHAIN_OFFSET * (_i)))
1065da6f1d7fSFelix Fietkau #define AR_PHY_NEW_ADC_DC_GAIN_CORR_9300_10(_i) (AR_PHY_ADC_GAIN_DC_CORR_0_9300_10 + (AR_PHY_CHAIN_OFFSET * (_i)))
1066da6f1d7fSFelix Fietkau #define AR_PHY_SWITCH_CHAIN(_i)     (AR_PHY_SWITCH_CHAIN_0 + (AR_PHY_CHAIN_OFFSET * (_i)))
1067da6f1d7fSFelix Fietkau #define AR_PHY_EXT_ATTEN_CTL(_i)    (AR_PHY_EXT_ATTEN_CTL_0 + (AR_PHY_CHAIN_OFFSET * (_i)))
1068da6f1d7fSFelix Fietkau 
1069da6f1d7fSFelix Fietkau #define AR_PHY_RXGAIN(_i)           (AR_PHY_FORCEMAX_GAINS_0 + (AR_PHY_CHAIN_OFFSET * (_i)))
1070da6f1d7fSFelix Fietkau #define AR_PHY_TPCRG5(_i)           (AR_PHY_TPC_5_B0 + (AR_PHY_CHAIN_OFFSET * (_i)))
1071da6f1d7fSFelix Fietkau #define AR_PHY_PDADC_TAB(_i)        (AR_PHY_PDADC_TAB_0 + (AR_PHY_CHAIN_OFFSET * (_i)))
1072da6f1d7fSFelix Fietkau 
1073da6f1d7fSFelix Fietkau #define AR_PHY_CAL_MEAS_0(_i)       (AR_PHY_IQ_ADC_MEAS_0_B0 + (AR_PHY_CHAIN_OFFSET * (_i)))
1074da6f1d7fSFelix Fietkau #define AR_PHY_CAL_MEAS_1(_i)       (AR_PHY_IQ_ADC_MEAS_1_B0 + (AR_PHY_CHAIN_OFFSET * (_i)))
1075da6f1d7fSFelix Fietkau #define AR_PHY_CAL_MEAS_2(_i)       (AR_PHY_IQ_ADC_MEAS_2_B0 + (AR_PHY_CHAIN_OFFSET * (_i)))
1076da6f1d7fSFelix Fietkau #define AR_PHY_CAL_MEAS_3(_i)       (AR_PHY_IQ_ADC_MEAS_3_B0 + (AR_PHY_CHAIN_OFFSET * (_i)))
1077da6f1d7fSFelix Fietkau #define AR_PHY_CAL_MEAS_0_9300_10(_i) (AR_PHY_IQ_ADC_MEAS_0_B0_9300_10 + (AR_PHY_CHAIN_OFFSET * (_i)))
1078da6f1d7fSFelix Fietkau #define AR_PHY_CAL_MEAS_1_9300_10(_i) (AR_PHY_IQ_ADC_MEAS_1_B0_9300_10 + (AR_PHY_CHAIN_OFFSET * (_i)))
1079da6f1d7fSFelix Fietkau #define AR_PHY_CAL_MEAS_2_9300_10(_i) (AR_PHY_IQ_ADC_MEAS_2_B0_9300_10 + (AR_PHY_CHAIN_OFFSET * (_i)))
1080da6f1d7fSFelix Fietkau #define AR_PHY_CAL_MEAS_3_9300_10(_i) (AR_PHY_IQ_ADC_MEAS_3_B0_9300_10 + (AR_PHY_CHAIN_OFFSET * (_i)))
1081da6f1d7fSFelix Fietkau 
1082aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_NON_IDLE_ENABLE    0x00000001
1083aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_IDLE_ENABLE        0x00000002
1084aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_IDLE_MASK          0xFFFF0000
1085aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_NON_IDLE_MASK      0x0000FFFC
1086da6f1d7fSFelix Fietkau 
1087aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_RST_ENABLE         0x00000002
1088aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_IRQ_ENABLE         0x00000004
1089aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_CNTL2_MASK         0xFFFFFFF9
1090da6f1d7fSFelix Fietkau 
1091aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_INFO               0x00000007
1092aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_INFO_S             0
1093aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_DET_HANG           0x00000008
1094aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_DET_HANG_S         3
1095aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_RADAR_SM           0x000000F0
1096aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_RADAR_SM_S         4
1097aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_RX_OFDM_SM         0x00000F00
1098aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_RX_OFDM_SM_S       8
1099aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_RX_CCK_SM          0x0000F000
1100aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_RX_CCK_SM_S        12
1101aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_TX_OFDM_SM         0x000F0000
1102aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_TX_OFDM_SM_S       16
1103aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_TX_CCK_SM          0x00F00000
1104aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_TX_CCK_SM_S        20
1105aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_AGC_SM             0x0F000000
1106aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_AGC_SM_S           24
1107aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_SRCH_SM            0xF0000000
1108aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_SRCH_SM_S          28
1109da6f1d7fSFelix Fietkau 
1110aea702b7SLuis R. Rodriguez #define AR_PHY_WATCHDOG_STATUS_CLR         0x00000008
1111da6f1d7fSFelix Fietkau 
1112ab334498SFelix Fietkau /*
1113ab334498SFelix Fietkau  * PAPRD registers
1114ab334498SFelix Fietkau  */
1115ab334498SFelix Fietkau #define AR_PHY_XPA_TIMING_CTL		(AR_SM_BASE + 0x64)
1116ab334498SFelix Fietkau 
1117ab334498SFelix Fietkau #define AR_PHY_PAPRD_AM2AM		(AR_CHAN_BASE + 0xe4)
1118ab334498SFelix Fietkau #define AR_PHY_PAPRD_AM2AM_MASK		0x01ffffff
1119ab334498SFelix Fietkau #define AR_PHY_PAPRD_AM2AM_MASK_S	0
1120ab334498SFelix Fietkau 
1121ab334498SFelix Fietkau #define AR_PHY_PAPRD_AM2PM		(AR_CHAN_BASE + 0xe8)
1122ab334498SFelix Fietkau #define AR_PHY_PAPRD_AM2PM_MASK		0x01ffffff
1123ab334498SFelix Fietkau #define AR_PHY_PAPRD_AM2PM_MASK_S	0
1124ab334498SFelix Fietkau 
1125ab334498SFelix Fietkau #define AR_PHY_PAPRD_HT40		(AR_CHAN_BASE + 0xec)
1126ab334498SFelix Fietkau #define AR_PHY_PAPRD_HT40_MASK		0x01ffffff
1127ab334498SFelix Fietkau #define AR_PHY_PAPRD_HT40_MASK_S	0
1128ab334498SFelix Fietkau 
1129ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL0_B0				(AR_CHAN_BASE + 0xf0)
1130ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL0_B1				(AR_CHAN1_BASE + 0xf0)
1131ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL0_B2				(AR_CHAN2_BASE + 0xf0)
1132ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL0_PAPRD_ENABLE			0x00000001
1133ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL0_PAPRD_ENABLE_S		0
1134ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL0_USE_SINGLE_TABLE_MASK	0x00000002
1135ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL0_USE_SINGLE_TABLE_MASK_S	1
1136ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL0_PAPRD_MAG_THRSH		0xf8000000
1137ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL0_PAPRD_MAG_THRSH_S		27
1138ab334498SFelix Fietkau 
1139ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL1_B0				(AR_CHAN_BASE + 0xf4)
1140ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL1_B1				(AR_CHAN1_BASE + 0xf4)
1141ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL1_B2				(AR_CHAN2_BASE + 0xf4)
1142ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL1_ADAPTIVE_SCALING_ENA		0x00000001
1143ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL1_ADAPTIVE_SCALING_ENA_S	0
1144ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL1_ADAPTIVE_AM2AM_ENABLE	0x00000002
1145ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL1_ADAPTIVE_AM2AM_ENABLE_S	1
1146ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL1_ADAPTIVE_AM2PM_ENABLE	0x00000004
1147ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL1_ADAPTIVE_AM2PM_ENABLE_S	2
1148ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL	0x000001f8
1149ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL_S	3
1150ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL1_PA_GAIN_SCALE_FACT_MASK	0x0001fe00
1151ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL1_PA_GAIN_SCALE_FACT_MASK_S	9
1152ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL1_PAPRD_MAG_SCALE_FACT		0x0ffe0000
1153ab334498SFelix Fietkau #define AR_PHY_PAPRD_CTRL1_PAPRD_MAG_SCALE_FACT_S	17
1154ab334498SFelix Fietkau 
1155*b3a663f0SWenli Looi #define AR_PHY_PAPRD_TRAINER_CNTL1(_ah) (AR_SM_BASE + (AR_SREV_9485(_ah) ? 0x580 : 0x490))
1156b8a95db7SSujith Manoharan 
1157ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL1_CF_CF_PAPRD_TRAIN_ENABLE	0x00000001
1158ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL1_CF_CF_PAPRD_TRAIN_ENABLE_S	0
1159ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING	0x0000007e
1160ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING_S	1
1161ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_IQCORR_ENABLE	0x00000100
1162ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_IQCORR_ENABLE_S	8
1163ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_RX_BB_GAIN_FORCE	0x00000200
1164ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_RX_BB_GAIN_FORCE_S	9
1165ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_TX_GAIN_FORCE	0x00000400
1166ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_TX_GAIN_FORCE_S	10
1167ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_ENABLE		0x00000800
1168ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_ENABLE_S		11
1169ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP		0x0003f000
1170ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP_S		12
1171ab334498SFelix Fietkau 
1172*b3a663f0SWenli Looi #define AR_PHY_PAPRD_TRAINER_CNTL2(_ah) (AR_SM_BASE + (AR_SREV_9485(_ah) ? 0x584 : 0x494))
1173b8a95db7SSujith Manoharan 
1174ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN	0xFFFFFFFF
1175ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN_S	0
1176ab334498SFelix Fietkau 
1177*b3a663f0SWenli Looi #define AR_PHY_PAPRD_TRAINER_CNTL3(_ah) (AR_SM_BASE + (AR_SREV_9485(_ah) ? 0x588 : 0x498))
1178b8a95db7SSujith Manoharan 
1179ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE	0x0000003f
1180ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE_S	0
1181ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP		0x00000fc0
1182ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP_S	6
1183ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_MIN_LOOPBACK_DEL	0x0001f000
1184ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_MIN_LOOPBACK_DEL_S	12
1185ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_NUM_CORR_STAGES	0x000e0000
1186ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_NUM_CORR_STAGES_S	17
1187ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_COARSE_CORR_LEN	0x00f00000
1188ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_COARSE_CORR_LEN_S	20
1189ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_FINE_CORR_LEN	0x0f000000
1190ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_FINE_CORR_LEN_S	24
1191ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE	0x20000000
1192ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE_S	29
1193ab334498SFelix Fietkau 
1194*b3a663f0SWenli Looi #define AR_PHY_PAPRD_TRAINER_CNTL4(_ah) (AR_SM_BASE + (AR_SREV_9485(_ah) ? 0x58c : 0x49c))
1195b8a95db7SSujith Manoharan 
1196ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES	0x03ff0000
1197ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES_S	16
1198ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_SAFETY_DELTA	0x0000f000
1199ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_SAFETY_DELTA_S	12
1200ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_MIN_CORR		0x00000fff
1201ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_MIN_CORR_S		0
1202ab334498SFelix Fietkau 
1203ab334498SFelix Fietkau #define AR_PHY_PAPRD_PRE_POST_SCALE_0_B0			(AR_CHAN_BASE + 0x100)
1204ab334498SFelix Fietkau #define AR_PHY_PAPRD_PRE_POST_SCALE_1_B0			(AR_CHAN_BASE + 0x104)
1205ab334498SFelix Fietkau #define AR_PHY_PAPRD_PRE_POST_SCALE_2_B0			(AR_CHAN_BASE + 0x108)
1206ab334498SFelix Fietkau #define AR_PHY_PAPRD_PRE_POST_SCALE_3_B0			(AR_CHAN_BASE + 0x10c)
1207ab334498SFelix Fietkau #define AR_PHY_PAPRD_PRE_POST_SCALE_4_B0			(AR_CHAN_BASE + 0x110)
1208ab334498SFelix Fietkau #define AR_PHY_PAPRD_PRE_POST_SCALE_5_B0			(AR_CHAN_BASE + 0x114)
1209ab334498SFelix Fietkau #define AR_PHY_PAPRD_PRE_POST_SCALE_6_B0			(AR_CHAN_BASE + 0x118)
1210ab334498SFelix Fietkau #define AR_PHY_PAPRD_PRE_POST_SCALE_7_B0			(AR_CHAN_BASE + 0x11c)
1211ab334498SFelix Fietkau #define AR_PHY_PAPRD_PRE_POST_SCALING				0x3FFFF
1212ab334498SFelix Fietkau #define AR_PHY_PAPRD_PRE_POST_SCALING_S				0
1213ab334498SFelix Fietkau 
1214*b3a663f0SWenli Looi #define AR_PHY_PAPRD_TRAINER_STAT1(_ah) (AR_SM_BASE + (AR_SREV_9485(_ah) ? 0x590 : 0x4a0))
1215b8a95db7SSujith Manoharan 
1216ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE		0x00000001
1217ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE_S		0
1218ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_INCOMPLETE	0x00000002
1219ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_INCOMPLETE_S	1
1220ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_CORR_ERR		0x00000004
1221ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_CORR_ERR_S		2
1222ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_ACTIVE		0x00000008
1223ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_ACTIVE_S		3
1224ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_RX_GAIN_IDX		0x000001f0
1225ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_RX_GAIN_IDX_S		4
1226ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR		0x0001fe00
1227ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR_S		9
1228ab334498SFelix Fietkau 
1229*b3a663f0SWenli Looi #define AR_PHY_PAPRD_TRAINER_STAT2(_ah) (AR_SM_BASE + (AR_SREV_9485(_ah) ? 0x594 : 0x4a4))
1230b8a95db7SSujith Manoharan 
1231ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_FINE_VAL		0x0000ffff
1232ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_FINE_VAL_S		0
1233ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_COARSE_IDX		0x001f0000
1234ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_COARSE_IDX_S		16
1235ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_FINE_IDX		0x00600000
1236ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_FINE_IDX_S		21
1237ab334498SFelix Fietkau 
1238*b3a663f0SWenli Looi #define AR_PHY_PAPRD_TRAINER_STAT3(_ah) (AR_SM_BASE + (AR_SREV_9485(_ah) ? 0x598 : 0x4a8))
1239b8a95db7SSujith Manoharan 
1240ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_STAT3_PAPRD_TRAIN_SAMPLES_CNT	0x000fffff
1241ab334498SFelix Fietkau #define AR_PHY_PAPRD_TRAINER_STAT3_PAPRD_TRAIN_SAMPLES_CNT_S	0
1242ab334498SFelix Fietkau 
1243ab334498SFelix Fietkau #define AR_PHY_PAPRD_MEM_TAB_B0			(AR_CHAN_BASE + 0x120)
1244ab334498SFelix Fietkau #define AR_PHY_PAPRD_MEM_TAB_B1			(AR_CHAN1_BASE + 0x120)
1245ab334498SFelix Fietkau #define AR_PHY_PAPRD_MEM_TAB_B2			(AR_CHAN2_BASE + 0x120)
1246ab334498SFelix Fietkau 
1247ab334498SFelix Fietkau #define AR_PHY_PA_GAIN123_B0			(AR_CHAN_BASE + 0xf8)
1248ab334498SFelix Fietkau #define AR_PHY_PA_GAIN123_B1			(AR_CHAN1_BASE + 0xf8)
1249ab334498SFelix Fietkau #define AR_PHY_PA_GAIN123_B2			(AR_CHAN2_BASE + 0xf8)
1250ab334498SFelix Fietkau #define AR_PHY_PA_GAIN123_PA_GAIN1		0x3FF
1251ab334498SFelix Fietkau #define AR_PHY_PA_GAIN123_PA_GAIN1_S		0
1252ab334498SFelix Fietkau 
1253ab334498SFelix Fietkau #define AR_PHY_POWERTX_RATE5			(AR_SM_BASE + 0x1d0)
1254ab334498SFelix Fietkau #define AR_PHY_POWERTX_RATE5_POWERTXHT20_0	0x3F
1255ab334498SFelix Fietkau #define AR_PHY_POWERTX_RATE5_POWERTXHT20_0_S	0
1256ab334498SFelix Fietkau 
12571bf38661SFelix Fietkau #define AR_PHY_POWERTX_RATE6			(AR_SM_BASE + 0x1d4)
12581bf38661SFelix Fietkau #define AR_PHY_POWERTX_RATE6_POWERTXHT20_5	0x3F00
12591bf38661SFelix Fietkau #define AR_PHY_POWERTX_RATE6_POWERTXHT20_5_S	8
12601bf38661SFelix Fietkau 
12611bf38661SFelix Fietkau #define AR_PHY_POWERTX_RATE8			(AR_SM_BASE + 0x1dc)
12621bf38661SFelix Fietkau #define AR_PHY_POWERTX_RATE8_POWERTXHT40_5	0x3F00
12631bf38661SFelix Fietkau #define AR_PHY_POWERTX_RATE8_POWERTXHT40_5_S	8
12641bf38661SFelix Fietkau 
1265f68e20f0SMohammed Shafi Shajakhan #define AR_PHY_CL_TAB_CL_GAIN_MOD		0x1f
1266f68e20f0SMohammed Shafi Shajakhan #define AR_PHY_CL_TAB_CL_GAIN_MOD_S		0
1267f68e20f0SMohammed Shafi Shajakhan 
1268362cd03fSSujith Manoharan #define AR_BTCOEX_WL_LNADIV                                0x1a64
1269362cd03fSSujith Manoharan #define AR_BTCOEX_WL_LNADIV_PREDICTED_PERIOD               0x00003FFF
1270362cd03fSSujith Manoharan #define AR_BTCOEX_WL_LNADIV_PREDICTED_PERIOD_S             0
1271362cd03fSSujith Manoharan #define AR_BTCOEX_WL_LNADIV_DPDT_IGNORE_PRIORITY           0x00004000
1272362cd03fSSujith Manoharan #define AR_BTCOEX_WL_LNADIV_DPDT_IGNORE_PRIORITY_S         14
1273362cd03fSSujith Manoharan #define AR_BTCOEX_WL_LNADIV_FORCE_ON                       0x00008000
1274362cd03fSSujith Manoharan #define AR_BTCOEX_WL_LNADIV_FORCE_ON_S                     15
1275362cd03fSSujith Manoharan #define AR_BTCOEX_WL_LNADIV_MODE_OPTION                    0x00030000
1276362cd03fSSujith Manoharan #define AR_BTCOEX_WL_LNADIV_MODE_OPTION_S                  16
1277362cd03fSSujith Manoharan #define AR_BTCOEX_WL_LNADIV_MODE                           0x007c0000
1278362cd03fSSujith Manoharan #define AR_BTCOEX_WL_LNADIV_MODE_S                         18
1279362cd03fSSujith Manoharan #define AR_BTCOEX_WL_LNADIV_ALLOWED_TX_ANTDIV_WL_TX_REQ    0x00800000
1280362cd03fSSujith Manoharan #define AR_BTCOEX_WL_LNADIV_ALLOWED_TX_ANTDIV_WL_TX_REQ_S  23
1281362cd03fSSujith Manoharan #define AR_BTCOEX_WL_LNADIV_DISABLE_TX_ANTDIV_ENABLE       0x01000000
1282362cd03fSSujith Manoharan #define AR_BTCOEX_WL_LNADIV_DISABLE_TX_ANTDIV_ENABLE_S     24
1283362cd03fSSujith Manoharan #define AR_BTCOEX_WL_LNADIV_CONTINUOUS_BT_ACTIVE_PROTECT   0x02000000
1284362cd03fSSujith Manoharan #define AR_BTCOEX_WL_LNADIV_CONTINUOUS_BT_ACTIVE_PROTECT_S 25
1285362cd03fSSujith Manoharan #define AR_BTCOEX_WL_LNADIV_BT_INACTIVE_THRESHOLD          0xFC000000
1286362cd03fSSujith Manoharan #define AR_BTCOEX_WL_LNADIV_BT_INACTIVE_THRESHOLD_S        26
1287362cd03fSSujith Manoharan 
12880b6eb366SRajkumar Manoharan /* Manual Peak detector calibration */
12890b6eb366SRajkumar Manoharan #define AR_PHY_65NM_BASE                               0x16000
12900b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_GAINSTAGES(i)                 (AR_PHY_65NM_BASE + \
12910b6eb366SRajkumar Manoharan 							(i * 0x400) + 0x8)
12920b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_GAINSTAGES_RX_OVERRIDE        0x80000000
12930b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_GAINSTAGES_RX_OVERRIDE_S      31
12940b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_GAINSTAGES_LNAON_CALDC        0x00000002
12950b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_GAINSTAGES_LNAON_CALDC_S      1
12960b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_GAINSTAGES_LNA2G_GAIN_OVR     0x70000000
12970b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_GAINSTAGES_LNA2G_GAIN_OVR_S   28
12980b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_GAINSTAGES_LNA5G_GAIN_OVR     0x03800000
12990b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_GAINSTAGES_LNA5G_GAIN_OVR_S   23
13000b6eb366SRajkumar Manoharan 
13010b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXTX2(i)                           (AR_PHY_65NM_BASE + \
13020b6eb366SRajkumar Manoharan 							(i * 0x400) + 0x104)
13030b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXTX2_RXON_OVR                     0x00001000
13040b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXTX2_RXON_OVR_S                   12
13050b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXTX2_RXON                         0x00000800
13060b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXTX2_RXON_S                       11
13070b6eb366SRajkumar Manoharan 
13080b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_AGC(i)                        (AR_PHY_65NM_BASE + \
13090b6eb366SRajkumar Manoharan 							(i * 0x400) + 0xc)
13100b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_AGC_AGC_OVERRIDE              0x80000000
13110b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_AGC_AGC_OVERRIDE_S            31
13120b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_AGC_AGC_ON_OVR                0x40000000
13130b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_AGC_AGC_ON_OVR_S              30
13140b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_AGC_AGC_CAL_OVR               0x20000000
13150b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_AGC_AGC_CAL_OVR_S             29
13160b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_AGC_AGC2G_DBDAC_OVR           0x1E000000
13170b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_AGC_AGC2G_DBDAC_OVR_S         25
13180b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_AGC_AGC5G_DBDAC_OVR           0x00078000
13190b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_AGC_AGC5G_DBDAC_OVR_S         15
13200b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_AGC_AGC2G_CALDAC_OVR          0x01F80000
13210b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_AGC_AGC2G_CALDAC_OVR_S        19
13220b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_AGC_AGC5G_CALDAC_OVR          0x00007e00
13230b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_AGC_AGC5G_CALDAC_OVR_S        9
13240b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_AGC_AGC_OUT                   0x00000004
13250b6eb366SRajkumar Manoharan #define AR_PHY_65NM_RXRF_AGC_AGC_OUT_S                 2
13260b6eb366SRajkumar Manoharan 
1327d88527d3SSujith Manoharan #define AR9300_DFS_FIRPWR -28
1328d88527d3SSujith Manoharan 
1329da6f1d7fSFelix Fietkau #endif  /* AR9003_PHY_H */
1330